Kaynağa Gözat

项目登记后,企业微信消息通知分管

lamphua 9 ay önce
ebeveyn
işleme
8944c108f0

+ 48
- 16
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcProjectController.java Dosyayı Görüntüle

@@ -1,13 +1,20 @@
1 1
 package com.ruoyi.web.controller.oa;
2 2
 
3
+import java.io.IOException;
4
+import java.util.ArrayList;
5
+import java.util.Arrays;
3 6
 import java.util.Date;
4 7
 import java.util.List;
5 8
 import javax.servlet.http.HttpServletResponse;
6 9
 
10
+import com.ruoyi.common.core.domain.entity.SysUser;
11
+import com.ruoyi.common.utils.StringUtils;
7 12
 import com.ruoyi.oa.service.ICmcPartyAService;
8 13
 import com.ruoyi.oa.service.ICmcProjectWorkService;
9 14
 import com.ruoyi.system.service.ISysDeptService;
10 15
 import com.ruoyi.system.service.ISysUserService;
16
+import com.ruoyi.web.controller.qyweixin.MessageController;
17
+import com.ruoyi.web.controller.system.SysPostController;
11 18
 import org.springframework.beans.factory.annotation.Autowired;
12 19
 import org.springframework.web.bind.annotation.*;
13 20
 import com.ruoyi.common.annotation.Log;
@@ -53,13 +60,7 @@ public class CmcProjectController extends BaseController
53 60
         startPage();
54 61
         List<CmcProject> list = cmcProjectService.selectCmcProjectList(cmcProject);
55 62
         for (CmcProject project : list) {
56
-            String underTakingDept = project.getUndertakingDept();
57
-            StringBuilder underTakingDeptName = new StringBuilder();
58
-            if (underTakingDept != null && !underTakingDept.equals("") && underTakingDept.split(",").length > 0) {
59
-                for (String dept : underTakingDept.split(","))
60
-                    underTakingDeptName.append(deptService.selectDeptById(Long.parseLong(dept)).getDeptName()).append(",");
61
-                project.setUndertakingDeptName(underTakingDeptName.substring(0, underTakingDeptName.length() - 1));
62
-            }
63
+            project.setUndertakingDeptName(deptIdToName(project));
63 64
             String qualityInspector = project.getQualityInspector();
64 65
             StringBuilder qualityInspectorName = new StringBuilder();
65 66
             if (qualityInspector != null && !qualityInspector.equals("") && qualityInspector.split(",").length > 0) {
@@ -90,13 +91,7 @@ public class CmcProjectController extends BaseController
90 91
     public AjaxResult getInfo(@PathVariable("projectId") String projectId)
91 92
     {
92 93
         CmcProject cmcProject = cmcProjectService.selectCmcProjectByProjectId(projectId);
93
-        String underTakingDept = cmcProject.getUndertakingDept();
94
-        StringBuilder underTakingDeptName = new StringBuilder();
95
-        if (underTakingDept != null && !underTakingDept.equals("") && underTakingDept.split(",").length > 0) {
96
-            for (String dept : underTakingDept.split(","))
97
-                underTakingDeptName.append(deptService.selectDeptById(Long.parseLong(dept)).getDeptName()).append(",");
98
-            cmcProject.setUndertakingDeptName(underTakingDeptName.substring(0, underTakingDeptName.length() - 1));
99
-        }
94
+        cmcProject.setUndertakingDeptName(deptIdToName(cmcProject));
100 95
         String qualityInspector = cmcProject.getQualityInspector();
101 96
         StringBuilder qualityInspectorName = new StringBuilder();
102 97
         if (qualityInspector != null && !qualityInspector.equals("") && qualityInspector.split(",").length > 0) {
@@ -124,10 +119,36 @@ public class CmcProjectController extends BaseController
124 119
      */
125 120
     @Log(title = "cmc项目", businessType = BusinessType.INSERT)
126 121
     @PostMapping
127
-    public AjaxResult add(@RequestBody CmcProject cmcProject)
128
-    {
122
+    public AjaxResult add(@RequestBody CmcProject cmcProject) throws IOException {
129 123
         cmcProject.setRegisterTime(new Date());
130 124
         cmcProject.setIsFinished("0");
125
+//        if (cmcProjectService.insertCmcProject(cmcProject) > 0) {
126
+//            String message = "经营发展部已发起项目登记:  \n>" +
127
+//                    "登记人: <font color='info'>" + userService.selectUserById(cmcProject.getProjectRegistrant()).getNickName() + "</font>  \n>" +
128
+//                    "项目编号:" + cmcProject.getProjectNumber() + "  \n>" +
129
+//                    "项目名称:" + cmcProject.getProjectName() + "  \n>" +
130
+//                    "  \n>" +
131
+//                    "项目类型:<font color='comment'>" + cmcProject.getProjectType() + "</font>  \n>" +
132
+//                    "项目来源:" + (cmcProject.getProjectSource().equals("0") ? "院内" : "院外") +"  \n>" +
133
+//                    "甲方单位:" + cmcPartyAService.selectCmcPartyAByPartyAId(cmcProject.getPartyAId()).getPartyAName() + "  \n>" +
134
+//                    "  \n>" +
135
+//                    "承担部门:<font color='warning'>" + deptIdToName(cmcProject) + "</font>  \n>" +
136
+//                    "请您确认承担部门,及时跟进项目流转  \n>" +
137
+//                    "  \n>";
138
+//            if (cmcProject.getUndertakingDept() != null) {
139
+//                String deptString = cmcProject.getUndertakingDept() + ",105";
140
+//                List<String> managerList = new ArrayList<>();
141
+//                String[] deptId = deptString.split(",");
142
+//                for (String dept : deptId) {
143
+//                        List<SysUser> manageList = SysPostController.getManageId(dept, null);
144
+//                        for (SysUser manager : manageList) {
145
+//                            managerList.add(manager.getPinyin());
146
+//
147
+//                    }
148
+//                }
149
+//                MessageController.sendAppMessage(message, StringUtils.join(managerList, "|"));
150
+//            }
151
+//        }
131 152
         return toAjax(cmcProjectService.insertCmcProject(cmcProject));
132 153
     }
133 154
 
@@ -151,4 +172,15 @@ public class CmcProjectController extends BaseController
151 172
         cmcProjectWorkService.deleteCmcProjectWorkByProjectIds(projectIds);
152 173
         return success(cmcProjectService.deleteCmcProjectByProjectIds(projectIds));
153 174
     }
175
+
176
+    public String deptIdToName(CmcProject cmcProject) {
177
+        String underTakingDept = cmcProject.getUndertakingDept();
178
+        StringBuilder underTakingDeptName = new StringBuilder();
179
+        if (underTakingDept != null && !underTakingDept.equals("") && underTakingDept.split(",").length > 0) {
180
+            for (String dept : underTakingDept.split(","))
181
+                underTakingDeptName.append(deptService.selectDeptById(Long.parseLong(dept)).getDeptName()).append(",");
182
+            cmcProject.setUndertakingDeptName(underTakingDeptName.substring(0, underTakingDeptName.length() - 1));
183
+        }
184
+        return cmcProject.getUndertakingDeptName();
185
+    }
154 186
 }

+ 111
- 0
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/qyweixin/MessageController.java Dosyayı Görüntüle

@@ -0,0 +1,111 @@
1
+package com.ruoyi.web.controller.qyweixin;
2
+
3
+import com.alibaba.fastjson2.JSONObject;
4
+import com.ruoyi.oa.domain.CmcProject;
5
+import liquibase.pro.packaged.S;
6
+import org.springframework.web.bind.annotation.GetMapping;
7
+import org.springframework.web.bind.annotation.PostMapping;
8
+import org.springframework.web.bind.annotation.RequestMapping;
9
+import org.springframework.web.bind.annotation.RestController;
10
+import java.io.*;
11
+import java.net.HttpURLConnection;
12
+import java.net.URL;
13
+
14
+/**
15
+ * 通用请求处理
16
+ * 
17
+ * @author ruoyi
18
+ */
19
+@RestController
20
+@RequestMapping("/qyweixin")
21
+public class MessageController
22
+{
23
+    /**
24
+     * 获取企业微信token并发送消息
25
+     *
26
+     */
27
+    @PostMapping("/sendMessage")
28
+    public static void sendMessage(String message, String userString) throws IOException {
29
+        String getUrlString = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=wwe7757ae3518f5674&corpsecret=6bvHwvgaMUwk_7EwEyLV-v_2nai-4I8qeewhFJgV0aI";
30
+        URL getUrl = new URL(getUrlString);
31
+        //打开和url之间的连接
32
+        HttpURLConnection conn = (HttpURLConnection) getUrl.openConnection();
33
+        //请求方式
34
+        conn.setRequestMethod("GET");
35
+        //设置通用的请求属性
36
+        conn.setRequestProperty("accept", "*/*");
37
+        conn.setRequestProperty("connection", "Keep-Alive");
38
+        conn.setRequestProperty("Content-Type", "application/json;charset=utf-8");
39
+        //设置是否向httpUrlConnection输出,设置是否从httpUrlConnection读入,此外发送post请求必须设置这两个
40
+        //最常用的Http请求无非是get和post,get请求可以获取静态页面,也可以把参数放在URL字串后面,传递给servlet,
41
+        //post与get的 不同之处在于post的参数不是放在URL字串里面,而是放在http请求的正文内。get请求不需要设置
42
+        //获取URLConnection对象对应的输出流
43
+        conn.connect();
44
+        //获取URLConnection对象对应的输入流
45
+        InputStream is = conn.getInputStream();
46
+        //构造一个字符流缓存
47
+        BufferedReader br = new BufferedReader(new InputStreamReader(is));
48
+        String str = "";
49
+        JSONObject json = null;
50
+        while ((str = br.readLine()) != null) {
51
+            json = JSONObject.parseObject(str);
52
+        }
53
+        //关闭流
54
+        is.close();
55
+        //断开连接,最好写上,disconnect是在底层tcp socket链接空闲时才切断。如果正在被其他线程使用就不切断。
56
+        //固定多线程的话,如果不disconnect,链接会增多,直到收发不出信息。写上disconnect后正常一些。
57
+        conn.disconnect();
58
+        String token = json != null ? json.getString("access_token") : "";
59
+        String postUrlString = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=" + token;
60
+        URL postUrl = new URL(postUrlString);
61
+        HttpURLConnection postConn = (HttpURLConnection) postUrl.openConnection();
62
+        //请求方式 这里设置你需要请求的方式
63
+        postConn.setRequestMethod("POST");
64
+        //设置通用的请求属性
65
+        postConn.setRequestProperty("accept", "*/*");
66
+        postConn.setRequestProperty("connection", "Keep-Alive");
67
+        //  这里设置请求头
68
+        postConn.setRequestProperty("Content-Type", "application/json;charset=utf-8");
69
+        //设置是否向httpUrlConnection输出,设置是否从httpUrlConnection读入,此外发送post请求必须设置这两个
70
+        //最常用的Http请求无非是get和post,get请求可以获取静态页面,也可以把参数放在URL字串后面,传递给servlet,
71
+        //post与get的 不同之处在于post的参数不是放在URL字串里面,而是放在http请求的正文内。
72
+        postConn.setDoOutput(true);
73
+        postConn.setDoInput(true);
74
+        //设置body内的参数,put到JSONObject中
75
+        JSONObject param = new JSONObject();
76
+        param.put("touser", userString);
77
+        param.put("agentid", 1000016);
78
+        JSONObject text = new JSONObject();
79
+        text.put("content", message);
80
+        param.put("markdown", text);
81
+        param.put("msgtype", "markdown");
82
+        // 得到请求的输出流对象
83
+        OutputStream outputStream = postConn.getOutputStream();
84
+        outputStream.write(param.toString().getBytes());
85
+        outputStream.flush();
86
+        outputStream.close();
87
+        //获取URLConnection对象对应的输入流
88
+        InputStream postIs = postConn.getInputStream();
89
+        //构造一个字符流缓存
90
+        BufferedReader postBr = new BufferedReader(new InputStreamReader(postIs));
91
+        String postStr = "";
92
+        JSONObject postJson = null;
93
+        while ((postStr = postBr.readLine()) != null) {
94
+            postJson = JSONObject.parseObject(postStr);
95
+        }
96
+        Integer errcode = postJson != null ? postJson.getInteger("errcode") : null;
97
+        if (errcode != null && errcode == 0)
98
+            System.out.println("应用消息发送成功");
99
+        else
100
+            System.out.println("应用消息发送失败");
101
+        //关闭流
102
+        postIs.close();
103
+        //断开连接,最好写上,disconnect是在底层tcp socket链接空闲时才切断。如果正在被其他线程使用就不切断。
104
+        //固定多线程的话,如果不disconnect,链接会增多,直到收发不出信息。写上disconnect后正常一些。
105
+        postConn.disconnect();
106
+    }
107
+
108
+    public static void sendAppMessage(String message, String userString) throws IOException {
109
+        sendMessage(message, userString);
110
+    }
111
+}

+ 4
- 4
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java Dosyayı Görüntüle

@@ -41,10 +41,10 @@ public class SysPostController extends BaseController
41 41
     private ISysPostService postService;
42 42
 
43 43
     @Autowired
44
-    private ISysUserService userService;
44
+    private static ISysUserService userService;
45 45
 
46 46
     @Autowired
47
-    private ICmcManageDeptService cmcManageDeptService;
47
+    private static ICmcManageDeptService cmcManageDeptService;
48 48
 
49 49
     /**
50 50
      * 获取岗位列表
@@ -165,7 +165,7 @@ public class SysPostController extends BaseController
165 165
     @GetMapping("/manageLeader")
166 166
     public AjaxResult getManageLeader(String userId)
167 167
     {
168
-        return success(getManageId(userService.selectUserById(Long.parseLong(userId)).getDeptId().toString(), ""));
168
+        return success(getManageId(userService.selectUserById(Long.parseLong(userId)).getDeptId().toString(), null));
169 169
     }
170 170
 
171 171
     /**
@@ -267,7 +267,7 @@ public class SysPostController extends BaseController
267 267
         return success(posts);
268 268
     }
269 269
 
270
-    private List<SysUser> getManageId(String deptId, String partyAId) {
270
+    public static List<SysUser> getManageId(String deptId, String partyAId) {
271 271
         List<SysUser> userList = new ArrayList<>();
272 272
         CmcManageDept cmcManageDept = new CmcManageDept();
273 273
         cmcManageDept.setDeptId(deptId);

+ 22
- 5
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java Dosyayı Görüntüle

@@ -8,8 +8,7 @@ import javax.servlet.http.HttpServletResponse;
8 8
 import com.alibaba.fastjson2.JSON;
9 9
 import com.alibaba.fastjson2.JSONArray;
10 10
 import com.alibaba.fastjson2.JSONObject;
11
-import com.ruoyi.common.utils.DateUtils;
12
-import com.ruoyi.common.utils.IDCard;
11
+import com.ruoyi.common.utils.*;
13 12
 import com.ruoyi.oa.domain.CmcUserHistory;
14 13
 import com.ruoyi.oa.service.ICmcUserHistoryService;
15 14
 import org.apache.commons.lang3.ArrayUtils;
@@ -34,8 +33,6 @@ import com.ruoyi.common.core.domain.entity.SysRole;
34 33
 import com.ruoyi.common.core.domain.entity.SysUser;
35 34
 import com.ruoyi.common.core.page.TableDataInfo;
36 35
 import com.ruoyi.common.enums.BusinessType;
37
-import com.ruoyi.common.utils.SecurityUtils;
38
-import com.ruoyi.common.utils.StringUtils;
39 36
 import com.ruoyi.common.utils.poi.ExcelUtil;
40 37
 import com.ruoyi.system.service.ISysDeptService;
41 38
 import com.ruoyi.system.service.ISysPostService;
@@ -300,6 +297,8 @@ public class SysUserController extends BaseController
300 297
             return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
301 298
         }
302 299
         user.setCreateBy(getUsername());
300
+        String pinyin = Pinyin4jUtil.getPinyin(user.getNickName());
301
+        user.setPinyin(pinyin.contains(",") ? pinyin.split(",")[0] : pinyin);
303 302
         user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
304 303
         if (user.getBirthday() != null)
305 304
             user.setAge(DateUtils.getAgeByBirth(user.getBirthday()));
@@ -320,7 +319,25 @@ public class SysUserController extends BaseController
320 319
                 userService.resetPwd(user);
321 320
             }
322 321
         }
323
-        return toAjax(userService.selectUserList(new SysUser()).size() - 15);
322
+        return toAjax(1);
323
+    }
324
+
325
+    /**
326
+     * 修改用户密码
327
+     */
328
+//    @PreAuthorize("@ss.hasPermi('system:user:edit')")
329
+    @Log(title = "用户管理", businessType = BusinessType.UPDATE)
330
+    @PutMapping("/pinyin")
331
+    public AjaxResult setPinyin()
332
+    {
333
+        for (SysUser user : userService.selectUserList(new SysUser())) {
334
+            if (user.getUserId() > 1) {
335
+                String pinyin = Pinyin4jUtil.getPinyin(user.getNickName());
336
+                user.setPinyin(pinyin.contains(",") ? pinyin.split(",")[0] : pinyin);
337
+                userService.updateUser(user);
338
+            }
339
+        }
340
+        return toAjax(1);
324 341
     }
325 342
 
326 343
     /**

+ 5
- 0
oa-back/ruoyi-common/pom.xml Dosyayı Görüntüle

@@ -126,6 +126,11 @@
126 126
             <artifactId>javax.servlet-api</artifactId>
127 127
         </dependency>
128 128
 
129
+        <dependency>
130
+            <groupId>com.belerweb</groupId>
131
+            <artifactId>pinyin4j</artifactId>
132
+            <version>2.5.0</version>
133
+        </dependency>
129 134
     </dependencies>
130 135
 
131 136
 </project>

+ 13
- 0
oa-back/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java Dosyayı Görüntüle

@@ -38,6 +38,9 @@ public class SysUser extends BaseEntity
38 38
     @Excel(name = "用户名称")
39 39
     private String nickName;
40 40
 
41
+    /** 用户拼音 */
42
+    private String pinyin;
43
+
41 44
     /** 用户邮箱 */
42 45
 //    @Excel(name = "用户邮箱")
43 46
     private String email;
@@ -231,6 +234,16 @@ public class SysUser extends BaseEntity
231 234
         this.nickName = nickName;
232 235
     }
233 236
 
237
+    public String getPinyin()
238
+    {
239
+        return pinyin;
240
+    }
241
+
242
+    public void setPinyin(String pinyin)
243
+    {
244
+        this.pinyin = pinyin;
245
+    }
246
+
234 247
     @Xss(message = "用户账号不能包含脚本字符")
235 248
     @NotBlank(message = "用户账号不能为空")
236 249
     @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")

+ 192
- 0
oa-back/ruoyi-common/src/main/java/com/ruoyi/common/utils/Pinyin4jUtil.java Dosyayı Görüntüle

@@ -0,0 +1,192 @@
1
+package com.ruoyi.common.utils;
2
+
3
+import net.sourceforge.pinyin4j.PinyinHelper;
4
+import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
5
+import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
6
+import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
7
+import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
8
+import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
9
+
10
+import java.util.HashSet;
11
+import java.util.Set;
12
+public class Pinyin4jUtil {
13
+
14
+    //将汉字转换为拼音全拼 首字母大写,多音字的返回多个拼音以逗号分隔
15
+    public static String getPinyin(String chinese) {
16
+        return getPinyinZh_CN(makeStringByStringSet(chinese));
17
+    }
18
+
19
+    //将汉字转换为拼音全拼 大写,多音字的返回多个拼音以逗号分隔
20
+    public static String getPinyinToUpperCase(String chinese) {
21
+        return getPinyinZh_CN(makeStringByStringSet(chinese)).toUpperCase();
22
+    }
23
+
24
+    //将汉字转换为拼音全拼 小写,多音字的返回多个拼音以逗号分隔
25
+    public static String getPinyinToLowerCase(String chinese) {
26
+        return getPinyinZh_CN(makeStringByStringSet(chinese)).toLowerCase();
27
+    }
28
+
29
+    //将汉字转换为拼音简拼 大写,多音字的返回多个拼音以逗号分隔
30
+    public static String getPinyinJianPin(String chinese) {
31
+        String[] strArray = getPinyin(chinese).split(",");
32
+        String strChar = "";
33
+        for (String str : strArray) {
34
+            char arr[] = str.toCharArray(); // 将字符串转化成char型数组
35
+            for (int i = 0; i < arr.length; i++) {
36
+                if (arr[i] >= 65 && arr[i] < 91) { // 判断是否是大写字母
37
+                    strChar += new String(arr[i] + "");
38
+                }
39
+            }
40
+            strChar += ",";
41
+        }
42
+        return strChar.substring(0,strChar.length()-1);
43
+    }
44
+
45
+    //字符集转换
46
+    public static Set<String> makeStringByStringSet(String chinese) {
47
+        char[] chars = chinese.toCharArray();
48
+        if (chinese != null && !chinese.trim().equalsIgnoreCase("")) {
49
+            char[] srcChar = chinese.toCharArray();
50
+            String[][] temp = new String[chinese.length()][];
51
+            for (int i = 0; i < srcChar.length; i++) {
52
+                char c = srcChar[i];
53
+
54
+                // 是中文或者a-z或者A-Z转换拼音
55
+                if (String.valueOf(c).matches("[\\u4E00-\\u9FA5]+")) {
56
+
57
+                    try {
58
+                        temp[i] = PinyinHelper.toHanyuPinyinStringArray(
59
+                                chars[i], getDefaultOutputFormat());
60
+
61
+                    } catch (BadHanyuPinyinOutputFormatCombination e) {
62
+                        e.printStackTrace();
63
+                    }
64
+                } else if (((int) c >= 65 && (int) c <= 90)
65
+                        || ((int) c >= 97 && (int) c <= 122)) {
66
+                    temp[i] = new String[] { String.valueOf(srcChar[i]) };
67
+                } else {
68
+                    temp[i] = new String[] { "" };
69
+                }
70
+            }
71
+            String[] pingyinArray = Exchange(temp);
72
+            Set<String> zhongWenPinYin = new HashSet<String>();
73
+            for (int i = 0; i < pingyinArray.length; i++) {
74
+                zhongWenPinYin.add(pingyinArray[i]);
75
+            }
76
+            return zhongWenPinYin;
77
+        }
78
+        return null;
79
+    }
80
+
81
+    //默认输出格式
82
+    public static HanyuPinyinOutputFormat getDefaultOutputFormat() {
83
+        HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
84
+        format.setCaseType(HanyuPinyinCaseType.LOWERCASE);// 小写
85
+        format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);// 没有音调数字
86
+        format.setVCharType(HanyuPinyinVCharType.WITH_U_AND_COLON);// u显示
87
+        return format;
88
+    }
89
+
90
+    public static String[] Exchange(String[][] strJaggedArray) {
91
+        String[][] temp = DoExchange(strJaggedArray);
92
+        return temp[0];
93
+    }
94
+
95
+    private static String[][] DoExchange(String[][] strJaggedArray) {
96
+        int len = strJaggedArray.length;
97
+        if (len >= 2) {
98
+            int len1 = strJaggedArray[0].length;
99
+            int len2 = strJaggedArray[1].length;
100
+            int newlen = len1 * len2;
101
+            String[] temp = new String[newlen];
102
+            int Index = 0;
103
+            for (int i = 0; i < len1; i++) {
104
+                for (int j = 0; j < len2; j++) {
105
+                    temp[Index] = capitalize(strJaggedArray[0][i])
106
+                            + capitalize(strJaggedArray[1][j]);
107
+                    Index++;
108
+                }
109
+            }
110
+            String[][] newArray = new String[len - 1][];
111
+            for (int i = 2; i < len; i++) {
112
+                newArray[i - 1] = strJaggedArray[i];
113
+            }
114
+            newArray[0] = temp;
115
+            return DoExchange(newArray);
116
+        } else {
117
+            return strJaggedArray;
118
+        }
119
+    }
120
+
121
+    //首字母大写
122
+    public static String capitalize(String s) {
123
+        char ch[];
124
+        ch = s.toCharArray();
125
+        if (ch[0] >= 'a' && ch[0] <= 'z') {
126
+            ch[0] = (char) (ch[0] - 32);
127
+        }
128
+        String newString = new String(ch);
129
+        return newString;
130
+    }
131
+
132
+    //字符串集合转换字符串(逗号分隔)
133
+    public static String getPinyinZh_CN(Set<String> stringSet) {
134
+        StringBuilder str = new StringBuilder();
135
+        int i = 0;
136
+        for (String s : stringSet) {
137
+            if (i == stringSet.size() - 1) {
138
+                str.append(s);
139
+            } else {
140
+                str.append(s + ",");
141
+            }
142
+            i++;
143
+        }
144
+        return str.toString();
145
+    }
146
+
147
+    // 将汉字转换为全拼 小写 不识别多音字
148
+    public static String getPingYin(String src) {
149
+        char[] t1 = null;
150
+        t1 = src.toCharArray();
151
+        String[] t2 = new String[t1.length];
152
+        HanyuPinyinOutputFormat t3 = new HanyuPinyinOutputFormat();
153
+
154
+        t3.setCaseType(HanyuPinyinCaseType.LOWERCASE);
155
+        t3.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
156
+        t3.setVCharType(HanyuPinyinVCharType.WITH_V);
157
+        String t4 = "";
158
+        int t0 = t1.length;
159
+        try {
160
+            for (int i = 0; i < t0; i++) {
161
+                // 判断是否为汉字字符
162
+                if (java.lang.Character.toString(t1[i]).matches(
163
+                        "[\\u4E00-\\u9FA5]+")) {
164
+                    t2 = PinyinHelper.toHanyuPinyinStringArray(t1[i], t3);
165
+                    t4 += t2[0];
166
+                } else
167
+                    t4 += java.lang.Character.toString(t1[i]);
168
+            }
169
+            // System.out.println(t4);
170
+            return t4;
171
+        } catch (BadHanyuPinyinOutputFormatCombination e1) {
172
+            e1.printStackTrace();
173
+        }
174
+        return t4;
175
+    }
176
+
177
+    // 汉字转拼音 小写首字母 不识别多音字
178
+    public static String getPinYinHeadChar(String str) {
179
+        String convert = "";
180
+        for (int j = 0; j < str.length(); j++) {
181
+            char word = str.charAt(j);
182
+            String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word);
183
+            if (pinyinArray != null) {
184
+                convert += pinyinArray[0].charAt(0);
185
+            } else {
186
+                convert += word;
187
+            }
188
+        }
189
+        return convert;
190
+    }
191
+}
192
+

+ 1
- 0
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcMaterialBuyMapper.xml Dosyayı Görüntüle

@@ -47,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
47 47
             <if test="amount != null "> and mb.amount = #{amount}</if>
48 48
             <if test="buyer != null "> and mb.buyer = #{buyer}</if>
49 49
         </where>
50
+        order by mb.buy_time desc
50 51
     </select>
51 52
     
52 53
     <select id="selectCmcMaterialBuyByBuyId" parameterType="Integer" resultMap="CmcMaterialBuyResult">

+ 1
- 0
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcMaterialGiveMapper.xml Dosyayı Görüntüle

@@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
50 50
             <if test="useDept != null "> and mg.use_dept = #{useDept}</if>
51 51
             <if test="giveNum != null "> and mg.give_num = #{giveNum}</if>
52 52
         </where>
53
+        order by mg.give_time desc
53 54
     </select>
54 55
     
55 56
     <select id="selectCmcMaterialGiveByGiveId" parameterType="Integer" resultMap="CmcMaterialGiveResult">

+ 6
- 2
oa-back/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml Dosyayı Görüntüle

@@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
9 9
         <result property="deptId"       column="dept_id"      />
10 10
         <result property="userName"     column="user_name"    />
11 11
         <result property="nickName"     column="nick_name"    />
12
+        <result property="pinyin"     	column="pinyin"    />
12 13
         <result property="email"        column="email"        />
13 14
         <result property="phonenumber"  column="phonenumber"  />
14 15
         <result property="sex"          column="sex"          />
@@ -76,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
76 77
     </resultMap>
77 78
 
78 79
 	<sql id="selectUserVo">
79
-        select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password,
80
+        select u.user_id, u.dept_id, u.user_name, u.nick_name, u.pinyin, u.email, u.avatar, u.phonenumber, u.password,
80 81
                u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
81 82
                u.pm_level, u.titles, u.certificates, u.update_reason, u.engineer_level, u.post_level, u.salary_level,
82 83
                u.operator_level, u.entry_date, u.birthday, u.age, u.id_card, u.native_place, u.political_affiliation,
@@ -91,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
91 92
     </sql>
92 93
 
93 94
     <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
94
-		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,
95
+		select u.user_id, u.dept_id, u.nick_name, u.pinyin, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag,
95 96
 		       u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.pm_level, u.titles, u.certificates, u.update_reason,
96 97
 		       u.engineer_level, u.post_level, u.salary_level, u.operator_level, u.entry_date, u.birthday, u.age, u.id_card,
97 98
 		       u.native_place, u.political_affiliation, u.ethnic, u.graduate_school, u.major, u.degree, u.contract_sign, u.contract_expire,
@@ -232,6 +233,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
232 233
 			<if test="contractSign != null">contract_sign,</if>
233 234
 			<if test="contractExpire != null">contract_expire,</if>
234 235
 			<if test="homePlace != null">home_place,</if>
236
+			<if test="pinyin != null">pinyin,</if>
235 237
  			create_time
236 238
  		)values(
237 239
  			<if test="userId != null and userId != ''">#{userId},</if>
@@ -267,6 +269,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
267 269
 			<if test="contractSign != null">#{contractSign},</if>
268 270
 			<if test="contractExpire != null">#{contractExpire},</if>
269 271
 			<if test="homePlace != null">#{homePlace},</if>
272
+			<if test="pinyin != null">#{pinyin},</if>
270 273
  			sysdate()
271 274
  		)
272 275
 	</insert>
@@ -308,6 +311,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
308 311
 			contract_sign = #{contractSign},
309 312
 			contract_expire = #{contractExpire},
310 313
 			<if test="homePlace != null">home_place = #{homePlace},</if>
314
+			<if test="pinyin != null">pinyin = #{pinyin},</if>
311 315
  			update_time = sysdate()
312 316
  		</set>
313 317
  		where user_id = #{userId}

+ 29
- 28
oa-ui/src/views/file/index.vue Dosyayı Görüntüle

@@ -2,7 +2,7 @@
2 2
  * @Author: ysh
3 3
  * @Date: 2024-06-21 18:51:49
4 4
  * @LastEditors: wrh
5
- * @LastEditTime: 2024-08-21 14:36:48
5
+ * @LastEditTime: 2024-08-23 17:20:57
6 6
 -->
7 7
 <template>
8 8
   <div class="warpper-container">
@@ -99,52 +99,53 @@
99 99
                 <div class="expand-info">
100 100
                   <el-descriptions :column="2">
101 101
                     <el-descriptions-item label="存放地址" class="desLabel" :span="2">
102
-                      {{ props.row.storageAddress == '' || props.row.storageAddress == undefined ? '暂无' :
102
+                      {{ props.row.storageAddress == '' || props.row.storageAddress == null ? '暂无' :
103 103
                         props.row.storageAddress
104 104
                       }}
105 105
                     </el-descriptions-item>
106
-                    <el-descriptions-item label="甲方单位" class="desLabel" :span="2">{{ props.row.partyA.partyAName == ''
106
+                    <el-descriptions-item label="甲方单位" class="desLabel" :span="2">{{ props.row.partyA == null
107 107
                       ? '暂无' :
108 108
                       props.row.partyA.partyAName
109 109
                     }}</el-descriptions-item>
110
-                    <el-descriptions-item label="联系人" class="desLabel">{{ props.row.contactPerson == '' ? '暂无' :
110
+                    <el-descriptions-item label="联系人" class="desLabel">{{ props.row.contactPerson == null ? '暂无' :
111 111
                       props.row.contactPerson
112 112
                     }}</el-descriptions-item>
113
-                    <el-descriptions-item label="联系电话" class="desLabel">{{ props.row.telephone == '' ? '暂无' :
113
+                    <el-descriptions-item label="联系电话" class="desLabel">{{ props.row.telephone == null ? '暂无' :
114 114
                       props.row.telephone
115 115
                     }}</el-descriptions-item>
116
-                    <el-descriptions-item label="项目类型" class="desLabel">{{ props.row.projectType == '' ? '暂无' :
116
+                    <el-descriptions-item label="项目类型" class="desLabel">{{ props.row.projectType == null ? '暂无' :
117 117
                       props.row.projectType
118 118
                     }}</el-descriptions-item>
119
-                    <el-descriptions-item label="技术负责人" class="desLabel">{{ props.row.technicalDirector == '' ? '暂无'
119
+                    <el-descriptions-item label="技术负责人" class="desLabel">{{ props.row.technicalDirectorUser == null ? '暂无'
120 120
                       :
121
-                      getUserName(props.row.technicalDirector)
121
+                      props.row.technicalDirectorUser.nickName
122 122
                     }}</el-descriptions-item>
123
-                    <el-descriptions-item label="技术设计人" class="desLabel">{{ props.row.techinicalDesigner == '' ? '暂无'
123
+                    <el-descriptions-item label="技术设计人" class="desLabel">{{ props.row.technicalDesignerUser == null ? '暂无'
124 124
                       :
125
-                      getUserName(props.row.techinicalDesigner)
125
+                      props.row.technicalDesignerUser.nickName
126 126
                     }}</el-descriptions-item>
127
-                    <el-descriptions-item label="承担部门" class="desLabel">{{ props.row.undertakingSector == '' ? '暂无' :
127
+                    <el-descriptions-item label="承担部门" class="desLabel">{{ props.row.undertakingSector == null ? '暂无' :
128 128
                       props.row.undertakingDeptName
129 129
                     }}</el-descriptions-item>
130
-                    <el-descriptions-item label="质量检察员" class="desLabel">{{ props.row.qualityInspector == '' ? '暂无' :
131
-                      getUserNames(props.row.qualityInspector)
130
+                    <el-descriptions-item label="质量检查员" class="desLabel">{{ props.row.qualityInspectorName == null ? '暂无'
131
+                      :
132
+                      props.row.qualityInspectorName
132 133
                     }}</el-descriptions-item>
133
-                    <el-descriptions-item label="项目登记时间" class="desLabel" :span="2">{{ props.row.registrationDate ==
134
-                      '' ? '暂无' :
135
-                      props.row.registrationDate
134
+                    <el-descriptions-item label="项目登记时间" class="desLabel" :span="2">{{ props.row.registerTime ==
135
+                      null ? '暂无' :
136
+                      props.row.registerTime
136 137
                     }}</el-descriptions-item>
137
-                    <el-descriptions-item label="项目登记人" class="desLabel">{{ props.row.projectRegistrant == '' ? '暂无'
138
+                    <el-descriptions-item label="项目登记人" class="desLabel">{{ props.row.projectRegistrantUser == null ? '暂无'
138 139
                       :
139
-                      getUserName(props.row.projectRegistrant)
140
+                      props.row.projectRegistrantUser.nickName
140 141
                     }}</el-descriptions-item>
141
-                    <el-descriptions-item label="进场时间" class="desLabel">{{ props.row.approachTime == '' ? '暂无' :
142
-                      props.row.approachTime
142
+                    <el-descriptions-item label="进场时间" class="desLabel">{{ props.row.approachTime == null ? '暂无' :
143
+                      props.row.entryTime
143 144
                     }}</el-descriptions-item>
144
-                    <el-descriptions-item label="撤场时间" class="desLabel">{{ props.row.withdrawalTime == '' ? '暂无' :
145
-                      props.row.withdrawalTime
145
+                    <el-descriptions-item label="撤场时间" class="desLabel">{{ props.row.withdrawalTime == null ? '暂无' :
146
+                      props.row.exitTime
146 147
                     }}</el-descriptions-item>
147
-                    <el-descriptions-item label="项目要求完成时间" class="desLabel">{{ props.row.requiredCompletionDate == ''
148
+                    <el-descriptions-item label="项目要求完成时间" class="desLabel">{{ props.row.requiredCompletionDate == null
148 149
                       ? '暂无' :
149 150
                       props.row.requiredCompletionDate
150 151
                     }}</el-descriptions-item>
@@ -373,7 +374,7 @@ export default {
373 374
         view: this.view,
374 375
       })
375 376
       this.map.addOverlay(this.popup);
376
-      this.mapClick(this.map, this.popup);
377
+      this.mapClick(this.map);
377 378
       // this.clickFeacturePopInfo();
378 379
       this.addKeyDownFun()
379 380
     },
@@ -411,7 +412,7 @@ export default {
411 412
       });
412 413
     },
413 414
     // 地图点击事件
414
-    mapClick(map, popup) {
415
+    mapClick(map) {
415 416
       let that = this;
416 417
       map.on('singleclick', function (evt) {
417 418
         if (!that.isDrawing) {
@@ -436,15 +437,15 @@ export default {
436 437
                   // 假设 this 在这里指向 Vue 组件实例或其他上下文  
437 438
                   that.clickFeature = res.data;
438 439
                   that.clickFeature.type = 'projectPoint';
439
-                  popup.setPosition(coordinate);
440
+                  this.popup.setPosition(coordinate);
440 441
                 }
441 442
               })
442 443
             } else {
443 444
               // 如果有多个特征,这里可以根据需要处理  
444
-              popup.setPosition(undefined);
445
+              this.popup.setPosition(undefined);
445 446
             }
446 447
           } else {
447
-            popup.setPosition(undefined);
448
+            this.popup.setPosition(undefined);
448 449
           }
449 450
 
450 451
 

+ 3
- 3
oa-ui/src/views/flowable/form/projectProcess/arrangeProject.vue Dosyayı Görüntüle

@@ -1,8 +1,8 @@
1 1
 <!--
2 2
  * @Author: ysh
3 3
  * @Date: 2024-03-19 09:24:06
4
- * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-08-05 14:36:35
4
+ * @LastEditors: wrh
5
+ * @LastEditTime: 2024-08-23 15:59:39
6 6
 -->
7 7
 <template>
8 8
   <div class="app-container">
@@ -240,7 +240,7 @@ export default {
240 240
       })
241 241
     },
242 242
     confirmPlanForm() {
243
-      this.$confirm('项目安排之后会自动发起预算编制、技术方案、技术交底、安全交底四个子流程,将无法进行撤回操作,是否继续提交?', '提示', {
243
+      this.$confirm('项目安排之后会自动发起预算编制、技术方案、安全交底三个子流程,将无法进行撤回操作,是否继续提交?', '提示', {
244 244
         confirmButtonText: '确定',
245 245
         cancelButtonText: '取消',
246 246
         type: 'warning'

Loading…
İptal
Kaydet