diff --git a/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java b/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java index 192f3eb..4492474 100644 --- a/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java +++ b/share-space-admin/src/main/java/com/ruoyi/web/controller/system/UserController.java @@ -10,7 +10,9 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.ss.user.domain.UserQuery; +import com.ruoyi.ss.user.service.IUserAssembler; import com.ruoyi.ss.user.service.IUserService; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -29,6 +31,9 @@ public class UserController extends BaseController @Resource private IUserService eUserService; + @Resource + private IUserAssembler userAssembler; + /** * 获取用户列表 */ @@ -37,6 +42,8 @@ public class UserController extends BaseController { startPage(); List list = eUserService.selectUserList(eUser); + /** 店铺数 */ + userAssembler.assemblerStoreNum(list); return getDataTable(list); } @@ -85,28 +92,28 @@ public class UserController extends BaseController } -// /** -// * 修改用户 -// */ -// @Log(title = "用户管理", businessType = BusinessType.UPDATE) -// @PutMapping -// public AjaxResult edit(@Validated @RequestBody EUser user) -// { -// if (!eUserService.checkUserNameUnique(user)) -// { -// return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); -// } -// else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !eUserService.checkPhoneUnique(user)) -// { -// return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); -// } -// else if (StringUtils.isNotEmpty(user.getEmail()) && !eUserService.checkEmailUnique(user)) -// { -// return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); -// } -// user.setUpdateBy(getUsername()); -// return toAjax(eUserService.updateUser(user)); -// } + /** + * 修改用户 + */ + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody User user) + { + if (!eUserService.checkUserNameUnique(user)) + { + return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); + } + else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !eUserService.checkPhoneUnique(user)) + { + return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); + } + else if (StringUtils.isNotEmpty(user.getEmail()) && !eUserService.checkEmailUnique(user)) + { + return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + user.setUpdateBy(getUsername()); + return toAjax(eUserService.updateUser(user)); + } // /** diff --git a/share-space-common/src/main/java/com/ruoyi/common/annotation/DataScope.java b/share-space-common/src/main/java/com/ruoyi/common/annotation/DataScope.java index 8155545..124501f 100644 --- a/share-space-common/src/main/java/com/ruoyi/common/annotation/DataScope.java +++ b/share-space-common/src/main/java/com/ruoyi/common/annotation/DataScope.java @@ -26,11 +26,6 @@ public @interface DataScope */ public String userAlias() default ""; -// /** -// * 只是用户隔离 如果是1,则只查询当前用户的数据 -// */ -// public String onlyUser() default ""; - /** * 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来 */ diff --git a/share-space-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java b/share-space-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java index 943e237..5acf284 100644 --- a/share-space-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java +++ b/share-space-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java @@ -155,6 +155,9 @@ public class User extends BaseEntity @ApiModelProperty(value = "提前开始使用时间") private int beforeTime; + @ApiModelProperty(value = "是否设备管理员") + private Boolean deviceAdmin; + public User() { } diff --git a/share-space-system/src/main/java/com/ruoyi/ss/room/domain/Room.java b/share-space-system/src/main/java/com/ruoyi/ss/room/domain/Room.java index fb357df..5b34fb1 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/room/domain/Room.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/room/domain/Room.java @@ -81,6 +81,10 @@ public class Room extends BaseEntity{ @ApiModelProperty("应用到房间的套餐ids") private List ruleIds; + @Excel(name = "房间图片") + @ApiModelProperty("房间图片") + private List pictures; + @Excel(name = "wifi账号") @ApiModelProperty("wifi账号") private String wifi; diff --git a/share-space-system/src/main/java/com/ruoyi/ss/room/mapper/RoomMapper.xml b/share-space-system/src/main/java/com/ruoyi/ss/room/mapper/RoomMapper.xml index d30256f..8565a48 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/room/mapper/RoomMapper.xml +++ b/share-space-system/src/main/java/com/ruoyi/ss/room/mapper/RoomMapper.xml @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + diff --git a/share-space-system/src/main/java/com/ruoyi/ss/store/domain/Store.java b/share-space-system/src/main/java/com/ruoyi/ss/store/domain/Store.java index 69f001d..4d7a10e 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/store/domain/Store.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/store/domain/Store.java @@ -146,6 +146,10 @@ public class Store extends BaseEntity{ @ApiModelProperty("房间类型标签") private List typeTags; + @Excel(name = "店铺图片") + @ApiModelProperty("店铺图片") + private List pictures; + @Excel(name = "起订时间") @ApiModelProperty("起订时间") private String minimumTime; diff --git a/share-space-system/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.java b/share-space-system/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.java index 4109e0d..708e91c 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.java @@ -89,4 +89,11 @@ public interface StoreMapper * @return String */ int offlineDeviceByDeviceId(Long deviceId); + + /** + * 获取店铺总数 + * @param userId + * @return + */ + int selectCount(Long userId); } diff --git a/share-space-system/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.xml b/share-space-system/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.xml index 5a9a62a..f2ad02c 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.xml +++ b/share-space-system/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.xml @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -103,6 +104,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select count(1) from ss_store where find_in_set(#{type}, type_tags) and store_id = #{storeId} and deleted = 0 + UPDATE ss_store diff --git a/share-space-system/src/main/java/com/ruoyi/ss/store/service/IStoreService.java b/share-space-system/src/main/java/com/ruoyi/ss/store/service/IStoreService.java index 7d4316d..3d345b9 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/store/service/IStoreService.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/store/service/IStoreService.java @@ -121,4 +121,11 @@ public interface IStoreService * @return String */ int offlineDeviceByDeviceId(Long deviceId); + + /** + * 获取用户已创建店铺数量 + * @param userId 用户id + * @return int + */ + int selectCount(Long userId); } diff --git a/share-space-system/src/main/java/com/ruoyi/ss/store/service/impl/StoreServiceImpl.java b/share-space-system/src/main/java/com/ruoyi/ss/store/service/impl/StoreServiceImpl.java index c032657..40f5273 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/store/service/impl/StoreServiceImpl.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/store/service/impl/StoreServiceImpl.java @@ -373,6 +373,16 @@ public class StoreServiceImpl implements IStoreService return storeMapper.offlineDeviceByDeviceId(deviceId); } + /** + * 获取用户已创建店铺数量 + * @param userId 用户id + * @return int + */ + @Override + public int selectCount(Long userId) { + return storeMapper.selectCount(userId); + } + private Double getDistance(String phoneLon, String phoneLat, BigDecimal lng, BigDecimal lat) { double[] point1 = {Double.parseDouble(phoneLon), Double.parseDouble(phoneLat)}; double[] point2 = {lng.doubleValue(), lat.doubleValue()}; diff --git a/share-space-system/src/main/java/com/ruoyi/ss/user/domain/UserVO.java b/share-space-system/src/main/java/com/ruoyi/ss/user/domain/UserVO.java index 1084da0..93fea9d 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/user/domain/UserVO.java +++ b/share-space-system/src/main/java/com/ruoyi/ss/user/domain/UserVO.java @@ -26,10 +26,10 @@ public class UserVO extends User /** 用户最多余额 */ private BigDecimal balance; -// /** 用户余额list */ -// private List userBalances; - /** 店铺名称 */ private String storeName; + /** 店铺数 */ + private int storeNum; + } diff --git a/share-space-system/src/main/java/com/ruoyi/ss/user/mapper/UserMapper.xml b/share-space-system/src/main/java/com/ruoyi/ss/user/mapper/UserMapper.xml index 707c396..b841d7c 100644 --- a/share-space-system/src/main/java/com/ruoyi/ss/user/mapper/UserMapper.xml +++ b/share-space-system/src/main/java/com/ruoyi/ss/user/mapper/UserMapper.xml @@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select u.user_id, u.user_name, u.real_name, u.id_card, u.nick_name, u.email, u.avatar,u.user_type,u.pay_channel,u.merchant_id,dividend_proportion, u.phonenumber, u.password, u.sex, u.status,u.service_fee_proportion,u.clean_duration, u.clean_notice,u.ago_cancel,u.penalty, u.before_time, - u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_authentication,store_id, + u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_authentication,u.store_id,u.device_admin, r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,u.balance from ss_user u left join sys_user_role ur on u.user_id = ur.user_id @@ -30,14 +30,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select u.user_id, u.user_name, u.real_name, u.id_card, u.nick_name, u.email, u.avatar,u.user_type,u.pay_channel,u.merchant_id,dividend_proportion, u.phonenumber, u.password, u.sex, u.status, u.service_fee_proportion,u.clean_duration, u.clean_notice,u.ago_cancel,u.penalty, u.before_time, - u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_authentication,store_id, + u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_authentication,u.store_id,u.device_admin, u.balance from ss_user u select u.user_id, u.user_name, u.real_name, u.id_card, u.nick_name, u.email, u.avatar,u.service_fee_proportion,pay_channel,merchant_id,u.clean_duration, u.clean_notice,u.ago_cancel,u.penalty, - u.phonenumber, u.password, u.sex, u.status,u.user_type,r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status, u.balance, + u.phonenumber, u.password, u.sex, u.status,u.user_type,r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status, u.balance,u.device_admin, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_authentication,u.pay_channel from ss_user u left join sys_user_role ur on u.user_id = ur.user_id @@ -133,7 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select u.user_id, u.user_name, u.real_name, u.id_card, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status,u.user_type,u.service_fee_proportion,u.clean_duration, u.clean_notice,u.ago_cancel,u.penalty,u.before_time, - u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_authentication,u.pay_channel, + u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_authentication,u.pay_channel,u.device_admin, ub.balance from ss_user u left join ss_user_balance ub on ub.user_id = u.user_id @@ -253,6 +253,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" user_name, real_name, user_type, + device_admin, id_card, nick_name, email, @@ -277,6 +278,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{userName}, #{realName}, #{userType}, + #{deviceAdmin}, #{idCard}, #{nickName}, #{email}, @@ -307,6 +309,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" id_card = #{idCard}, nick_name = #{nickName}, user_type = #{userType}, + device_admin = #{deviceAdmin}, email = #{email}, phonenumber = #{phonenumber}, is_authentication = #{isAuthentication}, diff --git a/share-space-system/src/main/java/com/ruoyi/ss/user/service/IUserAssembler.java b/share-space-system/src/main/java/com/ruoyi/ss/user/service/IUserAssembler.java new file mode 100644 index 0000000..68870b1 --- /dev/null +++ b/share-space-system/src/main/java/com/ruoyi/ss/user/service/IUserAssembler.java @@ -0,0 +1,21 @@ +package com.ruoyi.ss.user.service; + +import com.ruoyi.ss.user.domain.UserVO; + +import java.util.List; + +/** + * 用户 业务层 + * + * @author ruoyi + */ +public interface IUserAssembler +{ + + + /** + * 拼接店铺数 + * @param list 用户列表 + */ + void assemblerStoreNum(List list); +} diff --git a/share-space-system/src/main/java/com/ruoyi/ss/user/service/impl/UserAssemblerImpl.java b/share-space-system/src/main/java/com/ruoyi/ss/user/service/impl/UserAssemblerImpl.java new file mode 100644 index 0000000..4bda3b9 --- /dev/null +++ b/share-space-system/src/main/java/com/ruoyi/ss/user/service/impl/UserAssemblerImpl.java @@ -0,0 +1,39 @@ +package com.ruoyi.ss.user.service.impl; + +import com.ruoyi.common.utils.collection.CollectionUtils; +import com.ruoyi.ss.store.service.IStoreService; +import com.ruoyi.ss.user.domain.UserVO; +import com.ruoyi.ss.user.service.IUserAssembler; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 用户 业务层处理 + * + * @author ruoyi + */ +@Slf4j +@Service +public class UserAssemblerImpl implements IUserAssembler { + + @Autowired + private IStoreService storeService; + + /** + * 拼接店铺数 + * @param list 用户列表 + */ + @Override + public void assemblerStoreNum(List list) { + if (CollectionUtils.isEmptyElement(list)) { + return; + } + list.forEach(user -> { + user.setStoreNum(storeService.selectCount(user.getUserId())); + }); + } + +} diff --git a/share-space-system/src/main/resources/mapper/system/SysMenuMapper.xml b/share-space-system/src/main/resources/mapper/system/SysMenuMapper.xml index a5ab053..0ef10e7 100644 --- a/share-space-system/src/main/resources/mapper/system/SysMenuMapper.xml +++ b/share-space-system/src/main/resources/mapper/system/SysMenuMapper.xml @@ -75,7 +75,22 @@