Просмотр исходного кода

学生消费管理,个人财务画像,增加个人信息接口

dzx 1 год назад
Родитель
Сommit
956b0f5516

+ 10 - 50
src/main/java/com/xjrsoft/module/student/controller/ConsumptionController.java

@@ -1,25 +1,16 @@
 package com.xjrsoft.module.student.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
-import cn.hutool.core.bean.BeanUtil;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import cn.dev33.satoken.stp.StpUtil;
 import com.xjrsoft.common.model.result.RT;
-import com.xjrsoft.common.page.ConventPage;
-import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
-import com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto;
-import com.xjrsoft.module.student.service.impl.IBaseStudentSchoolRollService;
-import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
-import com.xjrsoft.module.student.vo.BaseStudentInfoPageDataVo;
-import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
+import com.xjrsoft.module.student.service.IStudentManagerService;
+import com.xjrsoft.module.student.vo.StudentPersonalInfoVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
@@ -35,44 +26,13 @@ import javax.validation.Valid;
 @Api(value = "/student"  + "/consumption",tags = "学生消费管理")
 @AllArgsConstructor
 public class ConsumptionController {
-
-
-    private final IBaseStudentSchoolRollService baseStudentSchoolRollService;
-
-    @GetMapping(value = "/mobile-page")
-    @ApiOperation(value="学生列表(分页)")
-    @SaCheckPermission("basestudentpost:detail")
-    public RT<PageOutput<BaseStudentInfoPageVo>> mobilePage(@Valid BaseStudentInfoPageDto dto){
-        Page<BaseStudentInfoPageVo> mobilePage = baseStudentSchoolRollService.getMobilePage(new Page<>(dto.getLimit(), dto.getSize()), dto);
-        PageOutput<BaseStudentInfoPageVo> pageOutput = ConventPage.getPageOutput(mobilePage, BaseStudentInfoPageVo.class);
-        return RT.ok(pageOutput);
-    }
-
-    @GetMapping(value = "/mobile-page-statistics")
-    @ApiOperation(value="学生列表人数统计")
-    @SaCheckPermission("basestudentpost:detail")
-    public RT<BaseStudentInfoPageDataVo> mobilePageStatistics(@Valid BaseStudentInfoPageDto dto){
-        BaseStudentInfoPageDataVo result = baseStudentSchoolRollService.getMobilePageStatistics(dto);
-        return RT.ok(result);
-    }
-
-
-    @PutMapping
-    @ApiOperation(value = "修改学生信息")
-    @SaCheckPermission("basestudentpost:edit")
-    public RT<Boolean> update(@Valid @RequestBody UpdateBaseStudentInfoDto dto){
-        return RT.ok(baseStudentSchoolRollService.updateInfo(dto));
-    }
-
-    @GetMapping(value = "/info")
-    @ApiOperation(value="根据id查询详情信息")
-    @SaCheckPermission("room:detail")
-    public RT<BaseStudentInfoDetailVo> info(@RequestParam Long id){
-        BaseStudentInfoDetailVo detailVo = baseStudentSchoolRollService.getInfoById(id);
-        if (detailVo == null) {
-            return RT.error("找不到此数据!");
-        }
-        return RT.ok(BeanUtil.toBean(detailVo, BaseStudentInfoDetailVo.class));
+    private final IStudentManagerService studentManagerService;
+    @GetMapping(value = "/personal-info")
+    @ApiOperation(value="学生个人信息")
+    @SaCheckPermission("consumption:detail")
+    public RT<StudentPersonalInfoVo> personalInfo(@Valid BaseStudentInfoPageDto dto){
+        StudentPersonalInfoVo info = studentManagerService.getPersonalInfo(StpUtil.getLoginIdAsLong());
+        return RT.ok(info);
     }
 
 

+ 3 - 0
src/main/java/com/xjrsoft/module/student/mapper/BaseStudentMapper.java

@@ -7,6 +7,7 @@ import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
 import com.xjrsoft.module.student.entity.BaseStudent;
 import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
 import com.xjrsoft.module.student.vo.StudentInfoVo;
+import com.xjrsoft.module.student.vo.StudentPersonalInfoVo;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
@@ -27,4 +28,6 @@ public interface BaseStudentMapper extends MPJBaseMapper<BaseStudent> {
     StudentInfoVo getStudentInfo(Long userId);
 
     List<StudentJianyuekbVo> getJianyueStudentList();
+
+    StudentPersonalInfoVo getPersonalInfo(Long userId);
 }

+ 8 - 3
src/main/java/com/xjrsoft/module/student/service/IStudentManagerService.java

@@ -1,11 +1,9 @@
 package com.xjrsoft.module.student.service;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.yulichang.base.MPJBaseService;
-import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
 import com.xjrsoft.module.student.entity.BaseStudentUser;
 import com.xjrsoft.module.student.vo.BaseStudentClassVo;
-import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
+import com.xjrsoft.module.student.vo.StudentPersonalInfoVo;
 
 import java.util.List;
 
@@ -42,4 +40,11 @@ public interface IStudentManagerService extends MPJBaseService<BaseStudentUser>
      * @return
      */
     BaseStudentClassVo getStudentClass(Long userId);
+
+    /**
+     * 个人财务画像,获取学生个人信息
+     * @param userId
+     * @return
+     */
+    StudentPersonalInfoVo getPersonalInfo(Long userId);
 }

+ 29 - 4
src/main/java/com/xjrsoft/module/student/service/impl/StudentManagerServiceImpl.java

@@ -2,17 +2,16 @@ package com.xjrsoft.module.student.service.impl;
 
 import cn.dev33.satoken.secure.BCrypt;
 import cn.hutool.core.bean.BeanUtil;
-import com.baomidou.mybatisplus.core.metadata.IPage;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.enums.RoleEnum;
-import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.mapper.BaseClassMapper;
 import com.xjrsoft.module.organization.entity.UserRoleRelation;
 import com.xjrsoft.module.organization.mapper.UserRoleRelationMapper;
-import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
 import com.xjrsoft.module.student.entity.BaseStudent;
 import com.xjrsoft.module.student.entity.BaseStudentContact;
 import com.xjrsoft.module.student.entity.BaseStudentFamily;
@@ -29,7 +28,7 @@ import com.xjrsoft.module.student.mapper.BaseStudentSubsidizeMapper;
 import com.xjrsoft.module.student.mapper.BaseStudentUserMapper;
 import com.xjrsoft.module.student.service.IStudentManagerService;
 import com.xjrsoft.module.student.vo.BaseStudentClassVo;
-import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
+import com.xjrsoft.module.student.vo.StudentPersonalInfoVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -305,4 +304,30 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
 
         return BeanUtil.toBean(baseClass, BaseStudentClassVo.class);
     }
+
+    /**
+     * 个人财务画像,获取学生个人信息
+     * @param userId
+     * @return
+     */
+    @Override
+    public StudentPersonalInfoVo getPersonalInfo(Long userId) {
+        StudentPersonalInfoVo info = studentbaseManagerBaseStudentMapper.getPersonalInfo(userId);
+        List<BaseStudentFamilyMember> members = studentbaseManagerBaseStudentFamilyMemberMapper.selectList(
+            new QueryWrapper<BaseStudentFamilyMember>().lambda()
+            .eq(BaseStudentFamilyMember::getUserId, userId)
+            .eq(BaseStudentFamilyMember::getIsGuardian, 1)
+        );
+        String guardianPhone = "";
+        for (int i = 0; i < members.size(); i ++){
+            if(i > 0){
+                guardianPhone += ",";
+            }
+            guardianPhone += members.get(i).getMobile();
+        }
+        if(StrUtil.isNotEmpty(guardianPhone)){
+            info.setGuardianPhone(guardianPhone);
+        }
+        return info;
+    }
 }

+ 92 - 0
src/main/java/com/xjrsoft/module/student/vo/StudentPersonalInfoVo.java

@@ -0,0 +1,92 @@
+package com.xjrsoft.module.student.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+* @title: 班级专业方向表表单出参
+* @Author szs
+* @Date: 2023-12-28
+* @Version 1.0
+*/
+@Data
+public class StudentPersonalInfoVo {
+
+    /**
+    * 主键
+    */
+    @ApiModelProperty("主键")
+    private Long userId;
+    /**
+    * 学生姓名
+    */
+    @ApiModelProperty("学生姓名")
+    private String name;
+    /**
+    * 性别中文
+    */
+    @ApiModelProperty("性别中文")
+    private String genderCn;
+    /**
+    * 班级名称
+    */
+    @ApiModelProperty("班级名称")
+    private String className;
+    /**
+    * 身份证号
+    */
+    @ApiModelProperty("身份证号")
+    private String credentialNumber;
+    /**
+    * 出生日期
+    */
+    @ApiModelProperty("出生日期")
+    private Date birthDate;
+    /**
+    * 本人手机号
+    */
+    @ApiModelProperty("本人手机号")
+    private String mobile;
+
+    @ApiModelProperty("学籍状态中文")
+    private String archivesStatusCn;
+
+    @ApiModelProperty("学习形式中文")
+    private String rollModalityCn;
+
+    @ApiModelProperty("学号")
+    private String studentId;
+
+    @ApiModelProperty("专业方向名称")
+    private String majorSetName;
+
+    @ApiModelProperty("就读方式")
+    private String stduyStatusCn;
+
+
+    @ApiModelProperty("班主任名称")
+    private String teacherName;
+
+
+    @ApiModelProperty("班主任电话")
+    private String teacherPhone;
+
+
+    @ApiModelProperty("床位编号")
+    private String bedNumber;
+
+    @ApiModelProperty("寝室名称")
+    private String roomName;
+
+    @ApiModelProperty("楼栋名称")
+    private String buildName;
+
+    @ApiModelProperty("是否低保户(1:是 0:否)")
+    private Integer isIndemnify;
+
+    @ApiModelProperty("监护人电话")
+    private String guardianPhone;
+
+}

+ 23 - 0
src/main/resources/mapper/student/BaseStudentMapper.xml

@@ -21,4 +21,27 @@
         AND t1.student_id IS NOT NULL AND t1.student_id != ''
         AND t3.archives_status = 'FB2901';
     </select>
+
+    <!--个人财务画像,查询学生个人信息-->
+    <select id="getPersonalInfo" resultType="com.xjrsoft.module.student.vo.StudentPersonalInfoVo">
+        SELECT t1.user_id,t2.name,t5.name AS gender_cn,t4.name AS class_name,t2.credential_number,t2.birth_date,t2.mobile,
+        t6.name AS archives_status_cn,t7.name AS roll_modality_cn,t1.student_id,t8.name AS major_set_name,
+        t9.name AS stduy_status_cn,t10.name AS teacher_name,t10.mobile AS teacher_phone,t11.bed_number,t12.room_name,
+        t13.name AS build_name,t14.is_indemnify FROM base_student t1
+        INNER JOIN xjr_user t2 ON t1.user_id = t2.id
+        INNER JOIN base_student_school_roll t3 ON t2.id = t3.user_id
+        LEFT JOIN base_class t4 ON t4.id = t3.class_id
+        LEFT JOIN xjr_dictionary_detail t5 ON t2.gender = t5.code AND t5.item_id = 2023000000000000004
+        LEFT JOIN xjr_dictionary_detail t6 ON t3.archives_status = t6.code AND t6.item_id = 2023000000000000029
+        LEFT JOIN xjr_dictionary_detail t7 ON t3.roll_modality = t7.code AND t7.item_id = 1762024751192084482
+        LEFT JOIN base_major_set t8 ON t3.major_set_id  = t8.id
+        LEFT JOIN xjr_dictionary_detail t9 ON t3.stduy_status = t9.code AND t9.item_id = 2023000000000000030
+        LEFT JOIN xjr_user t10 ON t4.teacher_id = t10.id
+        LEFT JOIN room_bed t11 ON t1.user_id = t11.student_user_id
+        LEFT JOIN room t12 ON t11.room_id = t12.id
+        LEFT JOIN base_office_build t13 ON t12.office_build_id = t13.id
+        LEFT JOIN base_student_subsidize t14 ON t1.user_id = t14.user_id
+        WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
+        AND t2.id = #{id}
+    </select>
 </mapper>