Переглянути джерело

部门权限开关,和部分功能部门权限

吴树波 4 днів тому
батько
коміт
15b5103947
25 змінених файлів з 216 додано та 106 видалено
  1. 41 1
      fs-admin/src/main/java/com/fs/company/controller/CompanyController.java
  2. 36 4
      fs-admin/src/main/java/com/fs/course/controller/FsCoursePlaySourceConfigController.java
  3. 1 2
      fs-admin/src/main/java/com/fs/fastGpt/FastgptExtUserTagController.java
  4. 25 3
      fs-admin/src/main/java/com/fs/his/controller/FsCompanyController.java
  5. 33 1
      fs-admin/src/main/java/com/fs/qw/controller/QwCompanyController.java
  6. 6 2
      fs-common/src/main/java/com/fs/common/core/domain/model/LoginUser.java
  7. 1 1
      fs-company/src/main/java/com/fs/company/controller/company/CompanyController.java
  8. 1 14
      fs-doctor-app/src/main/java/com/fs/app/controller/InquiryOrderController.java
  9. 7 3
      fs-service/src/main/java/com/fs/company/mapper/CompanyMapper.java
  10. 3 32
      fs-service/src/main/java/com/fs/company/param/CompanyParam.java
  11. 1 1
      fs-service/src/main/java/com/fs/company/service/ICompanyService.java
  12. 2 2
      fs-service/src/main/java/com/fs/company/service/impl/CompanyServiceImpl.java
  13. 1 0
      fs-service/src/main/java/com/fs/course/config/CourseConfig.java
  14. 4 0
      fs-service/src/main/java/com/fs/course/domain/FsCoursePlaySourceConfig.java
  15. 0 1
      fs-service/src/main/java/com/fs/course/param/FsCoursePlaySourceConfigCreateParam.java
  16. 4 0
      fs-service/src/main/java/com/fs/qw/domain/QwCompany.java
  17. 3 2
      fs-service/src/main/java/com/fs/qw/mapper/QwCompanyMapper.java
  18. 1 1
      fs-service/src/main/java/com/fs/qw/service/IQwCompanyService.java
  19. 2 2
      fs-service/src/main/java/com/fs/qw/service/impl/QwCompanyServiceImpl.java
  20. 1 3
      fs-service/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java
  21. 12 13
      fs-service/src/main/java/com/fs/statis/service/impl/StatisticsCompanyServiceImpl.java
  22. 6 0
      fs-service/src/main/resources/mapper/company/CompanyMapper.xml
  23. 6 0
      fs-service/src/main/resources/mapper/course/FsCoursePlaySourceConfigMapper.xml
  24. 18 0
      fs-service/src/main/resources/mapper/qw/QwCompanyMapper.xml
  25. 1 18
      fs-store/src/main/java/com/fs/hisStore/controller/store/CompanyController.java

+ 41 - 1
fs-admin/src/main/java/com/fs/company/controller/CompanyController.java

@@ -1,6 +1,7 @@
 package com.fs.company.controller;
 
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.json.JSONUtil;
 import com.fs.common.annotation.Log;
 import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.controller.BaseController;
@@ -24,8 +25,10 @@ import com.fs.company.vo.CompanyCrmVO;
 import com.fs.company.vo.CompanyVO;
 import com.fs.company.vo.CompanyVoiceCallerListVO;
 import com.fs.core.utils.OrderCodeUtils;
+import com.fs.course.config.CourseConfig;
 import com.fs.framework.web.service.TokenService;
 import com.fs.his.vo.OptionsVO;
+import com.fs.system.service.ISysConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.transaction.annotation.Transactional;
@@ -55,6 +58,8 @@ public class CompanyController extends BaseController
     private ICompanyDeductService deductService;
     @Autowired
     private ICompanyVoiceCallerService callerService;
+    @Autowired
+    private ISysConfigService configService;
     /**
      * 查询企业列表
      */
@@ -63,6 +68,12 @@ public class CompanyController extends BaseController
     public TableDataInfo list(CompanyParam param)
     {
         startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        if(!loginUser.isAdmin() && config.getIsBound() != null && config.getIsBound()){
+            param.setDeptId(loginUser.getDeptId());
+        }
         List<CompanyVO> list = companyService.selectCompanyVOList(param);
         return getDataTable(list);
     }
@@ -75,6 +86,12 @@ public class CompanyController extends BaseController
     @GetMapping("/export")
     public AjaxResult export(CompanyParam company)
     {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        if(!loginUser.isAdmin() && config.getIsBound() != null && config.getIsBound()){
+            company.setDeptId(loginUser.getDeptId());
+        }
         List<CompanyVO> list = companyService.selectCompanyVOList(company);
         ExcelUtil<CompanyVO> util = new ExcelUtil<CompanyVO>(CompanyVO.class);
         return util.exportExcel(list, "company");
@@ -98,6 +115,10 @@ public class CompanyController extends BaseController
     @PostMapping
     public R add(@RequestBody Company company)
     {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if(company.getDeptId() != null){
+            company.setDeptId(loginUser.getDeptId());
+        }
         company.setPassword(SecurityUtils.encryptPassword(company.getPassword()));
         company.setAppId(Md5Utils.hash(company.getUserName()));
         company.setAppKey(Md5Utils.hash(company.getPassword()));
@@ -154,6 +175,12 @@ public class CompanyController extends BaseController
     {
         Company map=new Company();
         map.setIsDel(0);
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        if(!loginUser.isAdmin() && config.getIsBound() != null && config.getIsBound()){
+            map.setDeptId(loginUser.getDeptId());
+        }
         List<Company> list = companyService.selectCompanyList(map);
         return R.ok().put("data",list);
     }
@@ -164,6 +191,12 @@ public class CompanyController extends BaseController
     public TableDataInfo companyCrmDayCountList(CompanyParam param)
     {
         startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        if(!loginUser.isAdmin() && config.getIsBound() != null && config.getIsBound()){
+            param.setDeptId(loginUser.getDeptId());
+        }
         List<CompanyCrmVO> list = companyService.selectCompanyCrmDayCountList(param);
         return getDataTable(list);
     }
@@ -239,7 +272,14 @@ public class CompanyController extends BaseController
     @GetMapping("/allList")
     public TableDataInfo getHospital()
     {
-        List<OptionsVO> list = companyService.selectAllCompanyList();
+        Long deptId = null;
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        if(!loginUser.isAdmin() && config.getIsBound() != null && config.getIsBound()){
+            deptId = loginUser.getDeptId();
+        }
+        List<OptionsVO> list = companyService.selectAllCompanyList(deptId);
         return getDataTable(list);
     }
 }

+ 36 - 4
fs-admin/src/main/java/com/fs/course/controller/FsCoursePlaySourceConfigController.java

@@ -1,21 +1,26 @@
 package com.fs.course.controller;
 
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
+import com.fs.common.core.domain.model.LoginUser;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.bean.BeanUtils;
+import com.fs.course.config.CourseConfig;
 import com.fs.course.domain.FsCoursePlaySourceConfig;
 import com.fs.course.param.FsCoursePlaySourceConfigCreateParam;
 import com.fs.course.param.FsCoursePlaySourceConfigEditParam;
 import com.fs.course.service.IFsCoursePlaySourceConfigService;
 import com.fs.course.vo.FsCoursePlaySourceConfigVO;
+import com.fs.framework.web.service.TokenService;
+import com.fs.system.service.ISysConfigService;
 import com.github.pagehelper.PageHelper;
 import lombok.AllArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -31,6 +36,8 @@ import java.util.*;
 public class FsCoursePlaySourceConfigController extends BaseController {
 
     private final IFsCoursePlaySourceConfigService fsCoursePlaySourceConfigService;
+    private final TokenService tokenService;
+    private final ISysConfigService configService;
 
     @PreAuthorize("@ss.hasPermi('course:playSourceConfig:list')")
     @GetMapping("/list")
@@ -41,6 +48,19 @@ public class FsCoursePlaySourceConfigController extends BaseController {
         Map<String, Object> params = new HashMap<>();
         params.put("name", name);
         params.put("appid", appid);
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        Long userId = null;
+        Long deptId = null;
+        if(!loginUser.isAdmin() && config.getIsBound() != null && config.getIsBound()){
+            deptId = loginUser.getDeptId();
+            if(config.getDept() == null || !config.getDept()){
+                userId = loginUser.getUserId();
+            }
+        }
+        params.put("userId", userId);
+        params.put("deptId", deptId);
 
         PageHelper.startPage(pageNum, pageSize);
         List<FsCoursePlaySourceConfigVO> list = fsCoursePlaySourceConfigService.selectCoursePlaySourceConfigVOListByMap(params);
@@ -70,8 +90,10 @@ public class FsCoursePlaySourceConfigController extends BaseController {
         if (fsCoursePlaySourceConfigService.count(queryWrapper) > 0) {
             return AjaxResult.error("appid已存在");
         }
-
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         FsCoursePlaySourceConfig config = new FsCoursePlaySourceConfig();
+        config.setCreateUserId(loginUser.getUserId());
+        config.setCreateDeptId(loginUser.getDeptId());
         BeanUtils.copyProperties(param, config);
 
         config.setIsDel(0);
@@ -116,7 +138,17 @@ public class FsCoursePlaySourceConfigController extends BaseController {
     }
 
     @GetMapping("/listAll")
-    public R listAll() {
-        return R.ok().put("data", fsCoursePlaySourceConfigService.list(new QueryWrapper<FsCoursePlaySourceConfig>().eq("is_del", 0)));
+    public R listAll(Long companyId) {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        QueryWrapper<FsCoursePlaySourceConfig> queryWrapper = new QueryWrapper<FsCoursePlaySourceConfig>().eq("is_del", 0);
+        if(!loginUser.isAdmin() && config.getIsBound() != null && config.getIsBound()){
+            queryWrapper.eq("create_user_id", loginUser.getUserId()).eq(config.getDept() == null || !config.getDept(), "create_dept_id", loginUser.getDeptId());
+        }
+        if(companyId != null){
+            queryWrapper.and(e -> e.eq("company_id", companyId).or().isNull("company_id"));
+        }
+        return R.ok().put("data", fsCoursePlaySourceConfigService.list(queryWrapper));
     }
 }

+ 1 - 2
fs-admin/src/main/java/com/fs/fastGpt/FastgptExtUserTagController.java

@@ -4,7 +4,6 @@ import java.util.List;
 
 import com.fs.common.core.domain.R;
 import com.fs.fastGpt.vo.FastgptExtUserTagVO;
-import com.fs.framework.web.service.TokenService;
 import com.fs.qw.service.IQwCompanyService;
 import com.fs.qw.vo.QwOptionsVO;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -64,7 +63,7 @@ public class FastgptExtUserTagController extends BaseController
     @GetMapping("/getMyQwUserList")
     public R getMyQwUserList()
     {
-        List<QwOptionsVO> list = qwCompanyService.selectQwCompanyListOptionsVO();
+        List<QwOptionsVO> list = qwCompanyService.selectQwCompanyListOptionsVO(null, null);
         return  R.ok().put("data",list);
     }
 

+ 25 - 3
fs-admin/src/main/java/com/fs/his/controller/FsCompanyController.java

@@ -2,7 +2,7 @@ package com.fs.his.controller;
 
 import java.util.List;
 
-import cn.hutool.core.util.IdUtil;
+import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.domain.R;
@@ -22,10 +22,11 @@ import com.fs.company.service.ICompanyService;
 import com.fs.company.service.ICompanyUserService;
 import com.fs.company.vo.CompanyVO;
 import com.fs.core.utils.OrderCodeUtils;
+import com.fs.course.config.CourseConfig;
 import com.fs.framework.web.service.TokenService;
-import com.fs.his.domain.FsDoctor;
 import com.fs.his.mapper.FsDoctorMapper;
 import com.fs.his.vo.OptionsVO;
+import com.fs.system.service.ISysConfigService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -67,6 +68,8 @@ public class FsCompanyController extends BaseController
     private FsDoctorMapper fsDoctorMapper;
     @Autowired
     private ICompanyDeductService deductService;
+    @Autowired
+    private ISysConfigService configService;
     /**
      * 查询诊所管理列表
      */
@@ -75,6 +78,12 @@ public class FsCompanyController extends BaseController
     public TableDataInfo list(Company company)
     {
         startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        if(!loginUser.isAdmin() && config.getIsBound() != null && config.getIsBound()){
+            company.setDeptId(loginUser.getDeptId());
+        }
         List<CompanyVO> list = companyService.selectCompanyListVO(company);
         return getDataTable(list);
     }
@@ -83,7 +92,14 @@ public class FsCompanyController extends BaseController
     public R companyList()
     {
 
-        List<OptionsVO> list = companyService.selectAllCompanyList();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        Long depId = null;
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        if(!loginUser.isAdmin() && config.getIsBound() != null && config.getIsBound()){
+            depId = loginUser.getDeptId();
+        }
+        List<OptionsVO> list = companyService.selectAllCompanyList(depId);
         return R.ok().put("data",list);
     }
     /**
@@ -133,6 +149,12 @@ public class FsCompanyController extends BaseController
     @PostMapping
     public R add(@RequestBody Company company)
     {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        if(!loginUser.isAdmin() && config.getIsBound() != null && config.getIsBound()){
+            company.setDeptId(loginUser.getDeptId());
+        }
         return companyService.insertCompany(company);
     }
 

+ 33 - 1
fs-admin/src/main/java/com/fs/qw/controller/QwCompanyController.java

@@ -2,8 +2,14 @@ package com.fs.qw.controller;
 
 import java.util.List;
 
+import cn.hutool.json.JSONUtil;
 import com.fs.common.core.domain.R;
+import com.fs.common.core.domain.model.LoginUser;
+import com.fs.common.utils.ServletUtils;
+import com.fs.course.config.CourseConfig;
+import com.fs.framework.web.service.TokenService;
 import com.fs.qw.vo.QwOptionsVO;
+import com.fs.system.service.ISysConfigService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -35,6 +41,10 @@ public class QwCompanyController extends BaseController
 {
     @Autowired
     private IQwCompanyService qwCompanyService;
+    @Autowired
+    private TokenService tokenService;
+    @Autowired
+    private ISysConfigService configService;
 
     /**
      * 查询企微主体列表
@@ -44,6 +54,13 @@ public class QwCompanyController extends BaseController
     public TableDataInfo list(QwCompany qwCompany)
     {
         startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        if(!loginUser.isAdmin() && config.getIsBound() != null && config.getIsBound()){
+            qwCompany.setCreateDeptId(loginUser.getDeptId());
+            qwCompany.setCreateUserId(loginUser.getUserId());
+        }
         List<QwCompany> list = qwCompanyService.selectQwCompanyList(qwCompany);
         return getDataTable(list);
     }
@@ -52,7 +69,18 @@ public class QwCompanyController extends BaseController
     @GetMapping("/all")
     public R all()
     {
-        List<QwOptionsVO> list = qwCompanyService.selectQwCompanyListOptionsVO();
+        Long userId = null;
+        Long deptId = null;
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        if(!loginUser.isAdmin() && config.getIsBound() != null && config.getIsBound()){
+            deptId = loginUser.getDeptId();
+            if(config.getDept() == null || !config.getDept()){
+                userId = loginUser.getUserId();
+            }
+        }
+        List<QwOptionsVO> list = qwCompanyService.selectQwCompanyListOptionsVO(userId, deptId);
         return R.ok().put("data", list);
     }
     /**
@@ -86,6 +114,10 @@ public class QwCompanyController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody QwCompany qwCompany)
     {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+
+        qwCompany.setCreateUserId(loginUser.getUserId());
+        qwCompany.setCreateDeptId(loginUser.getDeptId());
         return toAjax(qwCompanyService.insertQwCompany(qwCompany));
     }
 

+ 6 - 2
fs-common/src/main/java/com/fs/common/core/domain/model/LoginUser.java

@@ -1,7 +1,7 @@
 package com.fs.common.core.domain.model;
 
-import java.util.Collection;
-import java.util.Set;
+import java.util.*;
+
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.userdetails.UserDetails;
 import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -14,6 +14,7 @@ import com.fs.common.core.domain.entity.SysUser;
  */
 public class LoginUser implements UserDetails
 {
+    private static final List<String> ADMIN_USER_NAME = Collections.singletonList("admin");
     private static final long serialVersionUID = 1L;
 
     /**
@@ -254,6 +255,9 @@ public class LoginUser implements UserDetails
     {
         return user;
     }
+    public boolean isAdmin(){
+        return ADMIN_USER_NAME.contains(user.getUserName());
+    }
 
     public void setUser(SysUser user)
     {

+ 1 - 1
fs-company/src/main/java/com/fs/company/controller/company/CompanyController.java

@@ -107,7 +107,7 @@ public class CompanyController extends BaseController
     @GetMapping("/allList")
     public TableDataInfo getHospital()
     {
-        List<OptionsVO> list = companyService.selectAllCompanyList();
+        List<OptionsVO> list = companyService.selectAllCompanyList(null);
         return getDataTable(list);
     }
 

+ 1 - 14
fs-doctor-app/src/main/java/com/fs/app/controller/InquiryOrderController.java

@@ -1,27 +1,19 @@
 package com.fs.app.controller;
 
 
-import cn.hutool.core.util.IdUtil;
-import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.fs.app.annotation.Login;
-import com.fs.app.param.InquiryOrderMsgListParam;
 import com.fs.common.BeanCopyUtils;
 import com.fs.common.annotation.Log;
-import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
-import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
-import com.fs.common.utils.SecurityUtils;
 import com.fs.common.utils.StringUtils;
-import com.fs.common.utils.ip.IpUtils;
 import com.fs.company.service.ICompanyService;
 import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
 import com.fs.his.domain.*;
 import com.fs.his.dto.FsInquiryOrderPatientDTO;
-import com.fs.his.enums.FsInquiryOrderStatusEnum;
 import com.fs.his.param.*;
 import com.fs.his.service.*;
 import com.fs.his.vo.*;
@@ -30,10 +22,6 @@ import com.fs.im.dto.MsgDTO;
 import com.fs.im.dto.MsgDataDTO;
 import com.fs.im.dto.MsgDataFormatDTO;
 import com.fs.im.service.IImService;
-import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
-import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
-import com.github.binarywang.wxpay.config.WxPayConfig;
-import com.github.binarywang.wxpay.exception.WxPayException;
 import com.github.binarywang.wxpay.service.WxPayService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -42,7 +30,6 @@ import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -128,7 +115,7 @@ public class InquiryOrderController extends  AppBaseController {
     @GetMapping("/getCompanyList")
     public R getCompanyList()
     {
-        List<OptionsVO> list = companyService.selectAllCompanyList();
+        List<OptionsVO> list = companyService.selectAllCompanyList(deptId);
         return R.ok().put("list",list);
     }
     @Login

+ 7 - 3
fs-service/src/main/java/com/fs/company/mapper/CompanyMapper.java

@@ -11,7 +11,6 @@ import com.fs.company.vo.CompanyCrmVO;
 import com.fs.company.vo.CompanyNameVO;
 import com.fs.company.vo.CompanyVO;
 import com.fs.his.vo.OptionsVO;
-import com.fs.huifuPay.sdk.opps.core.utils.StringUtil;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
@@ -81,6 +80,9 @@ public interface CompanyMapper
             "<if test = 'maps.companyName != null and  maps.companyName !=\"\"     '> " +
             "and c.company_name like CONCAT('%',#{maps.companyName},'%') " +
             "</if>" +
+            "<if test = 'maps.deptId != null'> " +
+            "and c.dept_id = #{maps.deptId} " +
+            "</if>" +
 
             "<if test = 'maps.status != null   '> " +
             "and c.status = #{maps.status}" +
@@ -118,6 +120,9 @@ public interface CompanyMapper
             "<if test = 'maps.companyName != null and  maps.companyName !=\"\"     '> " +
             "and c.company_name like CONCAT('%',#{maps.companyName},'%') " +
             "</if>" +
+            "<if test = 'maps.deptId != null'> " +
+            "and c.dept_id = #{maps.deptId} " +
+            "</if>" +
 
             "<if test = 'maps.phonenumber != null and  maps.phonenumber !=\"\"     '> " +
             "and c.company_mobile like CONCAT('%',#{maps.phonenumber},'%') " +
@@ -170,8 +175,7 @@ public interface CompanyMapper
             "</script>"})
     List<CompanyVO> selectCompanyListVO(Company param);
 
-    @Select("select company_id dictValue,company_name dictLabel from company where is_del= 0")
-    List<OptionsVO> selectAllCompanyList();
+    List<OptionsVO> selectAllCompanyList(@Param("deptId") Long deptId);
 
     @Select("select company_id from company")
     List<Long> selectCompanyIds();

+ 3 - 32
fs-service/src/main/java/com/fs/company/param/CompanyParam.java

@@ -1,10 +1,12 @@
 package com.fs.company.param;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
 
 import java.util.Date;
 
 
+@Data
 public class CompanyParam
 {
 
@@ -12,36 +14,5 @@ public class CompanyParam
     private Long companyId;
     private Integer status;
     private String phonenumber;
-
-    public String getCompanyName() {
-        return companyName;
-    }
-
-    public void setCompanyName(String companyName) {
-        this.companyName = companyName;
-    }
-
-    public Long getCompanyId() {
-        return companyId;
-    }
-
-    public void setCompanyId(Long companyId) {
-        this.companyId = companyId;
-    }
-
-    public Integer getStatus() {
-        return status;
-    }
-
-    public void setStatus(Integer status) {
-        this.status = status;
-    }
-
-    public String getPhonenumber() {
-        return phonenumber;
-    }
-
-    public void setPhonenumber(String phonenumber) {
-        this.phonenumber = phonenumber;
-    }
+    private Long deptId;
 }

+ 1 - 1
fs-service/src/main/java/com/fs/company/service/ICompanyService.java

@@ -28,7 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
  */
 public interface ICompanyService
 {
-     List<OptionsVO> selectAllCompanyList() ;
+     List<OptionsVO> selectAllCompanyList(Long deptId) ;
 
     /**
      * 查询企业

+ 2 - 2
fs-service/src/main/java/com/fs/company/service/impl/CompanyServiceImpl.java

@@ -97,8 +97,8 @@ public class CompanyServiceImpl implements ICompanyService
     private CompanyUserMapper companyUserMapper;
 
     @Override
-    public List<OptionsVO> selectAllCompanyList() {
-        return companyMapper.selectAllCompanyList();
+    public List<OptionsVO> selectAllCompanyList(Long deptId) {
+        return companyMapper.selectAllCompanyList(deptId);
     }
 
     /**

+ 1 - 0
fs-service/src/main/java/com/fs/course/config/CourseConfig.java

@@ -62,6 +62,7 @@ public class CourseConfig implements Serializable {
      * 是否绑定
      */
     private Boolean isBound;
+    private Boolean dept;
     /**
      * 是否单销售观看(只能在第一次绑定的销售头上看课)
      */

+ 4 - 0
fs-service/src/main/java/com/fs/course/domain/FsCoursePlaySourceConfig.java

@@ -86,4 +86,8 @@ public class FsCoursePlaySourceConfig {
      * 销售ID
      */
     private Long companyUserId;
+    // 创建人
+    private Long createUserId;
+    // 创建部门
+    private Long createDeptId;
 }

+ 0 - 1
fs-service/src/main/java/com/fs/course/param/FsCoursePlaySourceConfigCreateParam.java

@@ -43,7 +43,6 @@ public class FsCoursePlaySourceConfigCreateParam {
     @ApiModelProperty("类型 1主要小程序 2公众号 3炮灰小程序")
     private Integer type;
 
-    @NotNull(message = "所属公司不能为空")
     @ApiModelProperty("所属公司")
     private Long companyId;
 }

+ 4 - 0
fs-service/src/main/java/com/fs/qw/domain/QwCompany.java

@@ -81,4 +81,8 @@ public class QwCompany extends BaseEntity
     private String miniAppId;
 
     private Integer companyServerNum;
+    // 创建人
+    private Long createUserId;
+    // 创建部门
+    private Long createDeptId;
 }

+ 3 - 2
fs-service/src/main/java/com/fs/qw/mapper/QwCompanyMapper.java

@@ -2,6 +2,7 @@ package com.fs.qw.mapper;
 
 import com.fs.qw.domain.QwCompany;
 import com.fs.qw.vo.QwOptionsVO;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
@@ -66,7 +67,7 @@ public interface QwCompanyMapper
 
     @Select("SELECT * from qw_company where corp_id=#{corpId} limit 1")
     QwCompany selectQwCompanyByCorpId(String corpId);
-    @Select("SELECT * from qw_company ")
-    List<QwOptionsVO> selectQwCompanyListOptionsVO();
+
+    List<QwOptionsVO> selectQwCompanyListOptionsVO(@Param("userId") Long userId, @Param("deptId") Long deptId);
 
 }

+ 1 - 1
fs-service/src/main/java/com/fs/qw/service/IQwCompanyService.java

@@ -64,7 +64,7 @@ public interface IQwCompanyService
      */
     public int deleteQwCompanyById(Long id);
 
-    List<QwOptionsVO> selectQwCompanyListOptionsVO();
+    List<QwOptionsVO> selectQwCompanyListOptionsVO(Long userId, Long deptId);
 
 
 }

+ 2 - 2
fs-service/src/main/java/com/fs/qw/service/impl/QwCompanyServiceImpl.java

@@ -129,7 +129,7 @@ public class QwCompanyServiceImpl implements IQwCompanyService
     }
 
     @Override
-    public List<QwOptionsVO> selectQwCompanyListOptionsVO() {
-        return qwCompanyMapper.selectQwCompanyListOptionsVO();
+    public List<QwOptionsVO> selectQwCompanyListOptionsVO(Long userId, Long deptId) {
+        return qwCompanyMapper.selectQwCompanyListOptionsVO(userId, deptId);
     }
 }

+ 1 - 3
fs-service/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java

@@ -64,8 +64,6 @@ import com.fs.system.service.ISysDictTypeService;
 import com.fs.voice.utils.StringUtil;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
-import lombok.extern.log4j.Log4j;
-import lombok.extern.log4j.Log4j2;
 import org.apache.rocketmq.spring.core.RocketMQTemplate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -4765,7 +4763,7 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
 
     @Override
     public void qwExternalContactSync() {
-        List<QwOptionsVO> qwOptionsVOS = qwCompanyMapper.selectQwCompanyListOptionsVO();
+        List<QwOptionsVO> qwOptionsVOS = qwCompanyMapper.selectQwCompanyListOptionsVO(null, null);
         ExecutorService executor = Executors.newFixedThreadPool(qwOptionsVOS.size());
 
         logger.info("开始同步");

+ 12 - 13
fs-service/src/main/java/com/fs/statis/service/impl/StatisticsCompanyServiceImpl.java

@@ -2,7 +2,6 @@ package com.fs.statis.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
 import com.fs.common.utils.TimeUtils;
@@ -84,7 +83,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
     private QwUserMapper qwUserMapper;
     @Override
     public void dataOverviewTask() {
-        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
+        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
         for (OptionsVO optionsVO : optionsVOS) {
             Long companyId = optionsVO.getDictValue();
             if(companyId == null){
@@ -108,7 +107,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
         redisCache.setCacheObject(String.format(StatisticsRedisConstant.DATA_OVERVIEW_TRAFFIC_LOG+":%d",companyId),trafficLog);
     }
     public void analysisPreviewTask0(){
-        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
+        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
         for (OptionsVO optionsVO : optionsVOS) {
             Long companyId = optionsVO.getDictValue();
             if (companyId == null) {
@@ -121,7 +120,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
     }
 
     public void analysisPreviewTask1(){
-        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
+        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
         for (OptionsVO optionsVO : optionsVOS) {
             Long companyId = optionsVO.getDictValue();
             if (companyId == null) {
@@ -201,7 +200,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
 
 
     public void watchEndPlayTrendTask0(){
-        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
+        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
         for (OptionsVO optionsVO : optionsVOS) {
             Long companyId = optionsVO.getDictValue();
             if(companyId == null){
@@ -214,7 +213,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
     }
 
     public void watchEndPlayTrendTask1(){
-        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
+        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
         for (OptionsVO optionsVO : optionsVOS) {
             Long companyId = optionsVO.getDictValue();
             if(companyId == null){
@@ -350,7 +349,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
     }
 
     public void companyWatchCourseTopTenTask0(){
-        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
+        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
         for (OptionsVO optionsVO : optionsVOS) {
             Long companyId = optionsVO.getDictValue();
             if (companyId == null) {
@@ -367,7 +366,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
     }
 
     public void companyWatchCourseTopTenTask1(){
-        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
+        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
         for (OptionsVO optionsVO : optionsVOS) {
             Long companyId = optionsVO.getDictValue();
             if (companyId == null) {
@@ -457,7 +456,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
 
 
     public void watchCourseTopTenTask0(){
-        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
+        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
         for (OptionsVO optionsVO : optionsVOS) {
             Long companyId = optionsVO.getDictValue();
             if (companyId == null) {
@@ -487,7 +486,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
     }
 
     public void watchCourseTopTenTask1(){
-        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
+        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
         for (OptionsVO optionsVO : optionsVOS) {
             Long companyId = optionsVO.getDictValue();
             if (companyId == null) {
@@ -712,7 +711,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
 
 
     public void rewardMoneyTask15Minutes(){
-        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
+        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
         for (OptionsVO optionsVO : optionsVOS) {
             Long companyId = optionsVO.getDictValue();
             if (companyId == null) {
@@ -733,7 +732,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
 
 
     public void rewardMoneyTaskEveryday(){
-        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
+        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
         for (OptionsVO optionsVO : optionsVOS) {
             Long companyId = optionsVO.getDictValue();
             if (companyId == null) {
@@ -1040,7 +1039,7 @@ public class StatisticsCompanyServiceImpl implements IStatisticsCompanyService {
     }
 
     public void companyThisMonthOrderCount(){
-        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList();
+        List<OptionsVO> optionsVOS = companyService.selectAllCompanyList(null);
         for (OptionsVO optionsVO : optionsVOS) {
             Long companyId = optionsVO.getDictValue();
             if (companyId == null) {

+ 6 - 0
fs-service/src/main/resources/mapper/company/CompanyMapper.xml

@@ -249,4 +249,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
     </select>
 
+    <select id="selectAllCompanyList" resultType="com.fs.his.vo.OptionsVO">
+        select company_id dictValue,company_name dictLabel from company where is_del= 0
+        <if test="deptId != null">
+            and dept_id = #{deptId}
+        </if>
+    </select>
 </mapper>

+ 6 - 0
fs-service/src/main/resources/mapper/course/FsCoursePlaySourceConfigMapper.xml

@@ -18,6 +18,12 @@
         <if test="params.companyId != null">
             and fcpsc.company_id = #{params.companyId}
         </if>
+        <if test="params.userId != null">
+            and fcpsc.create_user_id = #{params.userId}
+        </if>
+        <if test="params.deptId != null">
+            and fcpsc.create_dept_id = #{params.deptId}
+        </if>
         order by fcpsc.id desc
     </select>
 </mapper>

+ 18 - 0
fs-service/src/main/resources/mapper/qw/QwCompanyMapper.xml

@@ -56,6 +56,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyIds != null  and companyIds != ''"> and company_ids = #{companyIds}</if>
             <if test="status != null "> and status = #{status}</if>
             <if test="isBuy != null "> and isBuy = #{isBuy}</if>
+            <if test="createDeptId != null "> and create_dept_id = #{createDeptId}</if>
+            <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
         </where>
     </select>
 
@@ -95,6 +97,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isBuy != null">is_buy,</if>
             <if test="miniAppId != null">mini_app_id,</if>
             <if test="companyServerNum != null">company_server_num,</if>
+            <if test="createUserId != null != null">create_user_id,</if>
+            <if test="createDeptId != null">create_dept_id,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="corpId != null">#{corpId},</if>
@@ -119,6 +123,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isBuy != null">#{isBuy},</if>
             <if test="miniAppId != null">#{miniAppId},</if>
             <if test="companyServerNum != null">#{companyServerNum},</if>
+            <if test="createUserId != null">#{createUserId},</if>
+            <if test="createDeptId != null">#{createDeptId},</if>
          </trim>
     </insert>
 
@@ -161,4 +167,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <select id="selectQwCompanyListOptionsVO" resultType="com.fs.qw.vo.QwOptionsVO">
+        SELECT * from qw_company
+        <where>
+            <if test="userId != null">
+                and create_user_id = #{userId}
+            </if>
+            <if test="deptId != null">
+                and create_dept_id = #{deptId}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 1 - 18
fs-store/src/main/java/com/fs/hisStore/controller/store/CompanyController.java

@@ -1,32 +1,15 @@
 package com.fs.hisStore.controller.store;
 
-import com.fs.common.annotation.Log;
-import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
-import com.fs.common.core.domain.model.LoginUser;
 import com.fs.common.core.page.TableDataInfo;
-import com.fs.common.enums.BusinessType;
-import com.fs.common.utils.SecurityUtils;
-import com.fs.common.utils.ServletUtils;
-import com.fs.common.utils.StringUtils;
-import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.common.utils.sign.Md5Utils;
 import com.fs.company.domain.*;
-import com.fs.company.param.CompanyDeductParam;
 import com.fs.company.param.CompanyParam;
-import com.fs.company.param.CompanyRechargeParam;
-import com.fs.company.param.CompanyVoiceCallerParam;
 import com.fs.company.service.*;
-import com.fs.company.vo.CompanyCrmVO;
 import com.fs.company.vo.CompanyVO;
-import com.fs.company.vo.CompanyVoiceCallerListVO;
-import com.fs.core.utils.OrderCodeUtils;
 import com.fs.his.vo.OptionsVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -76,7 +59,7 @@ public class CompanyController extends BaseController
     @GetMapping("/allList")
     public TableDataInfo getHospital()
     {
-        List<OptionsVO> list = companyService.selectAllCompanyList();
+        List<OptionsVO> list = companyService.selectAllCompanyList(null);
         return getDataTable(list);
     }
 }