Przeglądaj źródła

20221013_sun门户新增老人机构预约相关

15143018065 1 rok temu
rodzic
commit
fae3d144c1

+ 15 - 0
ruoyi-modules/mz-business-lrgl/src/main/java/com/ruoyi/business/service/impl/ZwywLrJgyyServiceImpl.java

@@ -3,8 +3,14 @@ package com.ruoyi.business.service.impl;
 import com.ruoyi.business.domain.ZwywLrJgyy;
 import com.ruoyi.business.mapper.ZwywLrJgyyMapper;
 import com.ruoyi.business.service.IZwywLrJgyyService;
+import com.ruoyi.common.core.constant.SecurityConstants;
+import com.ruoyi.common.core.context.SecurityContextHolder;
 import com.ruoyi.common.core.exception.ServiceException;
 import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.common.core.utils.uuid.IdUtils;
+import com.ruoyi.system.api.RemoteUserService;
+import com.ruoyi.system.api.model.LoginUser;
+import io.seata.common.util.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -24,6 +30,9 @@ public class ZwywLrJgyyServiceImpl implements IZwywLrJgyyService
     @Autowired
     private ZwywLrJgyyMapper zwywLrJgyyMapper;
 
+    @Autowired
+    private RemoteUserService userService;
+
     /**
      * 查询老人机构预约
      *
@@ -81,6 +90,12 @@ public class ZwywLrJgyyServiceImpl implements IZwywLrJgyyService
     @Override
     public int insertPortalZwywLrJgyy(ZwywLrJgyy zwywLrJgyy)
     {
+        if (CollectionUtils.isNotEmpty(zwywLrJgyyMapper.selectPortalZwywLrJgyyList(zwywLrJgyy))) {
+            throw new ServiceException("您已经在该机构预约");
+        }
+        LoginUser user = userService.getUserInfo("admin", SecurityConstants.INNER).getData();
+        SecurityContextHolder.set(SecurityConstants.LOGIN_USER, user);
+        zwywLrJgyy.setId(IdUtils.simpleUUID());
         zwywLrJgyy.setCreateAreaCode(zwywLrJgyy.getLrjzdzxzqh());
         return zwywLrJgyyMapper.insertPortalZwywLrJgyy(zwywLrJgyy);
     }

+ 15 - 0
ruoyi-modules/mz-business-lrgl/src/main/java/com/ruoyi/business/service/impl/ZwywLrSlhgzServiceImpl.java

@@ -3,9 +3,15 @@ package com.ruoyi.business.service.impl;
 import com.ruoyi.business.domain.ZwywLrSlhgz;
 import com.ruoyi.business.mapper.ZwywLrSlhgzMapper;
 import com.ruoyi.business.service.IZwywLrSlhgzService;
+import com.ruoyi.common.core.constant.SecurityConstants;
+import com.ruoyi.common.core.context.SecurityContextHolder;
 import com.ruoyi.common.core.exception.ServiceException;
 import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
+import com.ruoyi.system.api.RemoteUserService;
+import com.ruoyi.system.api.model.LoginUser;
+import io.seata.common.util.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -24,6 +30,9 @@ public class ZwywLrSlhgzServiceImpl implements IZwywLrSlhgzService
     @Autowired
     private ZwywLrSlhgzMapper zwywLrSlhgzMapper;
 
+    @Autowired
+    private RemoteUserService userService;
+
     /**
      * 查询适老化改造
      *
@@ -79,7 +88,13 @@ public class ZwywLrSlhgzServiceImpl implements IZwywLrSlhgzService
     @Override
     public int insertPortalZwywLrSlhgz(ZwywLrSlhgz zwywLrSlhgz)
     {
+        if (CollectionUtils.isNotEmpty(zwywLrSlhgzMapper.selectPortalZwywLrSlhgzList(zwywLrSlhgz))) {
+            throw new ServiceException("您已经申请适老化改造");
+        }
+        LoginUser user = userService.getUserInfo("admin", SecurityConstants.INNER).getData();
+        SecurityContextHolder.set(SecurityConstants.LOGIN_USER, user);
         zwywLrSlhgz.setTbrSzqh(zwywLrSlhgz.getZfdz());
+        zwywLrSlhgz.setId(IdUtils.simpleUUID());
         return zwywLrSlhgzMapper.insertPortalZwywLrSlhgz(zwywLrSlhgz);
     }
 

+ 1 - 2
ruoyi-modules/mz-portal/src/main/java/com/ruoyi/portal/controller/ZwywLrJgyyController.java

@@ -7,7 +7,6 @@ import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.TableDataInfo;
 import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
-import com.ruoyi.system.validate.group.AddGroup;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -52,7 +51,7 @@ public class ZwywLrJgyyController extends BaseController
      */
     @Log(title = "老人机构预约", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated({AddGroup.class}) @RequestBody ZwywLrJgyy zwywLrJgyy)
+    public AjaxResult add(@Validated @RequestBody ZwywLrJgyy zwywLrJgyy)
     {
         return toAjax(zwywLrJgyyService.insertPortalZwywLrJgyy(zwywLrJgyy),zwywLrJgyy.getId());
     }