gongdecai преди 3 години
родител
ревизия
fbee1af5e6

+ 12 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/CommonUserController.java

@@ -191,6 +191,18 @@ public class CommonUserController {
         return commonUserService.findHisPageNoticeTasks(noticeTask);
     }
 
+    /**
+     * 查验app 账号
+     *
+     * @param commonUser
+     * @return
+     * @throws ServiceException
+     */
+    @PostMapping("/api/checkApp")
+    public String checkApp(CommonUser commonUser) throws ServiceException {
+        return commonUserService.checkApp(commonUser);
+    }
+
 
 
 }

+ 3 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ICommonUserService.java

@@ -74,4 +74,7 @@ public interface ICommonUserService extends IService<CommonUser> {
     Account login(Account user, String veriCode);
 
     Page<NoticeTaskInfo> findHisPageNoticeTasks(NoticeTaskInfo noticeTask);
+
+
+    String checkApp(CommonUser commonUser) throws ServiceException;
 }

+ 25 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/CommonUserServiceImpl.java

@@ -175,6 +175,31 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
     }
 
 
+    /**
+     * 查验app 账号
+     *
+     * @param commonUser
+     * @return
+     * @throws ServiceException
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String checkApp(CommonUser commonUser) throws ServiceException {
+        // 查询pc账号
+        CommonStaff commonStaff = commonStaffService.selectOne(new EntityWrapper<CommonStaff>()
+                .eq("staff_mobile_phone", commonUser.getPhone()).eq("enabled", "1"));
+        //  查询app 账号
+        CommonUser user = this.selectOne(new EntityWrapper<CommonUser>().eq("phone",commonUser.getPhone()));
+        if(user != null){
+            this.deleteById(user.getId());
+            user.setId(commonStaff.getStaffId());
+            this.insert(user);
+            return "OK";
+        }
+        return "NG";
+    }
+
+
     /**
      * 重置密码
      *

+ 2 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/CommonUserMapper.xml

@@ -14,6 +14,8 @@
             common_user
         WHERE
             phone = #{phone} AND `password` = #{cryptPassword}
+            and
+            delete_flag ='0'
     </select>