瀏覽代碼

Merge branch 'feature/eccs-upgrade' of lvjian/eccs into feature/eccs-upgrade

吕健 2 年之前
父節點
當前提交
41f0e5da77
共有 28 個文件被更改,包括 1340 次插入15 次删除
  1. 10 0
      eccs-admin/src/main/java/com/emato/web/controller/system/SysUserController.java
  2. 105 0
      eccs-biz/src/main/java/com/emato/biz/controller/merchant/MerchUserController.java
  3. 11 0
      eccs-biz/src/main/java/com/emato/biz/controller/merchant/MerchantBaseController.java
  4. 5 0
      eccs-biz/src/main/java/com/emato/biz/controller/warehouse/OWbInveMngController.java
  5. 2 2
      eccs-biz/src/main/java/com/emato/biz/controller/warehouse/OWbMerchShopInveController.java
  6. 111 0
      eccs-biz/src/main/java/com/emato/biz/domain/merchant/MerchUser.java
  7. 68 0
      eccs-biz/src/main/java/com/emato/biz/domain/merchant/MerchUserVO.java
  8. 13 0
      eccs-biz/src/main/java/com/emato/biz/domain/warehouse/OWbInveMng.java
  9. 87 0
      eccs-biz/src/main/java/com/emato/biz/mapper/merchant/MerchUserMapper.java
  10. 9 0
      eccs-biz/src/main/java/com/emato/biz/mapper/merchant/ThirdMerchantBizMapper.java
  11. 113 0
      eccs-biz/src/main/java/com/emato/biz/service/impl/MerchUserServiceImpl.java
  12. 18 1
      eccs-biz/src/main/java/com/emato/biz/service/impl/MerchantBaseServiceImpl.java
  13. 49 4
      eccs-biz/src/main/java/com/emato/biz/service/impl/OWbInveMngServiceImpl.java
  14. 1 2
      eccs-biz/src/main/java/com/emato/biz/service/impl/SalesDetaiServicelImpl.java
  15. 71 0
      eccs-biz/src/main/java/com/emato/biz/service/merchant/IMerchUserService.java
  16. 8 1
      eccs-biz/src/main/java/com/emato/biz/service/merchant/IMerchantBaseService.java
  17. 1 1
      eccs-biz/src/main/java/com/emato/biz/util/OmsUtils.java
  18. 33 0
      eccs-biz/src/main/java/com/emato/biz/util/RoleUtils.java
  19. 144 0
      eccs-biz/src/main/resources/mapper/biz/merchant/MerchUserMapper.xml
  20. 7 1
      eccs-biz/src/main/resources/mapper/biz/merchant/ThirdMerchantBizMapper.xml
  21. 2 1
      eccs-biz/src/main/resources/mapper/biz/warehouse/WbInveMngMapper.xml
  22. 7 0
      eccs-system/src/main/java/com/emato/system/mapper/SysUserMapper.java
  23. 10 0
      eccs-system/src/main/java/com/emato/system/service/ISysUserService.java
  24. 13 0
      eccs-system/src/main/java/com/emato/system/service/impl/SysUserServiceImpl.java
  25. 8 2
      eccs-system/src/main/resources/mapper/system/SysUserMapper.xml
  26. 70 0
      eccs-ui/src/api/merchant/merchUser.js
  27. 330 0
      eccs-ui/src/views/merchant/merchUser/index.vue
  28. 34 0
      sql/20230420/merch-userMenu.sql

+ 10 - 0
eccs-admin/src/main/java/com/emato/web/controller/system/SysUserController.java

@@ -54,6 +54,15 @@ public class SysUserController extends BaseController
     private TokenService tokenService;
 
     /**
+     * 查询用户列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:user:list')")
+    @GetMapping("/getAll")
+    public AjaxResult getAll(){
+        return userService.getAll();
+    }
+
+    /**
      * 获取用户列表
      */
     @PreAuthorize("@ss.hasPermi('system:user:list')")
@@ -202,4 +211,5 @@ public class SysUserController extends BaseController
         user.setUpdateBy(SecurityUtils.getUsername());
         return toAjax(userService.updateUserStatus(user));
     }
+
 }

+ 105 - 0
eccs-biz/src/main/java/com/emato/biz/controller/merchant/MerchUserController.java

@@ -0,0 +1,105 @@
+package com.emato.biz.controller.merchant;
+
+import java.util.List;
+
+import com.emato.biz.domain.merchant.MerchUser;
+import com.emato.biz.domain.merchant.MerchUserVO;
+import com.emato.biz.service.merchant.IMerchUserService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.emato.common.annotation.Log;
+import com.emato.common.core.controller.BaseController;
+import com.emato.common.core.domain.AjaxResult;
+import com.emato.common.enums.BusinessType;
+import com.emato.common.utils.poi.ExcelUtil;
+import com.emato.common.core.page.TableDataInfo;
+
+/**
+ * 商户用户Controller
+ * 
+ * @author admin
+ * @date 2023-04-20
+ */
+@RestController
+@RequestMapping("/merch/merchUser")
+public class MerchUserController extends BaseController
+{
+    @Autowired
+    private IMerchUserService merchUserService;
+
+    /**
+     * 查询商户用户列表
+     */
+    @PreAuthorize("@ss.hasPermi('biz:merchUser:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(MerchUser merchUser)
+    {
+        startPage();
+        List<MerchUserVO> list = merchUserService.selectMerchUserVOList(merchUser);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出商户用户列表
+     */
+    @PreAuthorize("@ss.hasPermi('biz:merchUser:export')")
+    @Log(title = "商户用户", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(MerchUser merchUser)
+    {
+        List<MerchUserVO> list = merchUserService.selectMerchUserVOList(merchUser);
+        ExcelUtil<MerchUserVO> util = new ExcelUtil<>(MerchUserVO.class);
+        return util.exportExcel(list, "merchUser");
+    }
+
+    /**
+     * 获取商户用户详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('biz:merchUser:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") String id)
+    {
+        return AjaxResult.success(merchUserService.selectMerchUserById(id));
+    }
+
+    /**
+     * 新增商户用户
+     */
+    @PreAuthorize("@ss.hasPermi('biz:merchUser:add')")
+    @Log(title = "商户用户", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody MerchUser merchUser)
+    {
+        return toAjax(merchUserService.insertMerchUser(merchUser));
+    }
+
+    /**
+     * 修改商户用户
+     */
+    @PreAuthorize("@ss.hasPermi('biz:merchUser:edit')")
+    @Log(title = "商户用户", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody MerchUser merchUser)
+    {
+        return toAjax(merchUserService.updateMerchUser(merchUser));
+    }
+
+    /**
+     * 删除商户用户
+     */
+    @PreAuthorize("@ss.hasPermi('biz:merchUser:remove')")
+    @Log(title = "商户用户", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable String[] ids)
+    {
+        return toAjax(merchUserService.deleteMerchUserByIds(ids));
+    }
+}

+ 11 - 0
eccs-biz/src/main/java/com/emato/biz/controller/merchant/MerchantBaseController.java

@@ -35,6 +35,17 @@ public class MerchantBaseController extends BaseController
     private IMerchantBaseService merchantBaseService;
 
     /**
+     * 查询所有商户信息
+     *
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('biz:merchantbase:list')")
+    @GetMapping("/getAll")
+    public AjaxResult getAll() {
+        return merchantBaseService.getAll();
+    }
+
+    /**
      * 查询商户基本信息列表
      */
     @PreAuthorize("@ss.hasPermi('biz:merchantbase:list')")

+ 5 - 0
eccs-biz/src/main/java/com/emato/biz/controller/warehouse/OWbInveMngController.java

@@ -3,6 +3,7 @@ package com.emato.biz.controller.warehouse;
 import java.util.List;
 
 import com.emato.biz.domain.warehouse.PullInveQueryVO;
+import com.emato.biz.util.RoleUtils;
 import com.emato.common.core.domain.entity.SysDept;
 import com.emato.common.core.domain.entity.SysUser;
 import com.emato.common.core.domain.model.LoginUser;
@@ -121,6 +122,10 @@ public class OWbInveMngController extends BaseController
         // 获取当前的用户
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         SysUser user = loginUser.getUser();
+
+        boolean allRole = RoleUtils.isAllRole(user);
+        logger.info("当前用户 {} 是否有所有权限 => {}", user.getUserName(), allRole);
+
         // 根据当前登录用户部门查询所属商户
         SysDept sysDept = sysDeptService.selectDeptById(user.getDeptId());
         // 获取当前商户号

+ 2 - 2
eccs-biz/src/main/java/com/emato/biz/controller/warehouse/OWbMerchShopInveController.java

@@ -117,16 +117,16 @@ public class OWbMerchShopInveController extends BaseController
     @PostMapping("/pullStoreInveMng")
     public AjaxResult pullStoreInveMng(PullInveQueryVO queryVO)
     {
-//        // 获取当前的用户
+        // 获取当前的用户
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         SysUser user = loginUser.getUser();
         // 根据当前登录用户部门查询所属商户
         SysDept sysDept = sysDeptService.selectDeptById(user.getDeptId());
         // 获取当前商户号
         String merchSn = sysDept.getMerchSn();
+        queryVO.setMerchId(merchSn);
 
         return oWbMerchShopInveService.pullShopInve(queryVO);
-        //return toAjax(oWbMerchShopInveService.pullStoreInveMng(merchSn));
     }
 
 }

+ 111 - 0
eccs-biz/src/main/java/com/emato/biz/domain/merchant/MerchUser.java

@@ -0,0 +1,111 @@
+package com.emato.biz.domain.merchant;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.emato.common.annotation.Excel;
+import com.emato.common.core.domain.BaseEntity;
+
+/**
+ * 商户用户对象 merch_user
+ * 
+ * @author admin
+ * @date 2023-04-20
+ */
+public class MerchUser extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    private String id;
+
+    /** 商户号 */
+    //@Excel(name = "商户号")
+    private String merchSn;
+
+    /** 用户 id */
+    //@Excel(name = "用户 id")
+    private String userId;
+
+    /** 创建人编号 */
+    //@Excel(name = "创建人编号")
+    private String createSn;
+
+    /** 修改人 */
+    //@Excel(name = "修改人")
+    private String modSn;
+
+    /** 修改时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    //@Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date modTime;
+
+    public void setId(String id) 
+    {
+        this.id = id;
+    }
+
+    public String getId() 
+    {
+        return id;
+    }
+    public void setMerchSn(String merchSn) 
+    {
+        this.merchSn = merchSn;
+    }
+
+    public String getMerchSn() 
+    {
+        return merchSn;
+    }
+    public void setUserId(String userId) 
+    {
+        this.userId = userId;
+    }
+
+    public String getUserId() 
+    {
+        return userId;
+    }
+    public void setCreateSn(String createSn) 
+    {
+        this.createSn = createSn;
+    }
+
+    public String getCreateSn() 
+    {
+        return createSn;
+    }
+    public void setModSn(String modSn) 
+    {
+        this.modSn = modSn;
+    }
+
+    public String getModSn() 
+    {
+        return modSn;
+    }
+    public void setModTime(Date modTime) 
+    {
+        this.modTime = modTime;
+    }
+
+    public Date getModTime() 
+    {
+        return modTime;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("merchSn", getMerchSn())
+            .append("userId", getUserId())
+            .append("createSn", getCreateSn())
+            .append("createTime", getCreateTime())
+            .append("modSn", getModSn())
+            .append("modTime", getModTime())
+            .toString();
+    }
+}

+ 68 - 0
eccs-biz/src/main/java/com/emato/biz/domain/merchant/MerchUserVO.java

@@ -0,0 +1,68 @@
+package com.emato.biz.domain.merchant;
+
+import com.emato.common.annotation.Excel;
+
+/**
+ * 商户用户 VO
+ *
+ * @author frankeleyn
+ * @email lvjian@qhdswl.com
+ * @date 2023/4/20 15:50
+ */
+public class MerchUserVO extends MerchUser{
+    /**
+     * 商户名
+     */
+    @Excel(name = "商户")
+    private String merchName;
+
+    /**
+     * 用户名
+     */
+    @Excel(name = "用户")
+    private String userName;
+
+    /**
+     * 创建者名字
+     */
+    @Excel(name = "创建人")
+    private String createrName;
+
+    /**
+     * 修改人名字
+     */
+    @Excel(name = "修改人")
+    private String moderName;
+
+    public String getMerchName() {
+        return merchName;
+    }
+
+    public void setMerchName(String merchName) {
+        this.merchName = merchName;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getCreaterName() {
+        return createrName;
+    }
+
+    public void setCreaterName(String createrName) {
+        this.createrName = createrName;
+    }
+
+    public String getModerName() {
+        return moderName;
+    }
+
+    public void setModerName(String moderName) {
+        this.moderName = moderName;
+    }
+}

+ 13 - 0
eccs-biz/src/main/java/com/emato/biz/domain/warehouse/OWbInveMng.java

@@ -108,6 +108,11 @@ public class OWbInveMng extends BaseEntity
     @Excel(name = "是否有效,0:有效,1:无效")
     private String isValid;
 
+    /**
+     * 三方商户号
+     */
+    private String thirdMerchSn;
+
     /** 创建人编号 */
     private String createrSn;
 
@@ -120,6 +125,14 @@ public class OWbInveMng extends BaseEntity
     /** 时间戳 */
     private Date tstm;
 
+    public String getThirdMerchSn() {
+        return thirdMerchSn;
+    }
+
+    public void setThirdMerchSn(String thirdMerchSn) {
+        this.thirdMerchSn = thirdMerchSn;
+    }
+
     public void setInveSn(String inveSn)
     {
         this.inveSn = inveSn;

+ 87 - 0
eccs-biz/src/main/java/com/emato/biz/mapper/merchant/MerchUserMapper.java

@@ -0,0 +1,87 @@
+package com.emato.biz.mapper.merchant;
+
+import com.emato.biz.domain.merchant.MerchUser;
+import com.emato.biz.domain.merchant.MerchUserVO;
+
+import java.util.List;
+
+/**
+ * 商户用户Mapper接口
+ * 
+ * @author admin
+ * @date 2023-04-20
+ */
+public interface MerchUserMapper 
+{
+    /**
+     * 根据用户 Id 查询绑定的商户
+     *
+     * @param userId
+     * @return
+     */
+    MerchUser selectMerchUserByUserId(String userId);
+
+    /**
+     * 根据查询条件统计数量
+     *
+     * @param merchUser
+     * @return
+     */
+    int selectCount(MerchUser merchUser);
+
+    /**
+     * 查询用户商户 VO
+     *
+     * @param merchUser 用户商户
+     * @return 用户商户 VO
+     */
+    List<MerchUserVO> selectMerchUserVOList(MerchUser merchUser);
+
+    /**
+     * 查询商户用户
+     * 
+     * @param id 商户用户ID
+     * @return 商户用户
+     */
+    public MerchUser selectMerchUserById(String id);
+
+    /**
+     * 查询商户用户列表
+     * 
+     * @param merchUser 商户用户
+     * @return 商户用户集合
+     */
+    public List<MerchUser> selectMerchUserList(MerchUser merchUser);
+
+    /**
+     * 新增商户用户
+     * 
+     * @param merchUser 商户用户
+     * @return 结果
+     */
+    public int insertMerchUser(MerchUser merchUser);
+
+    /**
+     * 修改商户用户
+     * 
+     * @param merchUser 商户用户
+     * @return 结果
+     */
+    public int updateMerchUser(MerchUser merchUser);
+
+    /**
+     * 删除商户用户
+     * 
+     * @param id 商户用户ID
+     * @return 结果
+     */
+    public int deleteMerchUserById(String id);
+
+    /**
+     * 批量删除商户用户
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteMerchUserByIds(String[] ids);
+}

+ 9 - 0
eccs-biz/src/main/java/com/emato/biz/mapper/merchant/ThirdMerchantBizMapper.java

@@ -11,6 +11,15 @@ import com.emato.biz.domain.merchant.ThirdMerchantBiz;
  */
 public interface ThirdMerchantBizMapper
 {
+
+    /**
+     * 根据货主编号查询第三方商户信息
+     *
+     * @param clientMerchSn
+     * @return
+     */
+    ThirdMerchantBiz selectByClientMerchSn(String clientMerchSn);
+
     /**
      * 查询第三方商户信息
      *

+ 113 - 0
eccs-biz/src/main/java/com/emato/biz/service/impl/MerchUserServiceImpl.java

@@ -0,0 +1,113 @@
+package com.emato.biz.service.impl;
+
+import java.util.List;
+import com.emato.biz.domain.merchant.MerchUser;
+import com.emato.biz.domain.merchant.MerchUserVO;
+import com.emato.biz.mapper.merchant.MerchUserMapper;
+import com.emato.biz.service.merchant.IMerchUserService;
+import com.emato.common.utils.DateUtils;
+import com.emato.common.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * 商户用户Service业务层处理
+ * 
+ * @author admin
+ * @date 2023-04-20
+ */
+@Service
+public class MerchUserServiceImpl implements IMerchUserService
+{
+    @Resource
+    private MerchUserMapper merchUserMapper;
+
+    /**
+     * 查询商户用户列表 VO
+     *
+     * @param merchUser 商户用户 VO
+     * @return 商户用户 VO
+     */
+    @Override
+    public List<MerchUserVO> selectMerchUserVOList(MerchUser merchUser) {
+        return merchUserMapper.selectMerchUserVOList(merchUser);
+    }
+
+    /**
+     * 查询商户用户
+     * 
+     * @param id 商户用户ID
+     * @return 商户用户
+     */
+    @Override
+    public MerchUser selectMerchUserById(String id)
+    {
+        return merchUserMapper.selectMerchUserById(id);
+    }
+
+    /**
+     * 查询商户用户列表
+     * 
+     * @param merchUser 商户用户
+     * @return 商户用户
+     */
+    @Override
+    public List<MerchUser> selectMerchUserList(MerchUser merchUser)
+    {
+        return merchUserMapper.selectMerchUserList(merchUser);
+    }
+
+    /**
+     * 新增商户用户
+     * 
+     * @param merchUser 商户用户
+     * @return 结果
+     */
+    @Override
+    public int insertMerchUser(MerchUser merchUser)
+    {
+        merchUser.setCreateSn(SecurityUtils.getLoginUser().getUser().getUserId()+"");
+        merchUser.setCreateTime(DateUtils.getNowDate());
+        return merchUserMapper.insertMerchUser(merchUser);
+    }
+
+    /**
+     * 修改商户用户
+     * 
+     * @param merchUser 商户用户
+     * @return 结果
+     */
+    @Override
+    public int updateMerchUser(MerchUser merchUser)
+    {
+        merchUser.setModSn(SecurityUtils.getLoginUser().getUser().getUserId()+"");
+        merchUser.setModTime(DateUtils.getNowDate());
+        return merchUserMapper.updateMerchUser(merchUser);
+    }
+
+    /**
+     * 批量删除商户用户
+     * 
+     * @param ids 需要删除的商户用户ID
+     * @return 结果
+     */
+    @Override
+    public int deleteMerchUserByIds(String[] ids)
+    {
+        return merchUserMapper.deleteMerchUserByIds(ids);
+    }
+
+    /**
+     * 删除商户用户信息
+     * 
+     * @param id 商户用户ID
+     * @return 结果
+     */
+    @Override
+    public int deleteMerchUserById(String id)
+    {
+        return merchUserMapper.deleteMerchUserById(id);
+    }
+}

+ 18 - 1
eccs-biz/src/main/java/com/emato/biz/service/impl/MerchantBaseServiceImpl.java

@@ -2,6 +2,7 @@ package com.emato.biz.service.impl;
 
 import java.util.List;
 
+import com.emato.common.core.domain.AjaxResult;
 import com.emato.common.utils.DateUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -11,6 +12,8 @@ import com.emato.biz.mapper.merchant.MerchantBaseMapper;
 import com.emato.biz.domain.merchant.MerchantBase;
 import com.emato.biz.service.merchant.IMerchantBaseService;
 
+import javax.annotation.Resource;
+
 /**
  * 商户基本信息Service业务层处理
  *
@@ -23,10 +26,24 @@ public class MerchantBaseServiceImpl implements IMerchantBaseService
 
     private static final Logger LOGGER = LoggerFactory.getLogger(MerchantBaseServiceImpl.class);
 
-    @Autowired
+    @Resource
     private MerchantBaseMapper merchantBaseMapper;
 
     /**
+     * 查询所有商户
+     *
+     * @return 返回结果
+     */
+    @Override
+    public AjaxResult getAll() {
+        MerchantBase merchantBase = new MerchantBase();
+        merchantBase.setIsValid("0");
+        // 查询商户列表
+        List<MerchantBase> merchList = merchantBaseMapper.selectMerchantBaseList(merchantBase);
+        return AjaxResult.success(merchList);
+    }
+
+    /**
      * 查询商户基本信息
      *
      * @param merchSn 商户基本信息ID

+ 49 - 4
eccs-biz/src/main/java/com/emato/biz/service/impl/OWbInveMngServiceImpl.java

@@ -11,14 +11,21 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.emato.biz.config.OmsConfig;
+import com.emato.biz.domain.merchant.MerchUser;
+import com.emato.biz.domain.merchant.ThirdMerchantBiz;
 import com.emato.biz.domain.warehouse.Page;
 import com.emato.biz.domain.warehouse.PullInveQueryVO;
+import com.emato.biz.mapper.merchant.MerchUserMapper;
+import com.emato.biz.mapper.merchant.ThirdMerchantBizMapper;
 import com.emato.biz.mapper.warehouse.WbInveMngMapper;
 import com.emato.biz.util.JsonUtil;
 import com.emato.biz.util.OmsDataUtil;
+import com.emato.biz.util.RoleUtils;
 import com.emato.common.core.domain.AjaxResult;
+import com.emato.common.core.domain.entity.SysUser;
 import com.emato.common.exception.ServiceException;
 import com.emato.common.utils.DateUtils;
+import com.emato.common.utils.SecurityUtils;
 import com.emato.common.utils.oms.JacksonUtils;
 import com.emato.common.utils.oms.request.OmsSign;
 import org.apache.http.HttpStatus;
@@ -55,6 +62,12 @@ public class OWbInveMngServiceImpl implements IOWbInveMngService
     @Resource
     private WbInveMngMapper wbInveMngMapper;
 
+    @Resource
+    private MerchUserMapper merchUserMapper;
+
+    @Resource
+    private ThirdMerchantBizMapper thirdMerchantBizMapper;
+
     private static final Logger log = LoggerFactory.getLogger(OWbInveMngServiceImpl.class);
 
     @Autowired
@@ -75,12 +88,18 @@ public class OWbInveMngServiceImpl implements IOWbInveMngService
         queryVO.setPage(page);
         queryVO.setLimit(10);
 
+        ThirdMerchantBiz merchantBiz = thirdMerchantBizMapper.selectByClientMerchSn(queryVO.getMerchId());
+        if (Objects.nonNull(merchantBiz)) {
+            queryVO.setThirdMerchId(merchantBiz.getThirdMerchSn());
+        }
+
+
         // 查询 OMS 分页数据
         Optional<Page<OWbInveMng>> firstPageOpt =
                 OmsDataUtil.fetchOmsPageData(queryVO, OmsConfig.getQueryMngInveUrl(), OWbInveMng.class);
 
         // 如果有数据
-        firstPageOpt.ifPresent(firstPage -> {
+        /*firstPageOpt.ifPresent(firstPage -> {
             // 如果有数据,开始批量处理
             firstPage.getList().forEach(obj -> log.debug("拉取的 sku => {}", obj.getSku()));
             // 插入数据库
@@ -103,14 +122,14 @@ public class OWbInveMngServiceImpl implements IOWbInveMngService
                     rows.getAndIncrement();
                 });
                 // 查询 OMS 数据
-                /*CompletableFuture<Void> task = CompletableFuture.runAsync(() -> {
+                CompletableFuture<Void> task = CompletableFuture.runAsync(() -> {
                 }, threadPoolExecutor);
                 // 将任务添加到列表中
-                tasks.add(task);*/
+                tasks.add(task);
             }
             CompletableFuture.allOf(tasks.toArray(new CompletableFuture[0])).join();
 
-        });
+        });*/
 
         log.debug("拉取库存成功,拉取数据条数 => {}", rows.get());
         return AjaxResult.success("拉取库存成功!");
@@ -137,6 +156,32 @@ public class OWbInveMngServiceImpl implements IOWbInveMngService
     @Override
     public List<OWbInveMng> selectOWbInveMngList(OWbInveMng oWbInveMng)
     {
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        boolean allRole = RoleUtils.isAllRole(user);
+
+        if (!allRole) {
+            // 如果没有全部数据权限
+            // 查询该用户属于哪个商户
+            MerchUser merchUser = merchUserMapper.selectMerchUserByUserId(user.getUserId()+"");
+            if (Objects.isNull(merchUser)) {
+                // 如果用户没有绑定商户就返回空数据
+                return Collections.emptyList();
+            }
+
+            // 如果用户绑定了商户
+            // 获取用户绑定的商户号,开始查询该商户的库存数据
+            String merchSn = merchUser.getMerchSn();
+            // 设置商户作为查询条件
+            oWbInveMng.setMerchSn(merchSn);
+
+            // 查询是否有三方商户
+            ThirdMerchantBiz merchantBiz = thirdMerchantBizMapper.selectByClientMerchSn(merchSn);
+            if (Objects.nonNull(merchantBiz)) {
+                // 如果有第三方商户,设置三方商户号作为查询条件
+                oWbInveMng.setThirdMerchSn(merchantBiz.getThirdMerchSn());
+            }
+        }
+
         return wbInveMngMapper.selectWbInveMngList(oWbInveMng);
     }
 

+ 1 - 2
eccs-biz/src/main/java/com/emato/biz/service/impl/SalesDetaiServicelImpl.java

@@ -2,7 +2,7 @@ package com.emato.biz.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.emato.biz.domain.OmsUtils;
+import com.emato.biz.util.OmsUtils;
 import com.emato.biz.domain.OperateLogDTO;
 import com.emato.biz.domain.OutRequest;
 import com.emato.biz.domain.mall.*;
@@ -17,7 +17,6 @@ import com.emato.biz.service.mall.ISalesDetaiServicel;
 import com.emato.biz.util.DateUtil;
 import com.emato.biz.util.MatchUtil;
 import com.emato.common.core.Result;
-import com.emato.common.exception.CustomException;
 import com.emato.common.exception.ServiceException;
 import com.emato.common.utils.DateUtils;
 import com.emato.common.utils.StringUtils;

+ 71 - 0
eccs-biz/src/main/java/com/emato/biz/service/merchant/IMerchUserService.java

@@ -0,0 +1,71 @@
+package com.emato.biz.service.merchant;
+
+import com.emato.biz.domain.merchant.MerchUser;
+import com.emato.biz.domain.merchant.MerchUserVO;
+
+import java.util.List;
+
+/**
+ * 商户用户Service接口
+ * 
+ * @author admin
+ * @date 2023-04-20
+ */
+public interface IMerchUserService 
+{
+    /**
+     * 查询商户用户列表 VO
+     *
+     * @param merchUser
+     * @return
+     */
+    List<MerchUserVO> selectMerchUserVOList(MerchUser merchUser);
+
+    /**
+     * 查询商户用户
+     * 
+     * @param id 商户用户ID
+     * @return 商户用户
+     */
+    public MerchUser selectMerchUserById(String id);
+
+    /**
+     * 查询商户用户列表
+     * 
+     * @param merchUser 商户用户
+     * @return 商户用户集合
+     */
+    public List<MerchUser> selectMerchUserList(MerchUser merchUser);
+
+    /**
+     * 新增商户用户
+     * 
+     * @param merchUser 商户用户
+     * @return 结果
+     */
+    public int insertMerchUser(MerchUser merchUser);
+
+    /**
+     * 修改商户用户
+     * 
+     * @param merchUser 商户用户
+     * @return 结果
+     */
+    public int updateMerchUser(MerchUser merchUser);
+
+    /**
+     * 批量删除商户用户
+     * 
+     * @param ids 需要删除的商户用户ID
+     * @return 结果
+     */
+    public int deleteMerchUserByIds(String[] ids);
+
+    /**
+     * 删除商户用户信息
+     * 
+     * @param id 商户用户ID
+     * @return 结果
+     */
+    public int deleteMerchUserById(String id);
+}

+ 8 - 1
eccs-biz/src/main/java/com/emato/biz/service/merchant/IMerchantBaseService.java

@@ -2,6 +2,7 @@ package com.emato.biz.service.merchant;
 
 import java.util.List;
 import com.emato.biz.domain.merchant.MerchantBase;
+import com.emato.common.core.domain.AjaxResult;
 
 /**
  * 商户基本信息Service接口
@@ -12,6 +13,13 @@ import com.emato.biz.domain.merchant.MerchantBase;
 public interface IMerchantBaseService
 {
     /**
+     * 查询所有商户
+     *
+     * @return 返回结果
+     */
+    AjaxResult getAll();
+
+    /**
      * 查询商户基本信息
      *
      * @param merchSn 商户基本信息ID
@@ -59,5 +67,4 @@ public interface IMerchantBaseService
      */
     public int deleteMerchantBaseById(String merchSn);
 
-
 }

+ 1 - 1
eccs-biz/src/main/java/com/emato/biz/domain/OmsUtils.java → eccs-biz/src/main/java/com/emato/biz/util/OmsUtils.java

@@ -1,4 +1,4 @@
-package com.emato.biz.domain;
+package com.emato.biz.util;
 
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.stereotype.Component;

+ 33 - 0
eccs-biz/src/main/java/com/emato/biz/util/RoleUtils.java

@@ -0,0 +1,33 @@
+package com.emato.biz.util;
+
+import com.emato.common.core.domain.entity.SysRole;
+import com.emato.common.core.domain.entity.SysUser;
+import com.emato.common.exception.CustomException;
+import com.emato.common.exception.ServiceException;
+import org.springframework.util.CollectionUtils;
+
+import java.util.Objects;
+import java.util.Optional;
+
+public class RoleUtils
+{
+    /**
+     * 判断用户是否有全部数据权限
+     * @param sysUser
+     * @return
+     */
+    public static boolean isAllRole(SysUser sysUser) {
+       if(Objects.isNull(sysUser)){
+           throw new ServiceException("用户信息为空!判断权限异常");
+       }
+       if(CollectionUtils.isEmpty(sysUser.getRoles())){
+           throw new ServiceException("用户角色为空!判断权限异常");
+       }
+
+        boolean hasAllRole = sysUser.getRoles()
+                .stream()
+                .anyMatch(role -> "1".equals(role.getDataScope()));
+
+        return hasAllRole;
+    }
+}

+ 144 - 0
eccs-biz/src/main/resources/mapper/biz/merchant/MerchUserMapper.xml

@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.emato.biz.mapper.merchant.MerchUserMapper">
+    
+    <resultMap type="com.emato.biz.domain.merchant.MerchUser" id="MerchUserResult">
+        <result property="id"    column="id"    />
+        <result property="merchSn"    column="merch_sn"    />
+        <result property="userId"    column="user_id"    />
+        <result property="createSn"    column="create_sn"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="modSn"    column="mod_sn"    />
+        <result property="modTime"    column="mod_time"    />
+    </resultMap>
+
+    <resultMap type="com.emato.biz.domain.merchant.MerchUserVO" id="MerchUserVOResult">
+        <result property="id"    column="id"    />
+        <result property="merchSn"    column="merch_sn"    />
+        <result property="merchName" column="merch_name" />
+        <result property="userId"    column="user_id"    />
+        <result property="userName" column="user_name" />
+        <result property="createSn"    column="create_sn"    />
+        <result property="createrName" column="creater_name" />
+        <result property="createTime"    column="create_time"    />
+        <result property="modSn"    column="mod_sn"    />
+        <result property="moderName" column="moder_name" />
+        <result property="modTime"    column="mod_time"    />
+    </resultMap>
+
+    <sql id="selectMerchUserVo">
+        select id, merch_sn, user_id, create_sn, create_time, mod_sn, mod_time from merch_user
+    </sql>
+
+    <sql id="selectMerchUserColumn">
+        t1.id,
+        t1.merch_sn,
+        t1.user_id,
+        t1.create_sn,
+        t1.create_time,
+        t1.mod_sn,
+        t1.mod_time
+    </sql>
+
+    <!-- 根据用户 Id 查询绑定的商户 -->
+    <select id="selectMerchUserByUserId" resultMap="MerchUserResult">
+        <include refid="selectMerchUserVo"/>
+        <where>
+            <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
+        </where>
+    </select>
+
+    <!-- 根据查询条件统计数量 -->
+    <select id="selectCount" resultType="int">
+        SELECT
+            COUTN(1)
+        FROM
+            merch_user
+        <where>
+            <if test="merchSn != null  and merchSn != ''"> and t1.merch_sn = #{merchSn}</if>
+            <if test="userId != null  and userId != ''"> and t1.user_id = #{userId}</if>
+        </where>
+    </select>
+
+    <!-- 查询用户商户 VO 列表-->
+    <select id="selectMerchUserVOList" resultMap="MerchUserVOResult">
+        SELECT
+            <include refid="selectMerchUserColumn" />,
+            t2.merch_name,
+            t3.nick_name AS user_name,
+            t4.nick_name AS creater_name,
+            t5.nick_name AS moder_name
+        FROM
+         merch_user t1
+        LEFT JOIN merchant_base t2 ON t1.merch_sn = t2.merch_sn
+        LEFT JOIN sys_user t3 ON t1.user_id = t3.user_id
+        LEFT JOIN sys_user t4 ON t1.create_sn = t4.user_id
+        LEFT JOIN sys_user t5 ON t1.mod_sn = t5.user_id
+        <where>
+            <if test="merchSn != null  and merchSn != ''"> and t1.merch_sn = #{merchSn}</if>
+            <if test="userId != null  and userId != ''"> and t1.user_id = #{userId}</if>
+        </where>
+    </select>
+
+    <select id="selectMerchUserList" parameterType="com.emato.biz.domain.merchant.MerchUser" resultMap="MerchUserResult">
+        <include refid="selectMerchUserVo"/>
+        <where>  
+            <if test="merchSn != null  and merchSn != ''"> and merch_sn = #{merchSn}</if>
+            <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
+        </where>
+    </select>
+    
+    <select id="selectMerchUserById" parameterType="String" resultMap="MerchUserResult">
+        <include refid="selectMerchUserVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertMerchUser" parameterType="com.emato.biz.domain.merchant.MerchUser">
+        insert into merch_user
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="merchSn != null">merch_sn,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="createSn != null">create_sn,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="modSn != null">mod_sn,</if>
+            <if test="modTime != null">mod_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="merchSn != null">#{merchSn},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="createSn != null">#{createSn},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="modSn != null">#{modSn},</if>
+            <if test="modTime != null">#{modTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateMerchUser" parameterType="com.emato.biz.domain.merchant.MerchUser">
+        update merch_user
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="merchSn != null">merch_sn = #{merchSn},</if>
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="createSn != null">create_sn = #{createSn},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="modSn != null">mod_sn = #{modSn},</if>
+            <if test="modTime != null">mod_time = #{modTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteMerchUserById" parameterType="String">
+        delete from merch_user where id = #{id}
+    </delete>
+
+    <delete id="deleteMerchUserByIds" parameterType="String">
+        delete from merch_user where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>

+ 7 - 1
eccs-biz/src/main/resources/mapper/biz/merchant/ThirdMerchantBizMapper.xml

@@ -22,6 +22,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select third_merch_sn, third_merch_code, third_merch_name, account_merch_sn, client_merch_sn, is_valid, creater_sn, create_time, moder_sn, mod_time, tstm from third_merchant_biz
     </sql>
 
+    <!-- 根据货主编号查询第三方商户信息 -->
+    <select id="selectByClientMerchSn" resultType="com.emato.biz.domain.merchant.ThirdMerchantBiz">
+        <include refid="selectThirdMerchantBizVo"/>
+        where client_merch_sn = #{clientMerchSn}
+         AND is_valid = '0'
+    </select>
+
     <select id="selectThirdMerchantBizList" parameterType="ThirdMerchantBiz" resultMap="ThirdMerchantBizResult">
         <include refid="selectThirdMerchantBizVo"/>
         <where>
@@ -95,5 +102,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{thirdMerchSn}
         </foreach>
     </delete>
-
 </mapper>

+ 2 - 1
eccs-biz/src/main/resources/mapper/biz/warehouse/WbInveMngMapper.xml

@@ -71,7 +71,8 @@
         FROM
             wb_inve_mng t
         <where>
-            <if test="merchSn != null  and merchSn != ''"> and merch_sn = #{merchSn}</if>
+            <if test="merchSn != null  and merchSn != ''"> and t.merch_sn = #{merchSn}</if>
+            <if test="thirdMerchSn != null and thirdMerchSn != ''">or t.third_merch_sn = #{thirdMerchSn}</if>
             <if test="merchName != null  and merchName != ''"> and merch_name like concat('%', #{merchName}, '%')</if>
             <if test="emsClassCode != null  and emsClassCode != ''"> and ems_class_code = #{emsClassCode}</if>
             <if test="sku != null  and sku != ''"> and sku = #{sku}</if>

+ 7 - 0
eccs-system/src/main/java/com/emato/system/mapper/SysUserMapper.java

@@ -11,6 +11,13 @@ import com.emato.common.core.domain.entity.SysUser;
  */
 public interface SysUserMapper
 {
+
+    /**
+     * 查询数据权限不为全部数据的用户
+     * @return
+     */
+    List<SysUser> selectUsersByDataScopeNot1();
+
     /**
      * 根据条件分页查询用户列表
      * 

+ 10 - 0
eccs-system/src/main/java/com/emato/system/service/ISysUserService.java

@@ -1,6 +1,8 @@
 package com.emato.system.service;
 
 import java.util.List;
+
+import com.emato.common.core.domain.AjaxResult;
 import com.emato.common.core.domain.entity.SysUser;
 
 /**
@@ -11,6 +13,13 @@ import com.emato.common.core.domain.entity.SysUser;
 public interface ISysUserService
 {
     /**
+     * 查询所有数据权限不为所有数据的用户
+     *
+     * @return
+     */
+    AjaxResult getAll();
+
+    /**
      * 根据条件分页查询用户列表
      * 
      * @param user 用户信息
@@ -164,4 +173,5 @@ public interface ISysUserService
      * @return 结果
      */
     public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
+
 }

+ 13 - 0
eccs-system/src/main/java/com/emato/system/service/impl/SysUserServiceImpl.java

@@ -2,6 +2,8 @@ package com.emato.system.service.impl;
 
 import java.util.ArrayList;
 import java.util.List;
+
+import com.emato.common.core.domain.AjaxResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -54,6 +56,17 @@ public class SysUserServiceImpl implements ISysUserService
     private ISysConfigService configService;
 
     /**
+     * 查询所有数据权限不为所有数据的用户
+     *
+     * @return
+     */
+    @Override
+    public AjaxResult getAll() {
+        List<SysUser> userList = userMapper.selectUsersByDataScopeNot1();
+        return AjaxResult.success(userList);
+    }
+
+    /**
      * 根据条件分页查询用户列表
      * 
      * @param user 用户信息

+ 8 - 2
eccs-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -54,6 +54,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		    left join sys_user_role ur on u.user_id = ur.user_id
 		    left join sys_role r on r.role_id = ur.role_id
     </sql>
+
+	<!-- 查询数据权限不为全部数据的用户 -->
+	<select id="selectUsersByDataScopeNot1" resultMap="SysUserResult">
+		<include refid="selectUserVo"/>
+		where r.data_scope != '1' AND u.del_flag = '0'
+	</select>
     
     <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
 		select u.user_id, u.dept_id, u.nick_name, u.user_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, d.dept_name, d.leader from sys_user u
@@ -178,5 +184,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			#{userId}
         </foreach> 
  	</delete>
-	
-</mapper> 
+
+</mapper>

+ 70 - 0
eccs-ui/src/api/merchant/merchUser.js

@@ -0,0 +1,70 @@
+import request from '@/utils/request'
+
+// 查询商户用户列表
+export function listMerchUser(query) {
+  return request({
+    url: '/merch/merchUser/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询商户用户详细
+export function getMerchUser(id) {
+  return request({
+    url: '/merch/merchUser/' + id,
+    method: 'get'
+  })
+}
+
+// 新增商户用户
+export function addMerchUser(data) {
+  return request({
+    url: '/merch/merchUser',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改商户用户
+export function updateMerchUser(data) {
+  return request({
+    url: '/merch/merchUser',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除商户用户
+export function delMerchUser(id) {
+  return request({
+    url: '/merch/merchUser/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出商户用户
+export function exportMerchUser(query) {
+  return request({
+    url: '/merch/merchUser/export',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询用户
+export function getAllUsers() {
+  return request({
+    url: '/system/user/getAll',
+    method: 'get',
+  })
+}
+
+// 查询商户列表
+export function getAllMerchants() {
+  return request({
+    url: '/biz/merchantbase/getAll',
+    method: 'get',
+  })
+}
+

+ 330 - 0
eccs-ui/src/views/merchant/merchUser/index.vue

@@ -0,0 +1,330 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="商户" prop="merchSn">
+        <el-select v-model="queryParams.merchSn" placeholder="请选择商户" clearable size="small">
+            <el-option
+              v-for="item in merchList"
+              :key="item.merchSn"
+              :label="item.merchName"
+              :value="item.merchSn">
+            </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="用户" prop="userId">
+        <el-select v-model="queryParams.userId" placeholder="请选择用户" clearable size="small">
+          <el-option
+            v-for="item in userList"
+            :key="item.userId"
+            :label="item.nickName"
+            :value="item.userId">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['biz:merchUser:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['biz:merchUser:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['biz:merchUser:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['biz:merchUser:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="merchUserList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <!-- <el-table-column label="主键" align="center" prop="id" /> -->
+      <el-table-column label="商户" align="center" prop="merchName" />
+      <el-table-column label="用户" align="center" prop="userName" />
+      <el-table-column label="创建人" align="center" prop="createrName" />
+      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="修改人" align="center" prop="moderName" />
+      <el-table-column label="修改时间" align="center" prop="modTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.modTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['biz:merchUser:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['biz:merchUser:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改商户用户对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="商户号" prop="merchSn">
+          <el-select v-model="form.merchSn" placeholder="请选择商户号">
+            <el-option
+              v-for="item in merchList"
+              :key="item.merchSn"
+              :label="item.merchName"
+              :value="item.merchSn">
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="用户" prop="userId">
+          <el-select v-model="form.userId" placeholder="请选择用户">
+            <el-option
+              v-for="item in userList"
+              :key="item.userId"
+              :label="item.nickName"
+              :value="item.userId">
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listMerchUser, getMerchUser, delMerchUser, addMerchUser, updateMerchUser, exportMerchUser, getAllUsers, getAllMerchants } from "@/api/merchant/merchUser";
+
+export default {
+  name: "MerchUser",
+  components: {
+  },
+  data() {
+    return {
+      // 商户列表
+      merchList: [],
+      // 用户列表
+      userList: [],
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 商户用户表格数据
+      merchUserList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        merchSn: null,
+        userId: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        userId: [
+          { required: true, message: "用户不能为空", trigger: "blur" }
+        ],
+        merchSn: [
+          { required: true, message: "商户不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+    this.getMerchsList();
+    this.getUsetList();
+  },
+  methods: {
+    /**
+     * 查询商户列表
+     */
+    getMerchsList() {
+      getAllMerchants().then(res => {
+        this.merchList = res.data;
+      });
+    },
+    /**
+     * 查询用户列表
+     */
+    getUsetList() {
+       getAllUsers().then(res => {
+         this.userList = res.data;
+       });
+    },
+    /** 查询商户用户列表 */
+    getList() {
+      this.loading = true;
+      listMerchUser(this.queryParams).then(response => {
+        this.merchUserList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        merchSn: null,
+        userId: null,
+        createSn: null,
+        createTime: null,
+        modSn: null,
+        modTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加商户用户";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getMerchUser(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改商户用户";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateMerchUser(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addMerchUser(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除商户用户编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delMerchUser(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        })
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有商户用户数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportMerchUser(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+        })
+    }
+  }
+};
+</script>

+ 34 - 0
sql/20230420/merch-userMenu.sql

@@ -0,0 +1,34 @@
+CREATE TABLE `merch_user` (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `merch_sn` varchar(32) DEFAULT NULL COMMENT '商户号',
+  `user_id` varchar(32) DEFAULT NULL COMMENT '用户 id',
+  `create_sn` varchar(32) DEFAULT NULL COMMENT '创建人编号',
+  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `mod_sn` varchar(255) DEFAULT NULL COMMENT '修改人',
+  `mod_time` datetime DEFAULT NULL COMMENT '修改时间',
+  `tstm` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商户用户表';
+
+-- 菜单 SQL
+insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
+values('商户用户', '2288', '1', 'merchUser', 'merchant/merchUser/index', 1, 0, 'C', '0', '0', 'biz:merchUser:list', '#', 'admin', sysdate(), '', null, '商户用户菜单');
+
+-- 按钮父菜单ID
+SELECT @parentId := LAST_INSERT_ID();
+
+-- 按钮 SQL
+insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
+values('商户用户查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'biz:merchUser:query',        '#', 'admin', sysdate(), '', null, '');
+
+insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
+values('商户用户新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'biz:merchUser:add',          '#', 'admin', sysdate(), '', null, '');
+
+insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
+values('商户用户修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'biz:merchUser:edit',         '#', 'admin', sysdate(), '', null, '');
+
+insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
+values('商户用户删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'biz:merchUser:remove',       '#', 'admin', sysdate(), '', null, '');
+
+insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
+values('商户用户导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'biz:merchUser:export',       '#', 'admin', sysdate(), '', null, '');