Quellcode durchsuchen

复学流程相关接口

dzx vor 8 Monaten
Ursprung
Commit
a94d022184

+ 60 - 0
src/main/java/com/xjrsoft/common/utils/CredentialNumberUtil.java

@@ -0,0 +1,60 @@
+package com.xjrsoft.common.utils;
+
+import com.xjrsoft.common.exception.MyException;
+
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * 身份证号相关处理
+ * @author dzx
+ * @date 2025/4/1
+ */
+public class CredentialNumberUtil {
+
+    /**
+     * 根据身份证号获取出生日期
+     * @param idCardNumber 身份证号
+     * @return 出生日期
+     */
+    public static LocalDate getBirthDate(String idCardNumber){
+        // 获取出生日期前6位,即yyyyMM
+        String birthdayString = idCardNumber.substring(6, 14);
+
+        // 将字符串解析为LocalDate对象
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
+        try {
+            LocalDate parse = LocalDate.parse(birthdayString, formatter);
+            return parse;
+        }catch (Exception e){
+            throw new MyException("身份证号填写错误,无法提取出生日期");
+        }
+    }
+
+    /**
+     * 根据身份证号判断性别
+     * @param idCard 身份证号码
+     * @return "男" 或 "女"
+     * @throws IllegalArgumentException 如果身份证号长度不正确
+     */
+    public static String getGenderByIdCard(String idCard) {
+        if (idCard == null || (idCard.length() != 15 && idCard.length() != 18)) {
+            throw new IllegalArgumentException("身份证号长度不正确");
+        }
+
+        // 15位身份证号:最后一位是性别位
+        // 18位身份证号:第17位是性别位
+        char genderChar;
+        if (idCard.length() == 15) {
+            genderChar = idCard.charAt(14);
+        } else {
+            genderChar = idCard.charAt(16);
+        }
+
+        // 将字符转换为数字
+        int genderNum = Character.getNumericValue(genderChar);
+
+        // 奇数男性,偶数女性
+        return genderNum % 2 == 1 ? "男" : "女";
+    }
+}

+ 46 - 0
src/main/java/com/xjrsoft/module/base/controller/BaseSystemConfigController.java

@@ -0,0 +1,46 @@
+package com.xjrsoft.module.base.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xjrsoft.common.annotation.XjrLog;
+import com.xjrsoft.common.model.result.RT;
+import com.xjrsoft.module.base.entity.BaseSystemConfig;
+import com.xjrsoft.module.base.service.IBaseSystemConfigService;
+import com.xjrsoft.module.base.vo.BaseSystemConfigVo;
+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.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @title: 年级管理
+ * @Author dzx
+ * @Date: 2025年3月31日
+ * @Version 1.0
+ */
+@RestController
+@RequestMapping("/baseSystemConfig")
+@Api(value = "/baseSystemConfig", tags = "系统参数配置")
+@AllArgsConstructor
+public class BaseSystemConfigController {
+    private final IBaseSystemConfigService systemConfigService;
+
+    @GetMapping(value = "/list")
+    @ApiOperation(value = "获取系统配置")
+    @SaCheckPermission("baseSystemConfig:detail")
+    @XjrLog(value = "年级列表")
+    public RT<List<BaseSystemConfigVo>> noTokenList(@RequestParam String code) {
+        List<BaseSystemConfig> list = systemConfigService.list(
+                new QueryWrapper<BaseSystemConfig>().lambda()
+                        .eq(BaseSystemConfig::getCode, code)
+        );
+
+        return RT.ok(BeanUtil.copyToList(list, BaseSystemConfigVo.class));
+    }
+}

+ 38 - 0
src/main/java/com/xjrsoft/module/base/entity/BaseSystemConfig.java

@@ -0,0 +1,38 @@
+package com.xjrsoft.module.base.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 系统参数配置
+ * </p>
+ *
+ * @author dzx
+ * @since 2025年4月1日
+ */
+@Data
+@TableName("base_system_config")
+@ApiModel(value = "base_system_config", description = "系统参数配置")
+public class BaseSystemConfig implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("主键")
+    private Long id;
+
+    @ApiModelProperty("编号")
+    private String code;
+
+    @ApiModelProperty("值")
+    private String value;
+
+    @ApiModelProperty("备注")
+    private String remark;
+
+}

+ 19 - 0
src/main/java/com/xjrsoft/module/base/mapper/BaseSystemConfigMapper.java

@@ -0,0 +1,19 @@
+package com.xjrsoft.module.base.mapper;
+
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.base.entity.BaseGrade;
+import com.xjrsoft.module.base.entity.BaseSystemConfig;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 系统参数配置
+ * </p>
+ *
+ * @author dzx
+ * @since 2025年4月1日
+ */
+@Mapper
+public interface BaseSystemConfigMapper extends MPJBaseMapper<BaseSystemConfig> {
+
+}

+ 16 - 0
src/main/java/com/xjrsoft/module/base/service/IBaseSystemConfigService.java

@@ -0,0 +1,16 @@
+package com.xjrsoft.module.base.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xjrsoft.module.base.entity.BaseSystemConfig;
+
+/**
+ * <p>
+ * 系统参数配置
+ * </p>
+ *
+ * @author dzx
+ * @since 2025年4月1日
+ */
+public interface IBaseSystemConfigService extends IService<BaseSystemConfig> {
+
+}

+ 20 - 0
src/main/java/com/xjrsoft/module/base/service/impl/BaseSystemConfigServiceImpl.java

@@ -0,0 +1,20 @@
+package com.xjrsoft.module.base.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xjrsoft.module.base.entity.BaseSystemConfig;
+import com.xjrsoft.module.base.mapper.BaseSystemConfigMapper;
+import com.xjrsoft.module.base.service.IBaseSystemConfigService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 系统参数配置
+ * </p>
+ *
+ * @author dzx
+ * @since 2025年4月1日
+ */
+@Service
+public class BaseSystemConfigServiceImpl extends ServiceImpl<BaseSystemConfigMapper, BaseSystemConfig> implements IBaseSystemConfigService {
+
+}

+ 32 - 0
src/main/java/com/xjrsoft/module/base/vo/BaseSystemConfigVo.java

@@ -0,0 +1,32 @@
+package com.xjrsoft.module.base.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+
+/**
+ * @title: 系统参数配置
+ * @Author dzx
+ * @Date: 2025年4月1日
+ * @Version 1.0
+ */
+@Data
+public class BaseSystemConfigVo {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("主键")
+    private Long id;
+
+    @ApiModelProperty("编号")
+    private String code;
+
+    @ApiModelProperty("值")
+    private String value;
+
+    @ApiModelProperty("备注")
+    private String remark;
+
+}

+ 77 - 1
src/main/java/com/xjrsoft/module/liteflow/node/WfStudentRepeatStudyNode.java

@@ -3,8 +3,24 @@ package com.xjrsoft.module.liteflow.node;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.db.Entity;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.enums.ArchivesStatusEnum;
+import com.xjrsoft.common.enums.StudentTypeEnum;
 import com.xjrsoft.common.enums.WorkflowApproveType;
 import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
+import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.organization.mapper.UserMapper;
+import com.xjrsoft.module.student.dto.AddBaseStudentContactDto;
+import com.xjrsoft.module.student.dto.AddBaseStudentDto;
+import com.xjrsoft.module.student.dto.AddBaseStudentFamilyDto;
+import com.xjrsoft.module.student.dto.AddBaseStudentFamilyMemberDto;
+import com.xjrsoft.module.student.dto.AddBaseStudentSchoolRollDto;
+import com.xjrsoft.module.student.dto.AddBaseStudentSubsidizeDto;
+import com.xjrsoft.module.student.dto.AddBaseStudentUserDto;
+import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
+import com.xjrsoft.module.student.service.IBaseStudentService;
+import com.xjrsoft.module.student.service.IStudentManagerService;
 import com.xjrsoft.module.workflow.entity.WorkflowRecord;
 import com.xjrsoft.module.workflow.mapper.WorkflowRecordMapper;
 import com.xjrsoft.module.workflow.service.IWorkflowExecuteService;
@@ -16,6 +32,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.transaction.support.TransactionSynchronization;
 import org.springframework.transaction.support.TransactionSynchronizationManager;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -28,11 +45,14 @@ import java.util.concurrent.CompletableFuture;
 public class WfStudentRepeatStudyNode extends NodeComponent {
 
     @Autowired
-    private WorkflowRecordMapper workflowRecordMapper;
+    private IStudentManagerService studentService;
 
     @Autowired
     private IWorkflowExecuteService workflowExecuteService;
 
+    @Autowired
+    private UserMapper userMapper;
+
 
     @Override
     public void process() throws Exception {
@@ -61,6 +81,62 @@ public class WfStudentRepeatStudyNode extends NodeComponent {
                             Entity where = Entity.create(tableName);
                             where.set("id", formId);
                             Map<String, Object> objectMap = SqlRunnerAdapter.db().dynamicSelectOne(tableName, where);
+                            int isOriginal = Integer.parseInt(objectMap.get("is_original").toString());
+
+                            String credentialNumber = objectMap.get("credential_number").toString();
+
+                            User user = userMapper.selectOne(
+                                    new MPJLambdaWrapper<User>()
+                                            .disableLogicDel()
+                                            .select(User::getId)
+                                            .select(User.class, x -> VoToColumnUtil.fieldsToColumns(User.class).contains(x.getProperty()))
+                                            .eq(User::getCredentialNumber, credentialNumber)
+                            );
+
+                            if(isOriginal == 0 && user == null){
+                                AddBaseStudentUserDto baseStudentUser = new AddBaseStudentUserDto();
+                                baseStudentUser.setName(objectMap.get("name").toString());
+                                baseStudentUser.setCredentialType("ZZLS10007");
+                                baseStudentUser.setCredentialNumber(objectMap.get("credential_number").toString());
+                                baseStudentUser.setMobile(objectMap.get("mobile").toString());
+                                baseStudentUser.setUserName(objectMap.get("credential_number").toString());
+
+                                List<AddBaseStudentSchoolRollDto> baseStudentSchoolRollList = new ArrayList<>();
+                                AddBaseStudentSchoolRollDto rollDto = new AddBaseStudentSchoolRollDto();
+                                rollDto.setStduyStatus(objectMap.get("stduy_status").toString());
+                                rollDto.setStduyStatus(ArchivesStatusEnum.FB2901.getCode());
+                                rollDto.setMajorSetId(Long.parseLong(objectMap.get("major_set_id").toString()));
+                                rollDto.setStudentType(StudentTypeEnum.FB2801.getCode());
+                                rollDto.setClassId(Long.parseLong(objectMap.get("class_id").toString()));
+                                rollDto.setGradeId(Long.parseLong(objectMap.get("grade_id").toString()));
+                                baseStudentSchoolRollList.add(rollDto);
+                                baseStudentUser.setBaseStudentSchoolRollList(baseStudentSchoolRollList);
+
+                                List<AddBaseStudentDto> baseStudentList = new ArrayList<>();
+                                AddBaseStudentDto studentDto = new AddBaseStudentDto();
+                                studentDto.setIsMigrateChildren(0);
+                                studentDto.setStudentId(baseStudentUser.getCredentialNumber());
+                                studentDto.setIsFloatingPopulation(0);
+                                baseStudentList.add(studentDto);
+                                baseStudentUser.setBaseStudentList(baseStudentList);
+
+                                List<AddBaseStudentContactDto> baseStudentContactList = new ArrayList<>();
+                                baseStudentContactList.add(new AddBaseStudentContactDto());
+                                baseStudentUser.setBaseStudentContactList(baseStudentContactList);
+
+                                List<AddBaseStudentFamilyDto> baseStudentFamilyList = new ArrayList<>();
+                                baseStudentFamilyList.add(new AddBaseStudentFamilyDto());
+                                baseStudentUser.setBaseStudentFamilyList(baseStudentFamilyList);
+
+                                List<AddBaseStudentFamilyMemberDto> baseStudentFamilyMemberList = new ArrayList<>();
+                                baseStudentFamilyMemberList.add(new AddBaseStudentFamilyMemberDto());
+                                baseStudentUser.setBaseStudentFamilyMemberList(baseStudentFamilyMemberList);
+
+                                List<AddBaseStudentSubsidizeDto> baseStudentSubsidizeList = new ArrayList<>();
+                                baseStudentUser.setBaseStudentSubsidizeList(baseStudentSubsidizeList);
+
+                                studentService.add(baseStudentUser);
+                            }
                         }
                     });
                 }

+ 3 - 1
src/main/java/com/xjrsoft/module/student/service/IBaseStudentService.java

@@ -9,7 +9,7 @@ import com.xjrsoft.module.student.vo.StudentPersonalInfoVo;
 import java.util.List;
 
 /**
- * @title: 奖学金申请
+ * @title: 学生基本信息
  * @Author dzx
  * @Date: 2023-11-23
  * @Version 1.0
@@ -21,4 +21,6 @@ public interface IBaseStudentService extends MPJBaseService<BaseStudent> {
     List<BaseStudentUserPageVo> getStudentList(BaseStudentUserPageDto dto);
 
     void changeIsNormal(String archivesStatus, Integer isNormal);
+
+    Boolean createStudent(String name, String credentialNumber, String mobile, String stduyStatus, Long classId, Long majorId);
 }

+ 95 - 0
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentServiceImpl.java

@@ -1,17 +1,32 @@
 package com.xjrsoft.module.student.service.impl;
 
+import cn.dev33.satoken.secure.BCrypt;
+import cn.dev33.satoken.stp.StpUtil;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.enums.ArchivesStatusEnum;
+import com.xjrsoft.common.enums.DeleteMark;
+import com.xjrsoft.common.enums.EnabledMark;
+import com.xjrsoft.common.enums.GenderDictionaryEnum;
+import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.config.CommonPropertiesConfig;
+import com.xjrsoft.common.utils.CredentialNumberUtil;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.organization.mapper.UserMapper;
 import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
 import com.xjrsoft.module.student.entity.BaseStudent;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.mapper.BaseStudentMapper;
+import com.xjrsoft.module.student.mapper.BaseStudentSchoolRollMapper;
 import com.xjrsoft.module.student.service.IBaseStudentService;
 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;
 
+import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.util.List;
 
 /**
@@ -24,6 +39,9 @@ import java.util.List;
 @AllArgsConstructor
 public class BaseStudentServiceImpl extends MPJBaseServiceImpl<BaseStudentMapper, BaseStudent> implements IBaseStudentService {
     private final BaseStudentMapper studentMapper;
+    private final UserMapper userMapper;
+    private final BaseStudentSchoolRollMapper schoolRollMapper;
+    private final CommonPropertiesConfig propertiesConfig;
 
     @Override
     public StudentPersonalInfoVo getPersonalInfo(Long userId) {
@@ -47,4 +65,81 @@ public class BaseStudentServiceImpl extends MPJBaseServiceImpl<BaseStudentMapper
             baseMapper.updateById(baseTeacher);
         }
     }
+
+    /**
+     * 创建学生
+     * @param name 姓名
+     * @param credentialNumber 身份证号
+     * @param mobile 手机号
+     * @param stduyStatus 就读方式
+     * @param classId 班级id
+     * @param majorId 专业方向id
+     */
+    @Override
+    @Transactional
+    public Boolean createStudent(String name, String credentialNumber, String mobile, String stduyStatus, Long classId, Long majorId) {
+        User user = userMapper.selectOne(
+                new MPJLambdaWrapper<User>()
+                        .disableLogicDel()
+                        .select(User::getId)
+                        .select(User.class, x -> VoToColumnUtil.fieldsToColumns(User.class).contains(x.getProperty()))
+                        .eq(User::getCredentialNumber, credentialNumber)
+        );
+        LocalDate birthDate = CredentialNumberUtil.getBirthDate(credentialNumber);
+        if(user != null){
+            user.setDeleteMark(DeleteMark.NODELETE.getCode());
+            user.setEnabledMark(EnabledMark.ENABLED.getCode());
+            user.setName(name);
+            user.setBirthDate(birthDate.atStartOfDay());
+            user.setMobile(mobile);
+            userMapper.updateById(user);
+
+            BaseStudent student = this.getOne(
+                    new MPJLambdaWrapper<BaseStudent>()
+                            .disableLogicDel()
+                            .select(BaseStudent::getId)
+                            .select(BaseStudent.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudent.class).contains(x.getProperty()))
+                            .eq(BaseStudent::getUserId, user.getId())
+            );
+            student.setDeleteMark(DeleteMark.NODELETE.getCode());
+            student.setEnabledMark(EnabledMark.ENABLED.getCode());
+            student.setIsNormal(1);
+            this.updateById(student);
+
+            BaseStudentSchoolRoll schoolRoll = schoolRollMapper.selectOne(
+                    new MPJLambdaWrapper<BaseStudentSchoolRoll>()
+                            .disableLogicDel()
+                            .select(BaseStudentSchoolRoll::getId)
+                            .select(BaseStudentSchoolRoll.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentSchoolRoll.class).contains(x.getProperty()))
+                            .eq(BaseStudentSchoolRoll::getUserId, user.getId())
+            );
+            schoolRoll.setDeleteMark(DeleteMark.NODELETE.getCode());
+            schoolRoll.setEnabledMark(EnabledMark.ENABLED.getCode());
+            schoolRoll.setArchivesStatus(ArchivesStatusEnum.FB2901.getCode());
+            schoolRoll.setStduyStatus(stduyStatus);
+            schoolRoll.setClassId(classId);
+            schoolRoll.setMajorSetId(majorId);
+            schoolRoll.setModifyUserId(StpUtil.getLoginIdAsLong());
+            schoolRoll.setModifyDate(LocalDateTime.now());
+            schoolRollMapper.updateById(schoolRoll);
+        }else{
+            String gender = CredentialNumberUtil.getGenderByIdCard(credentialNumber);
+
+            user = new User() {{
+                setName(name);
+                setCreateDate(LocalDateTime.now());
+                setDeleteMark(DeleteMark.NODELETE.getCode());
+                setEnabledMark(EnabledMark.ENABLED.getCode());
+                setBirthDate(birthDate.atStartOfDay());
+                setMobile(mobile);
+                setCredentialNumber(credentialNumber);
+                setCredentialType("ZZLS10007");
+                setPassword(BCrypt.hashpw(propertiesConfig.getDefaultPassword(), BCrypt.gensalt()));
+                setGender(GenderDictionaryEnum.getCode(gender));
+                setIsChangePassword(1);
+            }};
+            userMapper.insert(user);
+        }
+        return true;
+    }
 }

+ 1 - 0
src/main/resources/application-dev.yml

@@ -120,6 +120,7 @@ xjrsoft:
       - /system/dictionary-detail
       - /workflow/execute/start-process-info
       - /baseGrade/list
+      - /baseSystemConfig/list
     approval-time: 300 # 审核超时时间 目前设为5分钟
   email:
     host:  #邮件服务器的SMTP地址,可选,默认为smtp.<发件人邮箱后缀>

+ 1 - 1
src/main/resources/mapper/student/PbVXsxxsfytbMapper.xml

@@ -24,7 +24,7 @@
         AND beltcode = #{dto.beltcode} and feeitemcode in (103042766003001, 999010604, 999010603)
     </select>
     <select id="getSpecnameCount" parameterType="com.xjrsoft.module.student.dto.EnrollmentStatisticsInfoDto" resultType="com.xjrsoft.module.student.vo.PbVXsxxsfytbSpecnameCountVo">
-        SELECT specname,COUNT(DISTINCT(Studentcode)) as student_count FROM pb_v_xsxxsfytb WHERE jfzt = '已缴费' AND enteryear = #{dto.year} GROUP BY specname
+        SELECT specname,COUNT(DISTINCT(personalid)) AS student_count FROM pb_cse_feeobjupdate WHERE paymnystate = '已缴费' AND enteryear = #{dto.year} GROUP BY specname
     </select>
     <select id="getStudentFeeInfo" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoDetailDto" resultType="com.xjrsoft.module.student.vo.PbVXsxxsfytbFeeitemVo">
         SELECT replace(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = #{dto.credentialNumber} AND feeitemcode LIKE '999010604%' AND beltcode = #{dto.beltcode}),'欠费'),'未缴费','欠费') AS jxf,