Przeglądaj źródła

feature: 学员自助
1.报到完成后更新报到状态

luo.yibo@datuai.com 1 rok temu
rodzic
commit
8c19f085f3

+ 1 - 0
ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteDeptService.java

@@ -73,4 +73,5 @@ public interface RemoteDeptService {
     List<RemoteDeptVo> selectDoingClass(Date doingDate);
 
     RemoteDeptVo selectDeptById(Long deptId);
+    Boolean updateCheckInStatus(Long deptId, Long userId);
 }

+ 15 - 2
ruoyi-modules/ruoyi-backstage/src/main/java/org/dromara/backstage/business/self/TraineeBusiness.java

@@ -143,11 +143,11 @@ public class TraineeBusiness {
             ycTraineeVo.setGuestRoomId(kfOrderVo.getRoomId());
             ycTraineeVo.setOrderIndex(ObjectUtil.isNotEmpty(kfOrderVo.getOrderIndex()) ? kfOrderVo.getOrderIndex() : 0);
 
-            // TODO 2024-11-17 luoyibo 获取房卡信息
+            // 获取房卡信息
             String cardData = getRoomCardData(kfOrderVo);
             ycTraineeVo.setRoomCardData(cardData);
         }
-
+        setCheckInfoStatus(bo, ycTraineeVo);
         // 培训班级信息
         ycTraineeVo.setUserClass(YcVoConvert.ycClassVoConvert(remoteDeptVo));
         // 卡片信息
@@ -217,6 +217,7 @@ public class TraineeBusiness {
         }
         return R.ok();
     }
+
     /**
      * 获取学员对应的客人与团客信息
      * @param bo 学员业务对象
@@ -286,6 +287,11 @@ public class TraineeBusiness {
         return kfOrderService.checkInTeamByBo(remoteBo);
     }
 
+    /**
+     * 获取房卡的写卡信息
+     * @param orderVo 订单视图
+     * @return 写卡数据
+     */
     private String getRoomCardData(RemoteOrderVo orderVo) {
         RoomCardBo roomCardBo = new RoomCardBo();
         roomCardBo.setStartTime(DateUtil.toLocalDateTime(orderVo.getCheckinDate()));
@@ -302,4 +308,11 @@ public class TraineeBusiness {
             return "";
         }
     }
+
+    private void setCheckInfoStatus(YcTraineeBo bo, YcTraineeVo ycTraineeVo){
+        Boolean result = remoteDeptService.updateCheckInStatus(Long.valueOf(bo.getDeptId()),Long.valueOf(bo.getUserId()));
+        if(result){
+            ycTraineeVo.setCheckinState(1);
+        }
+    }
 }

+ 5 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/dubbo/RemoteDeptServiceImpl.java

@@ -191,4 +191,9 @@ public class RemoteDeptServiceImpl implements RemoteDeptService {
         }
         return null;
     }
+
+    @Override
+    public Boolean updateCheckInStatus(Long deptId, Long userId) {
+        return sysDeptService.updateCheckInStatus(deptId, userId);
+    }
 }

+ 2 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysDeptService.java

@@ -186,4 +186,6 @@ public interface ISysDeptService {
      * @return 班级列表
      */
     List<SysDeptVo> selectDoingClass(Date doingDate);
+
+    Boolean updateCheckInStatus(Long deptId, Long userId);
 }

+ 2 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/IUserDeptService.java

@@ -74,4 +74,6 @@ public interface IUserDeptService {
 
     Boolean deleteByUserIds(Collection<Long> userIds);
 
+    Boolean setCheckInStatus(Long deptId, Long userId);
+
 }

+ 7 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java

@@ -28,6 +28,7 @@ import org.dromara.system.mapper.SysDeptMapper;
 import org.dromara.system.mapper.SysRoleMapper;
 import org.dromara.system.mapper.SysUserMapper;
 import org.dromara.system.service.ISysDeptService;
+import org.dromara.system.service.IUserDeptService;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
@@ -49,6 +50,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
     private final SysDeptMapper baseMapper;
     private final SysRoleMapper roleMapper;
     private final SysUserMapper userMapper;
+    private final IUserDeptService userDeptService;
 
     /**
      * 查询部门管理数据
@@ -425,4 +427,9 @@ public class SysDeptServiceImpl implements ISysDeptService {
         return baseMapper.selectVoList(new LambdaQueryWrapper<SysDept>()
             .le(SysDept::getCheckDate, doingDate).ge(SysDept::getEndDate, doingDate));
     }
+
+    @Override
+    public Boolean updateCheckInStatus(Long deptId, Long userId) {
+        return userDeptService.setCheckInStatus(deptId, userId);
+    }
 }

+ 14 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/UserDeptServiceImpl.java

@@ -1,5 +1,6 @@
 package org.dromara.system.service.impl;
 
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import org.dromara.common.core.utils.MapstructUtils;
@@ -192,4 +193,17 @@ public class UserDeptServiceImpl implements IUserDeptService {
             .in(UserDept::getUserId, userIds)
             .eq(UserDept::getMainDept, 'N'))>0;
     }
+
+    @Override
+    public Boolean setCheckInStatus(Long deptId, Long userId) {
+        LambdaUpdateWrapper<UserDept> luw = new LambdaUpdateWrapper<>();
+        luw.eq(UserDept::getDeptId, deptId);
+        luw.eq(UserDept::getUserId, userId);
+        luw.eq(UserDept::getMainDept, "Y");
+        luw.eq(UserDept::getDelFlag, "0");
+        luw.set(UserDept::getCheckDate, DateUtil.date());
+        luw.set(UserDept::getCheckStatus, "1");
+
+        return baseMapper.update(null, luw) > 0;
+    }
 }