Browse Source

Merge remote-tracking branch 'origin/master'

Joburgess 5 năm trước cách đây
mục cha
commit
832a152d31

+ 1 - 1
edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/entity/Student.java

@@ -7,7 +7,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
 /**
  * 对应数据库表(student):
  */
-public class Student{
+public class Student extends SysUser{
 
 	@ApiModelProperty(value = "用户编号")
 	private Integer userId;

+ 12 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/StudentController.java

@@ -1,6 +1,8 @@
 package com.keao.edu.user.controller;
 
 
+import com.keao.edu.auth.api.client.SysUserFeignService;
+import com.keao.edu.auth.api.entity.SysUser;
 import com.keao.edu.common.controller.BaseController;
 import com.keao.edu.common.entity.HttpResponseResult;
 import com.keao.edu.common.page.PageInfo;
@@ -13,6 +15,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.util.ObjectUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -28,6 +31,8 @@ public class StudentController extends BaseController {
 
 	@Autowired
 	private StudentService studentService;
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
 
 	@ApiOperation(value = "学员列表")
 	@GetMapping(value = "list")
@@ -57,4 +62,11 @@ public class StudentController extends BaseController {
 		studentService.addStudent(student);
 		return succeed();
 	}
+
+	@ApiOperation(value = "获取学生信息")
+	@GetMapping(value = "getStudent")
+	public HttpResponseResult<Student> getStudent() {
+		SysUser user = sysUserFeignService.queryUserInfo();
+		return succeed(studentService.getStudent(user.getId()));
+	}
 }

+ 11 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/StudentDao.java

@@ -3,6 +3,7 @@ package com.keao.edu.user.dao;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.user.api.entity.Student;
 import com.keao.edu.user.dto.StudentExamPaymentDto;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -12,6 +13,7 @@ public interface StudentDao extends BaseDAO<Integer, Student> {
 
     /**
      * COUNT学员报名详情列表
+     *
      * @param params
      * @return
      */
@@ -19,8 +21,17 @@ public interface StudentDao extends BaseDAO<Integer, Student> {
 
     /**
      * 获取学员报名详情列表
+     *
      * @param params
      * @return
      */
     List<StudentExamPaymentDto> queryApplyList(Map<String, Object> params);
+
+    /**
+     * 获取学生信息
+     *
+     * @param userId
+     * @return
+     */
+    Student getStudent(@Param("userId") Integer userId);
 }

+ 7 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/StudentService.java

@@ -44,4 +44,11 @@ public interface StudentService extends BaseService<Integer, Student> {
      * @return
      */
     PageInfo<StudentExamPaymentDto> queryApplyList(StudentApplyQueryInfo queryInfo);
+
+    /**
+     * 获取学生信息
+     * @param userId
+     * @return
+     */
+    Student getStudent(Integer userId);
 }

+ 15 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationServiceImpl.java

@@ -12,6 +12,7 @@ import com.keao.edu.user.dto.ExamRegistrationStatisticsDto;
 import com.keao.edu.user.entity.*;
 import com.keao.edu.user.enums.ExamStatusEnum;
 import com.keao.edu.user.page.ExamRegistrationQueryInfo;
+import com.keao.edu.user.service.ExamRegistrationPaymentService;
 import com.keao.edu.user.service.ExamRegistrationService;
 import com.keao.edu.user.service.OrganizationService;
 import com.keao.edu.user.service.PayService;
@@ -49,6 +50,8 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
     private IdGeneratorService idGeneratorService;
     @Autowired
     private SysConfigDao sysConfigDao;
+    @Autowired
+    private ExamRegistrationPaymentService examRegistrationPaymentService;
 
     @Override
     public BaseDAO<Long, ExamRegistration> getDAO() {
@@ -76,6 +79,7 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         if (examSubjectSong == null) {
             throw new BizException("请选择专业级别");
         }
+        Date nowDate = new Date();
         String orderNo = idGeneratorService.generatorId("payment") + "";
 
         examRegistration.setLevel(examSubjectSong.getLevel());
@@ -94,6 +98,17 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         studentDao.insert(examRegistration);
         examRegistrationDao.insert(examRegistration);
 
+        ExamRegistrationPayment examRegistrationPayment = new ExamRegistrationPayment();
+        examRegistrationPayment.setTenantId(examRegistration.getTenantId());
+        examRegistrationPayment.setExamRegistrationId(examRegistration.getId().longValue());
+        examRegistrationPayment.setStudentId(examRegistration.getUserId());
+        examRegistrationPayment.setExaminationBasicId(examRegistration.getExaminationBasicId());
+        examRegistrationPayment.setOrderNo(orderNo);
+        examRegistrationPayment.setTransAmount(amount);
+        examRegistrationPayment.setTransStatus("ING");
+        examRegistrationPayment.setCreateTime(nowDate);
+        examRegistrationPayment.setUpdateTime(nowDate);
+        examRegistrationPaymentService.insert(examRegistrationPayment);
 
         String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
         Map<String, Object> payMap = payService.getPayMap(
@@ -104,7 +119,6 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
                 examinationBasic.getName(),
                 examinationBasic.getName()
         );
-
         return payMap;
     }
 

+ 5 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/StudentServiceImpl.java

@@ -147,4 +147,9 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
         pageInfo.setRows(dataList);
         return pageInfo;
     }
+
+    @Override
+    public Student getStudent(Integer userId) {
+        return studentDao.getStudent(userId);
+    }
 }

+ 5 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/StudentMapper.xml

@@ -106,4 +106,9 @@
 			</if>
 		</where>
 	</sql>
+    <select id="getStudent" resultMap="Student">
+		SELECT s.*,su.* FROM student s
+		LEFT JOIN sys_user su ON s.user_id_ = su.id_
+		WHERE user_id_ = #{userId}
+	</select>
 </mapper>