ソースを参照

研发打卡修改

anderx 2 年 前
コミット
b659ab4032

+ 18 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java

@@ -123,6 +123,24 @@ public class SysUser extends BaseEntity
     private Long companyId;
     private Long postId;
     private Double duration;
+    private String postName;
+    private String superiorName;
+
+    public String getSuperiorName() {
+        return superiorName;
+    }
+
+    public void setSuperiorName(String superiorName) {
+        this.superiorName = superiorName;
+    }
+
+    public String getPostName() {
+        return postName;
+    }
+
+    public void setPostName(String postName) {
+        this.postName = postName;
+    }
 
     public Double getDuration() {
         return duration;

+ 8 - 1
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectStaffServiceImpl.java

@@ -6,6 +6,7 @@ import com.ruoyi.project.mapper.ProjectStaffMapper;
 import com.ruoyi.project.mapper.ProjectStaffRecordMapper;
 import com.ruoyi.project.mapper.ProjectTaskMapper;
 import com.ruoyi.project.service.ProjectStaffService;
+import com.ruoyi.system.mapper.SysUserMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -17,9 +18,14 @@ public class ProjectStaffServiceImpl implements ProjectStaffService {
     private ProjectTaskMapper projectTaskMapper;
     @Autowired
     private ProjectStaffRecordMapper projectStaffRecordMapper;
+    @Autowired
+    private SysUserMapper userMapper;
+
+
     @Override
     public AjaxResult addStaff(ProjectStaff in) {
-        int i = projectStaffMapper.insertSelective(in);
+        projectStaffMapper.insertSelective(in);
+        userMapper.updateUserProjectSum(in.getAid(),0);
         projectTaskMapper.updateStaffName(in.getPid());
         return AjaxResult.success();
     }
@@ -30,6 +36,7 @@ public class ProjectStaffServiceImpl implements ProjectStaffService {
         if (sum > 0) {
             return AjaxResult.error("已存在打卡,请不要删除人员.");
         }
+        userMapper.updateUserProjectSum(in.getAid(),1);
         int i = projectStaffMapper.deleteByPrimaryKey(in.getId());
         if (i>0){
             projectTaskMapper.updateStaffName(in.getPid());

+ 6 - 1
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectTaskServiceImpl.java

@@ -16,6 +16,7 @@ import com.ruoyi.project.domain.ProjectTask;
 import com.ruoyi.project.mapper.ProjectStaffMapper;
 import com.ruoyi.project.mapper.ProjectTaskMapper;
 import com.ruoyi.project.service.ProjectTaskService;
+import com.ruoyi.system.mapper.SysUserMapper;
 import com.ruoyi.system.service.ISysDeptService;
 import com.ruoyi.system.service.impl.SysUserServiceImpl;
 import org.slf4j.Logger;
@@ -38,16 +39,20 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
     @Autowired
     private ISysDeptService deptService;
     @Autowired
-    protected Validator validator;
+    private Validator validator;
+    @Autowired
+    private SysUserMapper userMapper;
 
     @Override
     public AjaxResult addProjectTask(ProjectTask projectTask) {
+        userMapper.updateUserProjectSum(projectTask.getAid(),0);
         return AjaxResult.success(projectTaskMapper.insertSelective(projectTask));
     }
 
     @Override
     public AjaxResult deleteProject(ProjectTask in) {
         int i = projectTaskMapper.deleteByPrimaryKey(in.getId());
+        userMapper.updateUserProjectSum(in.getAid(),0);
         if (i>0){
             projectStaffMapper.deleteBypid(in.getId());
             return AjaxResult.success();

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

@@ -132,4 +132,6 @@ public interface SysUserMapper
 
 
     SysUser selectSuperUserByUid(Long aid);
+
+    void updateUserProjectSum(@Param("aid") Long aid, @Param("type") Integer type);
 }

+ 16 - 1
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -29,6 +29,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="jobNumber"       column="job_number"       />
         <result property="fullJob"       column="full_job"       />
 		<result property="postId"       column="post_id"       />
+		<result property="duration"       column="duration"       />
+		<result property="postName"       column="post_name"       />
+		<result property="superiorName"       column="superiorName"       />
         <association property="dept"    javaType="SysDept"         resultMap="deptResult" />
         <collection  property="roles"   javaType="java.util.List"  resultMap="RoleResult" />
     </resultMap>
@@ -67,10 +70,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectUserList" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserResult">
 		select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, 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,u.open_id,u.superior_id,
-		       u.project_quantity,u.job_number,u.full_job,sup.post_id
+		       u.project_quantity,u.job_number,u.full_job,sup.post_id,u.duration,sp.post_name,su.nick_name superiorName
 		from sys_user u
 		left join sys_dept d on u.dept_id = d.dept_id
 		left join sys_user_post sup on u.user_id = sup.user_id
+		left join sys_post sp on sup.post_id=sp.post_id
+		left join sys_user su on u.superior_id =su.user_id
 		where u.del_flag = '0'
 		<if test="userId != null and userId != 0">
 			AND u.user_id = #{userId}
@@ -291,4 +296,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		update sys_user set duration = duration+#{duration}
 		where user_id = #{userId}
 	</update>
+	<update id="updateUserProjectSum">
+		update sys_user set
+		<if test="type==0">
+			project_quantity = project_quantity+1
+		</if>
+		<if test="type==1">
+			project_quantity = project_quantity-1
+		</if>
+		where user_id = #{userId}
+	</update>
 </mapper>

+ 29 - 13
ruoyi-ui/src/views/system/user/index.vue

@@ -139,11 +139,16 @@
         <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
           <el-table-column type="selection" width="50" align="center" />
           <el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
-          <el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
-          <el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
+          <el-table-column label="工号" align="center" key="jobNumber" prop="jobNumber" v-if="columns[1].visible" />
+          <el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
+          <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
+          <el-table-column label="职位" align="center" key="postName" prop="postName" v-if="columns[4].visible" :show-overflow-tooltip="true" />
+          <el-table-column label="全职/兼职" align="center" key="fullJob" prop="fullJob" v-if="columns[5].visible" :show-overflow-tooltip="true" />
+          <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[6].visible" :show-overflow-tooltip="true" />
+          <el-table-column label="参与项目数" align="center" key="projectQuantity" prop="projectQuantity" v-if="columns[7].visible" :show-overflow-tooltip="true" />
+          <el-table-column label="上级负责人" align="center" key="superiorName" prop="superiorName" v-if="columns[8].visible" :show-overflow-tooltip="true" />
+          <el-table-column label="累计工时" align="center" key="duration" prop="duration" v-if="columns[9].visible" :show-overflow-tooltip="true" />
+          <el-table-column label="状态" align="center" key="status" v-if="columns[10].visible">
             <template slot-scope="scope">
               <el-switch
                 v-model="scope.row.status"
@@ -153,11 +158,16 @@
               ></el-switch>
             </template>
           </el-table-column>
-          <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
+          <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[11].visible" width="100">
             <template slot-scope="scope">
               <span>{{ parseTime(scope.row.createTime) }}</span>
             </template>
           </el-table-column>
+          <el-table-column label="最后登录时间" align="center"  prop="loginDate" v-if="columns[12].visible" width="100" >
+            <template slot-scope="scope">
+              <span>{{ parseTime(scope.row.loginDate) }}</span>
+            </template>
+          </el-table-column>
           <el-table-column
             label="操作"
             align="center"
@@ -414,13 +424,19 @@ export default {
       },
       // 列信息
       columns: [
-        { key: 0, label: `用户编号`, visible: true },
-        { key: 1, label: `用户名称`, visible: true },
-        { key: 2, label: `用户昵称`, visible: true },
-        { key: 3, label: `部门`, visible: true },
-        { key: 4, label: `手机号码`, visible: true },
-        { key: 5, label: `状态`, visible: true },
-        { key: 6, label: `创建时间`, visible: true }
+        { key: 0, label: `用户编号`, visible: false },
+        { key: 1, label: `工号`, visible: true },
+        { key: 2, label: `用户名称`, visible: true },
+        { key: 3, label: `用户昵称`, visible: true },
+        { key: 4, label: `职位`, visible: true },
+        { key: 5, label: `全职/兼职`, visible: true },
+        { key: 6, label: `部门`, visible: true },
+        { key: 7, label: `参与项目`, visible: true },
+        { key: 8, label: `上级负责人`, visible: true },
+        { key: 9, label: `累计工时`, visible: true },
+        { key: 10, label: `状态`, visible: true },
+        { key: 11, label: `创建时间`, visible: true },
+        { key: 12, label: `最后登录时间`, visible: true }
       ],
       // 表单校验
       rules: {