public static final String POINTS_RULE_FEEDBACK = "submit_feedback"; | public static final String POINTS_RULE_FEEDBACK = "submit_feedback"; | ||||
//积分规则-上传美拍并通过 | //积分规则-上传美拍并通过 | ||||
public static final String POINTS_RULE_PICTURE = "submit_scenery"; | public static final String POINTS_RULE_PICTURE = "submit_scenery"; | ||||
//积分规则-上报问题每日上限积分 | |||||
public static final String POINTS_RULE_DAILYLIMIT_FEEDBACK = "daily_limit_feedback"; | |||||
//积分规则-上传美拍每日上限积分 | |||||
public static final String POINTS_RULE_DAILYLIMIT_PICTURE = "daily_limit_picture"; | |||||
//积分规则-注册小程序账号 | |||||
public static final String APP_REGISTRY = "app_registry"; | |||||
//积分规则-关注抖音并通过 | |||||
public static final String TIKTOK = "tiktok"; | |||||
//积分规则-观看学习视频 | |||||
public static final String VIDEO = "video"; | |||||
//积分规则-报名志愿者活动 | |||||
public static final String VOLUNTEER_ACTIVITY = "volunteer_activity"; | |||||
//积分规则-提交护河建议 | |||||
public static final String PROTECT_RIVER_SUGGESTION = "protect_river_suggestion"; | |||||
//积分规则-提交护河建议每日积分上限 | |||||
public static final String POINTS_RULE_DAILYlIMIT_SUGGESTION = "daily_limit_suggestion"; | |||||
//积分规则-每日上限积分 | //积分规则-每日上限积分 | ||||
public static final String POINTS_RULE_DAILYLIMIT = "daily_limit"; | public static final String POINTS_RULE_DAILYLIMIT = "daily_limit"; | ||||
//短信规则code | //短信规则code | ||||
public static final String MSG_RULE_CODE = "msg_rule"; | public static final String MSG_RULE_CODE = "msg_rule"; | ||||
//短信规则name描述 | //短信规则name描述 |
public JsonResult exchange(UserPointsDetailQuery userPointsDetailQuery) { | public JsonResult exchange(UserPointsDetailQuery userPointsDetailQuery) { | ||||
return userPointsDetailService.exchange(userPointsDetailQuery); | return userPointsDetailService.exchange(userPointsDetailQuery); | ||||
} | } | ||||
/** | |||||
* 我的积分明细 | |||||
*/ | |||||
@GetMapping("/pointsDetail") | |||||
public JsonResult pointsDetail(UserPointsDetailQuery userPointsDetailQuery){ | |||||
return userPointsDetailService.pointsDetail(userPointsDetailQuery); | |||||
} | |||||
} | } |
package com.tuoheng.api.controller; | |||||
import com.tuoheng.api.entity.domain.WestreamActivityApply; | |||||
import com.tuoheng.api.entity.request.WestreamActivityQuery; | |||||
import com.tuoheng.api.service.IWestreamActivityApplyService; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.web.bind.annotation.*; | |||||
/** | |||||
* 全民护河志愿者活动 前端控制器 | |||||
* | |||||
* @author WangHaoran | |||||
* @since 2023-06-08 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/westreamActivityApply") | |||||
public class WestreamActivityApplyController { | |||||
@Autowired | |||||
private IWestreamActivityApplyService westreamActivityApplyService; | |||||
/** | |||||
* 活动-报名 | |||||
* | |||||
* @param westreamActivityApply | |||||
* @return | |||||
*/ | |||||
@PostMapping("/submit") | |||||
public JsonResult submit(@RequestBody WestreamActivityApply westreamActivityApply){ | |||||
return westreamActivityApplyService.submit(westreamActivityApply); | |||||
} | |||||
/** | |||||
* 查询活动申请 | |||||
* | |||||
* @return | |||||
*/ | |||||
@GetMapping("/getApply") | |||||
public JsonResult getApply(WestreamActivityQuery query) { | |||||
return westreamActivityApplyService.getApply(query); | |||||
} | |||||
} | |||||
package com.tuoheng.api.controller; | |||||
import com.tuoheng.api.entity.request.WestreamActivityQuery; | |||||
import com.tuoheng.api.service.IWestreamActivityService; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.web.bind.annotation.GetMapping; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
/** | |||||
* 全民护河志愿者活动 前端控制器 | |||||
* | |||||
* @author WangHaoran | |||||
* @since 2023-06-07 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/westreamActivity") | |||||
public class WestreamActivityController { | |||||
@Autowired | |||||
IWestreamActivityService westreamActivityService; | |||||
/** | |||||
* 志愿者活动查询(分页) | |||||
* | |||||
* @return | |||||
*/ | |||||
@GetMapping("/index") | |||||
public JsonResult index(WestreamActivityQuery query) { | |||||
return westreamActivityService.index(query); | |||||
} | |||||
} |
package com.tuoheng.api.controller; | |||||
import com.tuoheng.api.entity.request.WestreamMessageQuery; | |||||
import com.tuoheng.api.service.IWestreamMessageService; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.web.bind.annotation.*; | |||||
/** | |||||
* @Author xiaoying | |||||
* @Date 2023/6/6 11:57 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/message") | |||||
public class WestreamMessageController { | |||||
@Autowired | |||||
private IWestreamMessageService westreamMessageService; | |||||
/** | |||||
* 查询用户对应消息记录通知 | |||||
* | |||||
* @return | |||||
*/ | |||||
@GetMapping("/list") | |||||
private JsonResult getList(WestreamMessageQuery query) { | |||||
return westreamMessageService.getList(query); | |||||
} | |||||
/** | |||||
* 查询用户对应未读信息数量 | |||||
* | |||||
* @return | |||||
*/ | |||||
@GetMapping("/sum") | |||||
private JsonResult sum(WestreamMessageQuery query) { | |||||
return westreamMessageService.sum(query); | |||||
} | |||||
/** | |||||
* 查看信息详情 | |||||
* @return | |||||
*/ | |||||
@GetMapping("/deail") | |||||
private JsonResult deail(WestreamMessageQuery query) { | |||||
return westreamMessageService.deail(query); | |||||
} | |||||
/** | |||||
* 全部已读 | |||||
* @return | |||||
*/ | |||||
@PutMapping("/read") | |||||
private JsonResult read(@RequestBody WestreamMessageQuery query) { | |||||
return westreamMessageService.read(query); | |||||
} | |||||
} |
package com.tuoheng.api.controller; | |||||
import com.tuoheng.api.entity.domain.WestreamSuggest; | |||||
import com.tuoheng.api.service.IWestreamSuggestService; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
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; | |||||
/** | |||||
* 护河建议 前端控制器 | |||||
* | |||||
* @author WangHaoran | |||||
* @since 2023-06-06 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/westreamSuggest") | |||||
public class WestreamSuggestController { | |||||
@Autowired | |||||
IWestreamSuggestService westreamSuggestService; | |||||
/** | |||||
* 提交护河建议 | |||||
* | |||||
* @param entity | |||||
* @return | |||||
*/ | |||||
@PostMapping("/add") | |||||
public JsonResult add(@RequestBody WestreamSuggest entity) { | |||||
return westreamSuggestService.add(entity); | |||||
} | |||||
} |
package com.tuoheng.api.controller; | |||||
import com.tuoheng.api.entity.domain.ThWestreamTiktok; | |||||
import com.tuoheng.api.entity.request.WestreamTiktokQuery; | |||||
import com.tuoheng.api.service.IWestreamTiktokService; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.web.bind.annotation.*; | |||||
/** | |||||
* 关注抖音业务 前端控制器 | |||||
* | |||||
* @Author xiaoying | |||||
* @Date 2023/6/6 9:46 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/westreamTiktok") | |||||
public class WestreamTiktokController { | |||||
@Autowired | |||||
private IWestreamTiktokService thWestreamTiktokService; | |||||
/** | |||||
* 添加抖音关注审核 | |||||
* | |||||
* @param entity | |||||
* @return | |||||
*/ | |||||
@PostMapping("/add") | |||||
public JsonResult add(@RequestBody ThWestreamTiktok entity) { | |||||
return thWestreamTiktokService.add(entity); | |||||
} | |||||
/** | |||||
* 查询用户申请状态 | |||||
* | |||||
* @param | |||||
* @return | |||||
*/ | |||||
@GetMapping("/getIsApply") | |||||
public JsonResult getIsApply(WestreamTiktokQuery query) { | |||||
return thWestreamTiktokService.getIsApply(query); | |||||
} | |||||
} |
package com.tuoheng.api.controller; | |||||
import com.tuoheng.api.entity.request.WestreamVideoQuery; | |||||
import com.tuoheng.api.service.IWestreamVideoService; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.web.bind.annotation.*; | |||||
/** | |||||
* 全民护河学习视频 前端控制器 | |||||
* | |||||
* @author WangHaoran | |||||
* @since 2023-06-07 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/westreamVideo") | |||||
public class WestreamVideoController { | |||||
@Autowired | |||||
IWestreamVideoService westreamVideoService; | |||||
/** | |||||
* 获取学习视频列表(分页) | |||||
* | |||||
* @param query 查询条件 | |||||
* @return | |||||
*/ | |||||
@GetMapping("/index") | |||||
public JsonResult index(WestreamVideoQuery query) { | |||||
return westreamVideoService.queryPage(query); | |||||
} | |||||
/** | |||||
* 更新视频观看进度 | |||||
* | |||||
* @param query | |||||
* @return | |||||
*/ | |||||
@PutMapping("/updateProgress") | |||||
public JsonResult updateProgress(@RequestBody WestreamVideoQuery query) { | |||||
return westreamVideoService.updateProgress(query); | |||||
} | |||||
/** | |||||
* 查询学习视频观看进度 | |||||
* | |||||
* @param query 查询条件 | |||||
* @return | |||||
*/ | |||||
@GetMapping("/getVideoProgress") | |||||
public JsonResult getVideoProgress(WestreamVideoQuery query) { | |||||
return westreamVideoService.getVideoProgress(query); | |||||
} | |||||
} |
package com.tuoheng.api.entity.domain; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import com.tuoheng.common.common.BaseEntity; | |||||
import lombok.Data; | |||||
/** | |||||
* 全民护河消息表 | |||||
* | |||||
* @TableName th_westream_message | |||||
*/ | |||||
@TableName(value = "th_westream_message") | |||||
@Data | |||||
public class ThWestreamMessage extends BaseEntity { | |||||
/** | |||||
* 租户id | |||||
*/ | |||||
private Integer tenantId; | |||||
/** | |||||
* openid | |||||
*/ | |||||
private String openid; | |||||
/** | |||||
* 消息详情 | |||||
*/ | |||||
private String msgDetail; | |||||
/** | |||||
* 消息状态:1未读 2已读 | |||||
*/ | |||||
private Integer status; | |||||
} |
package com.tuoheng.api.entity.domain; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableField; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.io.Serializable; | |||||
import java.util.Date; | |||||
import com.tuoheng.common.common.BaseEntity; | |||||
import lombok.Data; | |||||
/** | |||||
* 全民护河抖音关注审核表 | |||||
* @TableName th_westream_tiktok | |||||
*/ | |||||
@TableName(value ="th_westream_tiktok") | |||||
@Data | |||||
public class ThWestreamTiktok extends BaseEntity { | |||||
/** | |||||
* 租户id | |||||
*/ | |||||
private Integer tenantId; | |||||
/** | |||||
* openid | |||||
*/ | |||||
private String openid; | |||||
/** | |||||
* 用户昵称 | |||||
*/ | |||||
private String nickname; | |||||
/** | |||||
* 护河身份ID | |||||
*/ | |||||
private Integer identityId; | |||||
/** | |||||
* 护河身份名称 | |||||
*/ | |||||
private String identityName; | |||||
/** | |||||
* 图片地址,多个用,隔开 | |||||
*/ | |||||
private String imageUrl; | |||||
/** | |||||
* 审核状态:1待审核 2通过 3驳回 | |||||
*/ | |||||
private Integer status; | |||||
/** | |||||
* 审核备注 | |||||
*/ | |||||
private String remark; | |||||
} |
* 操作人名称 | * 操作人名称 | ||||
*/ | */ | ||||
private String operatorName; | private String operatorName; | ||||
/** | |||||
* 变动活动名称 | |||||
*/ | |||||
private String changeName; | |||||
/** | /** | ||||
* 商铺名称 | * 商铺名称 |
package com.tuoheng.api.entity.domain; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import com.tuoheng.common.common.BaseEntity; | |||||
import lombok.Data; | |||||
import org.springframework.format.annotation.DateTimeFormat; | |||||
import javax.validation.constraints.NotBlank; | |||||
import javax.validation.constraints.NotNull; | |||||
import java.util.Date; | |||||
/** | |||||
* 全民护河志愿者活动表 | |||||
* @TableName th_westream_activity | |||||
*/ | |||||
@TableName(value ="th_westream_activity") | |||||
@Data | |||||
public class WestreamActivity extends BaseEntity { | |||||
/** | |||||
* 租户id | |||||
*/ | |||||
private Integer tenantId; | |||||
/** | |||||
* 活动主题 | |||||
*/ | |||||
@NotBlank(message = "活动主题不能为空") | |||||
private String activityTitle; | |||||
/** | |||||
* 封面图片地址 | |||||
*/ | |||||
@NotBlank(message = "封面图片地址不能为空") | |||||
private String imageUrl; | |||||
/** | |||||
* 报名开始时间 | |||||
*/ | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||||
@NotNull(message = "报名开始时间不能为空") | |||||
private Date applyBeginTime; | |||||
/** | |||||
* 报名结束时间 | |||||
*/ | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||||
@NotNull(message = "报名结束时间不能为空") | |||||
private Date applyEndTime; | |||||
/** | |||||
* 活动开始时间 | |||||
*/ | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||||
@NotNull(message = "活动开始时间不能为空") | |||||
private Date activityBeginTime; | |||||
/** | |||||
* 活动结束时间 | |||||
*/ | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||||
@NotNull(message = "活动结束时间不能为空") | |||||
private Date activityEndTime; | |||||
/** | |||||
* 活动介绍 | |||||
*/ | |||||
@NotBlank(message = "活动介绍不能为空") | |||||
private String intro; | |||||
} |
package com.tuoheng.api.entity.domain; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import com.tuoheng.common.common.BaseEntity; | |||||
import lombok.Data; | |||||
/** | |||||
* 全民护河志愿者活动审核表 | |||||
* @TableName th_westream_activity_apply | |||||
*/ | |||||
@TableName(value ="th_westream_activity_apply") | |||||
@Data | |||||
public class WestreamActivityApply extends BaseEntity { | |||||
/** | |||||
* 租户id | |||||
*/ | |||||
private Integer tenantId; | |||||
/** | |||||
* 活动id | |||||
*/ | |||||
private Integer activityId; | |||||
/** | |||||
* 活动主题 | |||||
*/ | |||||
private String activityTitle; | |||||
/** | |||||
* openid | |||||
*/ | |||||
private String openid; | |||||
/** | |||||
* 用户昵称 | |||||
*/ | |||||
private String nickname; | |||||
/** | |||||
* 申请姓名 | |||||
*/ | |||||
private String applyName; | |||||
/** | |||||
* 申请电话 | |||||
*/ | |||||
private String applyPhone; | |||||
/** | |||||
* 审核状态:1待审核 2通过 3驳回 | |||||
*/ | |||||
private Integer status; | |||||
/** | |||||
* 审核备注 | |||||
*/ | |||||
private String remark; | |||||
} |
package com.tuoheng.api.entity.domain; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import com.tuoheng.common.common.BaseEntity; | |||||
import lombok.Data; | |||||
/** | |||||
* 全民护河志愿者活动用户表 | |||||
* @TableName th_westream_activity_user | |||||
*/ | |||||
@TableName(value ="th_westream_activity_user") | |||||
@Data | |||||
public class WestreamActivityUser extends BaseEntity { | |||||
/** | |||||
* 租户id | |||||
*/ | |||||
private Integer tenantId; | |||||
/** | |||||
* 活动id | |||||
*/ | |||||
private Integer activityId; | |||||
/** | |||||
* openid | |||||
*/ | |||||
private String openid; | |||||
} |
package com.tuoheng.api.entity.domain; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import com.tuoheng.common.common.BaseEntity; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
import java.io.Serializable; | |||||
/** | |||||
* 全民护河保护河建议表 | |||||
* | |||||
* @author WangHaoran | |||||
* @since 2023-06-06 | |||||
*/ | |||||
@Data | |||||
@EqualsAndHashCode(callSuper = false) | |||||
@Accessors(chain = true) | |||||
@TableName("th_westream_suggest") | |||||
public class WestreamSuggest extends BaseEntity implements Serializable { | |||||
/** | |||||
* 租户id | |||||
*/ | |||||
private Integer tenantId; | |||||
/** | |||||
* openid | |||||
*/ | |||||
private String openid; | |||||
/** | |||||
* 用户昵称 | |||||
*/ | |||||
private String nickname; | |||||
/** | |||||
* 护河建议 | |||||
*/ | |||||
private String suggestName; | |||||
/** | |||||
* 审核状态:1待审核 2通过 3驳回 | |||||
*/ | |||||
private Integer status; | |||||
/** | |||||
* 审核备注 | |||||
*/ | |||||
private String remark; | |||||
} |
*/ | */ | ||||
@TableField(exist = false) | @TableField(exist = false) | ||||
private String identityRemark; | private String identityRemark; | ||||
/** | |||||
* 是否关注抖音 1是 0否 | |||||
*/ | |||||
private Integer isTiktok; | |||||
} | } |
package com.tuoheng.api.entity.domain; | |||||
import com.baomidou.mybatisplus.annotation.TableField; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import com.tuoheng.common.common.BaseEntity; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
import java.io.Serializable; | |||||
/** | |||||
* 全民护河学习视频表 | |||||
* | |||||
* @author WangHaoran | |||||
* @since 2023-06-07 | |||||
*/ | |||||
@Data | |||||
@EqualsAndHashCode(callSuper = false) | |||||
@Accessors(chain = true) | |||||
@TableName("th_westream_video") | |||||
public class WestreamVideo extends BaseEntity implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
/** | |||||
* 租户ID | |||||
*/ | |||||
private Integer tenantId; | |||||
/** | |||||
* 视频标题 | |||||
*/ | |||||
private String videoTitle; | |||||
/** | |||||
* 视频简介 | |||||
*/ | |||||
private String videoBrief; | |||||
/** | |||||
* 视频地址 | |||||
*/ | |||||
private String videoUrl; | |||||
/** | |||||
* 封面图片地址 | |||||
*/ | |||||
private String imageUrl; | |||||
/** | |||||
* 视频学习状态 0待学习 1学习中 2已学习 | |||||
*/ | |||||
@TableField(exist = false) | |||||
private Integer status; | |||||
} |
package com.tuoheng.api.entity.domain; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import com.tuoheng.common.common.BaseEntity; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
import java.io.Serializable; | |||||
/** | |||||
* 全民护河学习视频用户表 | |||||
* | |||||
* @author WangHaoran | |||||
* @since 2023-06-07 | |||||
*/ | |||||
@Data | |||||
@EqualsAndHashCode(callSuper = false) | |||||
@Accessors(chain = true) | |||||
@TableName("th_westream_video_user") | |||||
public class WestreamVideoUser extends BaseEntity implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
/** | |||||
* 租户ID | |||||
*/ | |||||
private Integer tenantId; | |||||
/** | |||||
* 视频标题 | |||||
*/ | |||||
private Integer videoId; | |||||
/** | |||||
* 视频标题 | |||||
*/ | |||||
private String openid; | |||||
/** | |||||
* 视频观看进度 | |||||
*/ | |||||
private String videoProgress; | |||||
/** | |||||
* 视频学习状态 1学习中 2已学习 | |||||
*/ | |||||
private Integer status; | |||||
} |
package com.tuoheng.api.entity.request; | |||||
import com.tuoheng.common.common.BaseQuery; | |||||
import lombok.Data; | |||||
/** | |||||
* @Author xiaoying | |||||
* @Date 2023/6/6 14:24 | |||||
*/ | |||||
@Data | |||||
public class WestreamActivityQuery extends BaseQuery { | |||||
/** | |||||
* 活动主题 | |||||
*/ | |||||
private String activityTitle; | |||||
/** | |||||
* 租户ID | |||||
*/ | |||||
private Integer tenantId; | |||||
/** | |||||
* 活动id | |||||
*/ | |||||
private Integer activityId; | |||||
/** | |||||
* openid | |||||
*/ | |||||
private String openid; | |||||
} |
package com.tuoheng.api.entity.request; | |||||
import com.tuoheng.common.common.BaseQuery; | |||||
import lombok.Data; | |||||
/** | |||||
* @Author xiaoying | |||||
* @Date 2023/6/6 15:32 | |||||
*/ | |||||
@Data | |||||
public class WestreamMessageQuery extends BaseQuery { | |||||
/** | |||||
* 信息id | |||||
*/ | |||||
private String msgId; | |||||
private String openId; | |||||
private Integer tenantId; | |||||
} |
package com.tuoheng.api.entity.request; | |||||
import lombok.Data; | |||||
/** | |||||
* 全民护河抖音关注审核表查询 | |||||
* | |||||
* @author WangHaoran | |||||
* @since 2023-06-06 | |||||
*/ | |||||
@Data | |||||
public class WestreamTiktokQuery { | |||||
/** | |||||
* 用户openid | |||||
*/ | |||||
private String openid; | |||||
/** | |||||
* 租户ID | |||||
*/ | |||||
private Integer tenantId; | |||||
} |
package com.tuoheng.api.entity.request; | |||||
import com.tuoheng.common.common.BaseQuery; | |||||
import lombok.Data; | |||||
@Data | |||||
public class WestreamVideoQuery extends BaseQuery { | |||||
/** | |||||
* 租户ID | |||||
*/ | |||||
private Integer tenantId; | |||||
/** | |||||
* 用户openid | |||||
*/ | |||||
private String openid; | |||||
/** | |||||
* 视频ID | |||||
*/ | |||||
private Integer videoId; | |||||
/** | |||||
* 视频观看进度 | |||||
*/ | |||||
private String videoProgress; | |||||
/** | |||||
* 视频学习状态 1学习中 2已学习 | |||||
*/ | |||||
private Integer status; | |||||
} |
package com.tuoheng.api.entity.vo; | |||||
import com.tuoheng.api.entity.domain.WestreamActivity; | |||||
import lombok.Data; | |||||
/** | |||||
* @Author xiaoying | |||||
* @Date 2023/6/6 14:41 | |||||
*/ | |||||
@Data | |||||
public class WestreamActivityVo extends WestreamActivity { | |||||
/** | |||||
* 报名时间 | |||||
*/ | |||||
private String applyTime; | |||||
/** | |||||
* 活动时间 | |||||
*/ | |||||
private String acticityTime; | |||||
/** | |||||
* 活动状态 1 活动未开始 2活动进行中 3活动已结束 | |||||
*/ | |||||
private Integer status; | |||||
} |
package com.tuoheng.api.enums; | |||||
import lombok.Getter; | |||||
public enum ActivityStatusEnum { | |||||
NO_STARTED(1, "报名未开始"), | |||||
IN_PROGRESS(2, "报名进行中"), | |||||
END(3, "报名已结束"); | |||||
ActivityStatusEnum(int code, String description) { | |||||
this.code = code; | |||||
this.description = description; | |||||
} | |||||
@Getter | |||||
private int code; | |||||
@Getter | |||||
private String description; | |||||
} |
package com.tuoheng.api.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.tuoheng.api.entity.domain.ThWestreamMessage; | |||||
/** | |||||
* @author 小影 | |||||
* @description 针对表【th_westream_message(全民护河消息表)】的数据库操作Mapper | |||||
* @createDate 2023-06-06 11:30:05 | |||||
* @Entity com.tuoheng.admin.entity.domain.ThWestreamMessage | |||||
*/ | |||||
public interface ThWestreamMessageMapper extends BaseMapper<ThWestreamMessage> { | |||||
} | |||||
package com.tuoheng.api.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.tuoheng.api.entity.domain.ThWestreamTiktok; | |||||
/** | |||||
* @author 小影 | |||||
* @description 针对表【th_westream_tiktok(全民护河抖音关注审核表)】的数据库操作Mapper | |||||
* @createDate 2023-06-06 09:46:18 | |||||
* @Entity com.tuoheng.admin.entity.ThWestreamTiktok | |||||
*/ | |||||
public interface ThWestreamTiktokMapper extends BaseMapper<ThWestreamTiktok> { | |||||
} | |||||
package com.tuoheng.api.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.tuoheng.api.entity.domain.WestreamActivityApply; | |||||
/** | |||||
* @author 小影 | |||||
* @description 针对表【th_westream_activity_apply(全民护河志愿者活动审核表)】的数据库操作Mapper | |||||
* @createDate 2023-06-06 14:22:11 | |||||
* @Entity com.tuoheng.admin.entity.domain.ThWestreamActivityApply | |||||
*/ | |||||
public interface WestreamActivityApplyMapper extends BaseMapper<WestreamActivityApply> { | |||||
} | |||||
package com.tuoheng.api.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.tuoheng.api.entity.domain.WestreamActivity; | |||||
/** | |||||
* @author 小影 | |||||
* @description 针对表【th_westream_activity(全民护河志愿者活动表)】的数据库操作Mapper | |||||
* @createDate 2023-06-06 14:22:00 | |||||
* @Entity com.tuoheng.admin.entity.domain.ThWestreamActivity | |||||
*/ | |||||
public interface WestreamActivityMapper extends BaseMapper<WestreamActivity> { | |||||
} | |||||
package com.tuoheng.api.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.tuoheng.api.entity.domain.WestreamActivityUser; | |||||
/** | |||||
* @author 小影 | |||||
* @description 针对表【th_westream_activity_user(全民护河志愿者活动用户表)】的数据库操作Mapper | |||||
* @createDate 2023-06-06 14:22:14 | |||||
* @Entity com.tuoheng.admin.entity.domain.ThWestreamActivityUser | |||||
*/ | |||||
public interface WestreamActivityUserMapper extends BaseMapper<WestreamActivityUser> { | |||||
} | |||||
package com.tuoheng.api.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.tuoheng.api.entity.domain.WestreamSuggest; | |||||
/** | |||||
* 全民护河保护河建议表 Mapper 接口 | |||||
* | |||||
* @author WangHaoran | |||||
* @since 2023-06-06 | |||||
*/ | |||||
public interface WestreamSuggestMapper extends BaseMapper<WestreamSuggest> { | |||||
} |
package com.tuoheng.api.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.tuoheng.api.entity.domain.WestreamVideo; | |||||
/** | |||||
* 全民护河学习视频表 Mapper 接口 | |||||
* | |||||
* @author WangHaoran | |||||
* @since 2023-06-07 | |||||
*/ | |||||
public interface WestreamVideoMapper extends BaseMapper<WestreamVideo> { | |||||
} |
package com.tuoheng.api.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.tuoheng.api.entity.domain.WestreamVideoUser; | |||||
/** | |||||
* 全民护河学习视频用户表 Mapper 接口 | |||||
* | |||||
* @author WangHaoran | |||||
* @since 2023-06-07 | |||||
*/ | |||||
public interface WestreamVideoUserMapper extends BaseMapper<WestreamVideoUser> { | |||||
} |
*/ | */ | ||||
public interface IUserPointsDetailService extends IBaseService<UserPointsDetail> { | public interface IUserPointsDetailService extends IBaseService<UserPointsDetail> { | ||||
JsonResult exchange(UserPointsDetailQuery userPointsDetailQuery); | JsonResult exchange(UserPointsDetailQuery userPointsDetailQuery); | ||||
JsonResult pointsDetail(UserPointsDetailQuery userPointsDetailQuery); | |||||
} | } |
package com.tuoheng.api.service; | |||||
import com.tuoheng.api.entity.domain.WestreamActivityApply; | |||||
import com.tuoheng.api.entity.request.WestreamActivityQuery; | |||||
import com.tuoheng.common.common.IBaseService; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
public interface IWestreamActivityApplyService extends IBaseService<WestreamActivityApply> { | |||||
JsonResult submit(WestreamActivityApply westreamActivityApply); | |||||
JsonResult getApply(WestreamActivityQuery query); | |||||
} |
package com.tuoheng.api.service; | |||||
import com.tuoheng.api.entity.domain.WestreamActivity; | |||||
import com.tuoheng.api.entity.request.WestreamActivityQuery; | |||||
import com.tuoheng.common.common.IBaseService; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
public interface IWestreamActivityService extends IBaseService<WestreamActivity> { | |||||
JsonResult index(WestreamActivityQuery query); | |||||
} |
package com.tuoheng.api.service; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
import com.tuoheng.api.entity.domain.ThWestreamMessage; | |||||
import com.tuoheng.api.entity.request.WestreamMessageQuery; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
/** | |||||
* @author 小影 | |||||
* @description 针对表【th_westream_message(全民护河消息表)】的数据库操作Service | |||||
* @createDate 2023-06-06 11:30:05 | |||||
*/ | |||||
public interface IWestreamMessageService extends IService<ThWestreamMessage> { | |||||
JsonResult getList(WestreamMessageQuery query); | |||||
JsonResult read(WestreamMessageQuery query); | |||||
JsonResult deail(WestreamMessageQuery query); | |||||
JsonResult sum(WestreamMessageQuery query); | |||||
} |
package com.tuoheng.api.service; | |||||
import com.tuoheng.api.entity.domain.WestreamSuggest; | |||||
import com.tuoheng.common.common.IBaseService; | |||||
public interface IWestreamSuggestService extends IBaseService<WestreamSuggest> { | |||||
} |
package com.tuoheng.api.service; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
import com.tuoheng.api.entity.domain.ThWestreamTiktok; | |||||
import com.tuoheng.api.entity.request.WestreamTiktokQuery; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
/** | |||||
* @author 小影 | |||||
* @description 针对表【th_westream_tiktok(全民护河抖音关注审核表)】的数据库操作Service | |||||
* @createDate 2023-06-06 09:46:18 | |||||
*/ | |||||
public interface IWestreamTiktokService extends IService<ThWestreamTiktok> { | |||||
JsonResult add(ThWestreamTiktok entity); | |||||
JsonResult getIsApply(WestreamTiktokQuery query); | |||||
} |
package com.tuoheng.api.service; | |||||
import com.tuoheng.api.entity.domain.WestreamVideo; | |||||
import com.tuoheng.api.entity.request.WestreamVideoQuery; | |||||
import com.tuoheng.common.common.IBaseService; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
public interface IWestreamVideoService extends IBaseService<WestreamVideo> { | |||||
JsonResult queryPage(WestreamVideoQuery query); | |||||
JsonResult updateProgress(WestreamVideoQuery query); | |||||
JsonResult getVideoProgress(WestreamVideoQuery query); | |||||
} |
package com.tuoheng.api.service.impl; | |||||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import com.tuoheng.api.entity.domain.ThWestreamMessage; | |||||
import com.tuoheng.api.entity.domain.WestreamActivity; | |||||
import com.tuoheng.api.entity.request.WestreamMessageQuery; | |||||
import com.tuoheng.api.mapper.ThWestreamMessageMapper; | |||||
import com.tuoheng.api.service.IWestreamMessageService; | |||||
import com.tuoheng.common.common.BaseEntity; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
import com.tuoheng.common.utils.StringUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
import java.util.List; | |||||
/** | |||||
* @author 小影 | |||||
* @description 针对表【th_westream_message(全民护河消息表)】的数据库操作Service实现 | |||||
* @createDate 2023-06-06 11:30:05 | |||||
*/ | |||||
@Service | |||||
public class ThWestreamMessageServiceImpl extends ServiceImpl<ThWestreamMessageMapper, ThWestreamMessage> | |||||
implements IWestreamMessageService { | |||||
@Autowired | |||||
private ThWestreamMessageMapper westreamMessageMapper; | |||||
/** | |||||
* 查询用户对应消息记录通知 | |||||
* | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public JsonResult getList(WestreamMessageQuery query) { | |||||
if (StringUtils.isEmpty(query.getOpenId())) { | |||||
return JsonResult.error("openid为空"); | |||||
} | |||||
if (StringUtils.isNull(query.getTenantId())) { | |||||
return JsonResult.error("TenantId为空"); | |||||
} | |||||
query.checkParam(); | |||||
IPage<ThWestreamMessage> page = new Page<>(query.getPage(), query.getLimit()); | |||||
IPage<ThWestreamMessage> pageDate = westreamMessageMapper.selectPage(page, Wrappers.<ThWestreamMessage>lambdaQuery() | |||||
.eq(ThWestreamMessage::getOpenid, query.getOpenId()) | |||||
.eq(ThWestreamMessage::getTenantId, query.getTenantId()) | |||||
.orderByDesc(BaseEntity::getCreateTime) | |||||
.eq(BaseEntity::getMark, 1)); | |||||
return JsonResult.success(pageDate); | |||||
} | |||||
/** | |||||
* 查看信息详情 | |||||
* | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public JsonResult deail(WestreamMessageQuery query) { | |||||
if (StringUtils.isEmpty(query.getMsgId())) { | |||||
return JsonResult.error("msgId为空"); | |||||
} | |||||
ThWestreamMessage message = this.getById(query.getMsgId()); | |||||
//点击查看详情的时候同步修改信息状态 | |||||
message.setStatus(2); | |||||
this.updateById(message); | |||||
return JsonResult.success(message); | |||||
} | |||||
@Override | |||||
public JsonResult read(WestreamMessageQuery query) { | |||||
if (StringUtils.isEmpty(query.getOpenId())) { | |||||
return JsonResult.error("openid为空"); | |||||
} | |||||
if (StringUtils.isNull(query.getTenantId())) { | |||||
return JsonResult.error("TenantId为空"); | |||||
} | |||||
//查询出所有未读的 | |||||
List<ThWestreamMessage> list = this.list(Wrappers.<ThWestreamMessage>lambdaQuery() | |||||
.eq(ThWestreamMessage::getTenantId, query.getTenantId()) | |||||
.eq(ThWestreamMessage::getOpenid, query.getOpenId()) | |||||
.eq(ThWestreamMessage::getStatus, 1) | |||||
.eq(BaseEntity::getMark, 1)); | |||||
list.forEach(t -> t.setStatus(2)); | |||||
this.updateBatchById(list); | |||||
return JsonResult.success(); | |||||
} | |||||
/** | |||||
* 查询用户对应未读信息数量 | |||||
* | |||||
* @param query | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public JsonResult sum(WestreamMessageQuery query) { | |||||
if (StringUtils.isEmpty(query.getOpenId())) { | |||||
return JsonResult.error("openid为空"); | |||||
} | |||||
if (StringUtils.isNull(query.getTenantId())) { | |||||
return JsonResult.error("TenantId为空"); | |||||
} | |||||
//查询出所有未读的 | |||||
List<ThWestreamMessage> list = this.list(Wrappers.<ThWestreamMessage>lambdaQuery() | |||||
.eq(ThWestreamMessage::getTenantId, query.getTenantId()) | |||||
.eq(ThWestreamMessage::getOpenid, query.getOpenId()) | |||||
.eq(ThWestreamMessage::getStatus, 1) | |||||
.eq(BaseEntity::getMark, 1)); | |||||
return JsonResult.success(list.size()); | |||||
} | |||||
} | |||||
package com.tuoheng.api.service.impl; | |||||
import cn.hutool.core.date.DateUtil; | |||||
import cn.hutool.core.util.ObjectUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import com.tuoheng.api.entity.domain.Identity; | |||||
import com.tuoheng.api.entity.domain.ThWestreamTiktok; | |||||
import com.tuoheng.api.entity.domain.WestreamUser; | |||||
import com.tuoheng.api.entity.request.WestreamTiktokQuery; | |||||
import com.tuoheng.api.mapper.IdentityMapper; | |||||
import com.tuoheng.api.mapper.ThWestreamTiktokMapper; | |||||
import com.tuoheng.api.mapper.WestreamUserMapper; | |||||
import com.tuoheng.api.service.IWestreamTiktokService; | |||||
import com.tuoheng.common.common.BaseEntity; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
import com.tuoheng.common.utils.StringUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* @author 小影 | |||||
* @description 针对表【th_westream_tiktok(全民护河抖音关注审核表)】的数据库操作Service实现 | |||||
* @createDate 2023-06-06 09:46:18 | |||||
*/ | |||||
@Service | |||||
public class ThWestreamTiktokServiceImpl extends ServiceImpl<ThWestreamTiktokMapper, ThWestreamTiktok> | |||||
implements IWestreamTiktokService { | |||||
@Autowired | |||||
private ThWestreamTiktokMapper westreamTiktokMapper; | |||||
@Autowired | |||||
private WestreamUserMapper westreamUserMapper; | |||||
@Autowired | |||||
private IdentityMapper identityMapper; | |||||
/** | |||||
* 添加抖音关注审核 | |||||
* | |||||
* @param entity | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public JsonResult add(ThWestreamTiktok entity) { | |||||
//校验 | |||||
if (StringUtils.isEmpty(entity.getOpenid())) { | |||||
return JsonResult.error("openid为空!"); | |||||
} | |||||
if (StringUtils.isNull(entity.getTenantId())) { | |||||
return JsonResult.error("tenantId不能为空!"); | |||||
} | |||||
//查询是否已经申请 | |||||
Integer count = westreamTiktokMapper.selectCount(new LambdaQueryWrapper<ThWestreamTiktok>() | |||||
.eq(ThWestreamTiktok::getOpenid, entity.getOpenid()) | |||||
.eq(ThWestreamTiktok::getTenantId, entity.getTenantId()) | |||||
.in(ThWestreamTiktok::getStatus, 1, 2) | |||||
.eq(ThWestreamTiktok::getMark, 1)); | |||||
if(count > 0){ | |||||
return JsonResult.error("您已参与了该活动!"); | |||||
} | |||||
//查询当前用户 | |||||
WestreamUser westreamUser = westreamUserMapper.selectOne(Wrappers.<WestreamUser>lambdaQuery() | |||||
.eq(WestreamUser::getOpenid, entity.getOpenid()) | |||||
.eq(WestreamUser::getTenantId, entity.getTenantId()) | |||||
.eq(BaseEntity::getMark, 1)); | |||||
if (StringUtils.isNull(westreamUser)) { | |||||
return JsonResult.error("该用户不存在此系统!"); | |||||
} | |||||
if (1 == westreamUser.getIsTiktok()) { | |||||
return JsonResult.error("您已参与了该活动,无法再次获得积分!"); | |||||
} | |||||
entity.setNickname(westreamUser.getNickname()); | |||||
if (StringUtils.isNotNull(westreamUser.getIdentityId())) { | |||||
Identity identity = identityMapper.selectById(westreamUser.getIdentityId()); | |||||
entity.setIdentityId(identity.getId()); | |||||
entity.setIdentityName(identity.getIdentityName()); | |||||
} | |||||
entity.setCreateTime(DateUtil.date()); | |||||
entity.setCreateUser(westreamUser.getId()); | |||||
//填充数据 | |||||
boolean flag = this.save(entity); | |||||
if (flag) { | |||||
return JsonResult.success(); | |||||
} else { | |||||
return JsonResult.error("新增抖音审核任务失败"); | |||||
} | |||||
} | |||||
@Override | |||||
public JsonResult getIsApply(WestreamTiktokQuery query) { | |||||
//查询该用户最新一条申请数据 | |||||
ThWestreamTiktok thWestreamTiktok = westreamTiktokMapper.selectOne(new LambdaQueryWrapper<ThWestreamTiktok>() | |||||
.eq(ThWestreamTiktok::getOpenid, query.getOpenid()) | |||||
.eq(ThWestreamTiktok::getTenantId, query.getTenantId()) | |||||
.eq(ThWestreamTiktok::getMark, 1) | |||||
.orderByDesc(ThWestreamTiktok::getCreateTime) | |||||
.last("limit 1")); | |||||
//0未申请(或驳回) 1待审核 2通过 | |||||
if(ObjectUtil.isNull(thWestreamTiktok)){ | |||||
return JsonResult.success(0); | |||||
}else { | |||||
if(1 == thWestreamTiktok.getStatus()){ | |||||
return JsonResult.success(1); | |||||
}else if(2 == thWestreamTiktok.getStatus()){ | |||||
return JsonResult.success(2); | |||||
}else if(3 == thWestreamTiktok.getStatus()){ | |||||
return JsonResult.success(0); | |||||
}else { | |||||
return JsonResult.success(0); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
/** | /** | ||||
* 全民护河公告表 服务实现类 | * 全民护河公告表 服务实现类 | ||||
* | * | ||||
} | } | ||||
return JsonResult.success(pageData); | return JsonResult.success(pageData); | ||||
} | } | ||||
@Override | |||||
public JsonResult pointsDetail(UserPointsDetailQuery userPointsDetailQuery) { | |||||
Integer tenantId = userPointsDetailQuery.getTenantId(); | |||||
String openid = userPointsDetailQuery.getOpenid(); | |||||
// List<UserPointsDetail> userPointsDetailResult = new ArrayList<>(); | |||||
IPage<UserPointsDetail> page = new Page<UserPointsDetail>(userPointsDetailQuery.getPage(), userPointsDetailQuery.getLimit()); | |||||
IPage<UserPointsDetail> userPointsDetailList = userPointsDetailMapper.selectPage(page, new LambdaQueryWrapper<UserPointsDetail>() | |||||
.eq(UserPointsDetail::getTenantId, tenantId) | |||||
.eq(UserPointsDetail::getOpenid, openid) | |||||
.eq(UserPointsDetail::getMark, 1) | |||||
.isNotNull(UserPointsDetail::getChangeName) | |||||
.orderByDesc(UserPointsDetail::getCreateTime)); | |||||
// userPointsDetailList.convert(x -> { | |||||
// if(x.getType().equals(2)){ | |||||
// x.setPointsChange(-1*x.getPointsChange()); | |||||
// } | |||||
// return x; | |||||
// }); | |||||
// for (UserPointsDetail userPointsDetail : userPointsDetailList) { | |||||
// UserPointsDetail userPointsDetail1 = new UserPointsDetail(); | |||||
// userPointsDetail1.setChangeName(userPointsDetail.getChangeName()); | |||||
// userPointsDetail1.setCreateTime(userPointsDetail.getCreateTime()); | |||||
// if(userPointsDetail.getType().equals(1)){ | |||||
// userPointsDetail1.setPointsChange(userPointsDetail.getPointsChange()); | |||||
// }else{ | |||||
// userPointsDetail1.setPointsChange(-1 * userPointsDetail.getPointsChange()); | |||||
// } | |||||
// userPointsDetailResult.add(userPointsDetail1); | |||||
// } | |||||
return JsonResult.success(userPointsDetailList); | |||||
} | |||||
} | } |
package com.tuoheng.api.service.impl; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.tuoheng.api.entity.domain.WestreamActivityApply; | |||||
import com.tuoheng.api.entity.request.WestreamActivityQuery; | |||||
import com.tuoheng.api.mapper.WestreamActivityApplyMapper; | |||||
import com.tuoheng.api.service.IWestreamActivityApplyService; | |||||
import com.tuoheng.common.common.BaseServiceImpl; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
import com.tuoheng.common.utils.StringUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
@Service | |||||
public class WestreamActivityApplyServiceImpl extends BaseServiceImpl<WestreamActivityApplyMapper, WestreamActivityApply> implements IWestreamActivityApplyService { | |||||
@Autowired | |||||
private WestreamActivityApplyMapper westreamActivityApplyMapper; | |||||
@Override | |||||
public JsonResult submit(WestreamActivityApply entity) { | |||||
if (null == entity.getTenantId() || StringUtils.isEmpty(entity.getOpenid())) { | |||||
return JsonResult.error("参数为空!"); | |||||
} | |||||
if (null == entity.getActivityId()) { | |||||
return JsonResult.error("活动ID为空!"); | |||||
} | |||||
//校验重复报名 | |||||
Integer count = westreamActivityApplyMapper.selectCount(new LambdaQueryWrapper<WestreamActivityApply>() | |||||
.eq(WestreamActivityApply::getActivityId, entity.getActivityId()) | |||||
.eq(WestreamActivityApply::getTenantId, entity.getTenantId()) | |||||
.eq(WestreamActivityApply::getOpenid, entity.getOpenid()) | |||||
.in(WestreamActivityApply::getStatus, 1,2) | |||||
.eq(WestreamActivityApply::getMark, 1)); | |||||
if(count > 0){ | |||||
return JsonResult.error("您已参加该活动!"); | |||||
} | |||||
super.add(entity); | |||||
return JsonResult.success(); | |||||
} | |||||
@Override | |||||
public JsonResult getApply(WestreamActivityQuery query) { | |||||
if (null == query.getTenantId() || StringUtils.isEmpty(query.getOpenid())) { | |||||
return JsonResult.error("参数为空!"); | |||||
} | |||||
if (null == query.getActivityId()) { | |||||
return JsonResult.error("活动ID为空!"); | |||||
} | |||||
WestreamActivityApply westreamActivityApply = westreamActivityApplyMapper.selectOne(new LambdaQueryWrapper<WestreamActivityApply>() | |||||
.eq(WestreamActivityApply::getActivityId, query.getActivityId()) | |||||
.eq(WestreamActivityApply::getTenantId, query.getTenantId()) | |||||
.eq(WestreamActivityApply::getOpenid, query.getOpenid()) | |||||
.eq(WestreamActivityApply::getMark, 1) | |||||
.orderByDesc(WestreamActivityApply::getCreateTime) | |||||
.last("limit 1")); | |||||
return JsonResult.success(westreamActivityApply); | |||||
} | |||||
} |
package com.tuoheng.api.service.impl; | |||||
import cn.hutool.core.convert.Convert; | |||||
import cn.hutool.core.date.DateTime; | |||||
import cn.hutool.core.date.DateUtil; | |||||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.tuoheng.api.entity.domain.WestreamActivity; | |||||
import com.tuoheng.api.entity.request.WestreamActivityQuery; | |||||
import com.tuoheng.api.entity.vo.WestreamActivityVo; | |||||
import com.tuoheng.api.enums.ActivityStatusEnum; | |||||
import com.tuoheng.api.mapper.WestreamActivityMapper; | |||||
import com.tuoheng.api.service.IWestreamActivityService; | |||||
import com.tuoheng.common.common.BaseEntity; | |||||
import com.tuoheng.common.common.BaseServiceImpl; | |||||
import com.tuoheng.common.utils.CommonUtils; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
import com.tuoheng.common.utils.StringUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
import java.util.Date; | |||||
@Service | |||||
public class WestreamActivityServiceImpl extends BaseServiceImpl<WestreamActivityMapper, WestreamActivity> implements IWestreamActivityService { | |||||
@Autowired | |||||
private WestreamActivityMapper westreamActivityMapper; | |||||
@Override | |||||
public JsonResult index(WestreamActivityQuery query) { | |||||
if (null == query.getTenantId()) { | |||||
return JsonResult.error("租户ID为空!"); | |||||
} | |||||
query.checkParam(); | |||||
//开启分页 | |||||
IPage<WestreamActivity> page = new Page<>(query.getPage(), query.getLimit()); | |||||
IPage<WestreamActivity> pageDate = westreamActivityMapper.selectPage(page, Wrappers.<WestreamActivity>lambdaQuery() | |||||
.eq(WestreamActivity::getTenantId, query.getTenantId()) | |||||
.eq(BaseEntity::getMark, 1) | |||||
.orderByDesc(WestreamActivity::getCreateTime)); | |||||
//返回图片地址匹配路径前缀 | |||||
IPage<WestreamActivityVo> result = pageDate.convert(item -> { | |||||
WestreamActivityVo vo = Convert.convert(WestreamActivityVo.class, item); | |||||
vo.setApplyTime(DateUtil.formatDateTime(vo.getApplyBeginTime()) + "-" + DateUtil.formatDateTime(vo.getApplyEndTime())); | |||||
vo.setActicityTime(DateUtil.formatDateTime(vo.getActivityBeginTime()) + "-" + DateUtil.formatDateTime(vo.getActivityEndTime())); | |||||
if (StringUtils.isNotEmpty(vo.getImageUrl())) { | |||||
vo.setImageUrl(CommonUtils.getImageURL(vo.getImageUrl())); | |||||
} | |||||
Integer status = getVoStatus(vo.getApplyBeginTime(), vo.getApplyEndTime()); | |||||
vo.setStatus(status); | |||||
return vo; | |||||
}); | |||||
return JsonResult.success(result); | |||||
} | |||||
/** | |||||
* 获取活动状态 | |||||
* | |||||
* @param applyBeginTime | |||||
* @param applyEndTime | |||||
* @return | |||||
*/ | |||||
private Integer getVoStatus(Date applyBeginTime, Date applyEndTime) { | |||||
DateTime nowTime = DateUtil.date(); | |||||
boolean flag = DateUtil.isIn(nowTime, applyBeginTime, applyEndTime); | |||||
boolean flag2 = nowTime.after(applyBeginTime); | |||||
if (flag) { | |||||
//进行中 | |||||
return ActivityStatusEnum.IN_PROGRESS.getCode(); | |||||
} | |||||
if (flag2) { | |||||
return ActivityStatusEnum.END.getCode(); | |||||
} else { | |||||
return ActivityStatusEnum.NO_STARTED.getCode(); | |||||
} | |||||
} | |||||
} |
package com.tuoheng.api.service.impl; | |||||
import cn.hutool.core.date.DateUtil; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.tuoheng.api.entity.domain.Identity; | |||||
import com.tuoheng.api.entity.domain.WestreamSuggest; | |||||
import com.tuoheng.api.entity.domain.WestreamUser; | |||||
import com.tuoheng.api.mapper.WestreamSuggestMapper; | |||||
import com.tuoheng.api.service.IWestreamSuggestService; | |||||
import com.tuoheng.common.common.BaseEntity; | |||||
import com.tuoheng.common.common.BaseServiceImpl; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
import com.tuoheng.common.utils.StringUtils; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* 全民护河保护河建议表 服务实现类 | |||||
* | |||||
* @author WangHaoran | |||||
* @since 2023-06-06 | |||||
*/ | |||||
@Slf4j | |||||
@Service | |||||
public class WestreamSuggestServiceImpl extends BaseServiceImpl<WestreamSuggestMapper, WestreamSuggest> implements IWestreamSuggestService { | |||||
/** | |||||
* 提交护河建议 | |||||
* | |||||
* @param entity | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public JsonResult add(WestreamSuggest entity) { | |||||
//校验 | |||||
if (null == entity.getTenantId()) { | |||||
return JsonResult.error("租户ID为空!"); | |||||
} | |||||
if (StringUtils.isEmpty(entity.getOpenid())) { | |||||
return JsonResult.error("openid为空!"); | |||||
} | |||||
return super.add(entity); | |||||
} | |||||
} |
import cn.hutool.core.util.ObjectUtil; | import cn.hutool.core.util.ObjectUtil; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.tuoheng.api.entity.domain.Identity; | |||||
import com.tuoheng.api.entity.domain.WestreamUser; | |||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; | |||||
import com.tuoheng.api.constants.DictConstants; | |||||
import com.tuoheng.api.entity.domain.*; | |||||
import com.tuoheng.api.entity.request.OnlineNumQuery; | import com.tuoheng.api.entity.request.OnlineNumQuery; | ||||
import com.tuoheng.api.entity.request.WestreamUserQuery; | import com.tuoheng.api.entity.request.WestreamUserQuery; | ||||
import com.tuoheng.api.mapper.IdentityMapper; | |||||
import com.tuoheng.api.mapper.WestreamUserMapper; | |||||
import com.tuoheng.api.mapper.*; | |||||
import com.tuoheng.api.service.IWestreamUserService; | import com.tuoheng.api.service.IWestreamUserService; | ||||
import com.tuoheng.api.utils.PointsTitleConstants; | |||||
import com.tuoheng.common.common.BaseServiceImpl; | import com.tuoheng.common.common.BaseServiceImpl; | ||||
import com.tuoheng.common.config.CommonConfig; | import com.tuoheng.common.config.CommonConfig; | ||||
import com.tuoheng.common.utils.CommonUtils; | import com.tuoheng.common.utils.CommonUtils; | ||||
import com.tuoheng.common.utils.JsonResult; | import com.tuoheng.common.utils.JsonResult; | ||||
import com.tuoheng.common.utils.StringUtils; | import com.tuoheng.common.utils.StringUtils; | ||||
import org.springframework.beans.BeanUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
@Autowired | @Autowired | ||||
private IdentityMapper identityMapper; | private IdentityMapper identityMapper; | ||||
@Autowired | |||||
private ThDictDataMapper dictDataMapper; | |||||
@Autowired | |||||
private ThDictMapper dictMapper; | |||||
@Autowired | |||||
private UserPointsDetailMapper userPointsDetailMapper; | |||||
@Override | @Override | ||||
@Override | @Override | ||||
public JsonResult login(WestreamUser westreamUser) { | public JsonResult login(WestreamUser westreamUser) { | ||||
if(null == westreamUser.getTenantId() || StringUtils.isEmpty(westreamUser.getOpenid())){ | |||||
if (null == westreamUser.getTenantId() || StringUtils.isEmpty(westreamUser.getOpenid())) { | |||||
return JsonResult.error("参数为空!"); | return JsonResult.error("参数为空!"); | ||||
} | } | ||||
WestreamUser westreamUserQuery = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>() | WestreamUser westreamUserQuery = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>() | ||||
.eq(WestreamUser::getTenantId, westreamUser.getTenantId()) | .eq(WestreamUser::getTenantId, westreamUser.getTenantId()) | ||||
.eq(WestreamUser::getOpenid, westreamUser.getOpenid())); | .eq(WestreamUser::getOpenid, westreamUser.getOpenid())); | ||||
if(ObjectUtil.isNull(westreamUserQuery)){ | |||||
if (ObjectUtil.isNull(westreamUserQuery)) { | |||||
//昵称生成规则:护河行者+4位随机数 | //昵称生成规则:护河行者+4位随机数 | ||||
int random = (int) (Math.random()*9000+1000);//随机生成一个四位整数 | |||||
westreamUser.setNickname("护河行者"+random); | |||||
int random = (int) (Math.random() * 9000 + 1000);//随机生成一个四位整数 | |||||
westreamUser.setNickname("护河行者" + random); | |||||
String url = "qmhh/headimgurl/" + (new Random().nextInt(11) + 1) + ".jpg"; | String url = "qmhh/headimgurl/" + (new Random().nextInt(11) + 1) + ".jpg"; | ||||
westreamUser.setHeadimgurl(url); | westreamUser.setHeadimgurl(url); | ||||
westreamUser.setCreateTime(new Date()); | westreamUser.setCreateTime(new Date()); | ||||
//添加积分及其积分明细 | |||||
westreamUserMapper.insert(westreamUser); | westreamUserMapper.insert(westreamUser); | ||||
westreamUser.setNickname("护河行者"+ westreamUser.getId()); | |||||
String points = addIntegral(westreamUser); | |||||
westreamUser.setMallPoints(Integer.parseInt(points)); | |||||
westreamUser.setNickname("护河行者" + westreamUser.getId()); | |||||
westreamUserMapper.updateById(westreamUser); | westreamUserMapper.updateById(westreamUser); | ||||
}else { | |||||
westreamUserQuery.setLoginNum(westreamUserQuery.getLoginNum()+1); | |||||
} else { | |||||
westreamUserQuery.setLoginNum(westreamUserQuery.getLoginNum() + 1); | |||||
westreamUserMapper.updateById(westreamUserQuery); | westreamUserMapper.updateById(westreamUserQuery); | ||||
} | } | ||||
return JsonResult.success(); | return JsonResult.success(); | ||||
} | } | ||||
private String addIntegral(WestreamUser westreamUser) { | |||||
//注册程序 积分设置 | |||||
ThDict thDict = dictMapper.selectOne(new LambdaQueryWrapper<ThDict>() | |||||
.eq(ThDict::getTenantId, westreamUser.getTenantId()) | |||||
.eq(ThDict::getCode, DictConstants.POINTS_RULE_CODE) | |||||
.eq(ThDict::getMark, 1)); | |||||
if (ObjectUtils.isNotNull(thDict)) { | |||||
ThDictData thDictData = dictDataMapper.selectOne(new LambdaQueryWrapper<ThDictData>() | |||||
.eq(ThDictData::getDictId, thDict.getId()) | |||||
.eq(ThDictData::getName, DictConstants.APP_REGISTRY)); | |||||
if (ObjectUtils.isNotNull(thDictData)) { | |||||
if (StringUtils.isNotEmpty(thDictData.getValue())) { | |||||
//积分明细表入库 | |||||
UserPointsDetail userPointsDetail = new UserPointsDetail(); | |||||
BeanUtils.copyProperties(westreamUser, userPointsDetail); | |||||
userPointsDetail.setNickname(westreamUser.getNickname()); | |||||
userPointsDetail.setPointsChange(Integer.parseInt(thDictData.getValue())); | |||||
userPointsDetail.setPointsTime(new Date()); | |||||
userPointsDetail.setChangeName(PointsTitleConstants.USER_REGISTRY); | |||||
userPointsDetail.setType(1); | |||||
userPointsDetail.setCreateTime(new Date()); | |||||
userPointsDetailMapper.insert(userPointsDetail); | |||||
//TODO 对接商城 | |||||
return thDictData.getValue(); | |||||
} | |||||
} | |||||
} | |||||
return "0"; | |||||
} | |||||
@Override | @Override | ||||
public JsonResult userInfo(WestreamUserQuery westreamUserQuery) { | public JsonResult userInfo(WestreamUserQuery westreamUserQuery) { | ||||
if(null == westreamUserQuery.getTenantId() || StringUtils.isEmpty(westreamUserQuery.getOpenid())){ | |||||
if (null == westreamUserQuery.getTenantId() || StringUtils.isEmpty(westreamUserQuery.getOpenid())) { | |||||
return JsonResult.error("参数为空!"); | return JsonResult.error("参数为空!"); | ||||
} | } | ||||
.eq(WestreamUser::getMark, 1) | .eq(WestreamUser::getMark, 1) | ||||
.eq(WestreamUser::getTenantId, westreamUserQuery.getTenantId()) | .eq(WestreamUser::getTenantId, westreamUserQuery.getTenantId()) | ||||
.eq(WestreamUser::getOpenid, westreamUserQuery.getOpenid())); | .eq(WestreamUser::getOpenid, westreamUserQuery.getOpenid())); | ||||
if(ObjectUtil.isNull(westreamUser)){ | |||||
if (ObjectUtil.isNull(westreamUser)) { | |||||
return JsonResult.error("用户不存在!"); | return JsonResult.error("用户不存在!"); | ||||
} | } | ||||
Identity identity = identityMapper.selectById(westreamUser.getIdentityId()); | Identity identity = identityMapper.selectById(westreamUser.getIdentityId()); | ||||
if(ObjectUtil.isNotNull(identity)){ | |||||
if (ObjectUtil.isNotNull(identity)) { | |||||
westreamUser.setIdentityName(identity.getIdentityName()); | westreamUser.setIdentityName(identity.getIdentityName()); | ||||
westreamUser.setIdentityRemark(identity.getIdentityRemark()); | westreamUser.setIdentityRemark(identity.getIdentityRemark()); | ||||
} | } | ||||
@Override | @Override | ||||
public JsonResult editInfo(WestreamUser westreamUser) { | public JsonResult editInfo(WestreamUser westreamUser) { | ||||
if(null == westreamUser.getId()){ | |||||
if (null == westreamUser.getId()) { | |||||
return JsonResult.error("用户ID为空!"); | return JsonResult.error("用户ID为空!"); | ||||
} | } | ||||
Integer count = westreamUserMapper.selectCount(new LambdaQueryWrapper<WestreamUser>() | Integer count = westreamUserMapper.selectCount(new LambdaQueryWrapper<WestreamUser>() | ||||
.ne(WestreamUser::getId, westreamUser.getId()) | .ne(WestreamUser::getId, westreamUser.getId()) | ||||
.eq(WestreamUser::getMark, 1) | .eq(WestreamUser::getMark, 1) | ||||
.eq(WestreamUser::getNickname, westreamUser.getNickname())); | .eq(WestreamUser::getNickname, westreamUser.getNickname())); | ||||
if(count > 0){ | |||||
if (count > 0) { | |||||
return JsonResult.error("用户昵称已存在!"); | return JsonResult.error("用户昵称已存在!"); | ||||
} | } | ||||
westreamUserMapper.updateById(westreamUser); | westreamUserMapper.updateById(westreamUser); |
package com.tuoheng.api.service.impl; | |||||
import cn.hutool.core.util.ObjectUtil; | |||||
import com.alibaba.fastjson.JSON; | |||||
import com.alibaba.fastjson.JSONObject; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.tuoheng.api.constants.DictConstants; | |||||
import com.tuoheng.api.entity.domain.*; | |||||
import com.tuoheng.api.entity.request.WestreamVideoQuery; | |||||
import com.tuoheng.api.mapper.*; | |||||
import com.tuoheng.api.service.IWestreamVideoService; | |||||
import com.tuoheng.common.common.BaseServiceImpl; | |||||
import com.tuoheng.common.utils.CommonUtils; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
import com.tuoheng.common.utils.StringUtils; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.beans.BeanUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
import org.springframework.transaction.annotation.Transactional; | |||||
import java.util.Date; | |||||
/** | |||||
* 全民护河学习视频表 服务实现类 | |||||
* | |||||
* @author WangHaoran | |||||
* @since 2023-06-07 | |||||
*/ | |||||
@Slf4j | |||||
@Service | |||||
public class WestreamVideoServiceImpl extends BaseServiceImpl<WestreamVideoMapper, WestreamVideo> implements IWestreamVideoService { | |||||
@Autowired | |||||
private WestreamVideoMapper westreamVideoMapper; | |||||
@Autowired | |||||
private WestreamVideoUserMapper westreamVideoUserMapper; | |||||
@Autowired | |||||
private WestreamUserMapper westreamUserMapper; | |||||
@Autowired | |||||
private ThDictMapper thDictMapper; | |||||
@Autowired | |||||
private ThDictDataMapper thDictDataMapper; | |||||
@Autowired | |||||
private UserPointsDetailMapper userPointsDetailMapper; | |||||
@Override | |||||
public JsonResult queryPage(WestreamVideoQuery query) { | |||||
if(null == query.getTenantId() || StringUtils.isEmpty(query.getOpenid())){ | |||||
return JsonResult.error("参数为空!"); | |||||
} | |||||
query.checkParam(); | |||||
// 获取分页数据 | |||||
IPage<WestreamVideo> page = new Page<>(query.getPage(), query.getLimit()); | |||||
IPage<WestreamVideo> pageData = westreamVideoMapper.selectPage(page, new LambdaQueryWrapper<WestreamVideo>() | |||||
.eq(WestreamVideo::getMark, 1) | |||||
.eq(WestreamVideo::getTenantId, query.getTenantId()) | |||||
.orderByDesc(WestreamVideo::getCreateTime)); | |||||
for (WestreamVideo record : pageData.getRecords()) { | |||||
//替换图片域名 | |||||
record.setImageUrl(CommonUtils.getImageURL(record.getImageUrl())); | |||||
//替换视频域名 | |||||
record.setVideoUrl(CommonUtils.getVideoURL(record.getVideoUrl())); | |||||
//查询该视频对应用户观看状态 | |||||
WestreamVideoUser westreamVideoUser = westreamVideoUserMapper.selectOne(new LambdaQueryWrapper<WestreamVideoUser>() | |||||
.eq(WestreamVideoUser::getVideoId, record.getId()) | |||||
.eq(WestreamVideoUser::getOpenid, query.getOpenid()) | |||||
.eq(WestreamVideoUser::getTenantId, query.getTenantId()) | |||||
.eq(WestreamVideoUser::getMark, 1)); | |||||
if(ObjectUtil.isNull(westreamVideoUser)){ | |||||
record.setStatus(0); | |||||
}else { | |||||
record.setStatus(westreamVideoUser.getStatus()); | |||||
} | |||||
} | |||||
return JsonResult.success(pageData); | |||||
} | |||||
@Override | |||||
@Transactional | |||||
public JsonResult updateProgress(WestreamVideoQuery query) { | |||||
if(null == query.getTenantId() || StringUtils.isEmpty(query.getOpenid())){ | |||||
return JsonResult.error("参数为空!"); | |||||
} | |||||
if(null == query.getVideoId()){ | |||||
return JsonResult.error("视频ID为空!"); | |||||
} | |||||
WestreamVideoUser westreamVideoUser = westreamVideoUserMapper.selectOne(new LambdaQueryWrapper<WestreamVideoUser>() | |||||
.eq(WestreamVideoUser::getTenantId, query.getTenantId()) | |||||
.eq(WestreamVideoUser::getOpenid, query.getOpenid()) | |||||
.eq(WestreamVideoUser::getVideoId, query.getVideoId()) | |||||
.eq(WestreamVideoUser::getMark, 1)); | |||||
if(ObjectUtil.isNull(westreamVideoUser)){ | |||||
log.info("全民护河学习视频用户表insert,入参:"+ JSON.toJSONString(query)); | |||||
WestreamVideoUser westreamVideoUserAdd = new WestreamVideoUser(); | |||||
BeanUtils.copyProperties(query, westreamVideoUserAdd); | |||||
westreamVideoUserAdd.setCreateTime(new Date()); | |||||
westreamVideoUserMapper.insert(westreamVideoUserAdd); | |||||
}else { | |||||
log.info("全民护河学习视频用户表update,入参:"+ JSON.toJSONString(query)); | |||||
westreamVideoUser.setVideoProgress(query.getVideoProgress()); | |||||
westreamVideoUser.setStatus(query.getStatus()); | |||||
westreamVideoUserMapper.updateById(westreamVideoUser); | |||||
} | |||||
//视频学习完成,开始计算积分 | |||||
if(2 == query.getStatus().intValue()){ | |||||
addPoints(query); | |||||
} | |||||
return JsonResult.success(); | |||||
} | |||||
private String addPoints(WestreamVideoQuery query) { | |||||
log.info("视频学习完成,开始计算积分【" + query.getTenantId() +"】"+ query.getOpenid()); | |||||
//查询学习视频 积分设置 | |||||
ThDict thDict = thDictMapper.selectOne(new LambdaQueryWrapper<ThDict>() | |||||
.eq(ThDict::getTenantId, query.getTenantId()) | |||||
.eq(ThDict::getCode, DictConstants.POINTS_RULE_CODE) | |||||
.eq(ThDict::getMark, 1)); | |||||
if(ObjectUtils.isNotNull(thDict)){ | |||||
ThDictData thDictData = thDictDataMapper.selectOne(new LambdaQueryWrapper<ThDictData>() | |||||
.eq(ThDictData::getDictId, thDict.getId()) | |||||
.eq(ThDictData::getName, DictConstants.VIDEO)); | |||||
if(ObjectUtils.isNotNull(thDictData)){ | |||||
if(StringUtils.isNotEmpty(thDictData.getValue())){ | |||||
log.info("视频学习积分规则查询完成"); | |||||
//查询用户昵称 | |||||
WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>() | |||||
.eq(WestreamUser::getTenantId, query.getTenantId()) | |||||
.eq(WestreamUser::getOpenid, query.getOpenid()) | |||||
.eq(WestreamUser::getMark, 1)); | |||||
log.info("查询用户昵称完成,tenantId:" + query.getTenantId()); | |||||
log.info("查询用户昵称完成,openid:" + query.getOpenid()); | |||||
//积分明细表入库 | |||||
UserPointsDetail userPointsDetail = new UserPointsDetail(); | |||||
BeanUtils.copyProperties(query,userPointsDetail); | |||||
userPointsDetail.setNickname(westreamUser.getNickname()); | |||||
userPointsDetail.setPointsChange(Integer.parseInt(thDictData.getValue())); | |||||
userPointsDetail.setPointsTime(new Date()); | |||||
userPointsDetail.setChangeName("观看学习视频"); | |||||
userPointsDetail.setType(1); | |||||
userPointsDetail.setCreateTime(new Date()); | |||||
userPointsDetailMapper.insert(userPointsDetail); | |||||
log.info("积分明细表入库完成"); | |||||
//用户积分更新 | |||||
westreamUser.setMallPoints(westreamUser.getMallPoints() + userPointsDetail.getPointsChange()); | |||||
westreamUserMapper.updateById(westreamUser); | |||||
log.info("用户积分更新完成"); | |||||
//TODO 对接商城 | |||||
return thDictData.getValue(); | |||||
} | |||||
} | |||||
} | |||||
return "0"; | |||||
} | |||||
@Override | |||||
public JsonResult getVideoProgress(WestreamVideoQuery query) { | |||||
if(null == query.getTenantId() || StringUtils.isEmpty(query.getOpenid())){ | |||||
return JsonResult.error("参数为空!"); | |||||
} | |||||
if(null == query.getVideoId()){ | |||||
return JsonResult.error("视频ID为空!"); | |||||
} | |||||
WestreamVideoUser westreamVideoUser = westreamVideoUserMapper.selectOne(new LambdaQueryWrapper<WestreamVideoUser>() | |||||
.eq(WestreamVideoUser::getTenantId, query.getTenantId()) | |||||
.eq(WestreamVideoUser::getOpenid, query.getOpenid()) | |||||
.eq(WestreamVideoUser::getVideoId, query.getVideoId()) | |||||
.eq(WestreamVideoUser::getMark, 1)); | |||||
return JsonResult.success(westreamVideoUser); | |||||
} | |||||
} |
package com.tuoheng.api.utils; | |||||
/** | |||||
* @Description | |||||
* @Author douzhenjun | |||||
* @DATE 2023/6/6 | |||||
**/ | |||||
public class PointsTitleConstants { | |||||
public static final String EXCHANGE_PRODUCTS = "兑换商品"; | |||||
public static final String SUBMIT_PICTURE = "上传美拍"; | |||||
public static final String SUBMIT_FEEDBACK = "河湖问题反馈"; | |||||
public static final String VOLUNTEER_ACTIVITY = "参与志愿者活动"; | |||||
public static final String PROTECT_RIVER_SUGGESTION = "护河建议"; | |||||
public static final String FOLLOW_TIKTOK = "关注抖音"; | |||||
public static final String WATCH_VIDEO = "观看学习视频"; | |||||
public static final String USER_REGISTRY = "用户注册"; | |||||
} |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE mapper | |||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.tuoheng.api.mapper.ThWestreamMessageMapper"> | |||||
<resultMap id="BaseResultMap" type="com.tuoheng.api.entity.domain.ThWestreamMessage"> | |||||
<id property="id" column="id" jdbcType="OTHER"/> | |||||
<result property="tenantId" column="tenant_id" jdbcType="INTEGER"/> | |||||
<result property="openid" column="openid" jdbcType="VARCHAR"/> | |||||
<result property="msgDetail" column="msg_detail" jdbcType="VARCHAR"/> | |||||
<result property="status" column="status" jdbcType="TINYINT"/> | |||||
<result property="createUser" column="create_user" jdbcType="OTHER"/> | |||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> | |||||
<result property="updateUser" column="update_user" jdbcType="OTHER"/> | |||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> | |||||
<result property="mark" column="mark" jdbcType="TINYINT"/> | |||||
</resultMap> | |||||
<sql id="Base_Column_List"> | |||||
id,tenant_id,openid, | |||||
msg_detail,status,create_user, | |||||
create_time,update_user,update_time, | |||||
mark | |||||
</sql> | |||||
</mapper> |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE mapper | |||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.tuoheng.api.mapper.ThWestreamTiktokMapper"> | |||||
<resultMap id="BaseResultMap" type="com.tuoheng.api.entity.domain.ThWestreamTiktok"> | |||||
<id property="id" column="id" jdbcType="OTHER"/> | |||||
<result property="tenantId" column="tenant_id" jdbcType="INTEGER"/> | |||||
<result property="openid" column="openid" jdbcType="VARCHAR"/> | |||||
<result property="nickname" column="nickname" jdbcType="VARCHAR"/> | |||||
<result property="identityId" column="identity_id" jdbcType="INTEGER"/> | |||||
<result property="identityName" column="identity_name" jdbcType="VARCHAR"/> | |||||
<result property="imageUrl" column="image_url" jdbcType="VARCHAR"/> | |||||
<result property="status" column="status" jdbcType="TINYINT"/> | |||||
<result property="remark" column="remark" jdbcType="VARCHAR"/> | |||||
<result property="createUser" column="create_user" jdbcType="OTHER"/> | |||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> | |||||
<result property="updateUser" column="update_user" jdbcType="OTHER"/> | |||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> | |||||
<result property="mark" column="mark" jdbcType="TINYINT"/> | |||||
</resultMap> | |||||
<sql id="Base_Column_List"> | |||||
id,tenant_id,openid, | |||||
nickname,identity_id,identity_name, | |||||
image_url,status,remark, | |||||
create_user,create_time,update_user, | |||||
update_time,mark | |||||
</sql> | |||||
</mapper> |
@Data | @Data | ||||
public class BaseQuery { | public class BaseQuery { | ||||
/** | /** | ||||
* 页码 | |||||
* 页码(默认1) | |||||
*/ | */ | ||||
private Integer page; | private Integer page; | ||||
/** | /** | ||||
* 每页数 | |||||
* 每页数(默认10) | |||||
*/ | */ | ||||
private Integer limit; | private Integer limit; | ||||
/** | |||||
* 不传参的时候默认1,10 | |||||
*/ | |||||
public void checkParam() { | |||||
if (this.page == null || this.page < 0) { | |||||
setPage(1); | |||||
} | |||||
if (this.limit == null || this.limit < 0 || this.limit > 100) { | |||||
setLimit(10); | |||||
} | |||||
} | |||||
} | } |
*/ | */ | ||||
public class CommonUtils { | public class CommonUtils { | ||||
/** | |||||
* 获取到视频域名的地址 | |||||
* | |||||
* @param videoUrl | |||||
* @return | |||||
*/ | |||||
public static String getVideoURL(String videoUrl) { | |||||
return CommonConfig.videoURL + videoUrl; | |||||
} | |||||
/** | /** | ||||
* 获取到图片域名的地址 | * 获取到图片域名的地址 | ||||
* | * |