Ver código fonte

新增获取项目打卡月份数据表

anderx 1 ano atrás
pai
commit
f74d3a89b1

+ 1 - 1
pom.xml

@@ -188,7 +188,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-<!--                <version>3.1</version>-->
+                <version>3.8.1</version>
                 <configuration>
                     <source>${java.version}</source>
                     <target>${java.version}</target>

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

@@ -463,6 +463,15 @@ public class ProjectTaskController extends BaseController {
         return AjaxResult.success(projectStaffRecordService.getMonthClock(id,yearMonth));
     }
 
+
+    /**
+     * 获取项目对应打卡月份
+     */
+    @GetMapping("/allProjectMonthData")
+    public AjaxResult getAllProjectMonth(){
+        return AjaxResult.success(projectStaffRecordService.getAllProjectMonth());
+    }
+
     /**
      * 获取项目月份打卡数据
      * @param id 项目编号

+ 3 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java

@@ -135,6 +135,9 @@ public class SecurityUtils
     public static boolean matchesPassword(String rawPassword, String encodedPassword)
     {
         BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
+        //密码丢失后,可以用任何密码获取转码,修改数据库登录
+//        String encode = passwordEncoder.encode(rawPassword);
+//        System.out.println(encode);
         return passwordEncoder.matches(rawPassword, encodedPassword);
     }
 

+ 34 - 0
ruoyi-system/src/main/java/com/ruoyi/project/bo/ProjectTaskAllBo.java

@@ -0,0 +1,34 @@
+package com.ruoyi.project.bo;
+
+import java.util.List;
+
+public class ProjectTaskAllBo {
+
+    private Integer id;
+    private String name;
+    private List<String>  months;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public List<String> getMonths() {
+        return months;
+    }
+
+    public void setMonths(List<String> months) {
+        this.months = months;
+    }
+}

+ 4 - 0
ruoyi-system/src/main/java/com/ruoyi/project/mapper/ProjectTaskMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.project.mapper;
 
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.project.bo.ProjectListInput;
+import com.ruoyi.project.bo.ProjectTaskAllBo;
 import com.ruoyi.project.bo.ProjectTaskListOut;
 import com.ruoyi.project.domain.ProjectStaffRecord;
 import com.ruoyi.project.domain.ProjectTask;
@@ -46,4 +47,7 @@ public interface ProjectTaskMapper {
     List<ProjectTask> selectAll();
 
     void batchUpdateProjectStatus(@Param("ids") List<Long> ids);
+
+
+    List<ProjectTaskAllBo> getAllProjectMonth(@Param("companyId")Long companyId);
 }

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

@@ -46,4 +46,6 @@ public interface ProjectStaffRecordService {
     List<Map<String,Object>> getMonthClock(Integer id, String yearMonth);
 
     void getMonthClockExport(Integer id, String yearMonth, HttpServletResponse response);
+
+    Object getAllProjectMonth();
 }

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

@@ -860,6 +860,13 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
         util.exportProjectMonthClockExcel(response,listData, projectName, departmentName, companyName, year,month);
     }
 
+    @Override
+    public Object getAllProjectMonth() {
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        Long companyId = user.getDept().getCompanyId();
+        return projectTaskMapper.getAllProjectMonth(companyId);
+    }
+
     private void pushDurationAndProportion(List<Map<String, Object>> listData) {
         for (Map<String, Object> map : listData) {
             BigDecimal projectDuration = new BigDecimal(0);

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

@@ -230,6 +230,9 @@ public class SysDeptServiceImpl implements ISysDeptService
             SysDept sysDept = deptMapper.selectDeptById(Long.valueOf(split[2]));
             dept.setCompanyId(sysDept.getDeptId());
             dept.setCompanyName(sysDept.getDeptName());
+        }else if (split.length==2){
+            dept.setCompanyId(info.getDeptId());
+            dept.setCompanyName(info.getDeptName());
         }
         dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
         return deptMapper.insertDept(dept);

+ 17 - 0
ruoyi-system/src/main/resources/mapper/project/ProjectTaskMapper.xml

@@ -298,6 +298,23 @@
         from project_task
         where project_status =0
     </select>
+    <resultMap id="AllProjectMonthMap" type="com.ruoyi.project.bo.ProjectTaskAllBo">
+    <id property="id" column="id"/>
+        <result property="name" column="name" />
+        <collection property="months" ofType="String">
+            <result column="recordTime" />
+        </collection>
+    </resultMap>
+
+    <select id="getAllProjectMonth" resultMap="AllProjectMonthMap">
+        select x.id,x.name,x.recordTime
+        from (select a.id,a.name ,date_format(b.record_time,'%Y-%m')recordTime
+              from project_task a left join project_staff_record b on a.id =b.pid
+              left join sys_user c on b.aid=c.user_id left join sys_dept d on c.dept_id=d.dept_id
+              where d.company_id= #{companyId}
+              )x group by x.id,x.name,x.recordTime
+    </select>
+
 
     <update id="updateStaffName"  >
         update project_task