diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/constants/DictConstants.java b/tuoheng-api/src/main/java/com/tuoheng/api/constants/DictConstants.java index d8958be..16e6940 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/constants/DictConstants.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/constants/DictConstants.java @@ -14,9 +14,24 @@ public class DictConstants { public static final String POINTS_RULE_FEEDBACK = "submit_feedback"; //积分规则-上传美拍并通过 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"; - //短信规则code public static final String MSG_RULE_CODE = "msg_rule"; //短信规则name描述 diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/MyController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/MyController.java index 9eaffda..82b643f 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/MyController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/MyController.java @@ -32,4 +32,12 @@ public class MyController { public JsonResult exchange(UserPointsDetailQuery userPointsDetailQuery) { return userPointsDetailService.exchange(userPointsDetailQuery); } + + /** + * 我的积分明细 + */ + @GetMapping("/pointsDetail") + public JsonResult pointsDetail(UserPointsDetailQuery userPointsDetailQuery){ + return userPointsDetailService.pointsDetail(userPointsDetailQuery); + } } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityApplyController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityApplyController.java new file mode 100644 index 0000000..8a2eaec --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityApplyController.java @@ -0,0 +1,46 @@ +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); + } + +} + diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityController.java new file mode 100644 index 0000000..e1fe61f --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityController.java @@ -0,0 +1,35 @@ +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); + } + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java new file mode 100644 index 0000000..03076ca --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java @@ -0,0 +1,62 @@ +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); + } + + + + + + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamSuggestController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamSuggestController.java new file mode 100644 index 0000000..b818e8b --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamSuggestController.java @@ -0,0 +1,37 @@ +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); + } + + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java new file mode 100644 index 0000000..5597e19 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java @@ -0,0 +1,45 @@ +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); + } + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVideoController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVideoController.java new file mode 100644 index 0000000..a478af2 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVideoController.java @@ -0,0 +1,54 @@ +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); + } +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/ThWestreamMessage.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/ThWestreamMessage.java new file mode 100644 index 0000000..1d9b70a --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/ThWestreamMessage.java @@ -0,0 +1,35 @@ +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; +} \ No newline at end of file diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/ThWestreamTiktok.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/ThWestreamTiktok.java new file mode 100644 index 0000000..b3eefdc --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/ThWestreamTiktok.java @@ -0,0 +1,60 @@ +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; +} \ No newline at end of file diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/UserPointsDetail.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/UserPointsDetail.java index 78e72ee..c103338 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/UserPointsDetail.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/UserPointsDetail.java @@ -61,6 +61,11 @@ public class UserPointsDetail extends BaseEntity implements Serializable { * 操作人名称 */ private String operatorName; + + /** + * 变动活动名称 + */ + private String changeName; /** * 商铺名称 diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamActivity.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamActivity.java new file mode 100644 index 0000000..4239eff --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamActivity.java @@ -0,0 +1,74 @@ +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; +} \ No newline at end of file diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamActivityApply.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamActivityApply.java new file mode 100644 index 0000000..1f80fa3 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamActivityApply.java @@ -0,0 +1,59 @@ +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; +} \ No newline at end of file diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamActivityUser.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamActivityUser.java new file mode 100644 index 0000000..9f2c22f --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamActivityUser.java @@ -0,0 +1,29 @@ +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; +} \ No newline at end of file diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamSuggest.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamSuggest.java new file mode 100644 index 0000000..dc9de1a --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamSuggest.java @@ -0,0 +1,53 @@ +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; + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamUser.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamUser.java index 38020f0..01d992b 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamUser.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamUser.java @@ -95,4 +95,9 @@ public class WestreamUser extends BaseEntity implements Serializable { */ @TableField(exist = false) private String identityRemark; + /** + * 是否关注抖音 1是 0否 + */ + private Integer isTiktok; + } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamVideo.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamVideo.java new file mode 100644 index 0000000..fd3661c --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamVideo.java @@ -0,0 +1,56 @@ +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; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamVideoUser.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamVideoUser.java new file mode 100644 index 0000000..6fc7a3a --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamVideoUser.java @@ -0,0 +1,51 @@ +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; + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamActivityQuery.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamActivityQuery.java new file mode 100644 index 0000000..6dd8f7c --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamActivityQuery.java @@ -0,0 +1,32 @@ +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; + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamMessageQuery.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamMessageQuery.java new file mode 100644 index 0000000..bad8cab --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamMessageQuery.java @@ -0,0 +1,20 @@ +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; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamTiktokQuery.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamTiktokQuery.java new file mode 100644 index 0000000..28cc1e8 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamTiktokQuery.java @@ -0,0 +1,23 @@ +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; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamVideoQuery.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamVideoQuery.java new file mode 100644 index 0000000..1bdc1cc --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamVideoQuery.java @@ -0,0 +1,32 @@ +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; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/vo/WestreamActivityVo.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/vo/WestreamActivityVo.java new file mode 100644 index 0000000..29ab1a9 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/vo/WestreamActivityVo.java @@ -0,0 +1,24 @@ +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; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/enums/ActivityStatusEnum.java b/tuoheng-api/src/main/java/com/tuoheng/api/enums/ActivityStatusEnum.java new file mode 100644 index 0000000..3f6ceb4 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/enums/ActivityStatusEnum.java @@ -0,0 +1,22 @@ +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; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/ThWestreamMessageMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/ThWestreamMessageMapper.java new file mode 100644 index 0000000..b986aac --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/ThWestreamMessageMapper.java @@ -0,0 +1,18 @@ +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 { + +} + + + + diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/ThWestreamTiktokMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/ThWestreamTiktokMapper.java new file mode 100644 index 0000000..e84e962 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/ThWestreamTiktokMapper.java @@ -0,0 +1,18 @@ +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 { + +} + + + + diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamActivityApplyMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamActivityApplyMapper.java new file mode 100644 index 0000000..946925c --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamActivityApplyMapper.java @@ -0,0 +1,18 @@ +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 { + +} + + + + diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamActivityMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamActivityMapper.java new file mode 100644 index 0000000..a97ff07 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamActivityMapper.java @@ -0,0 +1,18 @@ +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 { + +} + + + + diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamActivityUserMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamActivityUserMapper.java new file mode 100644 index 0000000..0fed25b --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamActivityUserMapper.java @@ -0,0 +1,18 @@ +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 { + +} + + + + diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamSuggestMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamSuggestMapper.java new file mode 100644 index 0000000..ab20336 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamSuggestMapper.java @@ -0,0 +1,13 @@ +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 { +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamVideoMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamVideoMapper.java new file mode 100644 index 0000000..440aca6 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamVideoMapper.java @@ -0,0 +1,13 @@ +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 { +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamVideoUserMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamVideoUserMapper.java new file mode 100644 index 0000000..3220503 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamVideoUserMapper.java @@ -0,0 +1,13 @@ +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 { +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/IUserPointsDetailService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IUserPointsDetailService.java index 5445901..91a3c83 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/IUserPointsDetailService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IUserPointsDetailService.java @@ -13,4 +13,6 @@ import com.tuoheng.common.utils.JsonResult; */ public interface IUserPointsDetailService extends IBaseService { JsonResult exchange(UserPointsDetailQuery userPointsDetailQuery); + + JsonResult pointsDetail(UserPointsDetailQuery userPointsDetailQuery); } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityApplyService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityApplyService.java new file mode 100644 index 0000000..8cae958 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityApplyService.java @@ -0,0 +1,13 @@ +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 { + + JsonResult submit(WestreamActivityApply westreamActivityApply); + + JsonResult getApply(WestreamActivityQuery query); +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityService.java new file mode 100644 index 0000000..5d78e37 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityService.java @@ -0,0 +1,10 @@ +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 { + JsonResult index(WestreamActivityQuery query); +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamMessageService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamMessageService.java new file mode 100644 index 0000000..32155ea --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamMessageService.java @@ -0,0 +1,22 @@ +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 { + + JsonResult getList(WestreamMessageQuery query); + + JsonResult read(WestreamMessageQuery query); + + JsonResult deail(WestreamMessageQuery query); + + JsonResult sum(WestreamMessageQuery query); +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamSuggestService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamSuggestService.java new file mode 100644 index 0000000..0688dbf --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamSuggestService.java @@ -0,0 +1,7 @@ +package com.tuoheng.api.service; + +import com.tuoheng.api.entity.domain.WestreamSuggest; +import com.tuoheng.common.common.IBaseService; + +public interface IWestreamSuggestService extends IBaseService { +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamTiktokService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamTiktokService.java new file mode 100644 index 0000000..ed9c850 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamTiktokService.java @@ -0,0 +1,18 @@ +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 { + + JsonResult add(ThWestreamTiktok entity); + + JsonResult getIsApply(WestreamTiktokQuery query); +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamVideoService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamVideoService.java new file mode 100644 index 0000000..378141a --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamVideoService.java @@ -0,0 +1,14 @@ +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 { + JsonResult queryPage(WestreamVideoQuery query); + + JsonResult updateProgress(WestreamVideoQuery query); + + JsonResult getVideoProgress(WestreamVideoQuery query); +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/ThWestreamMessageServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/ThWestreamMessageServiceImpl.java new file mode 100644 index 0000000..3986ad1 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/ThWestreamMessageServiceImpl.java @@ -0,0 +1,124 @@ +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 + 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 page = new Page<>(query.getPage(), query.getLimit()); + + IPage pageDate = westreamMessageMapper.selectPage(page, Wrappers.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 list = this.list(Wrappers.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 list = this.list(Wrappers.lambdaQuery() + .eq(ThWestreamMessage::getTenantId, query.getTenantId()) + .eq(ThWestreamMessage::getOpenid, query.getOpenId()) + .eq(ThWestreamMessage::getStatus, 1) + .eq(BaseEntity::getMark, 1)); + return JsonResult.success(list.size()); + + } +} + + + + diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/ThWestreamTiktokServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/ThWestreamTiktokServiceImpl.java new file mode 100644 index 0000000..5385cf4 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/ThWestreamTiktokServiceImpl.java @@ -0,0 +1,122 @@ +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 + 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() + .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.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() + .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); + } + } + + + } +} + + + + diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/UserPointsDetailServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/UserPointsDetailServiceImpl.java index c6c7d60..a3bfd00 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/UserPointsDetailServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/UserPointsDetailServiceImpl.java @@ -17,6 +17,9 @@ import com.tuoheng.common.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; + /** * 全民护河公告表 服务实现类 * @@ -72,4 +75,36 @@ public class UserPointsDetailServiceImpl extends BaseServiceImpl userPointsDetailResult = new ArrayList<>(); + IPage page = new Page(userPointsDetailQuery.getPage(), userPointsDetailQuery.getLimit()); + IPage userPointsDetailList = userPointsDetailMapper.selectPage(page, new LambdaQueryWrapper() + .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); + } } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyServiceImpl.java new file mode 100644 index 0000000..80dec7e --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyServiceImpl.java @@ -0,0 +1,64 @@ +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 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() + .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() + .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); + } +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityServiceImpl.java new file mode 100644 index 0000000..feb445f --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityServiceImpl.java @@ -0,0 +1,82 @@ +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 implements IWestreamActivityService { + + @Autowired + private WestreamActivityMapper westreamActivityMapper; + + @Override + public JsonResult index(WestreamActivityQuery query) { + if (null == query.getTenantId()) { + return JsonResult.error("租户ID为空!"); + } + query.checkParam(); + //开启分页 + IPage page = new Page<>(query.getPage(), query.getLimit()); + + IPage pageDate = westreamActivityMapper.selectPage(page, Wrappers.lambdaQuery() + .eq(WestreamActivity::getTenantId, query.getTenantId()) + .eq(BaseEntity::getMark, 1) + .orderByDesc(WestreamActivity::getCreateTime)); + //返回图片地址匹配路径前缀 + IPage 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(); + } + } + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamSuggestServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamSuggestServiceImpl.java new file mode 100644 index 0000000..46d60c6 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamSuggestServiceImpl.java @@ -0,0 +1,47 @@ +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 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); + } + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamUserServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamUserServiceImpl.java index fd2e5a5..7cc2dbd 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamUserServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamUserServiceImpl.java @@ -2,18 +2,20 @@ package com.tuoheng.api.service.impl; import cn.hutool.core.util.ObjectUtil; 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.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.utils.PointsTitleConstants; import com.tuoheng.common.common.BaseServiceImpl; import com.tuoheng.common.config.CommonConfig; import com.tuoheng.common.utils.CommonUtils; import com.tuoheng.common.utils.JsonResult; import com.tuoheng.common.utils.StringUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -35,6 +37,12 @@ public class WestreamUserServiceImpl extends BaseServiceImpl() @@ -59,28 +67,60 @@ public class WestreamUserServiceImpl extends BaseServiceImpl() + .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() + .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 public JsonResult userInfo(WestreamUserQuery westreamUserQuery) { - if(null == westreamUserQuery.getTenantId() || StringUtils.isEmpty(westreamUserQuery.getOpenid())){ + if (null == westreamUserQuery.getTenantId() || StringUtils.isEmpty(westreamUserQuery.getOpenid())) { return JsonResult.error("参数为空!"); } @@ -88,12 +128,12 @@ public class WestreamUserServiceImpl extends BaseServiceImpl() .ne(WestreamUser::getId, westreamUser.getId()) .eq(WestreamUser::getMark, 1) .eq(WestreamUser::getNickname, westreamUser.getNickname())); - if(count > 0){ + if (count > 0) { return JsonResult.error("用户昵称已存在!"); } westreamUserMapper.updateById(westreamUser); diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamVideoServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamVideoServiceImpl.java new file mode 100644 index 0000000..ba78747 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamVideoServiceImpl.java @@ -0,0 +1,193 @@ +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 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 page = new Page<>(query.getPage(), query.getLimit()); + IPage pageData = westreamVideoMapper.selectPage(page, new LambdaQueryWrapper() + .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() + .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() + .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() + .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() + .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() + .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() + .eq(WestreamVideoUser::getTenantId, query.getTenantId()) + .eq(WestreamVideoUser::getOpenid, query.getOpenid()) + .eq(WestreamVideoUser::getVideoId, query.getVideoId()) + .eq(WestreamVideoUser::getMark, 1)); + return JsonResult.success(westreamVideoUser); + } +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/utils/PointsTitleConstants.java b/tuoheng-api/src/main/java/com/tuoheng/api/utils/PointsTitleConstants.java new file mode 100644 index 0000000..b1cb619 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/utils/PointsTitleConstants.java @@ -0,0 +1,25 @@ +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 = "用户注册"; +} diff --git a/tuoheng-api/src/main/resources/mapper/ThWestreamMessageMapper.xml b/tuoheng-api/src/main/resources/mapper/ThWestreamMessageMapper.xml new file mode 100644 index 0000000..aae7225 --- /dev/null +++ b/tuoheng-api/src/main/resources/mapper/ThWestreamMessageMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + id,tenant_id,openid, + msg_detail,status,create_user, + create_time,update_user,update_time, + mark + + diff --git a/tuoheng-api/src/main/resources/mapper/ThWestreamTiktokMapper.xml b/tuoheng-api/src/main/resources/mapper/ThWestreamTiktokMapper.xml new file mode 100644 index 0000000..c329db5 --- /dev/null +++ b/tuoheng-api/src/main/resources/mapper/ThWestreamTiktokMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + id,tenant_id,openid, + nickname,identity_id,identity_name, + image_url,status,remark, + create_user,create_time,update_user, + update_time,mark + + diff --git a/tuoheng-common/src/main/java/com/tuoheng/common/common/BaseQuery.java b/tuoheng-common/src/main/java/com/tuoheng/common/common/BaseQuery.java index 69392bb..6f00f27 100644 --- a/tuoheng-common/src/main/java/com/tuoheng/common/common/BaseQuery.java +++ b/tuoheng-common/src/main/java/com/tuoheng/common/common/BaseQuery.java @@ -8,12 +8,24 @@ import lombok.Data; @Data public class BaseQuery { /** - * 页码 + * 页码(默认1) */ private Integer page; /** - * 每页数 + * 每页数(默认10) */ 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); + } + } } diff --git a/tuoheng-common/src/main/java/com/tuoheng/common/utils/CommonUtils.java b/tuoheng-common/src/main/java/com/tuoheng/common/utils/CommonUtils.java index 896db05..539de04 100644 --- a/tuoheng-common/src/main/java/com/tuoheng/common/utils/CommonUtils.java +++ b/tuoheng-common/src/main/java/com/tuoheng/common/utils/CommonUtils.java @@ -17,6 +17,16 @@ import java.util.stream.Collectors; */ public class CommonUtils { + /** + * 获取到视频域名的地址 + * + * @param videoUrl + * @return + */ + public static String getVideoURL(String videoUrl) { + return CommonConfig.videoURL + videoUrl; + } + /** * 获取到图片域名的地址 *