فهرست منبع

小程序接口

chenliqu 2 سال پیش
والد
کامیت
4b82ce9dc4

+ 16 - 12
ruoyi-modules/znyl-resource/src/main/java/com/ruoyi/resource/service/impl/ZnylJhdxServiceImpl.java

@@ -138,9 +138,14 @@ public class ZnylJhdxServiceImpl implements IZnylJhdxService
         if (userId == 1) {
             throw new CustomException("超级管理员用户不允许添加监护对象信息!");
         } else {
-            ZnylJhdx jhdx = znylJhdxMapper.selectByAccount(znylJhdx.getUserid());
-            if(null != jhdx){
-                throw new CustomException("用户账号已存在,请重新填写!");
+//            ZnylJhdx jhdx = znylJhdxMapper.selectByAccount(znylJhdx.getUserid());
+//            if(null != jhdx){
+//                throw new CustomException("用户账号已存在,请重新填写!");
+//            }
+            List<ZnylJhrxx> list = znylJhrxxMapper.userLogin(znylJhdx.getUserid(), null, null, null);
+            List<ZnylJhdx> jhdxList = znylJhdxMapper.userLogin(znylJhdx.getUserid(), null, null, null);
+            if (!list.isEmpty() || !jhdxList.isEmpty()) {
+                throw new CustomException("该用户账号已注册,请重新填写!");
             } else {
                 ZnylYgry ygry = znylYgryMapper.selectByAccount(SecurityUtils.getUsername());// 运管
                 if (null != ygry && null != ygry.getName()) {
@@ -207,12 +212,6 @@ public class ZnylJhdxServiceImpl implements IZnylJhdxService
     public ZnylJhdx selectJhdxByOpenid(String openId){
         if(StringUtils.isNotNull(openId) && StringUtils.isNotEmpty(openId)){
             return this.selectZnylJhdxByOpenId(openId);
-//            List<ZnylJhdx> list = znylJhdxMapper.userLogin(null,null,null,openId);
-//            if(!list.isEmpty() && list.size() == 1){
-//                return selectZnylJhdxById(list.get(0).getId());
-//            }else{
-//                throw new CustomException("当前用户还未绑定openId值,请重新登录。");
-//            }
         } else {
             throw new CustomException("openId值为空");
         }
@@ -260,9 +259,14 @@ public class ZnylJhdxServiceImpl implements IZnylJhdxService
     @Override
     public int userRegister(String loginName, String password,Long accountId){
 
-        List<ZnylJhdx> userListByLoginName = znylJhdxMapper.userInfo(loginName,null,accountId);
-        if(userListByLoginName.size() > 0){
-            throw new CustomException("该用户账号已注册,请重新填写");
+//        List<ZnylJhdx> userListByLoginName = znylJhdxMapper.userInfo(loginName,null,accountId);
+//        if(userListByLoginName.size() > 0){
+//            throw new CustomException("该用户账号已注册,请重新填写");
+//        }
+        List<ZnylJhrxx> list = znylJhrxxMapper.userLogin(loginName, null, null, null);
+        List<ZnylJhdx> jhdxList = znylJhdxMapper.userLogin(loginName, null, null, null);
+        if (!list.isEmpty() || !jhdxList.isEmpty()) {
+            throw new CustomException("该用户账号已注册,请重新填写!");
         }
         ZnylKhzh khzh = znylKhzhMapper.selectZnylKhzhById(accountId);
         if (ObjectUtils.isNotEmpty(khzh)) {

+ 10 - 3
ruoyi-modules/znyl-resource/src/main/java/com/ruoyi/resource/service/impl/ZnylJhrxxServiceImpl.java

@@ -8,8 +8,10 @@ import com.ruoyi.common.core.exception.CustomException;
 import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.core.utils.SecurityUtils;
 import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.resource.domain.ZnylJhdx;
 import com.ruoyi.resource.domain.ZnylKhzh;
 import com.ruoyi.resource.domain.ZnylYgry;
+import com.ruoyi.resource.mapper.ZnylJhdxMapper;
 import com.ruoyi.resource.mapper.ZnylKhzhMapper;
 import com.ruoyi.resource.mapper.ZnylYgryMapper;
 import com.ruoyi.system.api.RemoteDeptJlService;
@@ -32,6 +34,9 @@ public class ZnylJhrxxServiceImpl implements IZnylJhrxxService
     @Autowired
     private ZnylJhrxxMapper znylJhrxxMapper;
 
+    @Autowired
+    private ZnylJhdxMapper znylJhdxMapper;
+
     @Autowired
     private ZnylKhzhMapper znylKhzhMapper;
 
@@ -117,8 +122,9 @@ public class ZnylJhrxxServiceImpl implements IZnylJhrxxService
             throw new CustomException("超级管理员用户不允许添加监护人信息!");
         } else {
             if(StringUtils.isNotNull(znylJhrxx.getUserid()) && StringUtils.isNotEmpty(znylJhrxx.getUserid())){
-                List<ZnylJhrxx> list = znylJhrxxMapper.userLogin(znylJhrxx.getUserid(),null,null,null);
-                if(!list.isEmpty()){
+                List<ZnylJhrxx> list = znylJhrxxMapper.userLogin(znylJhrxx.getUserid(), null, null, null);
+                List<ZnylJhdx> jhdxList = znylJhdxMapper.userLogin(znylJhrxx.getUserid(), null, null, null);
+                if (!list.isEmpty() || !jhdxList.isEmpty()) {
                     throw new CustomException("用户账号已注册!");
                 } else {
                     ZnylYgry ygry = znylYgryMapper.selectByAccount(SecurityUtils.getUsername());// 运管
@@ -232,7 +238,8 @@ public class ZnylJhrxxServiceImpl implements IZnylJhrxxService
     {
         if(StringUtils.isNotNull(znylJhrxx.getUserid()) && StringUtils.isNotEmpty(znylJhrxx.getUserid())) {
             List<ZnylJhrxx> list = znylJhrxxMapper.userLogin(znylJhrxx.getUserid(), null, null, null);
-            if (!list.isEmpty()) {
+            List<ZnylJhdx> jhdxList = znylJhdxMapper.userLogin(znylJhrxx.getUserid(), null, null, null);
+            if (!list.isEmpty() || !jhdxList.isEmpty()) {
                 throw new CustomException("用户账号已注册!");
             }else {
                 return znylJhrxxMapper.insertZnylJhrxx(znylJhrxx);

+ 37 - 16
ruoyi-modules/znyl-resource/src/main/java/com/ruoyi/resource/service/impl/ZnylYjzcxxServiceImpl.java

@@ -84,21 +84,29 @@ public class ZnylYjzcxxServiceImpl implements IZnylYjzcxxService
         } else {
             String devicenum = znylYjzcxx.getDevicenum();
             if (null != devicenum && !"".equals(devicenum)) {
-                ZnylYjqd yjqd = znylYjqdMapper.selectZnylYjqdByCode(devicenum);
-                ZnylYgry ygry = znylYgryMapper.selectByAccount(SecurityUtils.getUsername());// 运管
-                if (null != ygry && null != ygry.getId() && null != yjqd && null != yjqd.getId()) {
-                    znylYjzcxx.setAccountid(ygry.getAccountid());
-                    znylYjzcxx.setProductid(yjqd.getId());
-                    znylYjzcxx.setRegdatetime(DateUtils.getNowDate());
-                    znylYjzcxx.setRegpersonid(ygry.getId());
-                    znylYjzcxx.setRegperson(ygry.getName());
-                    znylYjzcxx.setRegpersontype(ygry.getTypecode());
-                    znylYjzcxx.setCreateTime(DateUtils.getNowDate());
-                    znylYjzcxx.setCreateBy(SecurityUtils.getUsername());
-                    znylYjzcxx.setCreateUserId(SecurityUtils.getUserId());
-                    return znylYjzcxxMapper.insertZnylYjzcxx(znylYjzcxx);
+                // 重复绑定判断
+                ZnylYjzcxx yjzcxx = new ZnylYjzcxx();
+                yjzcxx.setDevicenum(znylYjzcxx.getDevicenum());
+                List<ZnylYjzcxx> bdList = znylYjzcxxMapper.selectZnylYjzcxxList(yjzcxx);
+                if (bdList.size() > 0) {
+                    ZnylYjqd yjqd = znylYjqdMapper.selectZnylYjqdByCode(devicenum);
+                    ZnylYgry ygry = znylYgryMapper.selectByAccount(SecurityUtils.getUsername());// 运管
+                    if (null != ygry && null != ygry.getId() && null != yjqd && null != yjqd.getId()) {
+                        znylYjzcxx.setAccountid(ygry.getAccountid());
+                        znylYjzcxx.setProductid(yjqd.getId());
+                        znylYjzcxx.setRegdatetime(DateUtils.getNowDate());
+                        znylYjzcxx.setRegpersonid(ygry.getId());
+                        znylYjzcxx.setRegperson(ygry.getName());
+                        znylYjzcxx.setRegpersontype(ygry.getTypecode());
+                        znylYjzcxx.setCreateTime(DateUtils.getNowDate());
+                        znylYjzcxx.setCreateBy(SecurityUtils.getUsername());
+                        znylYjzcxx.setCreateUserId(SecurityUtils.getUserId());
+                        return znylYjzcxxMapper.insertZnylYjzcxx(znylYjzcxx);
+                    } else {
+                        throw new CustomException("用户信息获取失败!");
+                    }
                 } else {
-                    throw new CustomException("用户信息获取失败!");
+                    throw new CustomException("硬件已绑定!");
                 }
             } else {
                 throw new CustomException("硬件编号有误!");
@@ -147,7 +155,20 @@ public class ZnylYjzcxxServiceImpl implements IZnylYjzcxxService
     @Override
     public int insertAppYjzcxx(ZnylYjzcxx znylYjzcxx)
     {
-        znylYjzcxx.setCreateTime(DateUtils.getNowDate());
-        return znylYjzcxxMapper.insertZnylYjzcxx(znylYjzcxx);
+        String devicenum = znylYjzcxx.getDevicenum();
+        if (null != devicenum && !"".equals(devicenum)) {
+            // 重复绑定判断
+            ZnylYjzcxx yjzcxx = new ZnylYjzcxx();
+            yjzcxx.setDevicenum(znylYjzcxx.getDevicenum());
+            List<ZnylYjzcxx> bdList = znylYjzcxxMapper.selectZnylYjzcxxList(yjzcxx);
+            if (bdList.size() > 0) {
+                znylYjzcxx.setCreateTime(DateUtils.getNowDate());
+                return znylYjzcxxMapper.insertZnylYjzcxx(znylYjzcxx);
+            } else {
+                throw new CustomException("硬件已绑定!");
+            }
+        } else {
+            throw new CustomException("硬件编号有误!");
+        }
     }
 }