Procházet zdrojové kódy

登录和部门的修改通话记录等

liyuanyuan před 1 rokem
rodič
revize
315b28b3b6

+ 5 - 0
zwrx-api/pom.xml

@@ -70,6 +70,11 @@
70 70
             <artifactId>druid</artifactId>
71 71
             <version>1.1.22</version>
72 72
         </dependency>
73
+        <dependency>
74
+            <groupId>com.getui.push</groupId>
75
+            <artifactId>restful-sdk</artifactId>
76
+            <version>1.0.3.0</version>
77
+        </dependency>
73 78
 
74 79
         <!--        <dependency>-->
75 80
 <!--            <groupId>org.apache.shardingsphere</groupId>-->

+ 44 - 5
zwrx-api/src/main/java/api/controller/HomeController.java

@@ -17,6 +17,7 @@ import api.util.constants.CacheConstants;
17 17
 import api.util.helper.*;
18 18
 import com.alibaba.fastjson2.JSON;
19 19
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
20
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
20 21
 import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
21 22
 import io.swagger.annotations.Api;
22 23
 import io.swagger.annotations.ApiOperation;
@@ -121,8 +122,15 @@ public class HomeController extends BaseController {
121 122
         }
122 123
         String encrypt = SecretHelper.MD5(input.getPassword());
123 124
         LambdaQueryWrapper<User> qw = new LambdaQueryWrapper<>();
124
-        qw.eq(User::getUserName, input.getUserName())
125
-                .eq(User::getPassword, encrypt)
125
+        try{
126
+        int usercode= Integer.parseInt( input.getUserName());
127
+        qw.eq(User::getUserName,input.getUserName());
128
+        }catch (Exception e ){
129
+            qw.eq(User::getNickName,input.getUserName());
130
+        }
131
+
132
+
133
+        qw     .eq(User::getPassword, encrypt)
126 134
                 .eq(User::getDeleteFlag, 0);
127 135
         User user = userService.getEntity(qw);
128 136
 
@@ -132,12 +140,42 @@ public class HomeController extends BaseController {
132 140
             logininforService.insert(logininfor);
133 141
             return Error("账号或者密码错误");
134 142
         }
135
-        if (!Objects.equals(user.getDeleteFlag(), "1")) {
136
-            logininfor.setMsg("账号已禁用");
143
+        if (Objects.equals(user.getDeleteFlag(), "1")) {
144
+            logininfor.setMsg("账号已禁用"+input.getUserName()+"分机号-" + input.getExtensionPhone());//
137 145
             logininfor.setStatus("1");
138 146
             logininforService.insert(logininfor);
139 147
             return Error("账号已禁用");
148
+        }else if(Objects.equals(user.getDeleteFlag(), "2")){
149
+            LambdaQueryWrapper<Logininfor>  loginqw=new LambdaQueryWrapper<>();
150
+            loginqw.eq(Logininfor::getUserName,input.getUserName()).like(Logininfor::getMsg,"锁定账号登录").orderByDesc(Logininfor::getInfoId);
151
+
152
+           List<Logininfor> inforList= logininforService.getList(loginqw);
153
+
154
+           if(inforList!=null &&inforList.stream().count()>0) {
155
+               if (DateHelper.calcutemin(new Date(), inforList.stream().findFirst().get().getLoginTime()) > 30) {
156
+                   LambdaUpdateWrapper<User> updateWrapper = new LambdaUpdateWrapper<>();
157
+                   updateWrapper.eq(User::getUserId, user.getUserId()).set(User::getDeleteFlag, 0);
158
+                   userService.updateBatch(updateWrapper);
159
+
160
+               } else {
161
+                   logininfor.setMsg("锁定账号登录:帐号-" + input.getUserName() + ";分机号-" + input.getExtensionPhone());
162
+                   logininfor.setStatus("1");
163
+                   logininforService.insert(logininfor);
164
+                   return Error("此账号已经被锁定,请联系管理员解锁");
165
+
166
+               }
167
+           }else {
168
+
169
+                   logininfor.setMsg("锁定账号登录:帐号-" + input.getUserName() + ";分机号-" + input.getExtensionPhone());
170
+                   logininfor.setStatus("1");
171
+                   logininforService.insert(logininfor);
172
+                   return Error("此账号已经被锁定,请联系管理员解锁");
173
+           }
174
+
175
+
176
+
140 177
         }
178
+
141 179
         user.setLastLoginDate(new Date());
142 180
         user.setLoginIp(ServletHelper.getIpAddr(request));
143 181
         userService.update(user);
@@ -154,6 +192,7 @@ public class HomeController extends BaseController {
154 192
         cls.put("RoleCode", role.getRoleCode());
155 193
         String token = JwtHelper.createToken(cls);
156 194
 
195
+        
157 196
 //        Calendar oldCal = Calendar.getInstance();
158 197
 //        if (user.getUpdatePasswordTime() == null) {
159 198
 //            oldCal.setTime(user.getCreateTime());
@@ -173,7 +212,7 @@ public class HomeController extends BaseController {
173 212
 //        data.put("easyPassword", easyPassword);
174 213
 
175 214
         logininfor.setStatus("0");
176
-        logininfor.setMsg("登成功");
215
+        logininfor.setMsg("登成功");
177 216
         logininforService.insert(logininfor);
178 217
 
179 218
         return Success("登录成功", data);

+ 15 - 0
zwrx-api/src/main/java/api/controller/system/DeptController.java

@@ -73,6 +73,21 @@ public class DeptController extends BaseController {
73 73
             return Success("成功", deptService.getList(qw));
74 74
         }
75 75
     }
76
+    @ApiOperation("新 二级单位交办时,获取子部门列表")
77
+    @Log(title = "二级单位交办时,获取子部门列表", businessType = BusinessType.QUERY)
78
+    @GetMapping
79
+    public AjaxResult getSonList() {
80
+        LambdaQueryWrapper<Dept> qw = new LambdaQueryWrapper();
81
+        qw.eq(Dept::getState,0L)
82
+                        .eq(Dept::getIsDept,2L).eq(Dept::getParentId,CurrentUser().getDeptId());
83
+            return Success("成功", deptService.getList(qw));
84
+
85
+    }
86
+    @ApiOperation("新 话务员交办时,获取要交办的部门tree")
87
+    @GetMapping("/deptZBTree")
88
+    public AjaxResult deptZBTree() {
89
+        return Success("查询成功", deptService.selectZBDeptTreeList());
90
+    }
76 91
 
77 92
     /**
78 93
      * 查询部门列表(排除节点)

+ 3 - 2
zwrx-api/src/main/java/api/controller/system/UserController.java

@@ -123,6 +123,8 @@ public class UserController extends BaseController {
123 123
         if (StringHelper.isEmpty(user.getNickName()))
124 124
             return Error("请输入工号");
125 125
 
126
+        user.setMobileShow(user.getMobile().substring(0,3)+"****"+user.getMobile().substring(7));
127
+        user.setMobile(SecretHelper.AesEncrypt( user.getMobile()));
126 128
         user.setPassword(SecretHelper.MD5(user.getPassword()));
127 129
         user.setCreateBy(CurrentUser().getUserName());
128 130
         boolean result = userService.insert(user);
@@ -285,8 +287,7 @@ public class UserController extends BaseController {
285 287
 
286 288
     public AjaxResult deptTree(Dept dept) {
287 289
         return Success("查询成功", deptService.selectDeptTreeList(dept));
288
-    }
289
-
290
+}
290 291
 
291 292
 
292 293
     @GetMapping("/deptUserTree")

+ 3 - 0
zwrx-api/src/main/java/api/filter/AuthenticationInterceptor.java

@@ -44,6 +44,8 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
44 44
     @Autowired
45 45
     private  IRoleService roleService;
46 46
 
47
+    @Autowired
48
+    private  IDeptService deptService;
47 49
     @Override
48 50
     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
49 51
 
@@ -136,6 +138,7 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
136 138
                                 uv.setIndexType(role.getIndexType());
137 139
                                 uv.setRoleName(   role.getRoleName());
138 140
                                 uv.setRoleCode(role.getRoleCode());
141
+                                uv.setDept(deptService.getEntity(uv.getDeptId()));
139 142
                                 request.setAttribute("CurrentUser", uv);
140 143
                             }
141 144
                         }

+ 7 - 3
zwrx-entity/src/main/java/api/entity/database/system/User.java

@@ -54,11 +54,15 @@ public class User {
54 54
     @ApiModelProperty("备注说明")
55 55
     private String remark;
56 56
     /** 电话 */
57
-    @ApiModelProperty("电话")
57
+    @ApiModelProperty("固定电话")
58 58
     private String telephone;
59 59
     /** 手机 */
60
-    @ApiModelProperty("手机")
60
+    @ApiModelProperty("手机号码")
61 61
     private String mobile;
62
+
63
+    @ApiModelProperty("手机号码显示中间是***号")
64
+    private String mobileShow;
65
+
62 66
     /** 家庭电话 */
63 67
     @ApiModelProperty("家庭电话")
64 68
     private String homePhone;
@@ -75,7 +79,7 @@ public class User {
75 79
     @ApiModelProperty("注销日期")
76 80
     private Date cancelOn;
77 81
     /** 删除标志 */
78
-    @ApiModelProperty("删除标志 0 正常 1 禁用 2 删除")
82
+    @ApiModelProperty("删除标志 0 正常 1 禁用 2 锁定")
79 83
     private Long deleteFlag;
80 84
     /** APP在线标志 */
81 85
     @ApiModelProperty("APP在线标志")

+ 5 - 0
zwrx-entity/src/main/java/api/entity/input/LoginInput.java

@@ -19,4 +19,9 @@ public class LoginInput {
19 19
     @ApiModelProperty("来源")
20 20
     private String source;
21 21
 
22
+    @ApiModelProperty("分机号")
23
+    private String extensionPhone;
24
+
25
+
26
+
22 27
 }

+ 4 - 1
zwrx-service/src/main/java/api/service/system/IDeptService.java

@@ -16,7 +16,10 @@ public interface IDeptService extends IBaseService<Dept> {
16 16
      * @return 结果
17 17
      */
18 18
     public boolean checkDeptNameUnique(Dept dept);
19
-
19
+    //获取处理部门的树
20
+  public   List<TreeSelect> selectZBDeptTreeList( ) ;
21
+  List<Dept> buildZBDeptTree(List<Dept> depts,List<Dept> allDept);
22
+  List<TreeSelect> buildZBDeptTreeSelect(List<Dept> depts,List<Dept> allDept);
20 23
     /**
21 24
      * 根据ID查询所有子部门(正常状态)
22 25
      *

+ 82 - 0
zwrx-service/src/main/java/api/service/system/impl/DeptServiceImpl.java

@@ -142,6 +142,35 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, Dept> implement
142 142
     }
143 143
 
144 144
 
145
+    @Override
146
+    public List<TreeSelect> selectZBDeptTreeList(  ) {
147
+
148
+
149
+
150
+
151
+
152
+        redisHelper.deleteCache("deptZBTree");
153
+        if (StringHelper.isEmpty(redisHelper.getCache("deptZBTree"))){
154
+            LambdaQueryWrapper<Dept> qw = new LambdaQueryWrapper<>();
155
+            qw.eq(Dept::getDelFlag, "0")
156
+                    .eq(Dept::getState,0).eq(Dept::getParentId,155L).eq(Dept::getIsDept,1L);
157
+
158
+
159
+            LambdaQueryWrapper<Dept> allqw = new LambdaQueryWrapper<>();
160
+            qw.eq(Dept::getDelFlag, "0")
161
+                    .eq(Dept::getState,0).like(Dept::getAncestors,155L);
162
+
163
+
164
+
165
+            List<Dept> depts = this.getList(qw);
166
+            List<TreeSelect> treeSelects = buildZBDeptTreeSelect(depts,this.getList(allqw));
167
+            redisHelper.setCache("deptZBTree", JSON.toJSONString(treeSelects));
168
+        }
169
+        String cache = redisHelper.getCache("deptZBTree");
170
+        List<TreeSelect> treeSelects = JSON.parseArray(cache, TreeSelect.class);
171
+        return treeSelects;
172
+    }
173
+
145 174
 
146 175
 
147 176
     /**
@@ -338,4 +367,57 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, Dept> implement
338 367
         return getChildList(list, t).size() > 0;
339 368
     }
340 369
 
370
+
371
+
372
+    @Override
373
+    public List<TreeSelect> buildZBDeptTreeSelect(List<Dept> depts,List<Dept> allDept) {
374
+        System.out.print("第一步"+depts);
375
+        List<Dept> deptTrees = buildZBDeptTree(depts,allDept);
376
+
377
+        System.out.print("最后"+deptTrees);
378
+        return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
379
+    }
380
+    @Override
381
+    public List<Dept> buildZBDeptTree(List<Dept> depts,List<Dept> allDept) {
382
+        List<Dept> returnList = new ArrayList<Dept>();
383
+        List<Long> tempList = allDept.stream().map(Dept::getDeptId).collect(Collectors.toList());
384
+        System.out.print("第二步"+tempList);
385
+        for (Dept dept : depts) {
386
+            // 如果是顶级节点, 遍历该父节点的所有子节点
387
+
388
+                recursionZBFn(allDept, dept);
389
+                returnList.add(dept);
390
+
391
+        }
392
+        if (returnList.isEmpty()) {
393
+            returnList = depts;
394
+        }
395
+        return returnList;
396
+    }
397
+
398
+    private void recursionZBFn(List<Dept> list, Dept t) {
399
+        // 得到子节点列表
400
+        List<Dept> childList = getZBChildList(list, t);
401
+        t.setChildren(childList);
402
+        for (Dept tChild : childList) {
403
+            if (hasChild(list, tChild)) {
404
+                recursionZBFn(list, tChild);
405
+            }
406
+
407
+        }
408
+    }
409
+    /**
410
+     * 得到子节点列表
411
+     */
412
+    private List<Dept> getZBChildList(List<Dept> list, Dept t) {
413
+        List<Dept> tlist = new ArrayList<Dept>();
414
+        Iterator<Dept> it = list.iterator();
415
+        while (it.hasNext()) {
416
+            Dept n = (Dept) it.next();
417
+            if (!StringHelper.isNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) {
418
+                tlist.add(n);
419
+            }
420
+        }
421
+        return tlist;
422
+    }
341 423
 }

+ 9 - 0
zwrx-util/src/main/java/api/util/helper/DateHelper.java

@@ -139,6 +139,15 @@ public class DateHelper extends DateUtils {
139 139
         return day + "天" + hour + "小时" + min + "分钟";
140 140
     }
141 141
 
142
+    public  static Long calcutemin(Date endDate,Date nowDate){
143
+        long nm = 1000 * 60;
144
+        // long ns = 1000;
145
+        // 获得两个时间的毫秒时间差异
146
+        Long diff = endDate.getTime() - nowDate.getTime();
147
+       Long re=  diff % nm;
148
+       return  re;
149
+    }
150
+
142 151
     /**
143 152
      * 增加 LocalDateTime ==> Date
144 153
      */

+ 1 - 2
zwrx-util/src/main/java/api/util/helper/SecretHelper.java

@@ -76,8 +76,7 @@ public class SecretHelper {
76 76
     private static String AES_KEY = "j8z&j*a$t{w#k}e@";
77 77
     private static String AES_ECB = "AES/ECB/PKCS5Padding";
78 78
     /**
79
-     * 使用AES加密原始字符串.
80
-     *
79
+     * 使用AES加密原始字符串.     *
81 80
      * @param input 原始输入字符串
82 81
      */
83 82
     public static String AesEncrypt(String input) {