|  | @@ -9,6 +9,7 @@ import com.fs.common.core.page.TableDataInfo;
 | 
											
												
													
														|  |  import com.fs.common.enums.BusinessType;
 |  |  import com.fs.common.enums.BusinessType;
 | 
											
												
													
														|  |  import com.fs.common.utils.ServletUtils;
 |  |  import com.fs.common.utils.ServletUtils;
 | 
											
												
													
														|  |  import com.fs.common.utils.poi.ExcelUtil;
 |  |  import com.fs.common.utils.poi.ExcelUtil;
 | 
											
												
													
														|  | 
 |  | +import com.fs.company.service.impl.CompanyDeptServiceImpl;
 | 
											
												
													
														|  |  import com.fs.framework.security.LoginUser;
 |  |  import com.fs.framework.security.LoginUser;
 | 
											
												
													
														|  |  import com.fs.framework.service.TokenService;
 |  |  import com.fs.framework.service.TokenService;
 | 
											
												
													
														|  |  import com.fs.qw.vo.SortDayVo;
 |  |  import com.fs.qw.vo.SortDayVo;
 | 
											
										
											
												
													
														|  | @@ -41,6 +42,11 @@ public class QwSopTempController extends BaseController
 | 
											
												
													
														|  |      private IQwSopTempService qwSopTempService;
 |  |      private IQwSopTempService qwSopTempService;
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  |      private TokenService tokenService;
 |  |      private TokenService tokenService;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private CompanyDeptServiceImpl companyDeptService;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 查询sop模板列表
 |  |       * 查询sop模板列表
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
										
											
												
													
														|  | @@ -57,10 +63,59 @@ public class QwSopTempController extends BaseController
 | 
											
												
													
														|  |          return getDataTable(list);
 |  |          return getDataTable(list);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 查询我创建的sop模板列表
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:myList')")
 | 
											
												
													
														|  | 
 |  | +    @GetMapping("/myList")
 | 
											
												
													
														|  | 
 |  | +    public TableDataInfo myList(QwSopTemp qwSopTemp)
 | 
											
												
													
														|  | 
 |  | +    {
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
 | 
											
												
													
														|  | 
 |  | +        qwSopTemp.setCompanyId(loginUser.getCompany().getCompanyId());
 | 
											
												
													
														|  | 
 |  | +        qwSopTemp.setCreateBy(String.valueOf(loginUser.getUser().getUserId()));
 | 
											
												
													
														|  | 
 |  | +        startPage();
 | 
											
												
													
														|  | 
 |  | +//        List<QwSopTemp> list = qwSopTempService.selectQwSopTempList(qwSopTemp);
 | 
											
												
													
														|  | 
 |  | +        List<QwSopTemp> list = qwSopTempService.selectQwSopTempListNew(qwSopTemp);
 | 
											
												
													
														|  | 
 |  | +        return getDataTable(list);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 查询部门下的sop模板列表
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:deptList')")
 | 
											
												
													
														|  | 
 |  | +    @GetMapping("/deptList")
 | 
											
												
													
														|  | 
 |  | +    public TableDataInfo deptList(QwSopTemp qwSopTemp)
 | 
											
												
													
														|  | 
 |  | +    {
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
 | 
											
												
													
														|  | 
 |  | +        qwSopTemp.setCompanyId(loginUser.getCompany().getCompanyId());
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        List<Long> combinedDpetList = new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        //本部门
 | 
											
												
													
														|  | 
 |  | +        Long deptId = loginUser.getUser().getDeptId();
 | 
											
												
													
														|  | 
 |  | +        if (deptId!=null){
 | 
											
												
													
														|  | 
 |  | +            combinedDpetList.add(deptId);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        //本部门的下级部门
 | 
											
												
													
														|  | 
 |  | +        List<Long> deptList = companyDeptService.selectCompanyDeptByParentId(deptId);
 | 
											
												
													
														|  | 
 |  | +        if (!deptList.isEmpty()){
 | 
											
												
													
														|  | 
 |  | +            combinedDpetList.addAll(deptList);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        qwSopTemp.setCuDeptIdList(combinedDpetList);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        startPage();
 | 
											
												
													
														|  | 
 |  | +//        List<QwSopTemp> list = qwSopTempService.selectQwSopTempList(qwSopTemp);
 | 
											
												
													
														|  | 
 |  | +        List<QwSopTemp> list = qwSopTempService.selectQwSopTempListNew(qwSopTemp);
 | 
											
												
													
														|  | 
 |  | +        return getDataTable(list);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 导出sop模板列表
 |  |       * 导出sop模板列表
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  | -    @PreAuthorize("@ss.hasPermi('qw:sopTemp:export')")
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:export') or @ss.hasPermi('qw:sopTemp:myExport') or @ss.hasPermi('qw:sopTemp:deptExport')")
 | 
											
												
													
														|  |      @Log(title = "sop模板", businessType = BusinessType.EXPORT)
 |  |      @Log(title = "sop模板", businessType = BusinessType.EXPORT)
 | 
											
												
													
														|  |      @GetMapping("/export")
 |  |      @GetMapping("/export")
 | 
											
												
													
														|  |      public AjaxResult export(QwSopTemp qwSopTemp)
 |  |      public AjaxResult export(QwSopTemp qwSopTemp)
 | 
											
										
											
												
													
														|  | @@ -81,7 +136,7 @@ public class QwSopTempController extends BaseController
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 新增sop模板
 |  |       * 新增sop模板
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  | -    @PreAuthorize("@ss.hasPermi('qw:sopTemp:add')")
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:add') or @ss.hasPermi('qw:sopTemp:myAdd') or @ss.hasPermi('qw:sopTemp:deptAdd')")
 | 
											
												
													
														|  |      @Log(title = "sop模板", businessType = BusinessType.INSERT)
 |  |      @Log(title = "sop模板", businessType = BusinessType.INSERT)
 | 
											
												
													
														|  |      @PostMapping
 |  |      @PostMapping
 | 
											
												
													
														|  |      public AjaxResult add(@RequestBody QwSopTemp qwSopTemp){
 |  |      public AjaxResult add(@RequestBody QwSopTemp qwSopTemp){
 | 
											
										
											
												
													
														|  | @@ -94,7 +149,7 @@ public class QwSopTempController extends BaseController
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 修改sop模板
 |  |       * 修改sop模板
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  | -    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit')")
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit') or @ss.hasPermi('qw:sopTemp:myEdit') or @ss.hasPermi('qw:sopTemp:deptEdit')")
 | 
											
												
													
														|  |      @Log(title = "sop模板", businessType = BusinessType.UPDATE)
 |  |      @Log(title = "sop模板", businessType = BusinessType.UPDATE)
 | 
											
												
													
														|  |      @PutMapping
 |  |      @PutMapping
 | 
											
												
													
														|  |      public AjaxResult edit(@RequestBody QwSopTemp qwSopTemp)
 |  |      public AjaxResult edit(@RequestBody QwSopTemp qwSopTemp)
 | 
											
										
											
												
													
														|  | @@ -109,7 +164,7 @@ public class QwSopTempController extends BaseController
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 删除sop模板
 |  |       * 删除sop模板
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  | -    @PreAuthorize("@ss.hasPermi('qw:sopTemp:remove')")
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:remove') or @ss.hasPermi('qw:sopTemp:myRemove') or @ss.hasPermi('qw:sopTemp:deptRemove')")
 | 
											
												
													
														|  |      @Log(title = "sop模板", businessType = BusinessType.DELETE)
 |  |      @Log(title = "sop模板", businessType = BusinessType.DELETE)
 | 
											
												
													
														|  |  	@DeleteMapping("/{ids}")
 |  |  	@DeleteMapping("/{ids}")
 | 
											
												
													
														|  |      public AjaxResult remove(@PathVariable String[] ids)
 |  |      public AjaxResult remove(@PathVariable String[] ids)
 | 
											
										
											
												
													
														|  | @@ -120,7 +175,7 @@ public class QwSopTempController extends BaseController
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      /** 分享sop模板 */
 |  |      /** 分享sop模板 */
 | 
											
												
													
														|  | -    @PreAuthorize("@ss.hasPermi('qw:sopTemp:share')")
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:share') or @ss.hasPermi('qw:sopTemp:myShare') or @ss.hasPermi('qw:sopTemp:deptShare')")
 | 
											
												
													
														|  |      @Log(title = "分享sop模板", businessType = BusinessType.DELETE)
 |  |      @Log(title = "分享sop模板", businessType = BusinessType.DELETE)
 | 
											
												
													
														|  |      @PostMapping("/shareTemp")
 |  |      @PostMapping("/shareTemp")
 | 
											
												
													
														|  |      public AjaxResult shareTemp(@RequestBody QwSopShareTempParam param)
 |  |      public AjaxResult shareTemp(@RequestBody QwSopShareTempParam param)
 | 
											
										
											
												
													
														|  | @@ -130,7 +185,7 @@ public class QwSopTempController extends BaseController
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    @PreAuthorize("@ss.hasPermi('qw:sopTemp:add')")
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:add') or @ss.hasPermi('qw:sopTemp:myAdd') or @ss.hasPermi('qw:sopTemp:deptAdd')")
 | 
											
												
													
														|  |      @Log(title = "sop模板addNew", businessType = BusinessType.INSERT)
 |  |      @Log(title = "sop模板addNew", businessType = BusinessType.INSERT)
 | 
											
												
													
														|  |      @PostMapping("/add")
 |  |      @PostMapping("/add")
 | 
											
												
													
														|  |      public AjaxResult addNew(@RequestBody QwSopTemp qwSopTemp){
 |  |      public AjaxResult addNew(@RequestBody QwSopTemp qwSopTemp){
 | 
											
										
											
												
													
														|  | @@ -148,7 +203,7 @@ public class QwSopTempController extends BaseController
 | 
											
												
													
														|  |          return toAjax(i);
 |  |          return toAjax(i);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit')")
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit') or @ss.hasPermi('qw:sopTemp:myEdit') or @ss.hasPermi('qw:sopTemp:deptEdit')")
 | 
											
												
													
														|  |      @Log(title = "sop模板update", businessType = BusinessType.UPDATE)
 |  |      @Log(title = "sop模板update", businessType = BusinessType.UPDATE)
 | 
											
												
													
														|  |      @PostMapping("/update")
 |  |      @PostMapping("/update")
 | 
											
												
													
														|  |      public AjaxResult updateNew(@RequestBody QwSopTemp qwSopTemp){
 |  |      public AjaxResult updateNew(@RequestBody QwSopTemp qwSopTemp){
 | 
											
										
											
												
													
														|  | @@ -156,41 +211,42 @@ public class QwSopTempController extends BaseController
 | 
											
												
													
														|  |          return toAjax(update);
 |  |          return toAjax(update);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit')")
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit') or @ss.hasPermi('qw:sopTemp:myEdit') or @ss.hasPermi('qw:sopTemp:deptEdit')")
 | 
											
												
													
														|  |      @Log(title = "addOrUpdateSop模板规则", businessType = BusinessType.UPDATE)
 |  |      @Log(title = "addOrUpdateSop模板规则", businessType = BusinessType.UPDATE)
 | 
											
												
													
														|  |      @PostMapping("/addOrUpdateSetting")
 |  |      @PostMapping("/addOrUpdateSetting")
 | 
											
												
													
														|  |      public AjaxResult addOrUpdateSetting(@RequestBody QwSopTempDay day){
 |  |      public AjaxResult addOrUpdateSetting(@RequestBody QwSopTempDay day){
 | 
											
												
													
														|  |          return AjaxResult.success(qwSopTempService.addOrUpdateSetting(day));
 |  |          return AjaxResult.success(qwSopTempService.addOrUpdateSetting(day));
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit')")
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit') or @ss.hasPermi('qw:sopTemp:myEdit') or @ss.hasPermi('qw:sopTemp:deptEdit')")
 | 
											
												
													
														|  |      @Log(title = "sop模板规则delRules", businessType = BusinessType.DELETE)
 |  |      @Log(title = "sop模板规则delRules", businessType = BusinessType.DELETE)
 | 
											
												
													
														|  |      @GetMapping("/delRules")
 |  |      @GetMapping("/delRules")
 | 
											
												
													
														|  |      public AjaxResult delRules(Long id){
 |  |      public AjaxResult delRules(Long id){
 | 
											
												
													
														|  |          qwSopTempService.delRules(id);
 |  |          qwSopTempService.delRules(id);
 | 
											
												
													
														|  |          return toAjax(1);
 |  |          return toAjax(1);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | -    @PreAuthorize("@ss.hasPermi('qw:sopTemp:list')")
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:list') or @ss.hasPermi('qw:sopTemp:myList') or @ss.hasPermi('qw:sopTemp:deptList')")
 | 
											
												
													
														|  |      @GetMapping("/selectRulesInfo")
 |  |      @GetMapping("/selectRulesInfo")
 | 
											
												
													
														|  |      public AjaxResult selectRulesInfo(Long id){
 |  |      public AjaxResult selectRulesInfo(Long id){
 | 
											
												
													
														|  |          return AjaxResult.success(qwSopTempService.selectRulesInfo(id));
 |  |          return AjaxResult.success(qwSopTempService.selectRulesInfo(id));
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit')")
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit') or @ss.hasPermi('qw:sopTemp:myEdit') or @ss.hasPermi('qw:sopTemp:deptEdit')")
 | 
											
												
													
														|  |      @PostMapping("/copyTemplate")
 |  |      @PostMapping("/copyTemplate")
 | 
											
												
													
														|  |      public AjaxResult copyTemplate(@RequestBody QwSopTemp qwSopTemp){
 |  |      public AjaxResult copyTemplate(@RequestBody QwSopTemp qwSopTemp){
 | 
											
												
													
														|  |          qwSopTempService.copyTemplate(qwSopTemp);
 |  |          qwSopTempService.copyTemplate(qwSopTemp);
 | 
											
												
													
														|  |          return toAjax(1);
 |  |          return toAjax(1);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit')")
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit') or @ss.hasPermi('qw:sopTemp:myEdit') or @ss.hasPermi('qw:sopTemp:deptEdit')")
 | 
											
												
													
														|  |      @PostMapping("/sortDay")
 |  |      @PostMapping("/sortDay")
 | 
											
												
													
														|  |      public AjaxResult sortDay(@RequestBody List<SortDayVo> list){
 |  |      public AjaxResult sortDay(@RequestBody List<SortDayVo> list){
 | 
											
												
													
														|  |          qwSopTempService.sortDay(list);
 |  |          qwSopTempService.sortDay(list);
 | 
											
												
													
														|  |          return toAjax(1);
 |  |          return toAjax(1);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit')")
 |  | 
 | 
											
												
													
														|  | 
 |  | +    @PreAuthorize("@ss.hasPermi('qw:sopTemp:edit') or @ss.hasPermi('qw:sopTemp:myEdit') or @ss.hasPermi('qw:sopTemp:deptEdit')")
 | 
											
												
													
														|  |      @GetMapping("/dayList")
 |  |      @GetMapping("/dayList")
 | 
											
												
													
														|  |      public AjaxResult dayList(String id){
 |  |      public AjaxResult dayList(String id){
 | 
											
												
													
														|  |          return AjaxResult.success(qwSopTempService.dayList(id));
 |  |          return AjaxResult.success(qwSopTempService.dayList(id));
 |