Jelajahi Sumber

feature: 自助服务
1.教职工自助卡处理

luoyb 1 tahun lalu
induk
melakukan
7c8e5bb7e1

+ 4 - 0
ruoyi-api/ruoyi-api-backstage/src/main/java/org/dromara/backstage/api/domain/bo/RemoteUserAccountBo.java

@@ -118,4 +118,8 @@ public class RemoteUserAccountBo implements Serializable {
      * 用户身份(0=内部用户 1=老师 2=学生 3=家长  4=其他人员)
      */
     private String category;
+    /**
+     * 用户性别(0男 1女 2未知)
+     */
+    private String sex;
 }

+ 16 - 8
ruoyi-modules/ruoyi-backstage/src/main/java/org/dromara/backstage/business/self/TraineeBusiness.java

@@ -1,5 +1,6 @@
 package org.dromara.backstage.business.self;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import lombok.RequiredArgsConstructor;
@@ -64,8 +65,8 @@ public class TraineeBusiness {
 
     public R<YcTraineeVo> getTraineeRegisterInfo(YcTraineeBo bo, Date doingDate) {
         PtUserAccountBo accountBo = new PtUserAccountBo().setPhone(bo.getMobilePhone())
-                                        .setCategory(bo.getCategory())
-                                        .setIdNumber(bo.getIdNumber());
+            .setCategory(bo.getCategory())
+            .setIdNumber(bo.getIdNumber());
         YcTraineeVo traineeVo = userAccountService.selectTraineeByBo(accountBo, doingDate);
         if (ObjectUtil.isEmpty(traineeVo)) {
             return R.fail("没有您的培训信息");
@@ -89,14 +90,16 @@ public class TraineeBusiness {
             traineeVo.setRoomCode(kfOrderVo.getRoomCode());
             traineeVo.setRoomId(kfOrderVo.getRoomId());
             traineeVo.setGuestRoomId(kfOrderVo.getRoomId());
-            traineeVo.setOrderIndex(kfOrderVo.getOrderIndex());
+            traineeVo.setOrderIndex(ObjectUtil.isNotEmpty(kfOrderVo.getOrderIndex()) ? kfOrderVo.getOrderIndex() : 0);
         }
         return R.ok(traineeVo);
     }
 
 
     public R<ErrorInfo> registerTrainee(YcTraineeBo bo, YcTraineeVo traineeVo) {
-        Map<String,Long> map = getGuestInfo(bo);
+        PtUserAccountBo accountBo = new PtUserAccountBo().setUserId(Long.valueOf(bo.getUserId()));
+        YcTraineeVo ycTraineeVo = userAccountService.selectTraineeByBo(accountBo, null);
+        Map<String, Long> map = getGuestInfo(bo);
         // 1.如果当前人员没有住房,则安排房间
         String roomCode = bo.getRoomCode();
         if (ObjectUtil.isEmpty(roomCode)) {
@@ -108,11 +111,15 @@ public class TraineeBusiness {
             // TODO 2024-11-17 luoyibo 办理住宿,获取房卡信息
         }
 
+        // 培训班级信息
+        RemoteDeptVo remoteDeptVo = remoteDeptService.selectDeptById(Long.valueOf(bo.getDeptId()));
+        ycTraineeVo.setUserClass(YcVoConvert.ycClassVoConvert(remoteDeptVo));
+        BeanUtil.copyProperties(ycTraineeVo, traineeVo);
         // 设置其它辅助信息
         return R.ok();
     }
 
-    public Map<String,Long> getGuestInfo(YcTraineeBo bo) {
+    public Map<String, Long> getGuestInfo(YcTraineeBo bo) {
         PtUserAccountVo accountVo = userAccountService.queryById(Long.valueOf(bo.getUserId()));
         RemoteDeptVo remoteDeptVo = remoteDeptService.selectDeptById(Long.valueOf(bo.getDeptId()));
         String userOtherId = accountVo.getOtherId();
@@ -129,7 +136,7 @@ public class TraineeBusiness {
         return map;
     }
 
-    public List<RemoteDeptVo> selectDoingClass(Date doingDate){
+    public List<RemoteDeptVo> selectDoingClass(Date doingDate) {
         return remoteDeptService.selectDoingClass(doingDate);
     }
 
@@ -144,15 +151,16 @@ public class TraineeBusiness {
 
     /**
      * 给学员分配房间
+     *
      * @param bo 报到学员业务对象
      */
     private void assignRoomToTrainee(YcTraineeBo bo) {
         Long teamId = bo.getTeamId();
         String key = CacheNames.CLASS_ROOM + "_" + teamId;
-        if (RedisUtils.getCacheObject(key)!=null) {
+        if (RedisUtils.getCacheObject(key) != null) {
             LinkedBlockingQueue<String> concurrentLinkedQueue = RedisUtils.getCacheObject(key);
             String roomCode = concurrentLinkedQueue.poll();
-            if(ObjectUtil.isNotEmpty(roomCode)){
+            if (ObjectUtil.isNotEmpty(roomCode)) {
                 bo.setRoomCode(roomCode);
                 RedisUtils.setCacheObject(key, concurrentLinkedQueue);
             }

+ 10 - 25
ruoyi-modules/ruoyi-backstage/src/main/java/org/dromara/backstage/controller/self/TraineeController.java

@@ -2,7 +2,6 @@ package org.dromara.backstage.controller.self;
 
 import cn.hutool.core.codec.Base64;
 import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.dromara.backstage.business.accouunt.UserAccountBusiness;
@@ -20,7 +19,6 @@ import org.dromara.common.redis.utils.RedisUtils;
 import org.dromara.system.api.domain.vo.RemoteDeptVo;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Date;
 import java.util.List;
 import java.util.concurrent.LinkedBlockingQueue;
 
@@ -48,17 +46,10 @@ public class TraineeController {
      * @param mobile 手机号
      * @return 教职工信息
      */
-    @GetMapping("/api/v1/mobile/{mobile}/{checkinDate}")
-    public ReturnResult getUserByMobile(@PathVariable("mobile") String mobile, @PathVariable("checkinDate") String checkinDate) {
-        if (StrUtil.isEmpty(mobile)) {
-            return ReturnResult.failure(ResultCodeEnum.PARAM_IS_BLANK, "手机号不能为空");
-        }
-        if (StrUtil.isEmpty(checkinDate)) {
-            return ReturnResult.failure(ResultCodeEnum.PARAM_IS_BLANK, "报到日期不能为空");
-        }
-        // String dePhone = Base64.decodeStr(mobile);
+    @GetMapping("/api/v1/mobile/{mobile}/{checkInDate}")
+    public ReturnResult getUserByMobile(@PathVariable("mobile") String mobile, @PathVariable("checkInDate") String checkInDate) {
         YcTraineeBo bo = new YcTraineeBo().setMobilePhone(mobile).setCategory("2");
-        R<YcTraineeVo> result = traineeBusiness.getTraineeRegisterInfo(bo, DateUtil.parseDate(checkinDate));
+        R<YcTraineeVo> result = traineeBusiness.getTraineeRegisterInfo(bo, DateUtil.parseDate(checkInDate));
         if (R.isError(result)) {
             return ReturnResult.failure(ResultCodeEnum.DATA_NOT_FOUND, "没有您的培训信息,请和班主任联系");
         }
@@ -71,18 +62,10 @@ public class TraineeController {
      * @param identity 身份证号
      * @return 学员信息
      */
-    @GetMapping("/api/v1/identity/{identity}/{checkinDate}")
-    public ReturnResult getUserByIdentity(@PathVariable("identity") String identity, @PathVariable("checkinDate") String checkinDate) {
-        if (StrUtil.isEmpty(identity)) {
-            return ReturnResult.failure(ResultCodeEnum.PARAM_IS_BLANK, "身份证号不能为空");
-        }
-        if (StrUtil.isEmpty(checkinDate)) {
-            return ReturnResult.failure(ResultCodeEnum.PARAM_IS_BLANK, "报到日期不能为空");
-        }
-        String deIdentity = Base64.decodeStr(identity);
-        YcTraineeBo bo = new YcTraineeBo().setIdNumber(deIdentity)
-                             .setCategory("2");
-        R<YcTraineeVo> result = traineeBusiness.getTraineeRegisterInfo(bo, DateUtil.parseDate(checkinDate));
+    @GetMapping("/api/v1/identity/{identity}/{checkInDate}")
+    public ReturnResult getUserByIdentity(@PathVariable("identity") String identity, @PathVariable("checkInDate") String checkInDate) {
+        YcTraineeBo bo = new YcTraineeBo().setIdNumber(identity).setCategory("2");
+        R<YcTraineeVo> result = traineeBusiness.getTraineeRegisterInfo(bo, DateUtil.parseDate(checkInDate));
         if (R.isError(result)) {
             return ReturnResult.failure(ResultCodeEnum.DATA_NOT_FOUND, "没有您的培训信息,请和班主任联系");
         }
@@ -117,14 +100,16 @@ public class TraineeController {
 
     /**
      * 获取正在进行的班级
+     *
      * @param doingDate 进行时间
      * @return 班级列表
      */
     @GetMapping("/api/v1/doing/class/{doingDate}")
-    public ReturnResult selectDoingClass(@PathVariable("doingDate") String doingDate){
+    public ReturnResult selectDoingClass(@PathVariable("doingDate") String doingDate) {
         List<RemoteDeptVo> list = traineeBusiness.selectDoingClass(DateUtil.parseDate(doingDate));
         return ReturnResult.success(list);
     }
+
     @PostMapping("/api/v1/lock/room")
     public ReturnResult lockRoomTest() {
         LinkedBlockingQueue<String> concurrentLinkedQueue = new LinkedBlockingQueue<>();

+ 4 - 1
ruoyi-modules/ruoyi-backstage/src/main/resources/mapper/payment/PtUserAccountMapper.xml

@@ -79,7 +79,7 @@
     </select>
     <select id="selectTraineeByBo" resultType="org.dromara.backstage.domain.vo.yc.YcTraineeVo">
         SELECT tpua.user_id as userId,tpuA.real_name as userXm,tpuA.user_numb as userNumb,(CASE tpua.sex WHEN '1' THEN '男' WHEN '2' THEN '女' ELSE '未知' END) as sexName
-             ,tpuA.phone as mobilePhone,tpuA.id_number as idNmber
+             ,tpuA.phone as mobilePhone,tpuA.id_number as idNumber
              ,tpuA.category,tpuA.card_type as userCardTypeId,tpuA.lifespan as userExpiryDate,tsd.dept_id as deptId,tsd.dept_name as deptName
              ,tsd.check_Date as checkinDate,tsd.end_date as checkoutDate,(CASE a.main_dept WHEN 'Y' THEN 1 ELSE 0 END ) as isMainDept,
               a.check_status as checkinState,a.pay_status as payStatus,tpuA.other_id as otherId
@@ -90,6 +90,9 @@
             <if test="bo.phone != null and bo.phone != ''">
                 and tpuA.phone = #{bo.phone}
             </if>
+            <if test="bo.userId != null and bo.userId != ''">
+                and tpuA.user_id = #{bo.userId}
+            </if>
             <if test="bo.idNumber != null and bo.idNumber != ''">
                 and tpuA.id_number = #{bo.idNumber}
             </if>

+ 6 - 5
ruoyi-modules/ruoyi-hotel/src/main/resources/mapper/hotel/business/KfOrderMapper.xml

@@ -75,12 +75,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </where>
     </select>
     <select id="selectByBo" resultType="org.dromara.hotel.api.domain.vo.RemoteOrderVo">
-        SELECT tkg.id AS guestId, tkg.name,tkg.sex,tkg.id_card as idCard,tkg.phone,tkg.other_id as otherId,tko.team_id as teamId
-        , tko.room_code AS roomCode, tpr.room_id AS roomId, tko.start_time AS checkinDate
-        , tko.end_time AS checkoutDate, tko.order_status as orderStatus,tko.order_type as orderType,tko.order_index as orderIndex
+        SELECT tkg.id AS guestId, tkg.name, tkg.sex, tkg.id_card AS idCard, tkg.phone, tkg.other_id AS otherId, tkgtr.team_id AS teamId,
+        tko.room_code AS roomCode, tpr.room_id AS roomId, tko.start_time AS checkinDate, tko.end_time AS checkoutDate,
+        tko.order_status AS orderStatus, tko.order_type AS orderType, tko.order_index AS orderIndex
         FROM t_kf_guest tkg
-                 LEFT JOIN t_kf_order tko ON tko.guest_id=tkg.id and tko.order_status in ('1','3')
-                 INNER JOIN t_pt_room tpr ON tpr.room_code=tko.room_code
+                LEFT JOIN t_kf_guest_team_r tkgtr ON tkgtr.guest_id=tkg.id AND tkgtr.del_flag=0
+                LEFT JOIN t_kf_order tko ON tko.guest_id=tkg.id and tko.order_status in ('1','3')
+                LEFT JOIN t_pt_room tpr ON tpr.room_code=tko.room_code
         <where>
             <if test="bo.otherId != null and  bo.otherId != ''">
                 and tkg.other_id = #{bo.otherId}

+ 56 - 56
ruoyi-server/ruoyi-server-sync/src/main/java/org/dromara/server/sync/service/SyncTrainService.java

@@ -91,67 +91,67 @@ public class SyncTrainService {
      * @return Boolean
      */
     public Boolean syncTrainee() {
-        HttpRequest req = CreateHttpRequest.createRequest();
-        req.body(getQueryBodyForTrainee());
-        // 获取到培训学员数据
-        try (HttpResponse res = req.execute()) {
-            SyncFullDataBo traineeDataBo = JSONUtil.toBean(res.body(), SyncFullDataBo.class);
-            List<ResourcePerson> resourcePersonList = getResourcePeople(traineeDataBo);
+        //HttpRequest req = CreateHttpRequest.createRequest();
+        //req.body(getQueryBodyForTrainee());
+        //// 获取到培训学员数据
+        //try (HttpResponse res = req.execute()) {
+        //    SyncFullDataBo traineeDataBo = JSONUtil.toBean(res.body(), SyncFullDataBo.class);
+        //    List<ResourcePerson> resourcePersonList = getResourcePeople(traineeDataBo);
+        //
+        //    // 获取到的学员与培训班对应关系
+        //    req.body(getQueryBodyForClassTrainee());
+        //    try (HttpResponse resTraineeClass = req.execute()) {
+        //        SyncFullDataBo classTraineeDataBo = JSONUtil.toBean(resTraineeClass.body(), SyncFullDataBo.class);
+        //        List<ResourcePersonDept> resourcePersonDeptList = getResourcePersonDeptList(classTraineeDataBo);
+        //
+        //        getResourcePeople(resourcePersonDeptList, resourcePersonList);
+        //        log.info("[全量获取到的培训学员数据]-[{}]条-[{}]", resourcePersonList.size(), JSONUtil.toJsonStr(traineeDataBo));
+        //
+        //        syncUserStrategyContent.syncUser(resourcePersonList, SyncResourceConstants.TRAINEE);
+        //        return true;
+        //    } catch (Exception e) {
+        //        log.error(e.getMessage());
+        //        throw new ServiceException(e.getMessage());
+        //    }
+        //} catch (Exception e) {
+        //    log.error(e.getMessage());
+        //    throw new ServiceException(e.getMessage());
+        //}
 
-            // 获取到的学员与培训班对应关系
-            req.body(getQueryBodyForClassTrainee());
-            try (HttpResponse resTraineeClass = req.execute()) {
-                SyncFullDataBo classTraineeDataBo = JSONUtil.toBean(resTraineeClass.body(), SyncFullDataBo.class);
-                List<ResourcePersonDept> resourcePersonDeptList = getResourcePersonDeptList(classTraineeDataBo);
+        // region 模拟测试数据
+         List<ResourcePerson> resourcePersonList = new ArrayList<>();
+         ResourcePerson person = new ResourcePerson();
+         person.setTenantId(DefaultConstants.TENANT_ID);
+         person.setUserId("1799827959791554562");
+         person.setDeptId("1828720861385904129");
+         person.setPostCode(DefaultConstants.TRAINEE_CODE);
+         person.setRealName("赵开羽");
+         person.setSex("1");
+         person.setPhone("18974390367");
+         person.setIdNumber("XP4aO5yhQyNPUctSqDOU9Syh9KUo/DN8");
+         person.setCategory("2");
+         person.setOperatorId(DefaultConstants.FULL_SYNC_ADMIN);
+         resourcePersonList.add(person);
 
-                getResourcePeople(resourcePersonDeptList, resourcePersonList);
-                log.info("[全量获取到的培训学员数据]-[{}]条-[{}]", resourcePersonList.size(), JSONUtil.toJsonStr(traineeDataBo));
+         List<ResourcePersonDept> resourcePersonDeptList = new ArrayList<>();
+         ResourcePersonDept personDept = new ResourcePersonDept();
+         personDept.setUserId("1799827959791554562");
+         personDept.setDeptId("1828720861385904129");
+         personDept.setPostCode(DefaultConstants.TRAINEE_CODE);
+         personDept.setDelFlag("0");
+         resourcePersonDeptList.add(personDept);
 
-                syncUserStrategyContent.syncUser(resourcePersonList, SyncResourceConstants.TRAINEE);
-                return true;
-            } catch (Exception e) {
-                log.error(e.getMessage());
-                throw new ServiceException(e.getMessage());
-            }
-        } catch (Exception e) {
-            log.error(e.getMessage());
-            throw new ServiceException(e.getMessage());
-        }
+         personDept = new ResourcePersonDept();
+         personDept.setUserId("1799827959791554562");
+         personDept.setDeptId("ffe051b8cf2e45ddb899d596108699d7");
+         personDept.setPostCode(DefaultConstants.TRAINEE_CODE);
+         personDept.setDelFlag("0");
+         resourcePersonDeptList.add(personDept);
+         getResourcePeople(resourcePersonDeptList, resourcePersonList);
 
-        // region 模拟测试数据
-        // List<ResourcePerson> resourcePersonList = new ArrayList<>();
-        // ResourcePerson person = new ResourcePerson();
-        // person.setTenantId(DefaultConstants.TENANT_ID);
-        // person.setUserId("1799827959791554562");
-        // person.setDeptId("1828720861385904129");
-        // person.setPostCode(DefaultConstants.TRAINEE_CODE);
-        // person.setRealName("赵开羽");
-        // person.setSex("1");
-        // person.setPhone("18974390367");
-        // person.setIdNumber("XP4aO5yhQyNPUctSqDOU9Syh9KUo/DN8");
-        // person.setCategory("2");
-        // person.setOperatorId(DefaultConstants.FULL_SYNC_ADMIN);
-        // resourcePersonList.add(person);
-        //
-        // List<ResourcePersonDept> resourcePersonDeptList = new ArrayList<>();
-        // ResourcePersonDept personDept = new ResourcePersonDept();
-        // personDept.setUserId("1799827959791554562");
-        // personDept.setDeptId("1828720861385904129");
-        // personDept.setPostCode(DefaultConstants.TRAINEE_CODE);
-        // personDept.setDelFlag("0");
-        // resourcePersonDeptList.add(personDept);
-        //
-        // personDept = new ResourcePersonDept();
-        // personDept.setUserId("1799827959791554562");
-        // personDept.setDeptId("ffe051b8cf2e45ddb899d596108699d7");
-        // personDept.setPostCode(DefaultConstants.TRAINEE_CODE);
-        // personDept.setDelFlag("0");
-        // resourcePersonDeptList.add(personDept);
-        // getResourcePeople(resourcePersonDeptList, resourcePersonList);
-        //
-        // syncUserStrategyContent.syncUser(resourcePersonList, SyncResourceConstants.TRAINEE);
+         syncUserStrategyContent.syncUser(resourcePersonList, SyncResourceConstants.TRAINEE);
 
-        // return true;
+         return true;
         // endregion
     }