@@ -0,0 +1,55 @@ | |||
package com.tuoheng.api.controller; | |||
import com.tuoheng.api.service.ThWestreamMessageService; | |||
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.PutMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* @Author xiaoying | |||
* @Date 2023/6/6 11:57 | |||
*/ | |||
@RestController | |||
@RequestMapping("/message") | |||
public class WestreamMessageController { | |||
@Autowired | |||
private ThWestreamMessageService westreamMessageService; | |||
/** | |||
* 查询用户对应消息记录通知 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/list") | |||
private JsonResult getList(String openId) { | |||
return westreamMessageService.getList(openId); | |||
} | |||
/** | |||
* 查看信息详情 | |||
* @return | |||
*/ | |||
@GetMapping("/deail") | |||
private JsonResult deail(String msgId) { | |||
return westreamMessageService.deail(msgId); | |||
} | |||
/** | |||
* 全部已读 | |||
* @return | |||
*/ | |||
@PutMapping("/read") | |||
private JsonResult read(String openId) { | |||
return westreamMessageService.read(openId); | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
package com.tuoheng.api.controller; | |||
import com.tuoheng.api.entity.domain.ThWestreamTiktok; | |||
import com.tuoheng.api.service.ThWestreamTiktokService; | |||
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.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* 关注抖音业务 前端控制器 | |||
* | |||
* @Author xiaoying | |||
* @Date 2023/6/6 9:46 | |||
*/ | |||
@RestController | |||
@RequestMapping("/tiktor") | |||
public class WestreamTiktokController { | |||
@Autowired | |||
private ThWestreamTiktokService thWestreamTiktokService; | |||
/** | |||
* 添加抖音关注审核 | |||
* | |||
* @param entity | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
public JsonResult add(ThWestreamTiktok entity) { | |||
return thWestreamTiktokService.add(entity); | |||
} | |||
} |
@@ -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; | |||
} |
@@ -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; | |||
} |
@@ -79,4 +79,8 @@ public class UserPointsDetail extends BaseEntity implements Serializable { | |||
*/ | |||
@TableField(exist = false) | |||
private String areaName; | |||
/** | |||
* 活动标题名称 | |||
*/ | |||
private String changeName; | |||
} |
@@ -95,4 +95,9 @@ public class WestreamUser extends BaseEntity implements Serializable { | |||
*/ | |||
@TableField(exist = false) | |||
private String identityRemark; | |||
/** | |||
* 是否关注抖音 1是 0否 | |||
*/ | |||
private Integer isTiktok; | |||
} |
@@ -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<ThWestreamMessage> { | |||
} | |||
@@ -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<ThWestreamTiktok> { | |||
} | |||
@@ -0,0 +1,19 @@ | |||
package com.tuoheng.api.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.tuoheng.api.entity.domain.ThWestreamMessage; | |||
import com.tuoheng.common.utils.JsonResult; | |||
/** | |||
* @author 小影 | |||
* @description 针对表【th_westream_message(全民护河消息表)】的数据库操作Service | |||
* @createDate 2023-06-06 11:30:05 | |||
*/ | |||
public interface ThWestreamMessageService extends IService<ThWestreamMessage> { | |||
JsonResult getList(String openId); | |||
JsonResult read(String openId); | |||
JsonResult deail(String msgId); | |||
} |
@@ -0,0 +1,15 @@ | |||
package com.tuoheng.api.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.tuoheng.api.entity.domain.ThWestreamTiktok; | |||
import com.tuoheng.common.utils.JsonResult; | |||
/** | |||
* @author 小影 | |||
* @description 针对表【th_westream_tiktok(全民护河抖音关注审核表)】的数据库操作Service | |||
* @createDate 2023-06-06 09:46:18 | |||
*/ | |||
public interface ThWestreamTiktokService extends IService<ThWestreamTiktok> { | |||
JsonResult add(ThWestreamTiktok entity); | |||
} |
@@ -0,0 +1,78 @@ | |||
package com.tuoheng.api.service.impl; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.tuoheng.api.entity.domain.ThWestreamMessage; | |||
import com.tuoheng.api.mapper.ThWestreamMessageMapper; | |||
import com.tuoheng.api.service.ThWestreamMessageService; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
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 ThWestreamMessageService { | |||
/** | |||
* 查询用户对应消息记录通知 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getList(String openId) { | |||
if (StringUtils.isEmpty(openId)) { | |||
return JsonResult.error("openid为空"); | |||
} | |||
List<ThWestreamMessage> list = this.list(Wrappers.<ThWestreamMessage>lambdaQuery() | |||
.eq(ThWestreamMessage::getOpenid, openId).eq(BaseEntity::getMark, 1)); | |||
return JsonResult.success(list); | |||
} | |||
/** | |||
* 查看信息详情 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult deail(String msgId) { | |||
if (StringUtils.isEmpty(msgId)) { | |||
return JsonResult.error("msgId为空"); | |||
} | |||
ThWestreamMessage message = this.getById(msgId); | |||
//点击查看详情的时候同步修改信息状态 | |||
message.setStatus(2); | |||
this.updateById(message); | |||
return JsonResult.success(message); | |||
} | |||
@Override | |||
public JsonResult read(String openId) { | |||
if (StringUtils.isEmpty(openId)) { | |||
return JsonResult.error("openid为空"); | |||
} | |||
//查询出所有未读的 | |||
List<ThWestreamMessage> list = this.list(Wrappers.<ThWestreamMessage>lambdaQuery() | |||
.eq(ThWestreamMessage::getOpenid, openId) | |||
.eq(ThWestreamMessage::getStatus, 1) | |||
.eq(BaseEntity::getMark, 1)); | |||
list.forEach(t -> t.setStatus(2)); | |||
this.saveOrUpdateBatch(list); | |||
return JsonResult.success(); | |||
} | |||
} | |||
@@ -0,0 +1,77 @@ | |||
package com.tuoheng.api.service.impl; | |||
import cn.hutool.core.date.DateUtil; | |||
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.mapper.IdentityMapper; | |||
import com.tuoheng.api.mapper.ThWestreamTiktokMapper; | |||
import com.tuoheng.api.mapper.WestreamUserMapper; | |||
import com.tuoheng.api.service.ThWestreamTiktokService; | |||
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 ThWestreamTiktokService { | |||
@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为空!"); | |||
} | |||
//查询当前用户 | |||
WestreamUser westreamUser = westreamUserMapper.selectOne(Wrappers.<WestreamUser>lambdaQuery() | |||
.eq(WestreamUser::getOpenid, entity.getOpenid()) | |||
.eq(BaseEntity::getMark, 1)); | |||
if (StringUtils.isNull(westreamUser)) { | |||
return JsonResult.error("该用户不存在此系统!"); | |||
} | |||
if (1 == westreamUser.getIsTiktok()) { | |||
return JsonResult.error("您已参与了该活动,无法再次获得积分!"); | |||
} | |||
entity.setNickname(westreamUser.getNickname()); | |||
entity.setTenantId(westreamUser.getTenantId()); | |||
if (StringUtils.isNotNull(westreamUser.getIdentityId())) { | |||
Identity identity = identityMapper.selectById(westreamUser.getIdentityId()); | |||
entity.setIdentityName(identity.getIdentityName()); | |||
} | |||
entity.setCreateTime(DateUtil.date()); | |||
//填充数据 | |||
boolean flag = this.save(entity); | |||
if (flag) { | |||
return JsonResult.success(); | |||
} else { | |||
return JsonResult.error("新增抖音审核任务失败"); | |||
} | |||
} | |||
} | |||
@@ -0,0 +1,26 @@ | |||
<?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> |
@@ -0,0 +1,31 @@ | |||
<?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> |