Althars123 4 年之前
父節點
當前提交
d273927159

+ 16 - 1
zzjs-admin/src/main/java/com/miaxis/app/controller/gzpt/GzptTrainRecordController.java

@@ -7,17 +7,22 @@ import com.miaxis.common.core.controller.BaseController;
 import com.miaxis.common.core.domain.Response;
 import com.miaxis.common.core.domain.entity.UserInfo;
 import com.miaxis.common.enums.BusinessTypeEnum;
+import com.miaxis.common.exception.CustomException;
 import com.miaxis.common.utils.SecurityUtils;
 import com.miaxis.newgzpt.domain.GzptTrainRecord;
+import com.miaxis.newgzpt.domain.GzptUserInfo;
 import com.miaxis.newgzpt.service.IGzptTrainRecordService;
+import com.miaxis.newgzpt.service.IGzptUserInfoService;
 import com.miaxis.question.domain.QuestionCollection;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
+import sun.plugin.net.protocol.jar.CachedJarURLConnection;
 
 import javax.annotation.Resource;
 
@@ -29,13 +34,16 @@ import javax.annotation.Resource;
  * @since 2021-03-23
  */
 @RestController
-@Api(tags = "【小程序-新增学时】")
+@Api(tags = "【小程序-学时管理】")
 @RequestMapping(Constants.STUDENT_PREFIX+"/gzpt-train-record")
 public class GzptTrainRecordController extends BaseController {
 
     @Resource
     IGzptTrainRecordService gzptTrainRecordService;
 
+    @Autowired
+    private IGzptUserInfoService gzptUserInfoService;
+
     /**
      * 新增学时
      */
@@ -43,6 +51,13 @@ public class GzptTrainRecordController extends BaseController {
     @PostMapping
     @ApiOperation("新增学时")
     public Response add(@RequestBody GzptTrainRecord gzptTrainRecord){
+
+        UserInfo student =  SecurityUtils.getLoginUser().getStudent();
+        GzptUserInfo gzptUserInfo = gzptUserInfoService.getInfoById(student.getGzptUserId());
+        if (gzptUserInfo == null) {
+            throw new CustomException("该用户未查到相关的学员信息");
+        }
+        gzptTrainRecord.setStudentId(gzptUserInfo.getOutId());
         gzptTrainRecordService.saveGzptTrainRecord(gzptTrainRecord);
         return Response.success();
     }

+ 1 - 1
zzjs-admin/src/main/java/com/miaxis/app/controller/gzpt/GzptUserInfoController.java

@@ -45,7 +45,7 @@ public class GzptUserInfoController extends BaseController {
     @ApiOperation("获取学员详细信息")
     public Response<GzptUserInfo> getInfo(
             @ApiParam(name = "id", value = "用户信息参数", required = true)
-            @PathVariable("id") Long id
+            @PathVariable("id") Integer id
     ){
         return Response.success(gzptUserInfoService.getInfoById(id));
     }

+ 1 - 1
zzjs-service/src/main/java/com/miaxis/newgzpt/domain/GzptTrainRecord.java

@@ -30,7 +30,7 @@ public class GzptTrainRecord implements Serializable {
     @ApiModelProperty(hidden = true)
     private BigDecimal id;
 
-    @ApiModelProperty(value = "学员ID")
+    @ApiModelProperty(value = "学员ID",hidden = true)
     @TableField("STUDENT_ID")
     private BigDecimal studentId;
 

+ 1 - 1
zzjs-service/src/main/java/com/miaxis/newgzpt/mapper/GzptUserInfoMapper.java

@@ -20,5 +20,5 @@ public interface GzptUserInfoMapper extends BaseMapper<GzptUserInfo> {
 
     GzptUserInfo getUserByWxlogin(GzptUserInfoDTO gzptUserInfoDTO);
 
-    GzptUserInfo getInfoById(Long id);
+    GzptUserInfo getInfoById(Integer id);
 }

+ 1 - 1
zzjs-service/src/main/java/com/miaxis/newgzpt/service/IGzptUserInfoService.java

@@ -22,5 +22,5 @@ public interface IGzptUserInfoService extends IService<GzptUserInfo> {
 
     GzptUserInfo getUserWxlogin(GzptUserInfoDTO userInfoDTO);
 
-    GzptUserInfo getInfoById(Long id);
+    GzptUserInfo getInfoById(Integer id);
 }

+ 1 - 1
zzjs-service/src/main/java/com/miaxis/newgzpt/service/impl/GzptUserInfoServiceImpl.java

@@ -42,7 +42,7 @@ public class GzptUserInfoServiceImpl extends ServiceImpl<GzptUserInfoMapper, Gzp
     }
 
     @Override
-    public GzptUserInfo getInfoById(Long id) {
+    public GzptUserInfo getInfoById(Integer id) {
         return  mapper.getInfoById(id);
     }
 }