he2802 преди 3 години
родител
ревизия
e268252dc8

+ 74 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/course/CoursePhotoLogController.java

@@ -0,0 +1,74 @@
+package com.zhongzheng.controller.course;
+
+import java.util.List;
+import java.util.Arrays;
+
+import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.framework.web.service.WxTokenService;
+import com.zhongzheng.modules.course.bo.CoursePhotoLogAddBo;
+import com.zhongzheng.modules.course.bo.CoursePhotoLogQueryBo;
+import com.zhongzheng.modules.course.bo.CourseQueryBo;
+import com.zhongzheng.modules.course.service.ICoursePhotoLogService;
+import com.zhongzheng.modules.course.vo.CoursePhotoLogVo;
+import com.zhongzheng.modules.user.entity.ClientLoginUser;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.zhongzheng.common.annotation.Log;
+import com.zhongzheng.common.core.controller.BaseController;
+import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.utils.poi.ExcelUtil;
+import com.zhongzheng.common.core.page.TableDataInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 用户节拍照记录Controller
+ *
+ * @author hjl
+ * @date 2022-01-12
+ */
+@Api(value = "用户节拍照记录控制器", tags = {"用户节拍照记录管理"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/course/photo/log")
+public class CoursePhotoLogController extends BaseController {
+
+    private final ICoursePhotoLogService iCoursePhotoLogService;
+
+
+    private final WxTokenService wxTokenService;
+
+
+    /**
+     * 获取用户节拍照记录详细信息
+     */
+    @ApiOperation("获取用户节拍照记录最后详细信息")
+    @GetMapping("/getLastInfo")
+    public AjaxResult<List<CoursePhotoLogVo>> getLastInfo(CoursePhotoLogQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        return AjaxResult.success(iCoursePhotoLogService.getLastInfo(bo));
+    }
+    /**
+     * 新增用户节拍照记录
+     */
+    @ApiOperation("新增用户节拍照记录")
+    @Log(title = "用户节拍照记录", businessType = BusinessType.INSERT)
+    @PostMapping()
+    public AjaxResult<Void> add(@RequestBody CoursePhotoLogAddBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        return toAjax(iCoursePhotoLogService.insertByAddBo(bo) ? 1 : 0);
+    }
+
+}

+ 3 - 3
zhongzheng-api/src/main/java/com/zhongzheng/controller/wx/WxLoginController.java

@@ -58,9 +58,9 @@ public class WxLoginController
      * @param loginBody 登录信息
      * @return 结果
      */
-    @ApiOperation("登录")
-    @PostMapping("/login")
-    public AjaxResult login(@RequestBody WxLoginBody loginBody)
+    @ApiOperation("小程序微信登录")
+    @PostMapping("/bindLogin")
+    public AjaxResult bindLogin(@RequestBody WxLoginBody loginBody)
     {
         Map<String,String> map = wxLoginService.login(loginBody);
         return AjaxResult.success(map);

+ 14 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxLoginService.java

@@ -104,6 +104,20 @@ public class WxLoginService
         return map;
     }
 
+
+    public Map<String,String> smallTel(WxLoginBody loginBody) {
+        User user = getWxUnionIdUser(loginBody);
+        if(user==null){
+            throw new CustomException("登录错误");
+        }
+        ClientLoginUser loginUser = new ClientLoginUser();
+        loginUser.setUser(user);
+        Map<String,String> map = new HashMap<>();
+        map.put(Constants.TOKEN,wxTokenService.createToken(loginUser));
+        map.put("union_id",loginUser.getUser().getUnionId());
+        return map;
+    }
+
     public Map<String,String> gzh_login(WxLoginBody loginBody) {
         User user = getWxGzhUnionIdUser(loginBody);
         if(user==null){

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CoursePhotoLogAddBo.java

@@ -45,4 +45,10 @@ public class CoursePhotoLogAddBo {
     /** 商品ID */
     @ApiModelProperty("商品ID")
     private Long goodsId;
+    /** 第几张图片 从0开始 */
+    @ApiModelProperty("第几张图片 从0开始")
+    private Integer photoIndex;
+    /** 班级ID */
+    @ApiModelProperty("班级ID")
+    private Long gradeId;
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CoursePhotoLogEditBo.java

@@ -52,4 +52,10 @@ public class CoursePhotoLogEditBo {
     /** 商品ID */
     @ApiModelProperty("商品ID")
     private Long goodsId;
+    /** 第几张图片 从0开始 */
+    @ApiModelProperty("第几张图片 从0开始")
+    private Integer photoIndex;
+    /** 班级ID */
+    @ApiModelProperty("班级ID")
+    private Long gradeId;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CoursePhotoLogQueryBo.java

@@ -54,4 +54,6 @@ public class CoursePhotoLogQueryBo extends BaseEntity {
 	/** 状态 1正常 0关闭 */
 	@ApiModelProperty("状态 1正常 0关闭")
 	private Integer status;
+	private Integer goodsId;
+	private Integer gradeId;
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/domain/CoursePhotoLog.java

@@ -44,4 +44,10 @@ private static final long serialVersionUID=1L;
     private Long updateTime;
     /** 状态 1正常 0关闭 */
     private Integer status;
+    /** 第几张图片 从0开始 */
+    private Integer photoIndex;
+    /** 班级ID */
+    private Long gradeId;
+    /** 商品ID */
+    private Long goodsId;
 }

+ 5 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CoursePhotoLogMapper.java

@@ -1,7 +1,11 @@
 package com.zhongzheng.modules.course.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.course.bo.CoursePhotoLogQueryBo;
 import com.zhongzheng.modules.course.domain.CoursePhotoLog;
+import com.zhongzheng.modules.course.vo.CoursePhotoLogVo;
+
+import java.util.List;
 
 /**
  * 用户节拍照记录Mapper接口
@@ -10,5 +14,5 @@ import com.zhongzheng.modules.course.domain.CoursePhotoLog;
  * @date 2022-01-12
  */
 public interface CoursePhotoLogMapper extends BaseMapper<CoursePhotoLog> {
-
+    List<CoursePhotoLogVo> getLastInfo(CoursePhotoLogQueryBo bo);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICoursePhotoLogService.java

@@ -35,6 +35,8 @@ public interface ICoursePhotoLogService extends IService<CoursePhotoLog> {
 	 */
 	Boolean insertByAddBo(CoursePhotoLogAddBo bo);
 
+	List<CoursePhotoLogVo> getLastInfo(CoursePhotoLogQueryBo bo);
+
 	/**
 	 * 根据编辑业务对象修改用户节拍照记录
 	 * @param bo 用户节拍照记录编辑业务对象

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CoursePhotoLogServiceImpl.java

@@ -77,6 +77,11 @@ public class CoursePhotoLogServiceImpl extends ServiceImpl<CoursePhotoLogMapper,
         return this.save(add);
     }
 
+    @Override
+    public List<CoursePhotoLogVo> getLastInfo(CoursePhotoLogQueryBo bo) {
+        return this.baseMapper.getLastInfo(bo);
+    }
+
     @Override
     public Boolean updateByEditBo(CoursePhotoLogEditBo bo) {
         CoursePhotoLog update = BeanUtil.toBean(bo, CoursePhotoLog.class);

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CoursePhotoLogVo.java

@@ -52,4 +52,12 @@ public class CoursePhotoLogVo {
 	@Excel(name = "商品ID")
 	@ApiModelProperty("商品ID")
 	private Long goodsId;
+	/** 第几张图片 从0开始 */
+	@Excel(name = "第几张图片 从0开始")
+	@ApiModelProperty("第几张图片 从0开始")
+	private Integer photoIndex;
+	/** 班级ID */
+	@Excel(name = "班级ID")
+	@ApiModelProperty("班级ID")
+	private Long gradeId;
 }

+ 26 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CoursePhotoLogMapper.xml

@@ -15,7 +15,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime" column="update_time"/>
         <result property="status" column="status"/>
         <result property="goodsId" column="goods_id"/>
+        <result property="photoIndex" column="photo_index"/>
+        <result property="gradeId" column="grade_id"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.course.vo.CoursePhotoLogVo" id="CoursePhotoLogVoResult">
+        <result property="id" column="id"/>
+        <result property="sectionId" column="section_id"/>
+        <result property="photo" column="photo"/>
+        <result property="photoTime" column="photo_time"/>
+        <result property="userId" column="user_id"/>
+        <result property="photoNum" column="photo_num"/>
+        <result property="status" column="status"/>
+        <result property="goodsId" column="goods_id"/>
+        <result property="photoIndex" column="photo_index"/>
+        <result property="gradeId" column="grade_id"/>
+    </resultMap>
+
+    <select id="getLastInfo" parameterType="com.zhongzheng.modules.course.bo.CoursePhotoLogQueryBo"  resultMap="CoursePhotoLogVoResult">
+        SELECT
+            *
+        FROM
+            course_photo_log
+        WHERE
+            user_id = #{userId}
+          AND goods_id = #{goodsId}
+          AND grade_id = #{gradeId}
+          AND section_id = #{sectionId}
+    </select>
 
 </mapper>