Преглед на файлове

新增获取公司部门数据

anderx преди 4 месеца
родител
ревизия
fd4e18860b

+ 9 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ProjectTaskController.java

@@ -5,6 +5,7 @@ import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.project.domain.CompanyClockBo;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
@@ -23,6 +24,7 @@ import com.ruoyi.project.domain.ProjectTask;
 import com.ruoyi.project.service.ProjectStaffRecordService;
 import com.ruoyi.project.service.ProjectStaffService;
 import com.ruoyi.project.service.ProjectTaskService;
+import com.ruoyi.system.service.ISysDeptService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.http.HttpStatus;
@@ -52,6 +54,8 @@ public class ProjectTaskController extends BaseController {
     private ProjectStaffService projectStaffService;
     @Resource
     private ProjectStaffRecordService projectStaffRecordService;
+    @Resource
+    private ISysDeptService sysDeptService;
 
     /**
      * 新增项目任务
@@ -543,7 +547,9 @@ public class ProjectTaskController extends BaseController {
      * 获取公司打卡数据
      */
     @GetMapping("/getCompanyClock")
-    public TableDataInfo getCompanyClock(Integer deptId){
+    public TableDataInfo getCompanyClock(String usci){
+        SysDept sysDept = sysDeptService.selectByusci(usci);
+        Long deptId = sysDept.getDeptId();
         startPage();
         List<CompanyClockBo> companyClock = projectStaffRecordService.getCompanyClock(deptId);
         return getDataTable(companyClock);
@@ -553,8 +559,8 @@ public class ProjectTaskController extends BaseController {
      * 获取公司部门,项目,人员信息
      */
     @GetMapping("/getCompanyData")
-    public AjaxResult getCompanyData(Integer deptId){
+    public AjaxResult getCompanyData(String usci){
 
-        return AjaxResult.success(projectTaskService.getCompanyData(deptId));
+        return AjaxResult.success(projectTaskService.getCompanyData(usci));
     }
 }

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/project/service/ProjectStaffRecordService.java

@@ -57,6 +57,6 @@ public interface ProjectStaffRecordService {
 
     Object getNewMonthClock(Integer id, String yearMonth, String duration);
 
-    List<CompanyClockBo> getCompanyClock(Integer deptId);
+    List<CompanyClockBo> getCompanyClock(Long deptId);
 
 }

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/project/service/ProjectTaskService.java

@@ -31,5 +31,5 @@ public interface ProjectTaskService {
 
     void saveText(String content) ;
 
-    Object getCompanyData(Integer deptId);
+    Object getCompanyData(String usci);
 }

+ 2 - 2
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectStaffRecordServiceImpl.java

@@ -1183,8 +1183,8 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
     }
 
     @Override
-    public List<CompanyClockBo>  getCompanyClock(Integer deptId) {
-        return projectStaffRecordMapper.getCompanyClock(deptId);
+    public List<CompanyClockBo>  getCompanyClock(Long deptId) {
+        return projectStaffRecordMapper.getCompanyClock(Math.toIntExact(deptId));
     }
 
 

+ 3 - 2
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectTaskServiceImpl.java

@@ -558,10 +558,11 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
 
 
     @Override
-    public Object getCompanyData(Integer deptId) {
+    public Object getCompanyData(String usci) {
         //获取部门信息
         SysDept sysDept = new SysDept();
-        sysDept.setAncestors(deptId.toString());
+        SysDept sysDept2 = sysDeptMapper.selectByusci(usci);
+        sysDept.setAncestors(sysDept2.getDeptId().toString());
         List<SysDept> sysDepts = sysDeptMapper.selectDeptList(sysDept);
         sysDepts.stream().forEach(System.out::println);
         //获取部门下的用户信息

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java

@@ -121,4 +121,6 @@ public interface SysDeptMapper
     SysDept selectByDepName(@Param("deptName") String deptName, @Param("companyId") Long companyId);
 
     SysDept selectDeptByPid(Long id);
+
+    SysDept selectByusci(String usci);
 }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java

@@ -131,4 +131,6 @@ public interface ISysDeptService
     SysDept selectByDepName(String deptName, Long company);
 
     SysDept selectDeptByPid(Long id);
+
+    SysDept selectByusci(String usci);
 }

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java

@@ -358,6 +358,11 @@ public class SysDeptServiceImpl implements ISysDeptService
         return deptMapper.selectDeptByPid(id);
     }
 
+    @Override
+    public SysDept selectByusci(String usci) {
+        return deptMapper.selectByusci(usci);
+    }
+
 
     /**
      * 递归列表

+ 6 - 1
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -80,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
 		select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.max_duration,
 		       d.company_id,(select dept_name from sys_dept where dept_id = d.company_id) companyName,d.company_logo,d.company_full_name,
-		       d.ky_id,
+		       d.ky_id,d.usci,
 			(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
 		from sys_dept d
 		where d.dept_id = #{deptId}
@@ -220,4 +220,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 							left join sys_dept c on b.dept_id =c.dept_id
 		where a.id= #{id}
 	</select>
+	<select id="selectByusci" resultMap="SysDeptResult">
+	<include refid="selectDeptVo"/>
+	where d.del_flag = '0'
+	and d.usci = #{usci}
+	</select>
 </mapper>