puzhibing
2023-12-07 aa0131b1efb96c9f52371160b3a1e6823db3656a
修改bug
14个文件已修改
212 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/sys/SysDept.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/sys/SysUser.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/staff/StaffShopController.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java 88 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/util/map/MapUtil.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/sys/StaffMenuController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/sys/SysMenuController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/UserMenuEditDto.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/sys/SysUserServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/resources/mapper/sys/SysDeptMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/resources/mapper/sys/SysUserMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/test/java/com/ruoyi/system/systemTest.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/sys/SysDept.java
@@ -56,6 +56,8 @@
    /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */
    @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
    private String dataScope;
    /**员工端数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)*/
    private String dataScopeEmployee;
    
    /** 子部门 */
    private List<SysDept> children = new ArrayList<SysDept>();
@@ -227,6 +229,14 @@
        this.wxDeptId = wxDeptId;
    }
    public String getDataScopeEmployee() {
        return dataScopeEmployee;
    }
    public void setDataScopeEmployee(String dataScopeEmployee) {
        this.dataScopeEmployee = dataScopeEmployee;
    }
    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -246,6 +256,7 @@
            .append("updateTime", getUpdateTime())
            .append("dataScope", getDataScope())
            .append("wxDeptId", getWxDeptId())
            .append("dataScopeEmployee", getDataScopeEmployee())
            .toString();
    }
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/sys/SysUser.java
@@ -99,9 +99,11 @@
    /** 角色ID */
    private Long roleId;
    /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */
    /** 平台数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */
    @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
    private String dataScope;
    /**员工端数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)*/
    private String dataScopeEmployee;
    public SysUser()
    {
@@ -327,6 +329,14 @@
        this.dataScope = dataScope;
    }
    public String getDataScopeEmployee() {
        return dataScopeEmployee;
    }
    public void setDataScopeEmployee(String dataScopeEmployee) {
        this.dataScopeEmployee = dataScopeEmployee;
    }
    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -351,6 +361,7 @@
            .append("dept", getDept())
            .append("userType", getUserType())
            .append("dataScope", getDataScope())
            .append("dataScopeEmployee", getDataScopeEmployee())
            .toString();
    }
}
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java
@@ -768,7 +768,10 @@
                    .collect(Collectors.toMap(MgtSimpleShopVo::getShopId, Function.identity()));
            for(MgtCouponAuditPageVo mgtCouponAuditPageVo : mgtCouponAuditPageVoList){
                if(mgtCouponAuditPageVo.getShopId()!=null){
                    mgtCouponAuditPageVo.setShopName(shopMap.get(mgtCouponAuditPageVo.getShopId()).getShopName());
                    MgtSimpleShopVo mgtSimpleShopVo = shopMap.get(mgtCouponAuditPageVo.getShopId());
                    if(null != mgtSimpleShopVo){
                        mgtCouponAuditPageVo.setShopName(mgtSimpleShopVo.getShopName());
                    }
                }
            }
        }
ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -569,8 +569,11 @@
        <if test="param.goodsType != null and param.goodsType !=''">
            AND tog.goods_type = #{param.goodsType}
        </if>
        <!--<if test="param.shopId != null and param.shopId != ''">-->
            <!--AND toc.shop_id = #{param.shopId}-->
        <!--</if>-->
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId}
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
        </if>
        <if test="param.shopIds != null and param.shopIds != ''">
            AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) &gt; 0
@@ -604,8 +607,11 @@
        <if test="param.goodsType != null and param.goodsType !=''">
            AND tog.goods_type = #{param.goodsType}
        </if>
        <!--<if test="param.shopId != null and param.shopId != ''">-->
            <!--AND toc.shop_id = #{param.shopId}-->
        <!--</if>-->
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId}
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
        </if>
        <if test="param.shopIds != null and param.shopIds != ''">
            AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) &gt; 0
@@ -639,8 +645,11 @@
        <if test="param.goodsType != null and param.goodsType !=''">
            AND tog.goods_type = #{param.goodsType}
        </if>
        <!--<if test="param.shopId != null and param.shopId != ''">-->
            <!--AND toc.shop_id = #{param.shopId}-->
        <!--</if>-->
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId}
            AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3))
        </if>
        <if test="param.shopIds != null and param.shopIds != ''">
            AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) &gt; 0
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/staff/StaffShopController.java
@@ -7,6 +7,7 @@
import com.ruoyi.shop.domain.vo.*;
import com.ruoyi.shop.service.shop.ShopService;
import com.ruoyi.system.api.domain.dto.StaffBaseGetDto;
import com.ruoyi.system.api.domain.poji.sys.SysUser;
import com.ruoyi.system.api.service.RemoteSysStaffService;
import com.ruoyi.system.api.service.RemoteUserService;
import io.swagger.annotations.Api;
@@ -50,13 +51,34 @@
    @ApiOperation(value = "分页获取员工端商户列表")
    public R<Page<StaffShopPageVo>> listStaffShop(@RequestBody StaffShopPageDto staffShopPageDto) {
        Long userId = SecurityUtils.getUserId();
        if (remoteSysStaffService.isLeader()) {
//        if (remoteSysStaffService.isLeader()) {
//            List<Long> userIds = sysUserService.getUserIdsByDept(userId).getData();
//            userIds.add(userId);
//            staffShopPageDto.setUserIdList(userIds);
//        } else {
//            staffShopPageDto.setBelongUserId(userId);
//        }
        // TODO: 2023/12/5 统一改成使用权限来控制数据
        R<SysUser> sysUser = sysUserService.getSysUser(userId);
        if(sysUser.getCode() != 200){
            return R.fail(sysUser.getMsg());
        }
        //员工端数据权限(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)
        //2/4暂未使用
        String dataScopeEmployee = sysUser.getData().getDataScopeEmployee();
        if(dataScopeEmployee.equals("1")){
            staffShopPageDto.setUserIdList(null);
        }
        if(dataScopeEmployee.equals("3")){
            List<Long> userIds = sysUserService.getUserIdsByDept(userId).getData();
            userIds.add(userId);
            staffShopPageDto.setUserIdList(userIds);
        } else {
        }
        if(dataScopeEmployee.equals("5")){
            staffShopPageDto.setBelongUserId(userId);
        }
        Page<StaffShopPageVo> page = new Page<>();
        page.setSize(staffShopPageDto.getPageSize());
        page.setCurrent(staffShopPageDto.getPageNum());
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -18,6 +18,7 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.ExceptionUtil;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.bean.BeanUtils;
import com.ruoyi.common.core.utils.uuid.IdUtils;
@@ -764,6 +765,7 @@
        }else if(StringUtils.isNotBlank(appNearbyShopDto.getLatitude())&&StringUtils.isNotBlank(appNearbyShopDto.getLongitude())){
            List<AppNearShopVo> appNearShopVos = shopMapper.getNearbyShops(appNearbyShopDto);
            if(appNearShopVos.size() > 0){
                log.info("候选店铺:{}", JSON.toJSONString(appNearShopVos));
                StringBuffer to = new StringBuffer();
                for (AppNearShopVo appNearShopVo : appNearShopVos) {
                    to.append(appNearShopVo.getLatitude() + "," + appNearShopVo.getLongitude() + ";");
@@ -780,7 +782,7 @@
                List<TencentDistanceMatrixElements> elements = data.get(0).getElements();
                for (int i = 0; i < elements.size(); i++) {
                    TencentDistanceMatrixElements matrix = elements.get(i);
                    if(dis.compareTo(BigDecimal.ZERO) == 0 || dis.compareTo(new BigDecimal(matrix.getDistance())) > 0){
                    if(i == 0 || dis.compareTo(new BigDecimal(matrix.getDistance())) > 0){
                        dis = new BigDecimal(matrix.getDistance());
                        appNearShopVo = appNearShopVos.get(i);
                    }
@@ -843,7 +845,43 @@
        List<Long> userIds = new ArrayList<>();
        List<Long> shopIds = new ArrayList<>();
        //如果是leader 查询leader下面所有的员工下的所有shopId
        if(remoteSysStaffService.isLeader()){
//        if(remoteSysStaffService.isLeader()){
//            userIds = sysUserService.getUserIdsByDept(userId).getData();
//            //根据用户所有id查询关联的商户id
//            MgtBasePlatformDto mgtBasePlatformDto = new MgtBasePlatformDto();
//            mgtBasePlatformDto.setUserIdList(userIds);
//            shopIds = shopMapper.listShopIdByTotal(mgtBasePlatformDto);
//            List<Shop> shopList = this.getShopByBelongUserId(userId);
//            if(shopList!=null&&!shopList.isEmpty()){
//                for(Shop shop : shopList){
//                    shopIds.add(shop.getShopId());
//                }
//                userIds.add(userId);
//            }
//        }else {
//            //普通员工查询商户归属的shopId
//            List<Shop> shopList = this.getShopByBelongUserId(userId);
//            if(shopList!=null&&!shopList.isEmpty()){
//                for(Shop shop : shopList){
//                    shopIds.add(shop.getShopId());
//                }
//                userIds.add(userId);
//            }
//        }
        // TODO: 2023/12/5 统一改成使用权限来控制数据
        R<SysUser> sysUser = sysUserService.getSysUser(userId);
        if(sysUser.getCode() != 200){
            throw new RuntimeException(sysUser.getMsg());
        }
        //员工端数据权限(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)
        //2/4暂未使用
        String dataScopeEmployee = sysUser.getData().getDataScopeEmployee();
        if(dataScopeEmployee.equals("1")){
            userIds = null;
            shopIds = null;
        }
        if(dataScopeEmployee.equals("3")){
            userIds = sysUserService.getUserIdsByDept(userId).getData();
            //根据用户所有id查询关联的商户id
            MgtBasePlatformDto mgtBasePlatformDto = new MgtBasePlatformDto();
@@ -856,8 +894,8 @@
                }
                userIds.add(userId);
            }
        }else {
            //普通员工查询商户归属的shopId
        }
        if(dataScopeEmployee.equals("5")){
            List<Shop> shopList = this.getShopByBelongUserId(userId);
            if(shopList!=null&&!shopList.isEmpty()){
                for(Shop shop : shopList){
@@ -866,6 +904,9 @@
                userIds.add(userId);
            }
        }
        //分别查询
        StaffHomeShopTotalVo staffHomeShopTotalVo = new StaffHomeShopTotalVo();
        if(userIds!=null&&!userIds.isEmpty()){
@@ -877,7 +918,7 @@
        }
        Integer shopTaskCount = 0;
        if(shopIds!=null&&!shopIds.isEmpty()){
            shopTaskService.getShopIngTotal(shopIds);
            shopTaskCount = shopTaskService.getShopIngTotal(shopIds);
        }
        staffHomeShopTotalVo.setFollowMember(0);
        staffHomeShopTotalVo.setNewMember(0);
@@ -1122,20 +1163,24 @@
     */
    @Override
    public void mgtShopHFTXAuth(MgtShopHFTXAuthDto mgtShopHFTXAuthDto) {
        ShopAuthenticationHftx shopAuthenticationHftx = shopAuthenticationHftxService.getOne(new QueryWrapper<ShopAuthenticationHftx>().eq("shop_id", mgtShopHFTXAuthDto.getShopId()));
        if(null != shopAuthenticationHftx && "U".equals(shopAuthenticationHftx.getAuditStatus())){
        ShopAuthenticationHftx shopAuthenticationHftx = shopAuthenticationHftxService.getOne(new QueryWrapper<ShopAuthenticationHftx>()
                .eq("shop_id", mgtShopHFTXAuthDto.getShopId()).eq("is_delete", 0));
        if(null != shopAuthenticationHftx && Arrays.asList("U", "Y").contains(shopAuthenticationHftx.getAuditStatus())){
            throw new ServiceException("不能重复进件");
        }
        if(null == shopAuthenticationHftx){
            shopAuthenticationHftx = new ShopAuthenticationHftx();
            shopAuthenticationHftx.setIsDelete(0);
            shopAuthenticationHftx.setInsertTime(new Date());
            shopAuthenticationHftx.setAuditStatus("U");
        }
        String auditStatus = shopAuthenticationHftx.getAuditStatus();
        BeanUtils.copyProperties(mgtShopHFTXAuthDto, shopAuthenticationHftx);
        shopAuthenticationHftx.setReqSeqId(IdUtils.simpleUUID());
        shopAuthenticationHftx.setAuditStatus("");
        shopAuthenticationHftx.setAuditDesc("");
        if(Arrays.asList("N", "F").contains(shopAuthenticationHftx.getAuditStatus())){
            shopAuthenticationHftx.setAuditStatus("");
            shopAuthenticationHftx.setAuditDesc("");
        }
        /**
         * 开始调起进件接口
         */
@@ -1446,12 +1491,33 @@
    @Override
    public StaffShopSimpleTotalVo getStaffSimpleTotal(Long userId){
        List<Long> userIdList = new ArrayList<>();
        if(remoteSysStaffService.isLeader()){
//        if(remoteSysStaffService.isLeader()){
//            userIdList = sysUserService.getUserIdsByDept(userId).getData();
//            userIdList.add(userId);
//        }else {
//            userIdList.add(userId);
//        }
        // TODO: 2023/12/5 统一改成使用权限来控制数据
        R<SysUser> sysUser = sysUserService.getSysUser(userId);
        if(sysUser.getCode() != 200){
            throw new RuntimeException(sysUser.getMsg());
        }
        //员工端数据权限(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)
        //2/4暂未使用
        String dataScopeEmployee = sysUser.getData().getDataScopeEmployee();
        if(dataScopeEmployee.equals("1")){
            userIdList = null;
        }
        if(dataScopeEmployee.equals("3")){
            userIdList = sysUserService.getUserIdsByDept(userId).getData();
            userIdList.add(userId);
        }else {
        }
        if(dataScopeEmployee.equals("5")){
            userIdList.add(userId);
        }
        StaffShopSimpleTotalVo shopTotal = shopMapper.getStaffSimpleTotal(1,userIdList);
        StaffShopSimpleTotalVo agencyTotal = shopMapper.getStaffSimpleTotal(2,userIdList);
        shopTotal.setAgencyTotal(agencyTotal.getShopTotal());
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/util/map/MapUtil.java
@@ -9,6 +9,8 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.shop.util.map.vo.TencentDistanceMatrix;
import com.ruoyi.shop.util.map.vo.TencentDistanceMatrixElements;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +21,8 @@
 * @Date 2023/10/30 9:44
 */
public class MapUtil {
    private static Logger logger = LoggerFactory.getLogger(MapUtil.class);
    private static final String tencentKey = "FATBZ-V3AWH-7IJDS-WC7NC-QXY3Q-TQFDJ";
@@ -31,6 +35,7 @@
     * @return
     */
    public static R<List<TencentDistanceMatrix>> tencentDistanceMatrix(String form, String to, String mode){
        logger.info("起点经纬度:{} 终点经纬度:{}", form, to);
        String url = "https://apis.map.qq.com/ws/distance/v1/matrix";
        HttpRequest get = HttpUtil.createGet(url)
                .form("key", tencentKey)
@@ -38,6 +43,7 @@
                .form("to", to)
                .form("mode", mode);
        HttpResponse execute = get.execute();
        logger.info("返回结果:{}", execute.body());
        JSONObject jsonObject = JSON.parseObject(execute.body());
        Integer status = jsonObject.getInteger("status");
        String message = jsonObject.getString("message");
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/sys/StaffMenuController.java
@@ -2,8 +2,10 @@
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.poji.sys.SysUser;
import com.ruoyi.system.domain.pojo.sys.SysMenu;
import com.ruoyi.system.service.sys.ISysMenuService;
import com.ruoyi.system.service.sys.ISysUserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -30,6 +32,12 @@
    @Autowired
    private ISysMenuService menuService;
    @Autowired
    private ISysUserService sysUserService;
    @ApiOperation(value = "加载对应部门员工菜单列表树")
    @GetMapping(value = "/roleStaffMenuTreeselect/{deptId}")
    public AjaxResult deptStaffMenuTreeselect(@PathVariable("deptId") Long deptId)
@@ -48,10 +56,12 @@
    public AjaxResult deptUserStaffMenuTreeselect(@PathVariable("deptUserId") Long deptUserId)
    {
        Long userId = SecurityUtils.getUserId();
        SysUser sysUser = sysUserService.selectUserById(deptUserId);
        List<SysMenu> menus = menuService.selectStaffDeptMenuList(deptUserId);
        AjaxResult ajax = success();
        ajax.put("checkedKeys", menuService.selectStaffMenuListByDeptUserId(deptUserId));
        ajax.put("menus", menuService.buildMenuTreeSelect(menus));
        ajax.put("dataScopeEmployee", sysUser.getDataScopeEmployee());
        return ajax;
    }
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/sys/SysMenuController.java
@@ -1,5 +1,6 @@
package com.ruoyi.system.controller.sys;
import com.alibaba.fastjson.JSON;
import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.controller.BaseController;
@@ -8,13 +9,16 @@
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.poji.sys.SysUser;
import com.ruoyi.system.domain.pojo.sys.SysMenu;
import com.ruoyi.system.service.sys.ISysMenuService;
import com.ruoyi.system.service.sys.ISysUserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
@@ -28,6 +32,9 @@
{
    @Autowired
    private ISysMenuService menuService;
    @Autowired
    private ISysUserService sysUserService;
    /**
     * 获取菜单列表
@@ -96,10 +103,12 @@
    public AjaxResult deptUserMenuTreeselect(@PathVariable("deptUserId") Long deptUserId)
    {
        Long userId = SecurityUtils.getUserId();
        SysUser sysUser = sysUserService.selectUserById(deptUserId);
        List<SysMenu> menus = menuService.selectDeptMenuList(deptUserId);
        AjaxResult ajax = AjaxResult.success();
        ajax.put("checkedKeys", menuService.selectMenuListByDeptUserId(deptUserId));
        ajax.put("menus", menuService.buildMenuTreeSelect(menus));
        ajax.put("dataScope", sysUser.getDataScope());
        return ajax;
    }
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/UserMenuEditDto.java
@@ -23,4 +23,6 @@
    private String dataScope;
    private String dataScopeEmployee;
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/sys/SysUserServiceImpl.java
@@ -673,6 +673,7 @@
    public void editUserMenu(UserMenuEditDto userMenuEditDto){
        SysUser sysUser = this.selectUserById(userMenuEditDto.getUserId());
        sysUser.setDataScope(userMenuEditDto.getDataScope());
        sysUser.setDataScopeEmployee(userMenuEditDto.getDataScopeEmployee());
        userMapper.updateUser(sysUser);
        userMenuMapper.deleteUserMenuByUserId(userMenuEditDto.getUserId());
        int rows = 1;
ruoyi-modules/ruoyi-system/src/main/resources/mapper/sys/SysDeptMapper.xml
@@ -22,10 +22,11 @@
        <result property="updateTime" column="update_time" />
        <result property="dataScope" column="data_scope" />
        <result property="wxDeptId" column="wx_dept_id" />
        <result property="dataScopeEmployee" column="data_scope_employee" />
    </resultMap>
    
    <sql id="selectDeptVo">
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time ,d.data_scope,d.wx_dept_id
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time ,d.data_scope,d.wx_dept_id,d.data_scope_employee
        from sys_dept d
    </sql>
    
@@ -106,6 +107,7 @@
             <if test="createBy != null and createBy != ''">create_by,</if>
            <if test="dataScope != null and dataScope != ''">data_scope,</if>
            <if test="wxDeptId != null and wxDeptId != ''">wx_dept_id,</if>
            <if test="dataScopeEmployee != null and dataScopeEmployee != ''">data_scope_employee,</if>
             create_time
         )values(
             <if test="deptId != null and deptId != 0">#{deptId},</if>
@@ -120,6 +122,7 @@
             <if test="createBy != null and createBy != ''">#{createBy},</if>
            <if test="dataScope != null and dataScope != ''">#{dataScope},</if>
            <if test="wxDeptId != null and wxDeptId != ''">#{wxDeptId},</if>
            <if test="dataScopeEmployee != null and dataScopeEmployee != ''">#{dataScopeEmployee},</if>
             sysdate()
         )
    </insert>
@@ -138,6 +141,7 @@
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            <if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if>
            <if test="wxDeptId != null and wxDeptId != ''">wx_dept_id = #{wxDeptId},</if>
            <if test="dataScopeEmployee != null and dataScopeEmployee != ''">data_scope_employee = #{dataScopeEmployee},</if>
            update_time = sysdate()
         </set>
         where dept_id = #{deptId}
ruoyi-modules/ruoyi-system/src/main/resources/mapper/sys/SysUserMapper.xml
@@ -24,7 +24,8 @@
        <result property="updateBy"     column="update_by"    />
        <result property="updateTime"   column="update_time"  />
        <result property="remark"       column="remark"       />
        <result property="dataScope"       column="user_data_scope"       />
        <result property="dataScope"       column="data_scope"/>
        <result property="dataScopeEmployee" column="data_scope_employee"/>
        <association property="dept"    column="dept_id" javaType="SysDept" resultMap="deptResult" />
        <collection  property="roles"   javaType="java.util.List"           resultMap="RoleResult" />
    </resultMap>
@@ -49,7 +50,7 @@
    </resultMap>
    
    <sql id="selectUserVo">
        select u.user_id, u.dept_id, u.user_name,u.user_type, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.data_scope as user_data_scope,
        select u.user_id, u.dept_id, u.user_name,u.user_type, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.data_scope, u.data_scope_employee,
        d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
        r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
        from sys_user u
@@ -160,6 +161,7 @@
             <if test="remark != null and remark != ''">remark,</if>
            <if test="dataScope != null and dataScope != ''">data_scope,</if>
            <if test="userType != null and userType != ''">user_type,</if>
            <if test="dataScopeEmployee != null and dataScopeEmployee != ''">data_scope_employee,</if>
        create_time
         )values(
             <if test="userId != null and userId != ''">#{userId},</if>
@@ -176,6 +178,7 @@
             <if test="remark != null and remark != ''">#{remark},</if>
            <if test="dataScope != null and dataScope != ''">#{dataScope},</if>
            <if test="userType != null and userType != ''">#{userType},</if>
            <if test="dataScopeEmployee != null and dataScopeEmployee != ''">#{dataScopeEmployee},</if>
        sysdate()
         )
    </insert>
@@ -197,6 +200,7 @@
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             <if test="remark != null">remark = #{remark},</if>
            <if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if>
            <if test="dataScopeEmployee != null and dataScopeEmployee != ''">data_scope_employee = #{dataScopeEmployee},</if>
            update_time = sysdate()
         </set>
         where user_id = #{userId}
ruoyi-modules/ruoyi-system/src/test/java/com/ruoyi/system/systemTest.java
@@ -1,13 +1,16 @@
//package com.ruoyi.system;
//
//
//import com.ruoyi.system.api.domain.poji.sys.SysUser;
//import com.ruoyi.system.domain.pojo.sys.SysMenu;
//import com.ruoyi.system.domain.vo.RouterVo;
//import com.ruoyi.system.service.staff.SysStaffService;
//import com.ruoyi.system.service.staff.SysWxCpService;
//import com.ruoyi.system.service.sys.ISysMenuService;
//import com.ruoyi.system.service.sys.ISysUserService;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
//
@@ -34,12 +37,13 @@
//    @Resource
//    private ISysMenuService menuService;
//
//    @Autowired
//    private ISysUserService sysUserService;
//
//    @Test
//    public void main() {
//        //List<SysMenu> menus = menuService.selectMenuTreeByUserId(1L);
//        List<SysMenu> menus = menuService.selectStaffMenuTreeByUserId(164L);
//        List<RouterVo> list = menuService.buildMenus(menus);
//        System.out.println(list);
//        SysUser sysUser = sysUserService.selectUserById(6323L);
//        System.out.println(sysUser.getDataScopeEmployee());
//    }
//
//}