Sfoglia il codice sorgente

上传员工绩效表

lamphua 1 giorno fa
parent
commit
1612a5fc7f

+ 58
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcPerformanceStaffController.java Vedi File

@@ -2,6 +2,11 @@ package com.ruoyi.web.controller.oa;
2 2
 
3 3
 import java.util.List;
4 4
 import javax.servlet.http.HttpServletResponse;
5
+
6
+import com.ruoyi.oa.domain.CmcPerformanceStaff;
7
+import com.ruoyi.oa.domain.CmcProject;
8
+import com.ruoyi.oa.service.ICmcProjectService;
9
+import com.ruoyi.system.service.ISysUserService;
5 10
 import org.springframework.beans.factory.annotation.Autowired;
6 11
 import org.springframework.web.bind.annotation.GetMapping;
7 12
 import org.springframework.web.bind.annotation.PostMapping;
@@ -15,10 +20,10 @@ import com.ruoyi.common.annotation.Log;
15 20
 import com.ruoyi.common.core.controller.BaseController;
16 21
 import com.ruoyi.common.core.domain.AjaxResult;
17 22
 import com.ruoyi.common.enums.BusinessType;
18
-import com.ruoyi.oa.domain.CmcPerformanceStaff;
19 23
 import com.ruoyi.oa.service.ICmcPerformanceStaffService;
20 24
 import com.ruoyi.common.utils.poi.ExcelUtil;
21 25
 import com.ruoyi.common.core.page.TableDataInfo;
26
+import org.springframework.web.multipart.MultipartFile;
22 27
 
23 28
 /**
24 29
  * cmc员工绩效Controller
@@ -33,6 +38,12 @@ public class CmcPerformanceStaffController extends BaseController
33 38
     @Autowired
34 39
     private ICmcPerformanceStaffService cmcPerformanceStaffService;
35 40
 
41
+    @Autowired
42
+    private ISysUserService userService;
43
+
44
+    @Autowired
45
+    private ICmcProjectService projectService;
46
+
36 47
     /**
37 48
      * 查询cmc员工绩效列表
38 49
      */
@@ -65,6 +76,52 @@ public class CmcPerformanceStaffController extends BaseController
65 76
         return success(cmcPerformanceStaffService.selectCmcPerformanceStaffByPerformanceStaffId(performanceStaffId));
66 77
     }
67 78
 
79
+    /**
80
+     * 上传员工绩效excel文件
81
+     */
82
+    @PostMapping("/uploadSheet")
83
+    public AjaxResult uploadPerformanceStaffSheet(MultipartFile file) throws Exception {
84
+        if (file.isEmpty()) {
85
+            return AjaxResult.error("文件内容为空!");
86
+        }
87
+        else {
88
+            ExcelUtil<CmcPerformanceStaff> util = new ExcelUtil<CmcPerformanceStaff>(CmcPerformanceStaff.class);
89
+            List<CmcPerformanceStaff> performanceStaffList = util.importExcel(file.getInputStream());
90
+            for (CmcPerformanceStaff performanceStaff : performanceStaffList) {
91
+                performanceStaff.setUserId(userService.selectUserByNickName(performanceStaff.getNickName()).getUserId());
92
+                CmcProject cmcProject = new CmcProject();
93
+                cmcProject.setProjectNumber(performanceStaff.getProjectNumber());
94
+                if (performanceStaff.getProjectNumber() != null && !performanceStaff.getProjectNumber().equals("0"))
95
+                    if (projectService.selectCmcProjectByProjectNumbers(cmcProject).size() > 0)
96
+                        performanceStaff.setProjectId(projectService.selectCmcProjectByProjectNumbers(cmcProject).get(0).getProjectId());
97
+                else
98
+                    performanceStaff.setProjectId("0");
99
+                CmcPerformanceStaff staff = new CmcPerformanceStaff();
100
+                staff.setUserId(performanceStaff.getUserId());
101
+                staff.setProjectId(performanceStaff.getProjectId());
102
+                staff.setWorkType(performanceStaff.getWorkType());
103
+                staff.setContent(performanceStaff.getContent());
104
+                staff.setPerformanceMonth(performanceStaff.getPerformanceMonth());
105
+                List<CmcPerformanceStaff> staffList = cmcPerformanceStaffService.selectCmcPerformanceStaffList(staff);
106
+                if (staffList.size() > 0) {
107
+                    staff.setPerformanceStaffId(performanceStaffList.get(0).getPerformanceStaffId());
108
+                    staff.setContent(performanceStaff.getContent());
109
+                    staff.setPrice(performanceStaff.getPrice());
110
+                    staff.setPerformance(performanceStaff.getPerformance());
111
+                    staff.setCoefficient(performanceStaff.getCoefficient());
112
+                    staff.setScaleGrade(performanceStaff.getScaleGrade());
113
+                    staff.setUnit(performanceStaff.getUnit());
114
+                    staff.setWorkload(performanceStaff.getWorkload());
115
+                    staff.setRemark(performanceStaff.getRemark());
116
+                    cmcPerformanceStaffService.updateCmcPerformanceStaff(staff);
117
+                }
118
+                else
119
+                    cmcPerformanceStaffService.insertCmcPerformanceStaff(performanceStaff);
120
+            }
121
+            return AjaxResult.success("上传成功");
122
+        }
123
+    }
124
+
68 125
     /**
69 126
      * 新增cmc员工绩效
70 127
      */

+ 53
- 8
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcPerformanceStaff.java Vedi File

@@ -30,7 +30,7 @@ public class CmcPerformanceStaff extends BaseEntity
30 30
     private String projectName;
31 31
 
32 32
     /** 员工姓名 */
33
-    @Excel(name = "员工姓名")
33
+    @Excel(name = "姓名")
34 34
     private String nickName;
35 35
     private Long userId;
36 36
 
@@ -47,13 +47,17 @@ public class CmcPerformanceStaff extends BaseEntity
47 47
     private String scaleGrade;
48 48
 
49 49
     /** 工作量 */
50
-    @Excel(name = "工作量")
50
+    @Excel(name = "工作量/工天")
51 51
     private Double workload;
52 52
 
53 53
     /** 单位 */
54 54
     @Excel(name = "单位")
55 55
     private String unit;
56 56
 
57
+    /** 单价 */
58
+    @Excel(name = "单价")
59
+    private BigDecimal price;
60
+
57 61
     /** 系数 */
58 62
     @Excel(name = "系数")
59 63
     private Double coefficient;
@@ -64,9 +68,13 @@ public class CmcPerformanceStaff extends BaseEntity
64 68
 
65 69
     /** 月份 */
66 70
     @JsonFormat(pattern = "yyyy-MM-dd")
67
-    @Excel(name = "月份", width = 30, dateFormat = "yyyy-MM-dd")
71
+    @Excel(name = "统计月份", width = 30, dateFormat = "yyyy-MM-dd")
68 72
     private Date performanceMonth;
69 73
 
74
+    /** 备注 */
75
+    @Excel(name = "备注")
76
+    private String remark;
77
+
70 78
     private SysUser user;
71 79
 
72 80
     private CmcProject project;
@@ -89,6 +97,15 @@ public class CmcPerformanceStaff extends BaseEntity
89 97
     {
90 98
         return projectId;
91 99
     }
100
+    public void setProjectNumber(String projectNumber)
101
+    {
102
+        this.projectNumber = projectNumber;
103
+    }
104
+
105
+    public String getProjectNumber()
106
+    {
107
+        return projectNumber;
108
+    }
92 109
     public void setProject(CmcProject project)
93 110
     {
94 111
         this.project = project;
@@ -109,6 +126,15 @@ public class CmcPerformanceStaff extends BaseEntity
109 126
     {
110 127
         return userId;
111 128
     }
129
+    public void setNickName(String nickName)
130
+    {
131
+        this.nickName = nickName;
132
+    }
133
+
134
+    public String getNickName()
135
+    {
136
+        return nickName;
137
+    }
112 138
     public void setUser(SysUser user)
113 139
     {
114 140
         this.user = user;
@@ -173,24 +199,42 @@ public class CmcPerformanceStaff extends BaseEntity
173 199
     {
174 200
         return coefficient;
175 201
     }
176
-    public void setPerformance(BigDecimal performance) 
202
+    public void setPerformance(BigDecimal performance)
177 203
     {
178 204
         this.performance = performance;
179 205
     }
180 206
 
181
-    public BigDecimal getPerformance() 
207
+    public BigDecimal getPerformance()
182 208
     {
183 209
         return performance;
184 210
     }
185
-    public void setPerformacneMonth(Date performanceMonth) 
211
+    public void setPrice(BigDecimal price)
212
+    {
213
+        this.price = price;
214
+    }
215
+
216
+    public BigDecimal getPrice()
217
+    {
218
+        return price;
219
+    }
220
+    public void setPerformanceMonth(Date performanceMonth) 
186 221
     {
187 222
         this.performanceMonth = performanceMonth;
188 223
     }
189 224
 
190
-    public Date getPerformacneMonth() 
225
+    public Date getPerformanceMonth() 
191 226
     {
192 227
         return performanceMonth;
193 228
     }
229
+    public String getRemark()
230
+    {
231
+        return remark;
232
+    }
233
+
234
+    public void setRemark(String remark)
235
+    {
236
+        this.remark = remark;
237
+    }
194 238
 
195 239
     @Override
196 240
     public String toString() {
@@ -203,9 +247,10 @@ public class CmcPerformanceStaff extends BaseEntity
203 247
             .append("scaleGrade", getScaleGrade())
204 248
             .append("workload", getWorkload())
205 249
             .append("unit", getUnit())
250
+            .append("price", getPrice())
206 251
             .append("coefficient", getCoefficient())
207 252
             .append("performance", getPerformance())
208
-            .append("performanceMonth", getPerformacneMonth())
253
+            .append("performanceMonth", getPerformanceMonth())
209 254
             .append("remark", getRemark())
210 255
             .toString();
211 256
     }

+ 8
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java Vedi File

@@ -51,6 +51,14 @@ public interface SysUserMapper
51 51
      */
52 52
     public SysUser selectUserByUserName(String userName);
53 53
 
54
+    /**
55
+     * 通过姓名查询用户
56
+     *
57
+     * @param nickName 姓名
58
+     * @return 用户对象信息
59
+     */
60
+    public SysUser selectUserByNickName(String nickName);
61
+
54 62
     /**
55 63
      * 通过用户ID查询用户
56 64
      * 

+ 8
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java Vedi File

@@ -50,6 +50,14 @@ public interface ISysUserService
50 50
      */
51 51
     public SysUser selectUserByUserName(String userName);
52 52
 
53
+    /**
54
+     * 通过姓名查询用户
55
+     *
56
+     * @param nickName 姓名
57
+     * @return 用户对象信息
58
+     */
59
+    public SysUser selectUserByNickName(String nickName);
60
+
53 61
     /**
54 62
      * 通过用户ID查询用户
55 63
      * 

+ 12
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java Vedi File

@@ -125,6 +125,18 @@ public class SysUserServiceImpl implements ISysUserService
125 125
         return userMapper.selectUserByUserName(userName);
126 126
     }
127 127
 
128
+    /**
129
+     * 通过姓名查询用户
130
+     *
131
+     * @param nickName 姓名
132
+     * @return 用户对象信息
133
+     */
134
+    @Override
135
+    public SysUser selectUserByNickName(String nickName)
136
+    {
137
+        return userMapper.selectUserByNickName(nickName);
138
+    }
139
+
128 140
     /**
129 141
      * 通过用户ID查询用户
130 142
      * 

+ 8
- 1
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcPerformanceStaffMapper.xml Vedi File

@@ -7,12 +7,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
7 7
     <resultMap type="CmcPerformanceStaff" id="CmcPerformanceStaffResult">
8 8
         <result property="performanceStaffId"    column="performance_staff_id"    />
9 9
         <result property="projectId"    column="project_id"    />
10
+        <result property="projectNumber"    column="project_number"    />
10 11
         <result property="userId"    column="user_id"    />
12
+        <result property="nickName"    column="nick_name"    />
11 13
         <result property="workType"    column="work_type"    />
12 14
         <result property="content"    column="content"    />
13 15
         <result property="scaleGrade"    column="scale_grade"    />
14 16
         <result property="workload"    column="workload"    />
15 17
         <result property="unit"    column="unit"    />
18
+        <result property="price"    column="price"    />
16 19
         <result property="coefficient"    column="coefficient"    />
17 20
         <result property="performance"    column="performance"    />
18 21
         <result property="performanceMonth"    column="performance_month"    />
@@ -33,7 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
33 36
     </resultMap>
34 37
 
35 38
     <sql id="selectCmcPerformanceStaffVo">
36
-        select ps.performance_staff_id, ps.project_id, p.project_number, p.project_name, ps.user_id, u.nick_name, ps.work_type, ps.content, ps.scale_grade, ps.workload, ps.unit, ps.coefficient, ps.performance, ps.performance_month, ps.remark from cmc_performance_staff as ps
39
+        select ps.performance_staff_id, ps.project_id, p.project_number, p.project_name, ps.user_id, u.nick_name, ps.work_type, ps.content, ps.scale_grade, ps.workload, ps.unit, ps.price,
40
+               ps.coefficient, ps.performance, ps.performance_month, ps.remark from cmc_performance_staff as ps
37 41
         left join cmc_project as p on p.project_id = ps.project_id
38 42
         left join sys_user as u on u.user_id = ps.user_id
39 43
     </sql>
@@ -69,6 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
69 73
             <if test="scaleGrade != null">scale_grade,</if>
70 74
             <if test="workload != null">workload,</if>
71 75
             <if test="unit != null">unit,</if>
76
+            <if test="price != null">price,</if>
72 77
             <if test="coefficient != null">coefficient,</if>
73 78
             <if test="performance != null">performance,</if>
74 79
             <if test="performanceMonth != null">performance_month,</if>
@@ -82,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
82 87
             <if test="scaleGrade != null">#{scaleGrade},</if>
83 88
             <if test="workload != null">#{workload},</if>
84 89
             <if test="unit != null">#{unit},</if>
90
+            <if test="price != null">#{price},</if>
85 91
             <if test="coefficient != null">#{coefficient},</if>
86 92
             <if test="performance != null">#{performance},</if>
87 93
             <if test="performanceMonth != null">#{performanceMonth},</if>
@@ -99,6 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
99 105
             <if test="scaleGrade != null">scale_grade = #{scaleGrade},</if>
100 106
             <if test="workload != null">workload = #{workload},</if>
101 107
             <if test="unit != null">unit = #{unit},</if>
108
+            <if test="price != null">price = #{price},</if>
102 109
             <if test="coefficient != null">coefficient = #{coefficient},</if>
103 110
             <if test="performance != null">performance = #{performance},</if>
104 111
             <if test="performanceMonth != null">performance_month = #{performanceMonth},</if>

+ 6
- 1
oa-back/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml Vedi File

@@ -234,7 +234,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
234 234
 	    <include refid="selectUserVo"/>
235 235
 		where u.user_name = #{userName} and u.del_flag = '0'
236 236
 	</select>
237
-	
237
+
238
+	<select id="selectUserByNickName" parameterType="String" resultMap="SysUserResult">
239
+	    <include refid="selectUserVo"/>
240
+		where u.nick_name = #{nickName} and u.del_flag = '0'
241
+	</select>
242
+
238 243
 	<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
239 244
 		<include refid="selectUserVo"/>
240 245
 		where u.user_id = #{userId}

+ 2
- 1
oa-back/sql/sq.sql Vedi File

@@ -8,9 +8,10 @@ CREATE TABLE `cmc_performance_staff`  (
8 8
   `scale_grade` varchar(20)DEFAULT NULL COMMENT '比例尺',
9 9
   `workload` double NULL COMMENT '工作量',
10 10
   `unit` varchar(10)DEFAULT NULL COMMENT '单位',
11
+  `price` decimal(10, 2)NULL COMMENT '单价',
11 12
   `coefficient` double NULL COMMENT '系数',
12 13
   `performance` decimal(10, 2)NULL COMMENT '绩效',
13 14
   `performance_month` date NULL COMMENT '月份',
14 15
   `remark` varchar(255)DEFAULT NULL COMMENT '备注',
15 16
   PRIMARY KEY (`performance_staff_id`) USING BTREE
16
-) ENGINE = InnoDB comment 'cmc员工绩效表';
17
+) ENGINE = InnoDB comment 'cmc员工绩效表'; 

+ 44
- 0
oa-ui/src/api/oa/performance/performanceStaff.js Vedi File

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询cmc员工绩效列表
4
+export function listPerformanceStaff(query) {
5
+  return request({
6
+    url: '/oa/performanceStaff/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询cmc员工绩效详细
13
+export function getPerformanceStaff(performanceStaffId) {
14
+  return request({
15
+    url: '/oa/performanceStaff/' + performanceStaffId,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增cmc员工绩效
21
+export function addPerformanceStaff(data) {
22
+  return request({
23
+    url: '/oa/performanceStaff',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改cmc员工绩效
30
+export function updatePerformanceStaff(data) {
31
+  return request({
32
+    url: '/oa/performanceStaff',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除cmc员工绩效
39
+export function delPerformanceStaff(performanceStaffId) {
40
+  return request({
41
+    url: '/oa/performanceStaff/' + performanceStaffId,
42
+    method: 'delete'
43
+  })
44
+}

Loading…
Annulla
Salva