Переглянути джерело

Merge remote-tracking branch 'origin/V1' into V1

zhengqiang 5 роки тому
батько
коміт
24d1629620

+ 6 - 4
common/src/main/java/com/jpsoft/smart/modules/lapi/service/impl/LapiServiceImpl.java

@@ -143,11 +143,12 @@ public class LapiServiceImpl implements ILapiService {
                     map3.put("FaceID", personInfo.getId());
                     map3.put("Name", personInfo.getId() + ".jpg");
                 } else {
-                    map1.put("ImageNum", 0);
+                    throw new Exception("照片不存在");
+                    /*map1.put("ImageNum", 0);
                     map3.put("FaceID", 0);
                     map3.put("Name", "");
                     map3.put("Size", 0);
-                    map3.put("Data", "");
+                    map3.put("Data", "");*/
                 }
 
                 //照片base64长度
@@ -272,11 +273,12 @@ public class LapiServiceImpl implements ILapiService {
                         throw new Exception("人员照片大小限定为10k~512k");
                     }
                 } else {
-                    map1.put("ImageNum", 0);
+                    throw new Exception("照片不存在");
+                   /* map1.put("ImageNum", 0);
                     map3.put("FaceID", 0);
                     map3.put("Name", "");
                     map3.put("Size", 0);
-                    map3.put("Data", "");
+                    map3.put("Data", "");*/
                 }
 
                 List listMap3 = new ArrayList();

+ 1 - 1
web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonDeviceRelationController.java

@@ -604,7 +604,7 @@ public class PersonDeviceRelationController {
                 //查找人脸ID
                 faceDbId = lapiService.getFaceDbId(di,personInfo.getCompanyName());
                 //查询人员是否成功写入设备
-                isWrite = lapiService.isSuccessAddPerson(personInfo,di,faceDbId);
+                isWrite = lapiService.isPersonImageExist(personInfo,di,faceDbId);
 
             }catch (Exception e){
                 isWrite = false;

+ 44 - 0
web/src/main/java/com/jpsoft/smart/modules/sys/controller/UserController.java

@@ -319,4 +319,48 @@ public class UserController {
 
         return msgResult;
     }
+
+
+    @ApiOperation(value="登录用户修改密码")
+    @PostMapping("changeLoginPassword")
+    public MessageResult<Integer> changeLoginPassword(
+            @RequestParam(name="oldPassword",defaultValue = "") String oldPassword,
+            @RequestParam(name="newPassword",defaultValue = "") String newPassword,
+            @RequestAttribute String subject) {
+
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            DES3 des3 = new DES3();
+            User user = userService.get(subject);
+
+            oldPassword = des3.encrypt(jwtSecret, oldPassword);
+            //不相同
+            if(!user.getPassword().equals(oldPassword)){
+                throw new Exception("旧密码输入错误");
+            }
+
+            user.setPassword(des3.encrypt(jwtSecret, newPassword));
+            user.setUpdateBy(subject);
+            user.setUpdateTime(new Date());
+
+            int affectCount = userService.update(user);
+
+            if(affectCount>0){
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            }
+            else{
+                msgResult.setResult(false);
+                msgResult.setMessage("修改失败!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }