Browse Source

上传员工绩效表

lamphua 2 days ago
parent
commit
1612a5fc7f

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

2
 
2
 
3
 import java.util.List;
3
 import java.util.List;
4
 import javax.servlet.http.HttpServletResponse;
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
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.web.bind.annotation.GetMapping;
11
 import org.springframework.web.bind.annotation.GetMapping;
7
 import org.springframework.web.bind.annotation.PostMapping;
12
 import org.springframework.web.bind.annotation.PostMapping;
15
 import com.ruoyi.common.core.controller.BaseController;
20
 import com.ruoyi.common.core.controller.BaseController;
16
 import com.ruoyi.common.core.domain.AjaxResult;
21
 import com.ruoyi.common.core.domain.AjaxResult;
17
 import com.ruoyi.common.enums.BusinessType;
22
 import com.ruoyi.common.enums.BusinessType;
18
-import com.ruoyi.oa.domain.CmcPerformanceStaff;
19
 import com.ruoyi.oa.service.ICmcPerformanceStaffService;
23
 import com.ruoyi.oa.service.ICmcPerformanceStaffService;
20
 import com.ruoyi.common.utils.poi.ExcelUtil;
24
 import com.ruoyi.common.utils.poi.ExcelUtil;
21
 import com.ruoyi.common.core.page.TableDataInfo;
25
 import com.ruoyi.common.core.page.TableDataInfo;
26
+import org.springframework.web.multipart.MultipartFile;
22
 
27
 
23
 /**
28
 /**
24
  * cmc员工绩效Controller
29
  * cmc员工绩效Controller
33
     @Autowired
38
     @Autowired
34
     private ICmcPerformanceStaffService cmcPerformanceStaffService;
39
     private ICmcPerformanceStaffService cmcPerformanceStaffService;
35
 
40
 
41
+    @Autowired
42
+    private ISysUserService userService;
43
+
44
+    @Autowired
45
+    private ICmcProjectService projectService;
46
+
36
     /**
47
     /**
37
      * 查询cmc员工绩效列表
48
      * 查询cmc员工绩效列表
38
      */
49
      */
65
         return success(cmcPerformanceStaffService.selectCmcPerformanceStaffByPerformanceStaffId(performanceStaffId));
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
      * 新增cmc员工绩效
126
      * 新增cmc员工绩效
70
      */
127
      */

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

30
     private String projectName;
30
     private String projectName;
31
 
31
 
32
     /** 员工姓名 */
32
     /** 员工姓名 */
33
-    @Excel(name = "员工姓名")
33
+    @Excel(name = "姓名")
34
     private String nickName;
34
     private String nickName;
35
     private Long userId;
35
     private Long userId;
36
 
36
 
47
     private String scaleGrade;
47
     private String scaleGrade;
48
 
48
 
49
     /** 工作量 */
49
     /** 工作量 */
50
-    @Excel(name = "工作量")
50
+    @Excel(name = "工作量/工天")
51
     private Double workload;
51
     private Double workload;
52
 
52
 
53
     /** 单位 */
53
     /** 单位 */
54
     @Excel(name = "单位")
54
     @Excel(name = "单位")
55
     private String unit;
55
     private String unit;
56
 
56
 
57
+    /** 单价 */
58
+    @Excel(name = "单价")
59
+    private BigDecimal price;
60
+
57
     /** 系数 */
61
     /** 系数 */
58
     @Excel(name = "系数")
62
     @Excel(name = "系数")
59
     private Double coefficient;
63
     private Double coefficient;
64
 
68
 
65
     /** 月份 */
69
     /** 月份 */
66
     @JsonFormat(pattern = "yyyy-MM-dd")
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
     private Date performanceMonth;
72
     private Date performanceMonth;
69
 
73
 
74
+    /** 备注 */
75
+    @Excel(name = "备注")
76
+    private String remark;
77
+
70
     private SysUser user;
78
     private SysUser user;
71
 
79
 
72
     private CmcProject project;
80
     private CmcProject project;
89
     {
97
     {
90
         return projectId;
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
     public void setProject(CmcProject project)
109
     public void setProject(CmcProject project)
93
     {
110
     {
94
         this.project = project;
111
         this.project = project;
109
     {
126
     {
110
         return userId;
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
     public void setUser(SysUser user)
138
     public void setUser(SysUser user)
113
     {
139
     {
114
         this.user = user;
140
         this.user = user;
173
     {
199
     {
174
         return coefficient;
200
         return coefficient;
175
     }
201
     }
176
-    public void setPerformance(BigDecimal performance) 
202
+    public void setPerformance(BigDecimal performance)
177
     {
203
     {
178
         this.performance = performance;
204
         this.performance = performance;
179
     }
205
     }
180
 
206
 
181
-    public BigDecimal getPerformance() 
207
+    public BigDecimal getPerformance()
182
     {
208
     {
183
         return performance;
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
         this.performanceMonth = performanceMonth;
222
         this.performanceMonth = performanceMonth;
188
     }
223
     }
189
 
224
 
190
-    public Date getPerformacneMonth() 
225
+    public Date getPerformanceMonth() 
191
     {
226
     {
192
         return performanceMonth;
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
     @Override
239
     @Override
196
     public String toString() {
240
     public String toString() {
203
             .append("scaleGrade", getScaleGrade())
247
             .append("scaleGrade", getScaleGrade())
204
             .append("workload", getWorkload())
248
             .append("workload", getWorkload())
205
             .append("unit", getUnit())
249
             .append("unit", getUnit())
250
+            .append("price", getPrice())
206
             .append("coefficient", getCoefficient())
251
             .append("coefficient", getCoefficient())
207
             .append("performance", getPerformance())
252
             .append("performance", getPerformance())
208
-            .append("performanceMonth", getPerformacneMonth())
253
+            .append("performanceMonth", getPerformanceMonth())
209
             .append("remark", getRemark())
254
             .append("remark", getRemark())
210
             .toString();
255
             .toString();
211
     }
256
     }

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

51
      */
51
      */
52
     public SysUser selectUserByUserName(String userName);
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
      * 通过用户ID查询用户
63
      * 通过用户ID查询用户
56
      * 
64
      * 

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

50
      */
50
      */
51
     public SysUser selectUserByUserName(String userName);
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
      * 通过用户ID查询用户
62
      * 通过用户ID查询用户
55
      * 
63
      * 

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

125
         return userMapper.selectUserByUserName(userName);
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
      * 通过用户ID查询用户
141
      * 通过用户ID查询用户
130
      * 
142
      * 

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

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

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

234
 	    <include refid="selectUserVo"/>
234
 	    <include refid="selectUserVo"/>
235
 		where u.user_name = #{userName} and u.del_flag = '0'
235
 		where u.user_name = #{userName} and u.del_flag = '0'
236
 	</select>
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
 	<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
243
 	<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
239
 		<include refid="selectUserVo"/>
244
 		<include refid="selectUserVo"/>
240
 		where u.user_id = #{userId}
245
 		where u.user_id = #{userId}

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

8
   `scale_grade` varchar(20)DEFAULT NULL COMMENT '比例尺',
8
   `scale_grade` varchar(20)DEFAULT NULL COMMENT '比例尺',
9
   `workload` double NULL COMMENT '工作量',
9
   `workload` double NULL COMMENT '工作量',
10
   `unit` varchar(10)DEFAULT NULL COMMENT '单位',
10
   `unit` varchar(10)DEFAULT NULL COMMENT '单位',
11
+  `price` decimal(10, 2)NULL COMMENT '单价',
11
   `coefficient` double NULL COMMENT '系数',
12
   `coefficient` double NULL COMMENT '系数',
12
   `performance` decimal(10, 2)NULL COMMENT '绩效',
13
   `performance` decimal(10, 2)NULL COMMENT '绩效',
13
   `performance_month` date NULL COMMENT '月份',
14
   `performance_month` date NULL COMMENT '月份',
14
   `remark` varchar(255)DEFAULT NULL COMMENT '备注',
15
   `remark` varchar(255)DEFAULT NULL COMMENT '备注',
15
   PRIMARY KEY (`performance_staff_id`) USING BTREE
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 View File

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…
Cancel
Save