浏览代码

查询考核表用户信息

lamphua 1年前
父节点
当前提交
916b5f9579

+ 37
- 5
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcAssessController.java 查看文件

1
 package com.ruoyi.web.controller.oa;
1
 package com.ruoyi.web.controller.oa;
2
 
2
 
3
+import java.util.ArrayList;
3
 import java.util.List;
4
 import java.util.List;
4
 import java.util.Objects;
5
 import java.util.Objects;
5
 import javax.servlet.http.HttpServletResponse;
6
 import javax.servlet.http.HttpServletResponse;
6
 
7
 
7
 import com.alibaba.fastjson2.JSONArray;
8
 import com.alibaba.fastjson2.JSONArray;
8
 import com.alibaba.fastjson2.JSONObject;
9
 import com.alibaba.fastjson2.JSONObject;
10
+import com.ruoyi.common.core.domain.entity.SysDictData;
9
 import com.ruoyi.common.utils.DateUtils;
11
 import com.ruoyi.common.utils.DateUtils;
10
 import com.ruoyi.oa.domain.CmcAssessContent;
12
 import com.ruoyi.oa.domain.CmcAssessContent;
11
 import com.ruoyi.oa.domain.CmcAssessContentWork;
13
 import com.ruoyi.oa.domain.CmcAssessContentWork;
13
 import com.ruoyi.oa.service.ICmcAssessContentWorkService;
15
 import com.ruoyi.oa.service.ICmcAssessContentWorkService;
14
 import com.ruoyi.oa.service.ICmcProjectService;
16
 import com.ruoyi.oa.service.ICmcProjectService;
15
 import com.ruoyi.system.service.ISysDeptService;
17
 import com.ruoyi.system.service.ISysDeptService;
18
+import com.ruoyi.system.service.ISysDictDataService;
16
 import com.ruoyi.system.service.ISysUserService;
19
 import com.ruoyi.system.service.ISysUserService;
17
 import org.springframework.beans.factory.annotation.Autowired;
20
 import org.springframework.beans.factory.annotation.Autowired;
18
 import org.springframework.web.bind.annotation.*;
21
 import org.springframework.web.bind.annotation.*;
47
     private ISysDeptService deptService;
50
     private ISysDeptService deptService;
48
     @Autowired
51
     @Autowired
49
     private ICmcProjectService cmcProjectService;
52
     private ICmcProjectService cmcProjectService;
53
+    @Autowired
54
+    private ISysDictDataService dictDataService;
50
 
55
 
51
     /**
56
     /**
52
      * 查询考核表列表
57
      * 查询考核表列表
91
         }
96
         }
92
         formData.put("deptName", deptService.selectDeptById(userService.selectUserById(userId).getDeptId()).getDeptName());
97
         formData.put("deptName", deptService.selectDeptById(userService.selectUserById(userId).getDeptId()).getDeptName());
93
         formData.put("postGroup", userService.selectUserPostGroup(userService.selectUserById(userId).getUserName()));
98
         formData.put("postGroup", userService.selectUserPostGroup(userService.selectUserById(userId).getUserName()));
94
-        formData.put("pmlevel", userService.selectUserById(userId).getPmLevel());
95
-        formData.put("titles", userService.selectUserById(userId).getTitles());
99
+        formData.put("pmLevel", dictDataService.selectDictLabel("sys_user_pmlevel", userService.selectUserById(userId).getPmLevel()));
100
+        String[] titles = userService.selectUserById(userId).getTitles().split(",");
101
+        List<String> titleList = new ArrayList<>();
102
+        for (String title : titles)
103
+            titleList.add(dictDataService.selectDictLabel("sys_user_titles", title));
104
+        formData.put("titles", String.join(",", titleList));
96
         formData.put("remark", userService.selectUserById(userId).getRemark());
105
         formData.put("remark", userService.selectUserById(userId).getRemark());
97
         formData.put("entryDate", userService.selectUserById(userId).getEntryDate());
106
         formData.put("entryDate", userService.selectUserById(userId).getEntryDate());
98
         formData.put("age", userService.selectUserById(userId).getAge());
107
         formData.put("age", userService.selectUserById(userId).getAge());
220
         cmcAssess.setManagerAssessment(formDataJson.getString("managerAssessment"));
229
         cmcAssess.setManagerAssessment(formDataJson.getString("managerAssessment"));
221
         cmcAssess.setManagerAdvice(formDataJson.getString("managerAdvice"));
230
         cmcAssess.setManagerAdvice(formDataJson.getString("managerAdvice"));
222
         cmcAssess.setManagerTime(formDataJson.getDate("managerTime"));
231
         cmcAssess.setManagerTime(formDataJson.getDate("managerTime"));
232
+        //判断是否删除某项考核工作
233
+        List<CmcAssessContentWork> cmcAssessContentWorks = cmcAssessContentWorkService.selectCmcAssessContentWorkByWorkId(formDataJson.getString("assessId"));
234
+        List<String> oldCmcAssessContentWorkIds = new ArrayList<>();
235
+        List<String> newCmcAssessContentWorkIds = new ArrayList<>();
236
+        for (CmcAssessContentWork cmcAssessContentWork : cmcAssessContentWorks) {
237
+            oldCmcAssessContentWorkIds.add(cmcAssessContentWork.getWorkId());
238
+        }
239
+        for (String key : formDataJson.keySet()) {
240
+            if (key.length() == 5 && key.startsWith("f") && !formDataJson.get(key).equals(""))
241
+                newCmcAssessContentWorkIds.add(key.substring(1));
242
+        }
243
+        for (String id : oldCmcAssessContentWorkIds) {
244
+            if (!newCmcAssessContentWorkIds.contains(id.substring(19)))
245
+                cmcAssessContentWorkService.deleteCmcAssessContentWorkByWorkId(id);
246
+        }
223
         for (String key : formDataJson.keySet()) {
247
         for (String key : formDataJson.keySet()) {
224
             if (key.startsWith("role") && !Objects.equals(formDataJson.get(key), new JSONArray())) {
248
             if (key.startsWith("role") && !Objects.equals(formDataJson.get(key), new JSONArray())) {
225
                 CmcAssessContent cmcAssessContent = cmcAssessContentService.selectCmcAssessContentByContentId(formDataJson.getString("assessId") + key.substring(4)).get(0);
249
                 CmcAssessContent cmcAssessContent = cmcAssessContentService.selectCmcAssessContentByContentId(formDataJson.getString("assessId") + key.substring(4)).get(0);
236
                 cmcAssessContentService.updateCmcAssessContent(cmcAssessContent);
260
                 cmcAssessContentService.updateCmcAssessContent(cmcAssessContent);
237
             }
261
             }
238
             if (key.length() == 5 && key.startsWith("f") && !formDataJson.get(key).equals("")) {
262
             if (key.length() == 5 && key.startsWith("f") && !formDataJson.get(key).equals("")) {
239
-                CmcAssessContentWork cmcAssessContentWork = cmcAssessContentWorkService.selectCmcAssessContentWorkByWorkId(formDataJson.getString("assessId") + key.substring(1)).get(0);
240
-                cmcAssessContentWork.setWorkLoad(formDataJson.getString(key));
241
-                cmcAssessContentWorkService.updateCmcAssessContentWork(cmcAssessContentWork);
263
+                List<CmcAssessContentWork> cmcAssessContentWorkList = cmcAssessContentWorkService.selectCmcAssessContentWorkByWorkId(formDataJson.getString("assessId") + key.substring(1));
264
+                if (cmcAssessContentWorkList.size() > 0) { //某项考核工作更改工作量
265
+                    cmcAssessContentWorkList.get(0).setWorkLoad(formDataJson.getString(key));
266
+                    cmcAssessContentWorkService.updateCmcAssessContentWork(cmcAssessContentWorkList.get(0));
267
+                }
268
+                else { //新增一项考核工作
269
+                    CmcAssessContentWork cmcAssessContentWork = new CmcAssessContentWork();
270
+                    cmcAssessContentWork.setWorkId(formDataJson.getString("assessId") + key.substring(1));
271
+                    cmcAssessContentWork.setWorkLoad(formDataJson.getString(key));
272
+                    cmcAssessContentWorkService.insertCmcAssessContentWork(cmcAssessContentWork);
273
+                }
242
             }
274
             }
243
             if (key.startsWith("familiar")) {
275
             if (key.startsWith("familiar")) {
244
                 CmcAssessContent cmcAssessContent = cmcAssessContentService.selectCmcAssessContentByContentId(formDataJson.getString("assessId") + key.substring(8)).get(0);
276
                 CmcAssessContent cmcAssessContent = cmcAssessContentService.selectCmcAssessContentByContentId(formDataJson.getString("assessId") + key.substring(8)).get(0);

+ 3
- 6
oa-back/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java 查看文件

88
 
88
 
89
     /** 年龄 */
89
     /** 年龄 */
90
     @Excel(name = "年龄")
90
     @Excel(name = "年龄")
91
-    private int age;
91
+    private Integer age;
92
 
92
 
93
     /** 部门对象 */
93
     /** 部门对象 */
94
     @Excels({
94
     @Excels({
307
         this.entryDate = entryDate;
307
         this.entryDate = entryDate;
308
     }
308
     }
309
 
309
 
310
-    public int getAge()
310
+    public Integer getAge()
311
     {
311
     {
312
         return age;
312
         return age;
313
     }
313
     }
314
 
314
 
315
-    public void setAge(int roleId)
316
-    {
317
-        this.age = age;
318
-    }
315
+    public void setAge(Integer age) { this.age = age; }
319
 
316
 
320
     public SysDept getDept()
317
     public SysDept getDept()
321
     {
318
     {

+ 3
- 3
oa-back/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml 查看文件

206
  			<if test="loginDate != null">login_date = #{loginDate},</if>
206
  			<if test="loginDate != null">login_date = #{loginDate},</if>
207
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
207
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
208
  			<if test="remark != null">remark = #{remark},</if>
208
  			<if test="remark != null">remark = #{remark},</if>
209
- 			<if test="pmLevel != null">pmLevel = #{pmLevel},</if>
209
+ 			<if test="pmLevel != null">pm_level = #{pmLevel},</if>
210
  			<if test="titles != null">titles = #{titles},</if>
210
  			<if test="titles != null">titles = #{titles},</if>
211
- 			<if test="engineerLevel != null">engineerLevel = #{engineerLevel},</if>
212
- 			<if test="entryDate != null">entryDate = #{entryDate},</if>
211
+ 			<if test="engineerLevel != null">engineer_level = #{engineerLevel},</if>
212
+ 			<if test="entryDate != null">entry_date = #{entryDate},</if>
213
  			<if test="age != null">age = #{age},</if>
213
  			<if test="age != null">age = #{age},</if>
214
  			update_time = sysdate()
214
  			update_time = sysdate()
215
  		</set>
215
  		</set>

+ 5
- 5
oa-back/sql/ry_20231130.sql 查看文件

71
   titles			varchar(9)		default null			   comment '技术职称(0正高、1副高、2中级、3助工、4注测、5注规、6注岩、7注安、8注会)',
71
   titles			varchar(9)		default null			   comment '技术职称(0正高、1副高、2中级、3助工、4注测、5注规、6注岩、7注安、8注会)',
72
   engineer_level	char(1)			default null			   comment '岗级(0二、1三、2四、3五、4六)',
72
   engineer_level	char(1)			default null			   comment '岗级(0二、1三、2四、3五、4六)',
73
   entry_date		datetime								   comment '入职时间',
73
   entry_date		datetime								   comment '入职时间',
74
-  age				int				default null			   comment '年龄',
74
+  age				int											comment '年龄',
75
   primary key (user_id)
75
   primary key (user_id)
76
 ) engine=innodb auto_increment=1 comment = '用户信息表';
76
 ) engine=innodb auto_increment=1 comment = '用户信息表';
77
 
77
 
793
 insert into sys_user_post values (31, 25);
793
 insert into sys_user_post values (31, 25);
794
 insert into sys_user_post values (32, 12);
794
 insert into sys_user_post values (32, 12);
795
 insert into sys_user_post values (33, 11);
795
 insert into sys_user_post values (33, 11);
796
-insert into sys_user_post values (34, 21);
797
-insert into sys_user_post values (35, 21);
798
-insert into sys_user_post values (36, 23);
799
-insert into sys_user_post values (37, 21);
796
+insert into sys_user_post values (34, 26);
797
+insert into sys_user_post values (35, 26);
798
+insert into sys_user_post values (36, 26);
799
+insert into sys_user_post values (37, 26);
800
 insert into sys_user_post values (38, 12);
800
 insert into sys_user_post values (38, 12);
801
 insert into sys_user_post values (39, 13);
801
 insert into sys_user_post values (39, 13);
802
 insert into sys_user_post values (40, 26);
802
 insert into sys_user_post values (40, 26);

正在加载...
取消
保存