From 4341da8d7e40f1e0b6ae479f9f0b17d88a4261ce Mon Sep 17 00:00:00 2001 From: xiaoying Date: Tue, 6 Jun 2023 13:38:10 +0800 Subject: [PATCH 01/80] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8A=96=E9=9F=B3?= =?UTF-8?q?=E5=85=B3=E6=B3=A8=E7=9A=84=E6=B7=BB=E5=8A=A0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20=E4=BF=A1=E6=81=AF=E9=80=9A=E7=9F=A5=E7=9A=84=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2=E4=BB=A5=E5=8F=8A=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E5=B7=B2=E8=AF=BB=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3,?= =?UTF-8?q?=E7=AD=89=E5=AD=97=E6=AE=B5=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WestreamMessageController.java | 55 +++++++++++++ .../controller/WestreamTiktokController.java | 35 +++++++++ .../api/entity/domain/ThWestreamMessage.java | 35 +++++++++ .../api/entity/domain/ThWestreamTiktok.java | 60 ++++++++++++++ .../api/entity/domain/UserPointsDetail.java | 4 + .../api/entity/domain/WestreamUser.java | 5 ++ .../api/mapper/ThWestreamMessageMapper.java | 18 +++++ .../api/mapper/ThWestreamTiktokMapper.java | 18 +++++ .../api/service/ThWestreamMessageService.java | 19 +++++ .../api/service/ThWestreamTiktokService.java | 15 ++++ .../impl/ThWestreamMessageServiceImpl.java | 78 +++++++++++++++++++ .../impl/ThWestreamTiktokServiceImpl.java | 77 ++++++++++++++++++ .../mapper/ThWestreamMessageMapper.xml | 26 +++++++ .../mapper/ThWestreamTiktokMapper.xml | 31 ++++++++ 14 files changed, 476 insertions(+) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/ThWestreamMessage.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/ThWestreamTiktok.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/mapper/ThWestreamMessageMapper.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/mapper/ThWestreamTiktokMapper.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamMessageService.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamTiktokService.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/impl/ThWestreamMessageServiceImpl.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/impl/ThWestreamTiktokServiceImpl.java create mode 100644 tuoheng-api/src/main/resources/mapper/ThWestreamMessageMapper.xml create mode 100644 tuoheng-api/src/main/resources/mapper/ThWestreamTiktokMapper.xml 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..d27ac20 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java @@ -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); + } + + + + + + +} 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..094da35 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java @@ -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); + } + +} 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..0f4af4f 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 @@ -79,4 +79,8 @@ public class UserPointsDetail extends BaseEntity implements Serializable { */ @TableField(exist = false) private String areaName; + /** + * 活动标题名称 + */ + private String changeName; } 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/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/service/ThWestreamMessageService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamMessageService.java new file mode 100644 index 0000000..65c9e2f --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamMessageService.java @@ -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 { + + JsonResult getList(String openId); + + JsonResult read(String openId); + + JsonResult deail(String msgId); +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamTiktokService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamTiktokService.java new file mode 100644 index 0000000..dfcc138 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamTiktokService.java @@ -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 { + + JsonResult add(ThWestreamTiktok entity); +} 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..207aa10 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/ThWestreamMessageServiceImpl.java @@ -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 + implements ThWestreamMessageService { + + + /** + * 查询用户对应消息记录通知 + * + * @return + */ + @Override + public JsonResult getList(String openId) { + if (StringUtils.isEmpty(openId)) { + return JsonResult.error("openid为空"); + } + List list = this.list(Wrappers.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 list = this.list(Wrappers.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(); + } +} + + + + 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..ac40418 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/ThWestreamTiktokServiceImpl.java @@ -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 + 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.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("新增抖音审核任务失败"); + } + } +} + + + + 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 + + -- 2.27.0 From 6ba5fcfe18d9d45a41d7f7e4519460a84bef67d0 Mon Sep 17 00:00:00 2001 From: douzhenjun Date: Tue, 6 Jun 2023 13:56:07 +0800 Subject: [PATCH 02/80] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=98=8E=E7=BB=86=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/controller/MyController.java | 8 ++++++ .../api/entity/domain/UserPointsDetail.java | 5 ++++ .../api/service/IUserPointsDetailService.java | 2 ++ .../impl/UserPointsDetailServiceImpl.java | 26 +++++++++++++++++++ .../api/utils/PointsTitleConstants.java | 25 ++++++++++++++++++ 5 files changed, 66 insertions(+) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/utils/PointsTitleConstants.java 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/entity/domain/UserPointsDetail.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/UserPointsDetail.java index 0f4af4f..edf84f2 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/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/impl/UserPointsDetailServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/UserPointsDetailServiceImpl.java index c6c7d60..f6ad82e 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,27 @@ public class UserPointsDetailServiceImpl extends BaseServiceImpl userPointsDetailResult = new ArrayList<>(); + List userPointsDetailList = userPointsDetailMapper.selectList(new LambdaQueryWrapper() + .eq(UserPointsDetail::getTenantId, tenantId) + .eq(UserPointsDetail::getOpenid, openid) + .eq(UserPointsDetail::getMark, 1) + .isNotNull(UserPointsDetail::getChangeName)); + 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()); + } + } + return null; + } } 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 = "用户注册"; +} -- 2.27.0 From 5dce6aa6aeff9ff153ef9866c95bb6a5e5cc3279 Mon Sep 17 00:00:00 2001 From: xiaoying Date: Tue, 6 Jun 2023 15:36:55 +0800 Subject: [PATCH 03/80] =?UTF-8?q?=E5=8F=98=E6=9B=B4=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WestreamMessageController.java | 13 +++++---- .../api/entity/domain/UserPointsDetail.java | 4 --- .../request/ThWestreamMessageQuery.java | 20 +++++++++++++ .../api/service/ThWestreamMessageService.java | 7 +++-- .../impl/ThWestreamMessageServiceImpl.java | 28 ++++++++++++------- .../impl/ThWestreamTiktokServiceImpl.java | 5 +++- 6 files changed, 53 insertions(+), 24 deletions(-) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ThWestreamMessageQuery.java 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 index d27ac20..ce20a0d 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java @@ -1,5 +1,6 @@ package com.tuoheng.api.controller; +import com.tuoheng.api.entity.request.ThWestreamMessageQuery; import com.tuoheng.api.service.ThWestreamMessageService; import com.tuoheng.common.utils.JsonResult; import org.springframework.beans.factory.annotation.Autowired; @@ -25,8 +26,8 @@ public class WestreamMessageController { * @return */ @GetMapping("/list") - private JsonResult getList(String openId) { - return westreamMessageService.getList(openId); + private JsonResult getList(ThWestreamMessageQuery query) { + return westreamMessageService.getList(query); } /** @@ -34,8 +35,8 @@ public class WestreamMessageController { * @return */ @GetMapping("/deail") - private JsonResult deail(String msgId) { - return westreamMessageService.deail(msgId); + private JsonResult deail(ThWestreamMessageQuery query) { + return westreamMessageService.deail(query); } /** @@ -43,8 +44,8 @@ public class WestreamMessageController { * @return */ @PutMapping("/read") - private JsonResult read(String openId) { - return westreamMessageService.read(openId); + private JsonResult read(ThWestreamMessageQuery query) { + return westreamMessageService.read(query); } 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 edf84f2..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 @@ -84,8 +84,4 @@ public class UserPointsDetail extends BaseEntity implements Serializable { */ @TableField(exist = false) private String areaName; - /** - * 活动标题名称 - */ - private String changeName; } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ThWestreamMessageQuery.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ThWestreamMessageQuery.java new file mode 100644 index 0000000..37aafbd --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ThWestreamMessageQuery.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 ThWestreamMessageQuery extends BaseQuery { + /** + * 信息id + */ + private String msgId; + + private String openId; + + private Integer tenantId; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamMessageService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamMessageService.java index 65c9e2f..6524e4b 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamMessageService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamMessageService.java @@ -2,6 +2,7 @@ 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.ThWestreamMessageQuery; import com.tuoheng.common.utils.JsonResult; /** @@ -11,9 +12,9 @@ import com.tuoheng.common.utils.JsonResult; */ public interface ThWestreamMessageService extends IService { - JsonResult getList(String openId); + JsonResult getList(ThWestreamMessageQuery query); - JsonResult read(String openId); + JsonResult read(ThWestreamMessageQuery query); - JsonResult deail(String msgId); + JsonResult deail(ThWestreamMessageQuery 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 index 207aa10..14a916c 100644 --- 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 @@ -3,6 +3,7 @@ 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.entity.request.ThWestreamMessageQuery; import com.tuoheng.api.mapper.ThWestreamMessageMapper; import com.tuoheng.api.service.ThWestreamMessageService; import com.tuoheng.common.common.BaseEntity; @@ -28,12 +29,15 @@ public class ThWestreamMessageServiceImpl extends ServiceImpl list = this.list(Wrappers.lambdaQuery() - .eq(ThWestreamMessage::getOpenid, openId).eq(BaseEntity::getMark, 1)); + .eq(ThWestreamMessage::getOpenid, query.getOpenId()).eq(ThWestreamMessage::getTenantId, query.getTenantId()).eq(BaseEntity::getMark, 1)); return JsonResult.success(list); } @@ -44,11 +48,11 @@ public class ThWestreamMessageServiceImpl extends ServiceImpl list = this.list(Wrappers.lambdaQuery() - .eq(ThWestreamMessage::getOpenid, openId) + .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.saveOrUpdateBatch(list); + this.updateBatchById(list); return JsonResult.success(); } 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 index ac40418..bad99a1 100644 --- 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 @@ -45,9 +45,13 @@ public class ThWestreamTiktokServiceImpl extends ServiceImpllambdaQuery() .eq(WestreamUser::getOpenid, entity.getOpenid()) + .eq(WestreamUser::getTenantId, entity.getTenantId()) .eq(BaseEntity::getMark, 1)); if (StringUtils.isNull(westreamUser)) { return JsonResult.error("该用户不存在此系统!"); @@ -56,7 +60,6 @@ public class ThWestreamTiktokServiceImpl extends ServiceImpl Date: Tue, 6 Jun 2023 15:37:41 +0800 Subject: [PATCH 04/80] =?UTF-8?q?=E6=8A=A4=E6=B2=B3=E5=BB=BA=E8=AE=AE=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WestreamSuggestController.java | 36 +++++++++++++ .../api/entity/domain/WestreamSuggest.java | 53 +++++++++++++++++++ .../api/mapper/WestreamSuggestMapper.java | 13 +++++ .../api/service/IWestreamSuggestService.java | 7 +++ .../impl/WestreamSuggestServiceImpl.java | 47 ++++++++++++++++ 5 files changed, 156 insertions(+) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamSuggestController.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamSuggest.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamSuggestMapper.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamSuggestService.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamSuggestServiceImpl.java 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..62f0934 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamSuggestController.java @@ -0,0 +1,36 @@ +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.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(WestreamSuggest entity) { + return westreamSuggestService.add(entity); + } + + +} 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/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/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/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); + } + +} -- 2.27.0 From d10c3e07be0f0251fb6906e4aadd510749543354 Mon Sep 17 00:00:00 2001 From: xiaoying Date: Tue, 6 Jun 2023 16:01:38 +0800 Subject: [PATCH 05/80] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tuoheng/api/controller/WestreamTiktokController.java | 3 ++- .../tuoheng/api/service/impl/ThWestreamTiktokServiceImpl.java | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) 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 index 094da35..b0dab04 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java @@ -5,6 +5,7 @@ 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.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -28,7 +29,7 @@ public class WestreamTiktokController { * @return */ @PostMapping("/add") - public JsonResult add(ThWestreamTiktok entity) { + public JsonResult add(@RequestBody ThWestreamTiktok entity) { return thWestreamTiktokService.add(entity); } 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 index bad99a1..9c044fe 100644 --- 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 @@ -62,9 +62,11 @@ public class ThWestreamTiktokServiceImpl extends ServiceImpl Date: Tue, 6 Jun 2023 16:56:19 +0800 Subject: [PATCH 06/80] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/controller/WestreamMessageController.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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 index ce20a0d..4d25cbf 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java @@ -4,10 +4,7 @@ import com.tuoheng.api.entity.request.ThWestreamMessageQuery; 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; +import org.springframework.web.bind.annotation.*; /** * @Author xiaoying @@ -44,7 +41,7 @@ public class WestreamMessageController { * @return */ @PutMapping("/read") - private JsonResult read(ThWestreamMessageQuery query) { + private JsonResult read(@RequestBody ThWestreamMessageQuery query) { return westreamMessageService.read(query); } -- 2.27.0 From 6d0f39544084adbc75c785e2721f0d655abe271b Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Wed, 7 Jun 2023 11:43:47 +0800 Subject: [PATCH 07/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9tiktok=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tuoheng/api/controller/WestreamTiktokController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index b0dab04..f1b1c59 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RestController; * @Date 2023/6/6 9:46 */ @RestController -@RequestMapping("/tiktor") +@RequestMapping("/tiktok") public class WestreamTiktokController { @Autowired -- 2.27.0 From 22846e088738f949e1bc19f7b4e48b63e18bfa44 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Wed, 7 Jun 2023 13:59:48 +0800 Subject: [PATCH 08/80] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8F=AF=E5=90=A6=E7=94=B3=E8=AF=B7=20=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WestreamTiktokController.java | 20 +++++++++---- .../entity/request/WestreamTiktokQuery.java | 23 ++++++++++++++ .../api/service/ThWestreamTiktokService.java | 3 ++ .../impl/ThWestreamTiktokServiceImpl.java | 30 +++++++++++++++++++ 4 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamTiktokQuery.java 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 index f1b1c59..6a7553f 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java @@ -1,13 +1,12 @@ package com.tuoheng.api.controller; import com.tuoheng.api.entity.domain.ThWestreamTiktok; +import com.tuoheng.api.entity.request.OnlineNumQuery; +import com.tuoheng.api.entity.request.WestreamTiktokQuery; 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.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * 关注抖音业务 前端控制器 @@ -16,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController; * @Date 2023/6/6 9:46 */ @RestController -@RequestMapping("/tiktok") +@RequestMapping("/westreamTiktok") public class WestreamTiktokController { @Autowired @@ -33,4 +32,15 @@ public class WestreamTiktokController { 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/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/service/ThWestreamTiktokService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamTiktokService.java index dfcc138..b47310f 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamTiktokService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamTiktokService.java @@ -2,6 +2,7 @@ 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; /** @@ -12,4 +13,6 @@ import com.tuoheng.common.utils.JsonResult; public interface ThWestreamTiktokService extends IService { JsonResult add(ThWestreamTiktok entity); + + JsonResult getIsApply(WestreamTiktokQuery query); } 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 index 9c044fe..591b3e4 100644 --- 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 @@ -1,11 +1,13 @@ package com.tuoheng.api.service.impl; import cn.hutool.core.date.DateUtil; +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; @@ -48,6 +50,15 @@ public class ThWestreamTiktokServiceImpl extends ServiceImpl() + .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()) @@ -75,6 +86,25 @@ public class ThWestreamTiktokServiceImpl extends ServiceImpl() + .eq(ThWestreamTiktok::getOpenid, query.getOpenid()) + .eq(ThWestreamTiktok::getTenantId, query.getTenantId()) + .in(ThWestreamTiktok::getStatus, 1, 2) + .eq(ThWestreamTiktok::getMark, 1)); + if(count > 0){ + //0代表已经申请,无法再申请 + return JsonResult.success(0); + }else { + //1代表可以申请 + return JsonResult.success(1); + } + + } } -- 2.27.0 From e1e140171b60e13970f9c74aefe3750631b91207 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Wed, 7 Jun 2023 15:45:53 +0800 Subject: [PATCH 09/80] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AD=A6=E4=B9=A0?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=88=97=E8=A1=A8(=E5=88=86=E9=A1=B5)=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WestreamVideoController.java | 36 ++++++++++ .../api/entity/domain/WestreamVideo.java | 56 +++++++++++++++ .../api/entity/domain/WestreamVideoUser.java | 51 ++++++++++++++ .../entity/request/WestreamVideoQuery.java | 17 +++++ .../api/mapper/WestreamVideoMapper.java | 13 ++++ .../api/mapper/WestreamVideoUserMapper.java | 13 ++++ .../api/service/IWestreamVideoService.java | 10 +++ .../impl/WestreamVideoServiceImpl.java | 69 +++++++++++++++++++ .../com/tuoheng/common/common/BaseQuery.java | 8 +-- .../com/tuoheng/common/utils/CommonUtils.java | 10 +++ 10 files changed, 279 insertions(+), 4 deletions(-) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVideoController.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamVideo.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamVideoUser.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamVideoQuery.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamVideoMapper.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamVideoUserMapper.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamVideoService.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamVideoServiceImpl.java 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..67e1700 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVideoController.java @@ -0,0 +1,36 @@ +package com.tuoheng.api.controller; + +import com.tuoheng.api.entity.request.StreamQuery; +import com.tuoheng.api.entity.request.WestreamVideoQuery; +import com.tuoheng.api.service.IWestreamUserService; +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.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 全民护河学习视频 前端控制器 + * + * @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); + } +} 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/WestreamVideoQuery.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamVideoQuery.java new file mode 100644 index 0000000..8c9f6d1 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamVideoQuery.java @@ -0,0 +1,17 @@ +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; +} 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/IWestreamVideoService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamVideoService.java new file mode 100644 index 0000000..85cf6e5 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamVideoService.java @@ -0,0 +1,10 @@ +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); +} 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..f05fc15 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamVideoServiceImpl.java @@ -0,0 +1,69 @@ +package com.tuoheng.api.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.tuoheng.api.entity.domain.WestreamScenery; +import com.tuoheng.api.entity.domain.WestreamVideo; +import com.tuoheng.api.entity.domain.WestreamVideoUser; +import com.tuoheng.api.entity.request.WestreamVideoQuery; +import com.tuoheng.api.mapper.WestreamVideoMapper; +import com.tuoheng.api.mapper.WestreamVideoUserMapper; +import com.tuoheng.api.service.IWestreamVideoService; +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.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 全民护河学习视频表 服务实现类 + * + * @author WangHaoran + * @since 2023-06-07 + */ +@Service +public class WestreamVideoServiceImpl extends BaseServiceImpl implements IWestreamVideoService { + + @Autowired + private WestreamVideoMapper westreamVideoMapper; + + @Autowired + private WestreamVideoUserMapper westreamVideoUserMapper; + + @Override + public JsonResult queryPage(WestreamVideoQuery query) { + if(null == query.getTenantId() || StringUtils.isEmpty(query.getOpenid())){ + return JsonResult.error("参数为空!"); + } + + // 获取分页数据 + 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::getTenantId, query.getTenantId()) + .eq(WestreamVideoUser::getMark, 1)); + if(ObjectUtil.isNull(westreamVideoUser)){ + record.setStatus(0); + }else { + record.setStatus(westreamVideoUser.getStatus()); + } + } + + return JsonResult.success(pageData); + } +} 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..852b049 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,12 @@ import lombok.Data; @Data public class BaseQuery { /** - * 页码 + * 页码(默认1) */ - private Integer page; + private Integer page = 1; /** - * 每页数 + * 每页数(默认10) */ - private Integer limit; + private Integer limit = 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; + } + /** * 获取到图片域名的地址 * -- 2.27.0 From 7881455609dfb6a5a3c523851f73eb46b95939cc Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Wed, 7 Jun 2023 16:50:00 +0800 Subject: [PATCH 10/80] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E8=A7=82=E7=9C=8B=E8=BF=9B=E5=BA=A6=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/constants/DictConstants.java | 17 ++- .../controller/WestreamVideoController.java | 16 ++- .../entity/request/WestreamVideoQuery.java | 15 +++ .../api/service/IWestreamVideoService.java | 2 + .../impl/WestreamVideoServiceImpl.java | 100 ++++++++++++++++-- 5 files changed, 140 insertions(+), 10 deletions(-) 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/WestreamVideoController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVideoController.java index 67e1700..70043cc 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVideoController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVideoController.java @@ -1,14 +1,13 @@ package com.tuoheng.api.controller; +import com.tuoheng.api.entity.domain.WestreamVideo; import com.tuoheng.api.entity.request.StreamQuery; import com.tuoheng.api.entity.request.WestreamVideoQuery; import com.tuoheng.api.service.IWestreamUserService; 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.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * 全民护河学习视频 前端控制器 @@ -33,4 +32,15 @@ public class WestreamVideoController { public JsonResult index(WestreamVideoQuery query) { return westreamVideoService.queryPage(query); } + + /** + * 更新视频观看进度 + * + * @param query + * @return + */ + @PutMapping("/updateProgress") + public JsonResult updateProgress(@RequestBody WestreamVideoQuery query) { + return westreamVideoService.updateProgress(query); + } } 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 index 8c9f6d1..1bdc1cc 100644 --- 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 @@ -14,4 +14,19 @@ public class WestreamVideoQuery extends BaseQuery { * 用户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/service/IWestreamVideoService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamVideoService.java index 85cf6e5..76cfa6e 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamVideoService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamVideoService.java @@ -7,4 +7,6 @@ import com.tuoheng.common.utils.JsonResult; public interface IWestreamVideoService extends IBaseService { JsonResult queryPage(WestreamVideoQuery query); + + JsonResult updateProgress(WestreamVideoQuery query); } 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 index f05fc15..9e3ec08 100644 --- 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 @@ -3,22 +3,26 @@ package com.tuoheng.api.service.impl; import cn.hutool.core.util.ObjectUtil; 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.entity.domain.WestreamScenery; -import com.tuoheng.api.entity.domain.WestreamVideo; -import com.tuoheng.api.entity.domain.WestreamVideoUser; +import com.tuoheng.api.constants.DictConstants; +import com.tuoheng.api.entity.domain.*; import com.tuoheng.api.entity.request.WestreamVideoQuery; -import com.tuoheng.api.mapper.WestreamVideoMapper; -import com.tuoheng.api.mapper.WestreamVideoUserMapper; +import com.tuoheng.api.mapper.*; import com.tuoheng.api.service.IWestreamVideoService; +import com.tuoheng.api.utils.SmsUtil; 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; +import java.util.Arrays; +import java.util.Date; +import java.util.List; + /** * 全民护河学习视频表 服务实现类 * @@ -34,6 +38,18 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl() + .eq(WestreamVideoUser::getTenantId, query.getTenantId()) + .eq(WestreamVideoUser::getOpenid, query.getOpenid()) + .eq(WestreamVideoUser::getVideoId, query.getVideoId()) + .eq(WestreamVideoUser::getMark, 1)); + + if(ObjectUtil.isNull(westreamVideoUser)){ + WestreamVideoUser westreamVideoUserAdd = new WestreamVideoUser(); + BeanUtils.copyProperties(query, westreamVideoUserAdd); + westreamVideoUserAdd.setCreateTime(new Date()); + westreamVideoUserMapper.insert(westreamVideoUserAdd); + }else { + westreamVideoUser.setVideoProgress(query.getVideoProgress()); + westreamVideoUser.setStatus(query.getStatus()); + westreamVideoUserMapper.updateById(westreamVideoUser); + //视频学习完成,开始计算积分 + if(2 == query.getStatus()){ + + //查询学习视频 积分设置 + //发送短信 + 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())){ + //查询用户昵称 + WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() + .eq(WestreamUser::getTenantId, query.getTenantId()) + .eq(WestreamUser::getOpenid, query.getOpenid()) + .eq(WestreamUser::getMark, 1)); + + + //积分明细表入库 + UserPointsDetail userPointsDetail = new UserPointsDetail(); + BeanUtils.copyProperties(query,userPointsDetail); + userPointsDetail.setNickname(westreamUser.getNickname()); + userPointsDetail.setPointsChange(Integer.parseInt(thDictData.getValue())); + userPointsDetail.setPointsTime(new Date()); + userPointsDetail.setChangeName("观看学习视频"+query.getVideoId()); + userPointsDetail.setType(1); + userPointsDetailMapper.insert(userPointsDetail); + + //TODO 对接商城 + } + } + } + } + + + + + } + + return JsonResult.success(); + } } -- 2.27.0 From 61ee1cff077b79530ef7104475c2226f66627523 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Wed, 7 Jun 2023 17:39:07 +0800 Subject: [PATCH 11/80] =?UTF-8?q?=E5=BF=97=E6=84=BF=E8=80=85=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E6=9F=A5=E8=AF=A2(=E5=88=86=E9=A1=B5)=20=20=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WestreamActivityController.java | 36 +++++++++ .../controller/WestreamMessageController.java | 12 +-- .../controller/WestreamTiktokController.java | 5 +- .../controller/WestreamVideoController.java | 3 - .../api/entity/domain/WestreamActivity.java | 74 +++++++++++++++++ .../entity/domain/WestreamActivityApply.java | 59 ++++++++++++++ .../entity/domain/WestreamActivityUser.java | 29 +++++++ .../entity/request/WestreamActivityQuery.java | 22 +++++ ...geQuery.java => WestreamMessageQuery.java} | 2 +- .../api/entity/vo/WestreamActivityVo.java | 24 ++++++ .../tuoheng/api/enums/ActivityStatusEnum.java | 22 +++++ .../mapper/WestreamActivityApplyMapper.java | 18 +++++ .../api/mapper/WestreamActivityMapper.java | 18 +++++ .../mapper/WestreamActivityUserMapper.java | 18 +++++ .../api/service/IWestreamActivityService.java | 10 +++ ...vice.java => IWestreamMessageService.java} | 10 +-- ...rvice.java => IWestreamTiktokService.java} | 2 +- .../impl/ThWestreamMessageServiceImpl.java | 12 +-- .../impl/ThWestreamTiktokServiceImpl.java | 4 +- .../impl/WestreamActivityServiceImpl.java | 81 +++++++++++++++++++ .../impl/WestreamVideoServiceImpl.java | 4 +- .../com/tuoheng/common/common/BaseQuery.java | 16 +++- 22 files changed, 449 insertions(+), 32 deletions(-) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityController.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamActivity.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamActivityApply.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamActivityUser.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamActivityQuery.java rename tuoheng-api/src/main/java/com/tuoheng/api/entity/request/{ThWestreamMessageQuery.java => WestreamMessageQuery.java} (83%) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/vo/WestreamActivityVo.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/enums/ActivityStatusEnum.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamActivityApplyMapper.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamActivityMapper.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamActivityUserMapper.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityService.java rename tuoheng-api/src/main/java/com/tuoheng/api/service/{ThWestreamMessageService.java => IWestreamMessageService.java} (54%) rename tuoheng-api/src/main/java/com/tuoheng/api/service/{ThWestreamTiktokService.java => IWestreamTiktokService.java} (87%) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityServiceImpl.java 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..b967f44 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityController.java @@ -0,0 +1,36 @@ +package com.tuoheng.api.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +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 index 4d25cbf..8346b41 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java @@ -1,7 +1,7 @@ package com.tuoheng.api.controller; -import com.tuoheng.api.entity.request.ThWestreamMessageQuery; -import com.tuoheng.api.service.ThWestreamMessageService; +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.*; @@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.*; public class WestreamMessageController { @Autowired - private ThWestreamMessageService westreamMessageService; + private IWestreamMessageService westreamMessageService; /** * 查询用户对应消息记录通知 @@ -23,7 +23,7 @@ public class WestreamMessageController { * @return */ @GetMapping("/list") - private JsonResult getList(ThWestreamMessageQuery query) { + private JsonResult getList(WestreamMessageQuery query) { return westreamMessageService.getList(query); } @@ -32,7 +32,7 @@ public class WestreamMessageController { * @return */ @GetMapping("/deail") - private JsonResult deail(ThWestreamMessageQuery query) { + private JsonResult deail(WestreamMessageQuery query) { return westreamMessageService.deail(query); } @@ -41,7 +41,7 @@ public class WestreamMessageController { * @return */ @PutMapping("/read") - private JsonResult read(@RequestBody ThWestreamMessageQuery query) { + private JsonResult read(@RequestBody WestreamMessageQuery query) { return westreamMessageService.read(query); } 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 index 6a7553f..8e3e294 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java @@ -1,9 +1,8 @@ package com.tuoheng.api.controller; import com.tuoheng.api.entity.domain.ThWestreamTiktok; -import com.tuoheng.api.entity.request.OnlineNumQuery; import com.tuoheng.api.entity.request.WestreamTiktokQuery; -import com.tuoheng.api.service.ThWestreamTiktokService; +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.*; @@ -19,7 +18,7 @@ import org.springframework.web.bind.annotation.*; public class WestreamTiktokController { @Autowired - private ThWestreamTiktokService thWestreamTiktokService; + private IWestreamTiktokService thWestreamTiktokService; /** * 添加抖音关注审核 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 index 70043cc..da282aa 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVideoController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVideoController.java @@ -1,9 +1,6 @@ package com.tuoheng.api.controller; -import com.tuoheng.api.entity.domain.WestreamVideo; -import com.tuoheng.api.entity.request.StreamQuery; import com.tuoheng.api.entity.request.WestreamVideoQuery; -import com.tuoheng.api.service.IWestreamUserService; import com.tuoheng.api.service.IWestreamVideoService; import com.tuoheng.common.utils.JsonResult; import org.springframework.beans.factory.annotation.Autowired; 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/request/WestreamActivityQuery.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamActivityQuery.java new file mode 100644 index 0000000..403cdfb --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamActivityQuery.java @@ -0,0 +1,22 @@ +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; + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ThWestreamMessageQuery.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamMessageQuery.java similarity index 83% rename from tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ThWestreamMessageQuery.java rename to tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamMessageQuery.java index 37aafbd..bad8cab 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ThWestreamMessageQuery.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamMessageQuery.java @@ -8,7 +8,7 @@ import lombok.Data; * @Date 2023/6/6 15:32 */ @Data -public class ThWestreamMessageQuery extends BaseQuery { +public class WestreamMessageQuery extends BaseQuery { /** * 信息id */ 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/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/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/ThWestreamMessageService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamMessageService.java similarity index 54% rename from tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamMessageService.java rename to tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamMessageService.java index 6524e4b..f3dbabe 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamMessageService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamMessageService.java @@ -2,7 +2,7 @@ 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.ThWestreamMessageQuery; +import com.tuoheng.api.entity.request.WestreamMessageQuery; import com.tuoheng.common.utils.JsonResult; /** @@ -10,11 +10,11 @@ import com.tuoheng.common.utils.JsonResult; * @description 针对表【th_westream_message(全民护河消息表)】的数据库操作Service * @createDate 2023-06-06 11:30:05 */ -public interface ThWestreamMessageService extends IService { +public interface IWestreamMessageService extends IService { - JsonResult getList(ThWestreamMessageQuery query); + JsonResult getList(WestreamMessageQuery query); - JsonResult read(ThWestreamMessageQuery query); + JsonResult read(WestreamMessageQuery query); - JsonResult deail(ThWestreamMessageQuery query); + JsonResult deail(WestreamMessageQuery query); } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamTiktokService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamTiktokService.java similarity index 87% rename from tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamTiktokService.java rename to tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamTiktokService.java index b47310f..ed9c850 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamTiktokService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamTiktokService.java @@ -10,7 +10,7 @@ import com.tuoheng.common.utils.JsonResult; * @description 针对表【th_westream_tiktok(全民护河抖音关注审核表)】的数据库操作Service * @createDate 2023-06-06 09:46:18 */ -public interface ThWestreamTiktokService extends IService { +public interface IWestreamTiktokService extends IService { JsonResult add(ThWestreamTiktok entity); 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 index 14a916c..179f2f2 100644 --- 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 @@ -3,9 +3,9 @@ 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.entity.request.ThWestreamMessageQuery; +import com.tuoheng.api.entity.request.WestreamMessageQuery; import com.tuoheng.api.mapper.ThWestreamMessageMapper; -import com.tuoheng.api.service.ThWestreamMessageService; +import com.tuoheng.api.service.IWestreamMessageService; import com.tuoheng.common.common.BaseEntity; import com.tuoheng.common.utils.JsonResult; import com.tuoheng.common.utils.StringUtils; @@ -20,7 +20,7 @@ import java.util.List; */ @Service public class ThWestreamMessageServiceImpl extends ServiceImpl - implements ThWestreamMessageService { + implements IWestreamMessageService { /** @@ -29,7 +29,7 @@ public class ThWestreamMessageServiceImpl extends ServiceImpl - implements ThWestreamTiktokService { + implements IWestreamTiktokService { @Autowired private ThWestreamTiktokMapper westreamTiktokMapper; 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..1f3e548 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityServiceImpl.java @@ -0,0 +1,81 @@ +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()) + .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/WestreamVideoServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamVideoServiceImpl.java index 9e3ec08..1a1c9ab 100644 --- 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 @@ -55,6 +55,7 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl page = new Page<>(query.getPage(), query.getLimit()); @@ -88,12 +89,10 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl() .eq(WestreamVideoUser::getTenantId, query.getTenantId()) .eq(WestreamVideoUser::getOpenid, query.getOpenid()) @@ -113,7 +112,6 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl() .eq(ThDict::getTenantId, query.getTenantId()) .eq(ThDict::getCode, DictConstants.POINTS_RULE_CODE) 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 852b049..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 @@ -10,10 +10,22 @@ public class BaseQuery { /** * 页码(默认1) */ - private Integer page = 1; + private Integer page; /** * 每页数(默认10) */ - private Integer limit = 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); + } + } } -- 2.27.0 From c46d2516fd9e2e149630c076386a0e61fc319974 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Wed, 7 Jun 2023 17:47:12 +0800 Subject: [PATCH 12/80] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E8=A7=82=E7=9C=8B=E8=BF=9B=E5=BA=A6=20=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=AD=97=E6=AE=B5=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tuoheng/api/service/impl/WestreamVideoServiceImpl.java | 1 + 1 file changed, 1 insertion(+) 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 index 1a1c9ab..6256122 100644 --- 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 @@ -137,6 +137,7 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl Date: Thu, 8 Jun 2023 11:57:53 +0800 Subject: [PATCH 13/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=A4=E6=B2=B3?= =?UTF-8?q?=E5=BB=BA=E8=AE=AE=E6=8F=90=E4=BA=A4=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WestreamActivityApplyController.java | 36 +++++++++++++++++++ .../WestreamActivityController.java | 1 - .../controller/WestreamSuggestController.java | 3 +- .../IWestreamActivityApplyService.java | 11 ++++++ .../impl/WestreamActivityApplyImpl.java | 11 ++++++ 5 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityApplyController.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityApplyService.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyImpl.java 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..8f7f8b0 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityApplyController.java @@ -0,0 +1,36 @@ +package com.tuoheng.api.controller; + +import com.tuoheng.api.entity.domain.WestreamActivityApply; +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.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-08 + */ +@RestController +@RequestMapping("/westreamActivityApply") +public class WestreamActivityApplyController { + + @Autowired + private IWestreamActivityApplyService westreamActivityApplyService; + + + /** + * 活动-报名 + * + * @param westreamActivityApply + * @return + */ + @PostMapping("/submit") + public JsonResult submit(@RequestBody WestreamActivityApply westreamActivityApply){ + return IWestreamActivityApplyService.submit(westreamActivityApply); + } +} 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 index b967f44..e1fe61f 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityController.java @@ -1,6 +1,5 @@ package com.tuoheng.api.controller; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.tuoheng.api.entity.request.WestreamActivityQuery; import com.tuoheng.api.service.IWestreamActivityService; import com.tuoheng.common.utils.JsonResult; 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 index 62f0934..b818e8b 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamSuggestController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamSuggestController.java @@ -5,6 +5,7 @@ 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; @@ -28,7 +29,7 @@ public class WestreamSuggestController { * @return */ @PostMapping("/add") - public JsonResult add(WestreamSuggest entity) { + public JsonResult add(@RequestBody WestreamSuggest entity) { return westreamSuggestService.add(entity); } 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..3586871 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityApplyService.java @@ -0,0 +1,11 @@ +package com.tuoheng.api.service; + +import com.tuoheng.api.entity.domain.WestreamActivityApply; +import com.tuoheng.common.common.IBaseService; +import com.tuoheng.common.utils.JsonResult; + +public interface IWestreamActivityApplyService extends IBaseService { + static JsonResult submit(WestreamActivityApply westreamActivityApply) { + return null; + } +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyImpl.java new file mode 100644 index 0000000..f5060ef --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyImpl.java @@ -0,0 +1,11 @@ +package com.tuoheng.api.service.impl; + +import com.tuoheng.api.entity.domain.WestreamActivityApply; +import com.tuoheng.api.mapper.WestreamActivityApplyMapper; +import com.tuoheng.api.service.IWestreamActivityApplyService; +import com.tuoheng.common.common.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Service +public class WestreamActivityApplyImpl extends BaseServiceImpl implements IWestreamActivityApplyService { +} -- 2.27.0 From 5687315c922f2a64482077b1006f2e41c4389525 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Thu, 8 Jun 2023 13:40:02 +0800 Subject: [PATCH 14/80] =?UTF-8?q?=E5=BF=97=E6=84=BF=E8=80=85=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8-=E6=8A=A5=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WestreamActivityApplyController.java | 2 +- .../IWestreamActivityApplyService.java | 5 +-- .../impl/WestreamActivityApplyImpl.java | 11 ----- .../WestreamActivityApplyServiceImpl.java | 43 +++++++++++++++++++ 4 files changed, 46 insertions(+), 15 deletions(-) delete mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyImpl.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyServiceImpl.java 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 index 8f7f8b0..c931dd6 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityApplyController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityApplyController.java @@ -31,6 +31,6 @@ public class WestreamActivityApplyController { */ @PostMapping("/submit") public JsonResult submit(@RequestBody WestreamActivityApply westreamActivityApply){ - return IWestreamActivityApplyService.submit(westreamActivityApply); + return westreamActivityApplyService.submit(westreamActivityApply); } } 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 index 3586871..b35ed13 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityApplyService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityApplyService.java @@ -5,7 +5,6 @@ import com.tuoheng.common.common.IBaseService; import com.tuoheng.common.utils.JsonResult; public interface IWestreamActivityApplyService extends IBaseService { - static JsonResult submit(WestreamActivityApply westreamActivityApply) { - return null; - } + + JsonResult submit(WestreamActivityApply westreamActivityApply); } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyImpl.java deleted file mode 100644 index f5060ef..0000000 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyImpl.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.tuoheng.api.service.impl; - -import com.tuoheng.api.entity.domain.WestreamActivityApply; -import com.tuoheng.api.mapper.WestreamActivityApplyMapper; -import com.tuoheng.api.service.IWestreamActivityApplyService; -import com.tuoheng.common.common.BaseServiceImpl; -import org.springframework.stereotype.Service; - -@Service -public class WestreamActivityApplyImpl extends BaseServiceImpl implements IWestreamActivityApplyService { -} 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..623590a --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyServiceImpl.java @@ -0,0 +1,43 @@ +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.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(); + } +} -- 2.27.0 From 125c7eed3061f6a3199c1e648a8f4de746ec18cb Mon Sep 17 00:00:00 2001 From: xiaoying Date: Thu, 8 Jun 2023 14:33:52 +0800 Subject: [PATCH 15/80] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/service/impl/WestreamActivityServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 index 1f3e548..feb445f 100644 --- 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 @@ -30,7 +30,7 @@ public class WestreamActivityServiceImpl extends BaseServiceImpl pageDate = westreamActivityMapper.selectPage(page, Wrappers.lambdaQuery() .eq(WestreamActivity::getTenantId, query.getTenantId()) + .eq(BaseEntity::getMark, 1) .orderByDesc(WestreamActivity::getCreateTime)); //返回图片地址匹配路径前缀 IPage result = pageDate.convert(item -> { -- 2.27.0 From 3238b97edab670b75df22516df4370e83c922089 Mon Sep 17 00:00:00 2001 From: xiaoying Date: Thu, 8 Jun 2023 16:17:59 +0800 Subject: [PATCH 16/80] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=8F=98=E4=B8=BA=E5=88=86=E9=A1=B5=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ThWestreamMessageServiceImpl.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 index 179f2f2..c261c74 100644 --- 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 @@ -1,14 +1,18 @@ 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; @@ -22,6 +26,9 @@ import java.util.List; public class ThWestreamMessageServiceImpl extends ServiceImpl implements IWestreamMessageService { + @Autowired + private ThWestreamMessageMapper westreamMessageMapper; + /** * 查询用户对应消息记录通知 @@ -36,10 +43,13 @@ public class ThWestreamMessageServiceImpl extends ServiceImpl list = this.list(Wrappers.lambdaQuery() + 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()).eq(BaseEntity::getMark, 1)); - return JsonResult.success(list); + return JsonResult.success(pageDate); } /** -- 2.27.0 From 493b95cc77855bd9b611afb52f96433857c565b6 Mon Sep 17 00:00:00 2001 From: xiaoying Date: Thu, 8 Jun 2023 16:36:43 +0800 Subject: [PATCH 17/80] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=80=92=E5=BA=8F=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/impl/ThWestreamMessageServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 index c261c74..354776f 100644 --- 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 @@ -47,7 +47,10 @@ public class ThWestreamMessageServiceImpl extends ServiceImpl page = new Page<>(query.getPage(), query.getLimit()); IPage pageDate = westreamMessageMapper.selectPage(page, Wrappers.lambdaQuery() - .eq(ThWestreamMessage::getOpenid, query.getOpenId()).eq(ThWestreamMessage::getTenantId, query.getTenantId()).eq(BaseEntity::getMark, 1)); + .eq(ThWestreamMessage::getOpenid, query.getOpenId()) + .eq(ThWestreamMessage::getTenantId, query.getTenantId()) + .orderByDesc(BaseEntity::getCreateTime) + .eq(BaseEntity::getMark, 1)); return JsonResult.success(pageDate); } -- 2.27.0 From 2cd5ff863d223fabcd51220ac557754128544fb0 Mon Sep 17 00:00:00 2001 From: douzhenjun Date: Thu, 8 Jun 2023 17:36:48 +0800 Subject: [PATCH 18/80] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=98=8E=E7=BB=86=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/service/impl/UserPointsDetailServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 f6ad82e..15f8cc6 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 @@ -95,7 +95,8 @@ public class UserPointsDetailServiceImpl extends BaseServiceImpl Date: Thu, 8 Jun 2023 18:34:06 +0800 Subject: [PATCH 19/80] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=98=8E=E7=BB=86=E7=9A=84=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A7=B0=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/UserPointsDetailServiceImpl.java | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) 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 15f8cc6..b4da06f 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 @@ -80,23 +80,30 @@ public class UserPointsDetailServiceImpl extends BaseServiceImpl userPointsDetailResult = new ArrayList<>(); - List userPointsDetailList = userPointsDetailMapper.selectList(new LambdaQueryWrapper() +// List 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)); - 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()); + userPointsDetailList.convert(x -> { + if(x.getType().equals(2)){ + x.setPointsChange(-1*x.getPointsChange()); } - userPointsDetailResult.add(userPointsDetail1); - } - return JsonResult.success(userPointsDetailResult); + 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); } } -- 2.27.0 From 87e9096a32b472d727e227557a25afdae5f89768 Mon Sep 17 00:00:00 2001 From: douzhenjun Date: Thu, 8 Jun 2023 18:41:10 +0800 Subject: [PATCH 20/80] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=98=8E=E7=BB=86=E7=9A=84=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A7=B0=E5=88=86=E9=A1=B52?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/UserPointsDetailServiceImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 b4da06f..6cad647 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 @@ -87,12 +87,12 @@ public class UserPointsDetailServiceImpl extends BaseServiceImpl { - if(x.getType().equals(2)){ - x.setPointsChange(-1*x.getPointsChange()); - } - return x; - }); +// 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()); -- 2.27.0 From e0211b324e0dff8fa1fd5c49e6425efe8f634072 Mon Sep 17 00:00:00 2001 From: xiaoying Date: Fri, 9 Jun 2023 14:36:08 +0800 Subject: [PATCH 21/80] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=AF=B9=E5=BA=94=E6=9C=AA=E8=AF=BB=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WestreamMessageController.java | 9 +++++++++ .../api/service/IWestreamMessageService.java | 2 ++ .../impl/ThWestreamMessageServiceImpl.java | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+) 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 index 8346b41..249769b 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java @@ -26,6 +26,15 @@ public class WestreamMessageController { private JsonResult getList(WestreamMessageQuery query) { return westreamMessageService.getList(query); } + /** + * 查询用户对应未读信息数量 + * + * @return + */ + @GetMapping("/list") + private JsonResult sum(WestreamMessageQuery query) { + return westreamMessageService.sum(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 index f3dbabe..32155ea 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamMessageService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamMessageService.java @@ -17,4 +17,6 @@ public interface IWestreamMessageService extends IService { JsonResult read(WestreamMessageQuery query); JsonResult deail(WestreamMessageQuery query); + + JsonResult sum(WestreamMessageQuery 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 index 354776f..7d7df28 100644 --- 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 @@ -92,6 +92,25 @@ public class ThWestreamMessageServiceImpl extends ServiceImpl 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()); + + } } -- 2.27.0 From 073439b7b3c63a556b932bf6c206242a33497152 Mon Sep 17 00:00:00 2001 From: xiaoying Date: Fri, 9 Jun 2023 14:38:16 +0800 Subject: [PATCH 22/80] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tuoheng/api/controller/WestreamMessageController.java | 2 +- .../tuoheng/api/service/impl/ThWestreamMessageServiceImpl.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) 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 index 249769b..03076ca 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamMessageController.java @@ -31,7 +31,7 @@ public class WestreamMessageController { * * @return */ - @GetMapping("/list") + @GetMapping("/sum") private JsonResult sum(WestreamMessageQuery query) { return westreamMessageService.sum(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 index 7d7df28..c9cac3f 100644 --- 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 @@ -107,7 +107,6 @@ public class ThWestreamMessageServiceImpl extends ServiceImpl Date: Fri, 9 Jun 2023 14:39:54 +0800 Subject: [PATCH 23/80] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/impl/ThWestreamMessageServiceImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) 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 index c9cac3f..3986ad1 100644 --- 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 @@ -101,6 +101,13 @@ public class ThWestreamMessageServiceImpl extends ServiceImpl list = this.list(Wrappers.lambdaQuery() .eq(ThWestreamMessage::getTenantId, query.getTenantId()) -- 2.27.0 From 5a84a1cf40461ed25a35de8cd78cb60bcb60476c Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Fri, 9 Jun 2023 14:46:26 +0800 Subject: [PATCH 24/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=94=B3=E8=AF=B7=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WestreamTiktokController.java | 2 +- .../impl/ThWestreamTiktokServiceImpl.java | 24 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) 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 index 8e3e294..5597e19 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java @@ -32,7 +32,7 @@ public class WestreamTiktokController { } /** - * 查询用户可否申请 + * 查询用户申请状态 * * @param * @return 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 index 31a370f..7dfecbb 100644 --- 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 @@ -1,6 +1,7 @@ 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; @@ -90,20 +91,27 @@ public class ThWestreamTiktokServiceImpl extends ServiceImpl() + //查询该用户最新一条申请数据 + ThWestreamTiktok thWestreamTiktok = westreamTiktokMapper.selectOne(new LambdaQueryWrapper() .eq(ThWestreamTiktok::getOpenid, query.getOpenid()) .eq(ThWestreamTiktok::getTenantId, query.getTenantId()) - .in(ThWestreamTiktok::getStatus, 1, 2) - .eq(ThWestreamTiktok::getMark, 1)); - if(count > 0){ - //0代表已经申请,无法再申请 + .eq(ThWestreamTiktok::getMark, 1) + .orderByDesc(ThWestreamTiktok::getCreateTime) + .last("limit 1")); + //0未申请 1待审核(或驳回) 2通过 + if(ObjectUtil.isNull(thWestreamTiktok)){ return JsonResult.success(0); }else { - //1代表可以申请 - return JsonResult.success(1); + if(1 == thWestreamTiktok.getStatus() || 3 == thWestreamTiktok.getStatus()){ + return JsonResult.success(1); + }else if(2 == thWestreamTiktok.getStatus()){ + return JsonResult.success(2); + }else { + return JsonResult.success(0); + } } + } } -- 2.27.0 From 94dbcc0fcaf3229bd8400ea9b988ddbd98a2cf6c Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Fri, 9 Jun 2023 15:33:17 +0800 Subject: [PATCH 25/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E8=A7=86=E9=A2=91=E5=88=97=E8=A1=A8(?= =?UTF-8?q?=E5=88=86=E9=A1=B5)=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tuoheng/api/service/impl/WestreamVideoServiceImpl.java | 1 + 1 file changed, 1 insertion(+) 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 index 6256122..824473d 100644 --- 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 @@ -72,6 +72,7 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl() .eq(WestreamVideoUser::getVideoId, record.getId()) + .eq(WestreamVideoUser::getOpenid, query.getOpenid()) .eq(WestreamVideoUser::getTenantId, query.getTenantId()) .eq(WestreamVideoUser::getMark, 1)); if(ObjectUtil.isNull(westreamVideoUser)){ -- 2.27.0 From 3eaec89852f2dda7603de29b5e2345465e0af4a1 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Mon, 12 Jun 2023 17:00:53 +0800 Subject: [PATCH 26/80] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=AD=A6=E4=B9=A0?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=A7=82=E7=9C=8B=E8=BF=9B=E5=BA=A6=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WestreamVideoController.java | 11 ++++++++++ .../api/service/IWestreamVideoService.java | 2 ++ .../impl/WestreamVideoServiceImpl.java | 20 ++++++++++++++++--- 3 files changed, 30 insertions(+), 3 deletions(-) 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 index da282aa..a478af2 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVideoController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVideoController.java @@ -40,4 +40,15 @@ public class WestreamVideoController { 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/service/IWestreamVideoService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamVideoService.java index 76cfa6e..378141a 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamVideoService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamVideoService.java @@ -9,4 +9,6 @@ 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/WestreamVideoServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamVideoServiceImpl.java index 824473d..7756eaf 100644 --- 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 @@ -10,7 +10,6 @@ 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.api.utils.SmsUtil; import com.tuoheng.common.common.BaseServiceImpl; import com.tuoheng.common.utils.CommonUtils; import com.tuoheng.common.utils.JsonResult; @@ -19,9 +18,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Arrays; import java.util.Date; -import java.util.List; /** * 全民护河学习视频表 服务实现类 @@ -154,4 +151,21 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl() + .eq(WestreamVideoUser::getTenantId, query.getTenantId()) + .eq(WestreamVideoUser::getOpenid, query.getOpenid()) + .eq(WestreamVideoUser::getVideoId, query.getVideoId()) + .eq(WestreamVideoUser::getMark, 1)); + return JsonResult.success(westreamVideoUser); + } } -- 2.27.0 From b2f906d0a292ee70fc3df2e592610917480b4896 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Mon, 12 Jun 2023 17:19:47 +0800 Subject: [PATCH 27/80] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WestreamActivityApplyController.java | 18 ++++++++++++---- .../entity/request/WestreamActivityQuery.java | 10 +++++++++ .../IWestreamActivityApplyService.java | 3 +++ .../WestreamActivityApplyServiceImpl.java | 21 +++++++++++++++++++ 4 files changed, 48 insertions(+), 4 deletions(-) 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 index c931dd6..8a2eaec 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityApplyController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityApplyController.java @@ -1,13 +1,11 @@ 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.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * 全民护河志愿者活动 前端控制器 @@ -33,4 +31,16 @@ public class WestreamActivityApplyController { 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/entity/request/WestreamActivityQuery.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamActivityQuery.java index 403cdfb..6dd8f7c 100644 --- 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 @@ -19,4 +19,14 @@ public class WestreamActivityQuery extends BaseQuery { */ private Integer tenantId; + /** + * 活动id + */ + private Integer activityId; + + /** + * openid + */ + private String openid; + } 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 index b35ed13..8cae958 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityApplyService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityApplyService.java @@ -1,10 +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/impl/WestreamActivityApplyServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyServiceImpl.java index 623590a..80dec7e 100644 --- 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 @@ -2,6 +2,7 @@ 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; @@ -40,4 +41,24 @@ public class WestreamActivityApplyServiceImpl extends BaseServiceImpl() + .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); + } } -- 2.27.0 From 5deaf0cc40398e0e49038c02287114dc1ddabd9b Mon Sep 17 00:00:00 2001 From: douzhenjun Date: Tue, 13 Jun 2023 11:48:34 +0800 Subject: [PATCH 28/80] =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E6=8C=89=E6=97=B6=E9=97=B4=E5=80=92=E5=BA=8F=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/service/impl/UserPointsDetailServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 6cad647..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 @@ -86,7 +86,8 @@ public class UserPointsDetailServiceImpl extends BaseServiceImpl { // if(x.getType().equals(2)){ // x.setPointsChange(-1*x.getPointsChange()); -- 2.27.0 From cd4f71f834c8bec44d2cc943274800bff4395e37 Mon Sep 17 00:00:00 2001 From: xiaoying Date: Tue, 13 Jun 2023 16:13:29 +0800 Subject: [PATCH 29/80] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=B7=BB=E5=8A=A0=E5=93=8D=E5=BA=94?= =?UTF-8?q?=E7=A7=AF=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WestreamUserServiceImpl.java | 75 +++++++++++++++---- 1 file changed, 59 insertions(+), 16 deletions(-) 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..a6068c2 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,63 @@ public class WestreamUserServiceImpl extends BaseServiceImpl() + .eq(ThDict::getTenantId, westreamUserQuery.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())){ + //查询用户昵称 + WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() + .eq(WestreamUser::getTenantId, westreamUserQuery.getTenantId()) + .eq(WestreamUser::getOpenid, westreamUserQuery.getOpenid()) + .eq(WestreamUser::getMark, 1)); + //积分明细表入库 + UserPointsDetail userPointsDetail = new UserPointsDetail(); + BeanUtils.copyProperties(westreamUserQuery,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 对接商城 + } + } + } + } + @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 +131,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); -- 2.27.0 From f8a6c4df37de07647116c967ff64549311519d20 Mon Sep 17 00:00:00 2001 From: xiaoying Date: Tue, 13 Jun 2023 16:24:36 +0800 Subject: [PATCH 30/80] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tuoheng/api/service/impl/WestreamUserServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a6068c2..9172321 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 @@ -75,8 +75,8 @@ public class WestreamUserServiceImpl extends BaseServiceImpl Date: Tue, 13 Jun 2023 16:38:51 +0800 Subject: [PATCH 31/80] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/impl/WestreamUserServiceImpl.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) 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 9172321..da32866 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 @@ -76,7 +76,7 @@ public class WestreamUserServiceImpl extends BaseServiceImpl() - .eq(ThDict::getTenantId, westreamUserQuery.getTenantId()) + .eq(ThDict::getTenantId, westreamUser.getTenantId()) .eq(ThDict::getCode, DictConstants.POINTS_RULE_CODE) .eq(ThDict::getMark, 1)); if(ObjectUtils.isNotNull(thDict)){ @@ -100,14 +100,9 @@ public class WestreamUserServiceImpl extends BaseServiceImpl() - .eq(WestreamUser::getTenantId, westreamUserQuery.getTenantId()) - .eq(WestreamUser::getOpenid, westreamUserQuery.getOpenid()) - .eq(WestreamUser::getMark, 1)); //积分明细表入库 UserPointsDetail userPointsDetail = new UserPointsDetail(); - BeanUtils.copyProperties(westreamUserQuery,userPointsDetail); + BeanUtils.copyProperties(westreamUser,userPointsDetail); userPointsDetail.setNickname(westreamUser.getNickname()); userPointsDetail.setPointsChange(Integer.parseInt(thDictData.getValue())); userPointsDetail.setPointsTime(new Date()); -- 2.27.0 From e16622389d739bb419e122176c10c4cfcdd72e74 Mon Sep 17 00:00:00 2001 From: xiaoying Date: Tue, 13 Jun 2023 16:43:36 +0800 Subject: [PATCH 32/80] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/service/impl/WestreamUserServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 da32866..5820f1d 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 @@ -76,8 +76,8 @@ public class WestreamUserServiceImpl extends BaseServiceImpl() .eq(ThDict::getTenantId, westreamUser.getTenantId()) @@ -111,6 +111,7 @@ public class WestreamUserServiceImpl extends BaseServiceImpl Date: Tue, 13 Jun 2023 16:44:14 +0800 Subject: [PATCH 33/80] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/impl/WestreamUserServiceImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 5820f1d..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 @@ -94,15 +94,15 @@ public class WestreamUserServiceImpl extends BaseServiceImpl() .eq(ThDictData::getDictId, thDict.getId()) .eq(ThDictData::getName, DictConstants.APP_REGISTRY)); - if(ObjectUtils.isNotNull(thDictData)){ - if(StringUtils.isNotEmpty(thDictData.getValue())){ + if (ObjectUtils.isNotNull(thDictData)) { + if (StringUtils.isNotEmpty(thDictData.getValue())) { //积分明细表入库 UserPointsDetail userPointsDetail = new UserPointsDetail(); - BeanUtils.copyProperties(westreamUser,userPointsDetail); + BeanUtils.copyProperties(westreamUser, userPointsDetail); userPointsDetail.setNickname(westreamUser.getNickname()); userPointsDetail.setPointsChange(Integer.parseInt(thDictData.getValue())); userPointsDetail.setPointsTime(new Date()); @@ -115,6 +115,7 @@ public class WestreamUserServiceImpl extends BaseServiceImpl Date: Tue, 13 Jun 2023 17:19:47 +0800 Subject: [PATCH 34/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=82=E7=9C=8B?= =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E8=A7=86=E9=A2=91=20=20=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E8=A1=A8=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tuoheng/api/service/impl/WestreamVideoServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 7756eaf..c1533eb 100644 --- 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 @@ -133,7 +133,7 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl Date: Wed, 14 Jun 2023 09:25:33 +0800 Subject: [PATCH 35/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=AD=A6=E4=B9=A0?= =?UTF-8?q?=E8=A7=86=E9=A2=91=EF=BC=8C=E8=8E=B7=E5=8F=96=E7=A7=AF=E5=88=86?= =?UTF-8?q?=EF=BC=8C=E6=9B=B4=E6=96=B0=E7=94=A8=E6=88=B7=E8=A1=A8=E7=A7=AF?= =?UTF-8?q?=E5=88=86=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/service/impl/WestreamVideoServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) 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 index c1533eb..884853a 100644 --- 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 @@ -17,6 +17,7 @@ import com.tuoheng.common.utils.StringUtils; 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; @@ -83,6 +84,7 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl Date: Wed, 14 Jun 2023 09:37:11 +0800 Subject: [PATCH 36/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=20=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E7=94=A8=E6=88=B7=E7=94=B3=E8=AF=B7=E7=8A=B6=E6=80=81?= =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/impl/ThWestreamTiktokServiceImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 index 7dfecbb..5385cf4 100644 --- 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 @@ -98,14 +98,16 @@ public class ThWestreamTiktokServiceImpl extends ServiceImpl Date: Wed, 14 Jun 2023 12:06:28 +0800 Subject: [PATCH 37/80] =?UTF-8?q?=E6=89=93=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/impl/WestreamVideoServiceImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 index 884853a..cc4883e 100644 --- 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 @@ -14,6 +14,7 @@ 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; @@ -27,6 +28,7 @@ import java.util.Date; * @author WangHaoran * @since 2023-06-07 */ +@Slf4j @Service public class WestreamVideoServiceImpl extends BaseServiceImpl implements IWestreamVideoService { @@ -110,7 +112,7 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl() .eq(ThDict::getTenantId, query.getTenantId()) @@ -122,11 +124,14 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl() .eq(WestreamUser::getTenantId, query.getTenantId()) .eq(WestreamUser::getOpenid, query.getOpenid()) .eq(WestreamUser::getMark, 1)); + log.info("查询用户昵称完成,tenantId:" + query.getTenantId()); + log.info("查询用户昵称完成,openid:" + query.getOpenid()); //积分明细表入库 @@ -139,10 +144,12 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl Date: Wed, 14 Jun 2023 14:03:10 +0800 Subject: [PATCH 38/80] =?UTF-8?q?=E6=89=93=E6=97=A5=E5=BF=97=EF=BC=8C2023-?= =?UTF-8?q?6-14=2014:03:00?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/service/impl/WestreamVideoServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 index cc4883e..1ecea29 100644 --- 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 @@ -1,6 +1,8 @@ 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; @@ -102,16 +104,18 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl() -- 2.27.0 From a70d9803d952684939003c955c046ff178689693 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Wed, 14 Jun 2023 14:37:46 +0800 Subject: [PATCH 39/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=A7=82=E7=9C=8B=E8=BF=9B=E5=BA=A6=20=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WestreamVideoServiceImpl.java | 103 +++++++++--------- 1 file changed, 54 insertions(+), 49 deletions(-) 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 index 1ecea29..ba78747 100644 --- 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 @@ -103,6 +103,7 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl() - .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 对接商城 - } - } - } - } - + } + //视频学习完成,开始计算积分 + 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 JsonResult.success(); + } + return "0"; } @Override -- 2.27.0 From 4f1f9b2c61e37ea18d21386b87dcce776b485cd4 Mon Sep 17 00:00:00 2001 From: chenjiandong Date: Sun, 25 Jun 2023 09:58:01 +0800 Subject: [PATCH 40/80] =?UTF-8?q?=E4=B8=89=E5=8B=BE=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/controller/WxController.java | 33 ++++++++++++-- .../api/entity/domain/WestreamUser.java | 5 +++ .../api/entity/dto/WxGetUserPointsDto.java | 23 ++++++++++ .../api/entity/dto/WxSubUserPointsDto.java | 25 +++++++++++ .../tuoheng/api/entity/dto/WxUserInfoDto.java | 24 +++++++++++ .../entity/request/WxGetUserPointsQuery.java | 21 +++++++++ .../request/WxSubUserPointsRequest.java | 24 +++++++++++ .../com/tuoheng/api/service/IWxService.java | 8 ++++ .../api/service/impl/WxServiceImpl.java | 43 +++++++++++++++++++ 9 files changed, 202 insertions(+), 4 deletions(-) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxGetUserPointsDto.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxSubUserPointsDto.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxUserInfoDto.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxGetUserPointsQuery.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxSubUserPointsRequest.java diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java index 3e69fc8..4b508e2 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java @@ -1,12 +1,12 @@ package com.tuoheng.api.controller; +import com.tuoheng.api.entity.request.WxGetUserPointsQuery; +import com.tuoheng.api.entity.request.WxSubUserPointsRequest; import com.tuoheng.api.service.IWxService; 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.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; /** * 后台用户管理表 前端控制器 @@ -31,4 +31,29 @@ public class WxController { return wxService.openid(code); } + @GetMapping("/openIdAndUnionId/{code}") + public JsonResult openIdAndUnionId(@PathVariable("code") String code) { + return wxService.openIdAndUnionId(code); + } + + /** + * 查询用户积分 + * @param wxGetUserPointsQuery + * @return + */ + @PostMapping("/getUserPoints") + public JsonResult getUserPoints(@Validated @RequestBody WxGetUserPointsQuery wxGetUserPointsQuery) { + return wxService.getUserPoints(wxGetUserPointsQuery); + } + + /** + * 消减用户积分 + * @param wxSubUserPointsRequest + * @return + */ + @PostMapping("/subUserPoints") + public JsonResult subUserPoints(@Validated @RequestBody WxSubUserPointsRequest wxSubUserPointsRequest) { + return wxService.subUserPoints(wxSubUserPointsRequest); + } + } 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 01d992b..23fa9da 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 @@ -34,6 +34,11 @@ public class WestreamUser extends BaseEntity implements Serializable { */ private String openid; + /** + * 用户unionid + */ + private String unionid; + /** * 用户昵称 */ diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxGetUserPointsDto.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxGetUserPointsDto.java new file mode 100644 index 0000000..8b261aa --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxGetUserPointsDto.java @@ -0,0 +1,23 @@ +package com.tuoheng.api.entity.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + * @author chenjiandong + * @description: TODO + * @date 2023/6/25 9:03 + */ +@Data +@Accessors(chain = true) +public class WxGetUserPointsDto { + + private Integer tenantId; + + private String unionId; + + private Integer points; + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxSubUserPointsDto.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxSubUserPointsDto.java new file mode 100644 index 0000000..d5f8b35 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxSubUserPointsDto.java @@ -0,0 +1,25 @@ +package com.tuoheng.api.entity.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +/** + * @author chenjiandong + * @description: TODO + * @date 2023/6/25 9:03 + */ +@Data +@Accessors(chain = true) +public class WxSubUserPointsDto { + + private Integer tenantId; + + private String unionId; + + private Integer points; + + private Boolean optResult; + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxUserInfoDto.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxUserInfoDto.java new file mode 100644 index 0000000..23058df --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxUserInfoDto.java @@ -0,0 +1,24 @@ +package com.tuoheng.api.entity.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +/** + * @author chenjiandong + * @description: TODO + * @date 2023/6/21 15:07 + */ +@Data +@Accessors(chain = true) +@AllArgsConstructor +@NoArgsConstructor +public class WxUserInfoDto { + + private String openId; + + private String unionId; + +} + diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxGetUserPointsQuery.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxGetUserPointsQuery.java new file mode 100644 index 0000000..746cb9c --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxGetUserPointsQuery.java @@ -0,0 +1,21 @@ +package com.tuoheng.api.entity.request; + +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author chenjiandong + * @description: TODO + * @date 2023/6/25 9:03 + */ +@Data +public class WxGetUserPointsQuery { + + @NotNull(message = "tenantId can not be null") + private Integer tenantId; + + @NotNull(message = "unionId can not be null") + private String unionId; + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxSubUserPointsRequest.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxSubUserPointsRequest.java new file mode 100644 index 0000000..ae0a490 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxSubUserPointsRequest.java @@ -0,0 +1,24 @@ +package com.tuoheng.api.entity.request; + +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author chenjiandong + * @description: TODO + * @date 2023/6/25 9:03 + */ +@Data +public class WxSubUserPointsRequest { + + @NotNull(message = "tenantId can not be null") + private Integer tenantId; + + @NotNull(message = "unionId can not be null") + private String unionId; + + @NotNull(message = "points can not be null") + private Integer points; + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWxService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWxService.java index 6881ff8..bacedc2 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWxService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWxService.java @@ -1,8 +1,16 @@ package com.tuoheng.api.service; +import com.tuoheng.api.entity.request.WxGetUserPointsQuery; +import com.tuoheng.api.entity.request.WxSubUserPointsRequest; import com.tuoheng.common.utils.JsonResult; public interface IWxService { JsonResult openid(String code); + JsonResult openIdAndUnionId(String code); + + JsonResult getUserPoints(WxGetUserPointsQuery wxGetUserPointsQuery); + + JsonResult subUserPoints(WxSubUserPointsRequest wxSubUserPointsRequest); + } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java index f527624..ec61e1d 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java @@ -4,6 +4,11 @@ import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.tuoheng.api.entity.domain.WestreamUser; +import com.tuoheng.api.entity.dto.WxGetUserPointsDto; +import com.tuoheng.api.entity.dto.WxSubUserPointsDto; +import com.tuoheng.api.entity.dto.WxUserInfoDto; +import com.tuoheng.api.entity.request.WxGetUserPointsQuery; +import com.tuoheng.api.entity.request.WxSubUserPointsRequest; import com.tuoheng.api.mapper.WestreamUserMapper; import com.tuoheng.api.service.IWxService; import com.tuoheng.common.config.CommonConfig; @@ -34,4 +39,42 @@ public class WxServiceImpl implements IWxService { } } + @Override + public JsonResult openIdAndUnionId(String code) { + String result = GetOpenIdUtil.getopenid(code, CommonConfig.appId, CommonConfig.appSecret); + String openid = JSONObject.parseObject(result).getString("openid"); + String unionid = JSONObject.parseObject(result).getString("unionid"); + if(StringUtils.isNotEmpty(unionid) && StringUtils.isNotEmpty(openid)){ + WxUserInfoDto wxUserInfoDto = new WxUserInfoDto() + .setUnionId(unionid) + .setOpenId(openid); + return JsonResult.success(wxUserInfoDto); + }else { + log.error("获取openid & unionid失败:",result); + return JsonResult.error("获取openid & unionid失败"); + } + } + + @Override + public JsonResult getUserPoints(WxGetUserPointsQuery wxGetUserPointsQuery){ + //todo: 第三方查询用户积分接口 + WxGetUserPointsDto wxGetUserPointsDto = new WxGetUserPointsDto() + .setTenantId(wxGetUserPointsQuery.getTenantId()) + .setUnionId(wxGetUserPointsQuery.getUnionId()) + .setPoints(9000); + return JsonResult.success(wxGetUserPointsDto); + } + + @Override + public JsonResult subUserPoints(WxSubUserPointsRequest wxSubUserPointsRequest){ + //todo: 第三方消减用户积分接口 + WxSubUserPointsDto wxSubUserPointsDto = new WxSubUserPointsDto() + .setTenantId(wxSubUserPointsRequest.getTenantId()) + .setUnionId(wxSubUserPointsRequest.getUnionId()) + .setPoints(wxSubUserPointsRequest.getPoints()) + .setOptResult(true); + return JsonResult.success(wxSubUserPointsDto); + } + + } -- 2.27.0 From 659861633bf58ff81925d95d6744b3f185835c6b Mon Sep 17 00:00:00 2001 From: chenjiandong Date: Sun, 25 Jun 2023 16:27:07 +0800 Subject: [PATCH 41/80] =?UTF-8?q?=E4=B8=89=E5=8B=BE=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/tuoheng/api/entity/dto/WxGetUserPointsDto.java | 2 +- .../java/com/tuoheng/api/entity/dto/WxSubUserPointsDto.java | 2 +- .../com/tuoheng/api/entity/request/WxGetUserPointsQuery.java | 4 ++-- .../tuoheng/api/entity/request/WxSubUserPointsRequest.java | 4 ++-- .../main/java/com/tuoheng/api/service/impl/WxServiceImpl.java | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxGetUserPointsDto.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxGetUserPointsDto.java index 8b261aa..06ac479 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxGetUserPointsDto.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxGetUserPointsDto.java @@ -14,7 +14,7 @@ import javax.validation.constraints.NotNull; @Accessors(chain = true) public class WxGetUserPointsDto { - private Integer tenantId; + private String tenantCode; private String unionId; diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxSubUserPointsDto.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxSubUserPointsDto.java index d5f8b35..770457c 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxSubUserPointsDto.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/dto/WxSubUserPointsDto.java @@ -14,7 +14,7 @@ import javax.validation.constraints.NotNull; @Accessors(chain = true) public class WxSubUserPointsDto { - private Integer tenantId; + private String tenantCode; private String unionId; diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxGetUserPointsQuery.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxGetUserPointsQuery.java index 746cb9c..3a14cbe 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxGetUserPointsQuery.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxGetUserPointsQuery.java @@ -12,8 +12,8 @@ import javax.validation.constraints.NotNull; @Data public class WxGetUserPointsQuery { - @NotNull(message = "tenantId can not be null") - private Integer tenantId; + @NotNull(message = "tenantCode can not be null") + private String tenantCode; @NotNull(message = "unionId can not be null") private String unionId; diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxSubUserPointsRequest.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxSubUserPointsRequest.java index ae0a490..6d0c786 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxSubUserPointsRequest.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxSubUserPointsRequest.java @@ -12,8 +12,8 @@ import javax.validation.constraints.NotNull; @Data public class WxSubUserPointsRequest { - @NotNull(message = "tenantId can not be null") - private Integer tenantId; + @NotNull(message = "tenantCode can not be null") + private String tenantCode; @NotNull(message = "unionId can not be null") private String unionId; diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java index ec61e1d..275712d 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java @@ -59,7 +59,7 @@ public class WxServiceImpl implements IWxService { public JsonResult getUserPoints(WxGetUserPointsQuery wxGetUserPointsQuery){ //todo: 第三方查询用户积分接口 WxGetUserPointsDto wxGetUserPointsDto = new WxGetUserPointsDto() - .setTenantId(wxGetUserPointsQuery.getTenantId()) + .setTenantCode(wxGetUserPointsQuery.getTenantCode()) .setUnionId(wxGetUserPointsQuery.getUnionId()) .setPoints(9000); return JsonResult.success(wxGetUserPointsDto); @@ -69,7 +69,7 @@ public class WxServiceImpl implements IWxService { public JsonResult subUserPoints(WxSubUserPointsRequest wxSubUserPointsRequest){ //todo: 第三方消减用户积分接口 WxSubUserPointsDto wxSubUserPointsDto = new WxSubUserPointsDto() - .setTenantId(wxSubUserPointsRequest.getTenantId()) + .setTenantCode(wxSubUserPointsRequest.getTenantCode()) .setUnionId(wxSubUserPointsRequest.getUnionId()) .setPoints(wxSubUserPointsRequest.getPoints()) .setOptResult(true); -- 2.27.0 From 8b525747f6e71ef8f534e50abdc2e2374a4aa134 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Mon, 26 Jun 2023 10:16:57 +0800 Subject: [PATCH 42/80] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=A7=AF=E5=88=86=20=E5=92=8C=20=E6=B6=88?= =?UTF-8?q?=E5=87=8F=E7=94=A8=E6=88=B7=E7=A7=AF=E5=88=86=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/entity/domain/WestreamUser.java | 5 ++ .../api/service/impl/WxServiceImpl.java | 58 ++++++++++++++++--- 2 files changed, 55 insertions(+), 8 deletions(-) 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 23fa9da..94b9c6c 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 @@ -105,4 +105,9 @@ public class WestreamUser extends BaseEntity implements Serializable { */ private Integer isTiktok; + /** + * unionid + */ + private String unionId; + } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java index ec61e1d..d4d7154 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java @@ -3,12 +3,14 @@ package com.tuoheng.api.service.impl; import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.tuoheng.api.entity.domain.UserPointsDetail; import com.tuoheng.api.entity.domain.WestreamUser; import com.tuoheng.api.entity.dto.WxGetUserPointsDto; import com.tuoheng.api.entity.dto.WxSubUserPointsDto; import com.tuoheng.api.entity.dto.WxUserInfoDto; import com.tuoheng.api.entity.request.WxGetUserPointsQuery; import com.tuoheng.api.entity.request.WxSubUserPointsRequest; +import com.tuoheng.api.mapper.UserPointsDetailMapper; import com.tuoheng.api.mapper.WestreamUserMapper; import com.tuoheng.api.service.IWxService; import com.tuoheng.common.config.CommonConfig; @@ -18,15 +20,21 @@ import com.tuoheng.api.utils.GetOpenIdUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.Date; -import java.util.Random; @Slf4j @Service public class WxServiceImpl implements IWxService { + @Autowired + WestreamUserMapper westreamUserMapper; + + @Autowired + UserPointsDetailMapper userPointsDetailMapper; + @Override public JsonResult openid(String code) { String openidResult = GetOpenIdUtil.getopenid(code, CommonConfig.appId, CommonConfig.appSecret); @@ -57,17 +65,51 @@ public class WxServiceImpl implements IWxService { @Override public JsonResult getUserPoints(WxGetUserPointsQuery wxGetUserPointsQuery){ - //todo: 第三方查询用户积分接口 - WxGetUserPointsDto wxGetUserPointsDto = new WxGetUserPointsDto() - .setTenantId(wxGetUserPointsQuery.getTenantId()) - .setUnionId(wxGetUserPointsQuery.getUnionId()) - .setPoints(9000); - return JsonResult.success(wxGetUserPointsDto); + WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() + .eq(WestreamUser::getTenantId, wxGetUserPointsQuery.getTenantId()) + .eq(WestreamUser::getUnionId, wxGetUserPointsQuery.getUnionId()) + .eq(WestreamUser::getMark, 1)); + if(ObjectUtil.isNotNull(westreamUser)){ + WxGetUserPointsDto wxGetUserPointsDto = new WxGetUserPointsDto() + .setTenantId(wxGetUserPointsQuery.getTenantId()) + .setUnionId(wxGetUserPointsQuery.getUnionId()) + .setPoints(westreamUser.getMallPoints()); + return JsonResult.success(wxGetUserPointsDto); + }else { + return JsonResult.error("用户不存在"); + } + } @Override + @Transactional public JsonResult subUserPoints(WxSubUserPointsRequest wxSubUserPointsRequest){ - //todo: 第三方消减用户积分接口 + + //查询用户 + WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() + .eq(WestreamUser::getTenantId, wxSubUserPointsRequest.getTenantId()) + .eq(WestreamUser::getUnionId, wxSubUserPointsRequest.getUnionId()) + .eq(WestreamUser::getMark, 1)); + + if (westreamUser.getMallPoints() >= wxSubUserPointsRequest.getPoints()) { + westreamUser.setMallPoints(westreamUser.getMallPoints() - wxSubUserPointsRequest.getPoints()); + westreamUserMapper.updateById(westreamUser); + }else { + return JsonResult.error("积分不足,消减失败"); + } + + //积分明细入库 + UserPointsDetail userPointsDetail = new UserPointsDetail(); + userPointsDetail.setTenantId(wxSubUserPointsRequest.getTenantId()); + userPointsDetail.setOpenid(westreamUser.getOpenid()); + userPointsDetail.setPointsChange(wxSubUserPointsRequest.getPoints()); + userPointsDetail.setChangeName("积分兑换"); + userPointsDetail.setPointsTime(new Date()); + userPointsDetail.setType(2); + userPointsDetailMapper.insert(userPointsDetail); + + + WxSubUserPointsDto wxSubUserPointsDto = new WxSubUserPointsDto() .setTenantId(wxSubUserPointsRequest.getTenantId()) .setUnionId(wxSubUserPointsRequest.getUnionId()) -- 2.27.0 From 487d75c9ee2060efb79b1a8d7dd6717498b059e1 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Mon, 26 Jun 2023 11:59:16 +0800 Subject: [PATCH 43/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9WestreamUser=E5=AE=9E?= =?UTF-8?q?=E4=BD=93=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/tuoheng/api/entity/domain/WestreamUser.java | 5 ----- .../java/com/tuoheng/api/service/impl/WxServiceImpl.java | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) 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 94b9c6c..23fa9da 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 @@ -105,9 +105,4 @@ public class WestreamUser extends BaseEntity implements Serializable { */ private Integer isTiktok; - /** - * unionid - */ - private String unionId; - } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java index d48ded0..487c671 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java @@ -78,7 +78,7 @@ public class WxServiceImpl implements IWxService { WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() .eq(WestreamUser::getTenantId, tenant.getId()) - .eq(WestreamUser::getUnionId, wxGetUserPointsQuery.getUnionId()) + .eq(WestreamUser::getUnionid, wxGetUserPointsQuery.getUnionId()) .eq(WestreamUser::getMark, 1)); if(ObjectUtil.isNotNull(westreamUser)){ WxGetUserPointsDto wxGetUserPointsDto = new WxGetUserPointsDto() @@ -105,7 +105,7 @@ public class WxServiceImpl implements IWxService { //查询用户 WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() .eq(WestreamUser::getTenantId, tenant.getId()) - .eq(WestreamUser::getUnionId, wxSubUserPointsRequest.getUnionId()) + .eq(WestreamUser::getUnionid, wxSubUserPointsRequest.getUnionId()) .eq(WestreamUser::getMark, 1)); if (westreamUser.getMallPoints() >= wxSubUserPointsRequest.getPoints()) { -- 2.27.0 From 82438540c1045f7e8fb1887dee3f8331ea681169 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Sat, 1 Jul 2023 12:44:53 +0800 Subject: [PATCH 44/80] =?UTF-8?q?unionid=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tuoheng/api/service/impl/WestreamUserServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) 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 7cc2dbd..554d4cd 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 @@ -62,6 +62,9 @@ public class WestreamUserServiceImpl extends BaseServiceImpl() .eq(WestreamUser::getMark, 1) .eq(WestreamUser::getTenantId, westreamUser.getTenantId()) @@ -82,6 +85,7 @@ public class WestreamUserServiceImpl extends BaseServiceImpl Date: Sat, 1 Jul 2023 13:12:04 +0800 Subject: [PATCH 45/80] =?UTF-8?q?=E7=A7=9F=E6=88=B7code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/tuoheng/api/service/impl/WxServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java index 487c671..5ca1eea 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java @@ -69,7 +69,7 @@ public class WxServiceImpl implements IWxService { @Override public JsonResult getUserPoints(WxGetUserPointsQuery wxGetUserPointsQuery){ Tenant tenant = tenantMapper.selectOne(new LambdaQueryWrapper() - .eq(Tenant::getCode, wxGetUserPointsQuery.getTenantCode()) + .eq(Tenant::getUsername, wxGetUserPointsQuery.getTenantCode()) .eq(Tenant::getMark, 1).last("limit 1")); if(ObjectUtil.isNull(tenant)){ return JsonResult.error("租户不存在"); @@ -96,7 +96,7 @@ public class WxServiceImpl implements IWxService { @Transactional public JsonResult subUserPoints(WxSubUserPointsRequest wxSubUserPointsRequest){ Tenant tenant = tenantMapper.selectOne(new LambdaQueryWrapper() - .eq(Tenant::getCode, wxSubUserPointsRequest.getTenantCode()) + .eq(Tenant::getUsername, wxSubUserPointsRequest.getTenantCode()) .eq(Tenant::getMark, 1).last("limit 1")); if(ObjectUtil.isNull(tenant)){ return JsonResult.error("租户不存在"); -- 2.27.0 From 464ebff7806f7ce9c7dffdbcfa33e57eb24fe19e Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Sat, 1 Jul 2023 13:15:34 +0800 Subject: [PATCH 46/80] =?UTF-8?q?=E7=A7=9F=E6=88=B7code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/tuoheng/api/service/impl/WxServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java index 5ca1eea..487c671 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java @@ -69,7 +69,7 @@ public class WxServiceImpl implements IWxService { @Override public JsonResult getUserPoints(WxGetUserPointsQuery wxGetUserPointsQuery){ Tenant tenant = tenantMapper.selectOne(new LambdaQueryWrapper() - .eq(Tenant::getUsername, wxGetUserPointsQuery.getTenantCode()) + .eq(Tenant::getCode, wxGetUserPointsQuery.getTenantCode()) .eq(Tenant::getMark, 1).last("limit 1")); if(ObjectUtil.isNull(tenant)){ return JsonResult.error("租户不存在"); @@ -96,7 +96,7 @@ public class WxServiceImpl implements IWxService { @Transactional public JsonResult subUserPoints(WxSubUserPointsRequest wxSubUserPointsRequest){ Tenant tenant = tenantMapper.selectOne(new LambdaQueryWrapper() - .eq(Tenant::getUsername, wxSubUserPointsRequest.getTenantCode()) + .eq(Tenant::getCode, wxSubUserPointsRequest.getTenantCode()) .eq(Tenant::getMark, 1).last("limit 1")); if(ObjectUtil.isNull(tenant)){ return JsonResult.error("租户不存在"); -- 2.27.0 From 42dca6ee8e985c478fd2a821baf02e4d3b1343e2 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Sat, 1 Jul 2023 13:47:04 +0800 Subject: [PATCH 47/80] =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=85=91=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/tuoheng/api/service/impl/WxServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java index 487c671..15d99f3 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java @@ -123,6 +123,7 @@ public class WxServiceImpl implements IWxService { userPointsDetail.setChangeName("积分兑换"); userPointsDetail.setPointsTime(new Date()); userPointsDetail.setType(2); + userPointsDetail.setCreateTime(new Date()); userPointsDetailMapper.insert(userPointsDetail); -- 2.27.0 From dfd67b20ff4c47a8b2c12b25deaa37c51f749e7c Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Sat, 1 Jul 2023 15:38:01 +0800 Subject: [PATCH 48/80] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tuoheng/api/service/impl/WestreamUserServiceImpl.java | 3 --- 1 file changed, 3 deletions(-) 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 554d4cd..b8c18fa 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 @@ -62,9 +62,6 @@ public class WestreamUserServiceImpl extends BaseServiceImpl() .eq(WestreamUser::getMark, 1) .eq(WestreamUser::getTenantId, westreamUser.getTenantId()) -- 2.27.0 From e08f31fe4deecbe5baa96acec8c0a58eb3144cd2 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Wed, 5 Jul 2023 13:16:58 +0800 Subject: [PATCH 49/80] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A7=AF=E5=88=86=20?= =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/controller/WxController.java | 10 +++++ .../com/tuoheng/api/service/IWxService.java | 1 + .../api/service/impl/WxServiceImpl.java | 42 +++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java index 4b508e2..1d3c656 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java @@ -56,4 +56,14 @@ public class WxController { return wxService.subUserPoints(wxSubUserPointsRequest); } + /** + * 增加用户积分 + * @param wxSubUserPointsRequest + * @return + */ + @PostMapping("/addUserPoints") + public JsonResult addUserPoints(@Validated @RequestBody WxSubUserPointsRequest wxSubUserPointsRequest) { + return wxService.addUserPoints(wxSubUserPointsRequest); + } + } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWxService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWxService.java index bacedc2..b05ddb2 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWxService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWxService.java @@ -13,4 +13,5 @@ public interface IWxService { JsonResult subUserPoints(WxSubUserPointsRequest wxSubUserPointsRequest); + JsonResult addUserPoints(WxSubUserPointsRequest wxSubUserPointsRequest); } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java index 15d99f3..9fb55e9 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java @@ -119,6 +119,7 @@ public class WxServiceImpl implements IWxService { UserPointsDetail userPointsDetail = new UserPointsDetail(); userPointsDetail.setTenantId(tenant.getId()); userPointsDetail.setOpenid(westreamUser.getOpenid()); + userPointsDetail.setNickname(westreamUser.getNickname()); userPointsDetail.setPointsChange(wxSubUserPointsRequest.getPoints()); userPointsDetail.setChangeName("积分兑换"); userPointsDetail.setPointsTime(new Date()); @@ -128,6 +129,47 @@ public class WxServiceImpl implements IWxService { + WxSubUserPointsDto wxSubUserPointsDto = new WxSubUserPointsDto() + .setTenantCode(wxSubUserPointsRequest.getTenantCode()) + .setUnionId(wxSubUserPointsRequest.getUnionId()) + .setPoints(wxSubUserPointsRequest.getPoints()) + .setOptResult(true); + return JsonResult.success(wxSubUserPointsDto); + } + + @Override + @Transactional + public JsonResult addUserPoints(WxSubUserPointsRequest wxSubUserPointsRequest) { + Tenant tenant = tenantMapper.selectOne(new LambdaQueryWrapper() + .eq(Tenant::getCode, wxSubUserPointsRequest.getTenantCode()) + .eq(Tenant::getMark, 1).last("limit 1")); + if(ObjectUtil.isNull(tenant)){ + return JsonResult.error("租户不存在"); + } + + //查询用户 + WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() + .eq(WestreamUser::getTenantId, tenant.getId()) + .eq(WestreamUser::getUnionid, wxSubUserPointsRequest.getUnionId()) + .eq(WestreamUser::getMark, 1)); + + westreamUser.setMallPoints(westreamUser.getMallPoints() + wxSubUserPointsRequest.getPoints()); + westreamUserMapper.updateById(westreamUser); + + //积分明细入库 + UserPointsDetail userPointsDetail = new UserPointsDetail(); + userPointsDetail.setTenantId(tenant.getId()); + userPointsDetail.setOpenid(westreamUser.getOpenid()); + userPointsDetail.setNickname(westreamUser.getNickname()); + userPointsDetail.setPointsChange(wxSubUserPointsRequest.getPoints()); + userPointsDetail.setChangeName("积分返还"); + userPointsDetail.setPointsTime(new Date()); + userPointsDetail.setType(1); + userPointsDetail.setCreateTime(new Date()); + userPointsDetailMapper.insert(userPointsDetail); + + + WxSubUserPointsDto wxSubUserPointsDto = new WxSubUserPointsDto() .setTenantCode(wxSubUserPointsRequest.getTenantCode()) .setUnionId(wxSubUserPointsRequest.getUnionId()) -- 2.27.0 From 5a0848070112032c40fce9fa9b1a112134ff620c Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Fri, 7 Jul 2023 10:14:31 +0800 Subject: [PATCH 50/80] =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=A0=B8=E9=94=80?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=95=86=E9=93=BA?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/entity/request/WxSubUserPointsRequest.java | 5 +++++ .../java/com/tuoheng/api/service/impl/WxServiceImpl.java | 2 ++ 2 files changed, 7 insertions(+) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxSubUserPointsRequest.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxSubUserPointsRequest.java index 6d0c786..72ac1f5 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxSubUserPointsRequest.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WxSubUserPointsRequest.java @@ -21,4 +21,9 @@ public class WxSubUserPointsRequest { @NotNull(message = "points can not be null") private Integer points; + /** + * 商铺名称 + */ + private String shopName; + } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java index 9fb55e9..f7ab82a 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WxServiceImpl.java @@ -121,6 +121,7 @@ public class WxServiceImpl implements IWxService { userPointsDetail.setOpenid(westreamUser.getOpenid()); userPointsDetail.setNickname(westreamUser.getNickname()); userPointsDetail.setPointsChange(wxSubUserPointsRequest.getPoints()); + userPointsDetail.setOperatorName(wxSubUserPointsRequest.getShopName()); userPointsDetail.setChangeName("积分兑换"); userPointsDetail.setPointsTime(new Date()); userPointsDetail.setType(2); @@ -162,6 +163,7 @@ public class WxServiceImpl implements IWxService { userPointsDetail.setOpenid(westreamUser.getOpenid()); userPointsDetail.setNickname(westreamUser.getNickname()); userPointsDetail.setPointsChange(wxSubUserPointsRequest.getPoints()); + userPointsDetail.setOperatorName(wxSubUserPointsRequest.getShopName()); userPointsDetail.setChangeName("积分返还"); userPointsDetail.setPointsTime(new Date()); userPointsDetail.setType(1); -- 2.27.0 From dde2f3b3391a384c37a9004569ac8fb0ce7da62d Mon Sep 17 00:00:00 2001 From: xiaoying Date: Tue, 11 Jul 2023 09:13:04 +0800 Subject: [PATCH 51/80] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=9F=A5=E8=AF=A2=E7=9B=B8=E5=85=B3=20?= =?UTF-8?q?=E5=8F=82=E5=8A=A0=E6=88=96=E6=8F=90=E4=BA=A4=E5=BB=BA=E8=AE=AE?= =?UTF-8?q?=E6=97=B6=E5=8F=91=E9=80=81=E7=9F=AD=E4=BF=A1=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/TextMessageController.java | 41 ++++++++++ .../controller/WestreamUserController.java | 16 +++- .../api/entity/request/DspSmsRequest.java | 20 +++++ .../request/TextMessageRuleRequest.java | 27 +++++++ .../com/tuoheng/api/enums/DictDateEnum.java | 25 ++++++ .../api/service/IWestreamUserService.java | 2 + .../api/service/TextMessageService.java | 14 ++++ .../service/impl/TextMessageServiceImpl.java | 77 +++++++++++++++++++ .../WestreamActivityApplyServiceImpl.java | 29 ++++++- .../impl/WestreamSuggestServiceImpl.java | 32 ++++++-- .../service/impl/WestreamUserServiceImpl.java | 54 +++++++++++++ 11 files changed, 327 insertions(+), 10 deletions(-) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/controller/TextMessageController.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/request/DspSmsRequest.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/request/TextMessageRuleRequest.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/enums/DictDateEnum.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/TextMessageService.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/impl/TextMessageServiceImpl.java diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/TextMessageController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/TextMessageController.java new file mode 100644 index 0000000..b89f9d8 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/TextMessageController.java @@ -0,0 +1,41 @@ +package com.tuoheng.api.controller; + +import com.tuoheng.api.entity.request.TextMessageRuleRequest; +import com.tuoheng.api.service.TextMessageService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Description 短信通知设置模块 + * @Author douzhenjun + * @DATE 2023/4/12 + **/ +@RestController +@RequestMapping("/textMessage") +@Slf4j +public class TextMessageController { + + @Autowired + private TextMessageService textMessageService; + + + /** + * @Description: 发送短信(测试) + * @Param: + * @return: + */ + @PostMapping("/sendMessage") + public Integer sendMessage(@RequestBody TextMessageRuleRequest textMessageRuleRequest) { + String phones = textMessageRuleRequest.getSendPhone(); + List phoneList = Arrays.stream(phones.split(",")).collect(Collectors.toList()); + return textMessageService.sendMessage(phoneList); + } +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamUserController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamUserController.java index 7252a2b..97994d1 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamUserController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamUserController.java @@ -39,7 +39,7 @@ public class WestreamUserController { * @return */ @PostMapping("/login") - public JsonResult login(@RequestBody WestreamUser westreamUser){ + public JsonResult login(@RequestBody WestreamUser westreamUser) { return westreamUserService.login(westreamUser); } @@ -50,7 +50,7 @@ public class WestreamUserController { * @return */ @GetMapping("/userInfo") - public JsonResult userInfo(WestreamUserQuery westreamUserQuery){ + public JsonResult userInfo(WestreamUserQuery westreamUserQuery) { return westreamUserService.userInfo(westreamUserQuery); } @@ -61,8 +61,18 @@ public class WestreamUserController { * @return */ @PutMapping("/editInfo") - public JsonResult editInfo(@RequestBody WestreamUser westreamUser){ + public JsonResult editInfo(@RequestBody WestreamUser westreamUser) { return westreamUserService.editInfo(westreamUser); } + /** + * 获取对应活动及其设置的积分 + * @return + */ + @GetMapping("getIntegralInfo") + public JsonResult getIntegralInfo(WestreamUserQuery westreamUserQuery) { + return westreamUserService.getIntegralInfo(westreamUserQuery); + } + + } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/DspSmsRequest.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/DspSmsRequest.java new file mode 100644 index 0000000..f9a61ee --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/DspSmsRequest.java @@ -0,0 +1,20 @@ +package com.tuoheng.api.entity.request; + +import lombok.Data; + +/** + * @Description + * @Author douzhenjun + * @DATE 2023/4/12 + **/ +@Data +public class DspSmsRequest { + private String phoneNumbers; + + private String templateCode; + + private String signName; + + // private final Map templateParam = new HashMap<>(); + private String templateParam; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/TextMessageRuleRequest.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/TextMessageRuleRequest.java new file mode 100644 index 0000000..fef10d6 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/TextMessageRuleRequest.java @@ -0,0 +1,27 @@ +package com.tuoheng.api.entity.request; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @Description + * @Author douzhenjun + * @DATE 2023/4/12 + **/ +@Data +public class TextMessageRuleRequest { + //发送超时时间 + @NotNull(message = "发送配置不能为空") + private Integer sendRule; + //发送起始时间 + @NotBlank(message = "发送起始时间不能为空") + private String startTime; + //发送频率, 以时为单位 + @NotNull(message = "发送频率不能为空") + private Integer sendRate; + //发送手机号,每个手机号有11个数字,超过一个用逗号拼接 + @NotBlank(message = "发送手机号不能为空") + private String sendPhone; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/enums/DictDateEnum.java b/tuoheng-api/src/main/java/com/tuoheng/api/enums/DictDateEnum.java new file mode 100644 index 0000000..86e1b2d --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/enums/DictDateEnum.java @@ -0,0 +1,25 @@ +package com.tuoheng.api.enums; + +import lombok.Getter; + +/** + * @Author xiaoying + * @Date 2023/7/10 9:27 + */ +public enum DictDateEnum { + + VOLUNTEER_ACTIVITY("volunteer_activity", "志愿者活动"), + TIKTOK("tiktok", "关注抖音"), + VIDEO("video", "学习视频"); + + DictDateEnum(String code, String description) { + this.code = code; + this.description = description; + } + + @Getter + private String code; + + @Getter + private String description; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamUserService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamUserService.java index 2ece080..bb7d0aa 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamUserService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamUserService.java @@ -14,4 +14,6 @@ public interface IWestreamUserService extends IBaseService { JsonResult userInfo(WestreamUserQuery westreamUserQuery); JsonResult editInfo(WestreamUser westreamUser); + + JsonResult getIntegralInfo(WestreamUserQuery westreamUserQuery); } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/TextMessageService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/TextMessageService.java new file mode 100644 index 0000000..d0c4d4b --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/TextMessageService.java @@ -0,0 +1,14 @@ +package com.tuoheng.api.service; + +import java.util.List; + +/** + * @Description + * @Author douzhenjun + * @DATE 2023/4/23 + **/ +public interface TextMessageService { + + //发送短信 + Integer sendMessage(List phoneList); +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/TextMessageServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/TextMessageServiceImpl.java new file mode 100644 index 0000000..b5ab02f --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/TextMessageServiceImpl.java @@ -0,0 +1,77 @@ +package com.tuoheng.api.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.tuoheng.api.entity.request.DspSmsRequest; +import com.tuoheng.api.service.TextMessageService; +import com.tuoheng.common.utils.JsonResult; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +import java.util.List; + +/** + * @Description + * @Author douzhenjun + * @DATE 2023/4/23 + **/ +@Slf4j +@Service +public class TextMessageServiceImpl implements TextMessageService { + + @Autowired + @Qualifier("restTemplate") + private RestTemplate restTemplate; + + @Value("${tuoheng.dsp-domain-url}") + private String dspUrl; + + //向dsp短信通知平台发送的请求体对象 + private static DspSmsRequest request; + + //初始化短信通知请求中的固定模板 + static { + request = new DspSmsRequest(); + request.setSignName("智慧河湖"); + //todo 变更 + request.setTemplateCode("SMS_276426880"); + } + + /** + * @Description: 发送问题通知短信 + * @Param: + * @return: 发送成功的条数 + */ + @Override + public Integer sendMessage(List phoneList) { + Integer success = 0; + for (String phone : phoneList) { + //判断是否符合格式,如不符合直接报错 + if (!phone.matches("^[1][3,4,5,7,8][0-9]{9}$")) { + log.error("不存在的电话号码!"); + continue; + } + request.setPhoneNumbers(phone); + //占位符数据以key-value存放于map集合,再以string类型存入 + JSONObject templateParam = new JSONObject(); + request.setTemplateParam(templateParam.toJSONString()); + + //发送http请求 + HttpEntity httpEntity = new HttpEntity<>(request); + String dspSmsUrl = dspUrl + "api/web/sms/sendSyncSms"; + ResponseEntity response = restTemplate.exchange(dspSmsUrl, HttpMethod.POST, httpEntity, JsonResult.class); + if (response == null || !response.hasBody() || response.getBody().getCode() != JsonResult.SUCCESS) { + log.error("短信向手机号: {} 发送失败", phone); + continue; + } + success++; + } + return success; + } +} 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 index 80dec7e..15ff0e5 100644 --- 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 @@ -1,21 +1,37 @@ package com.tuoheng.api.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.tuoheng.api.entity.domain.Tenant; +import com.tuoheng.api.entity.domain.User; import com.tuoheng.api.entity.domain.WestreamActivityApply; import com.tuoheng.api.entity.request.WestreamActivityQuery; +import com.tuoheng.api.mapper.TenantMapper; +import com.tuoheng.api.mapper.UserMapper; import com.tuoheng.api.mapper.WestreamActivityApplyMapper; import com.tuoheng.api.service.IWestreamActivityApplyService; +import com.tuoheng.api.service.TextMessageService; 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; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + @Service public class WestreamActivityApplyServiceImpl extends BaseServiceImpl implements IWestreamActivityApplyService { @Autowired private WestreamActivityApplyMapper westreamActivityApplyMapper; + @Autowired + private TenantMapper tenantMapper; + @Autowired + private UserMapper userMapper; + @Autowired + private TextMessageService textMessageService; @Override public JsonResult submit(WestreamActivityApply entity) { @@ -31,13 +47,22 @@ public class WestreamActivityApplyServiceImpl extends BaseServiceImpl 0){ + if (count > 0) { return JsonResult.error("您已参加该活动!"); } super.add(entity); + //向对应的审批人发送短信,获取手机号 + Tenant tenant = tenantMapper.selectById(entity.getTenantId()); + User user = userMapper.selectOne(Wrappers.lambdaQuery().eq(User::getUsername, tenant.getUsername()).eq(User::getMark, 1)); + String mobile = user.getMobile(); + if (StringUtils.isNotEmpty(mobile)) { + List list = Arrays.stream(mobile.split(",")).collect(Collectors.toList()); + //发送短信 + textMessageService.sendMessage(list); + } return JsonResult.success(); } 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 index 46d60c6..0eada28 100644 --- 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 @@ -1,19 +1,25 @@ 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.Tenant; +import com.tuoheng.api.entity.domain.User; import com.tuoheng.api.entity.domain.WestreamSuggest; -import com.tuoheng.api.entity.domain.WestreamUser; +import com.tuoheng.api.mapper.TenantMapper; +import com.tuoheng.api.mapper.UserMapper; import com.tuoheng.api.mapper.WestreamSuggestMapper; import com.tuoheng.api.service.IWestreamSuggestService; -import com.tuoheng.common.common.BaseEntity; +import com.tuoheng.api.service.TextMessageService; 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.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + /** * 全民护河保护河建议表 服务实现类 * @@ -25,6 +31,14 @@ import org.springframework.stereotype.Service; public class WestreamSuggestServiceImpl extends BaseServiceImpl implements IWestreamSuggestService { + @Autowired + private TenantMapper tenantMapper; + @Autowired + private UserMapper userMapper; + @Autowired + private TextMessageService textMessageService; + + /** * 提交护河建议 * @@ -40,7 +54,15 @@ public class WestreamSuggestServiceImpl extends BaseServiceImpllambdaQuery().eq(User::getUsername, tenant.getUsername()).eq(User::getMark, 1)); + String mobile = user.getMobile(); + if (StringUtils.isNotEmpty(mobile)) { + List list = Arrays.stream(mobile.split(",")).collect(Collectors.toList()); + //发送短信 + textMessageService.sendMessage(list); + } 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 b8c18fa..ce2b4e3 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 @@ -3,10 +3,12 @@ package com.tuoheng.api.service.impl; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.enums.DictDateEnum; import com.tuoheng.api.mapper.*; import com.tuoheng.api.service.IWestreamUserService; import com.tuoheng.api.utils.PointsTitleConstants; @@ -19,8 +21,11 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.Date; +import java.util.List; import java.util.Random; +import java.util.stream.Collectors; /** @@ -157,4 +162,53 @@ public class WestreamUserServiceImpl extends BaseServiceImpl thDictData = new ArrayList<>(); + + //获取对应租户的积分规则字典表单 + ThDict thDict = dictMapper.selectOne(new LambdaQueryWrapper() + .eq(ThDict::getTenantId, westreamUserQuery.getTenantId()) + .eq(ThDict::getCode, DictConstants.POINTS_RULE_CODE) + .eq(ThDict::getMark, 1)); + if (StringUtils.isNull(thDict)) { + ThDictData param1 = new ThDictData(); + ThDictData param2 = new ThDictData(); + ThDictData param3 = new ThDictData(); + param1.setName(DictDateEnum.TIKTOK.getDescription()); + param2.setName(DictDateEnum.VIDEO.getDescription()); + param3.setName(DictDateEnum.VOLUNTEER_ACTIVITY.getDescription()); + thDictData.add(param1); + thDictData.add(param2); + thDictData.add(param3); + return JsonResult.success(thDictData); + } + //对应每一条积分及其明细 + thDictData = dictDataMapper.selectList(Wrappers.lambdaQuery() + .eq(ThDictData::getTenantId, westreamUserQuery.getTenantId()) + .eq(ThDictData::getDictId, thDict.getId()) + .eq(ThDictData::getMark, 1)); + for (ThDictData thDictDatum : thDictData) { + if (DictDateEnum.TIKTOK.getCode().equals(thDictDatum.getName())) { + thDictDatum.setNote(DictDateEnum.TIKTOK.getDescription()); + } + if (DictDateEnum.VIDEO.getCode().equals(thDictDatum.getName())) { + thDictDatum.setNote(DictDateEnum.VIDEO.getDescription()); + } + if (DictDateEnum.VOLUNTEER_ACTIVITY.getCode().equals(thDictDatum.getName())) { + thDictDatum.setNote(DictDateEnum.VOLUNTEER_ACTIVITY.getDescription()); + } + } + thDictData = thDictData.stream().filter(t -> StringUtils.isNotEmpty(t.getNote())).collect(Collectors.toList()); + return JsonResult.success(thDictData); + } } -- 2.27.0 From e80bf32dc3462e6c07ea247ce4d3a0b52e19f226 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Tue, 11 Jul 2023 14:47:57 +0800 Subject: [PATCH 52/80] =?UTF-8?q?=E6=88=91=E7=9A=84=E5=85=91=E6=8D=A2?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/service/impl/UserPointsDetailServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) 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 a3bfd00..b89be2c 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 @@ -69,6 +69,8 @@ public class UserPointsDetailServiceImpl extends BaseServiceImpl Date: Tue, 11 Jul 2023 14:54:06 +0800 Subject: [PATCH 53/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=88=91=E7=9A=84?= =?UTF-8?q?=E5=85=91=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/impl/UserPointsDetailServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 b89be2c..fd387ba 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 @@ -57,6 +57,9 @@ public class UserPointsDetailServiceImpl extends BaseServiceImpl() @@ -69,8 +72,6 @@ public class UserPointsDetailServiceImpl extends BaseServiceImpl Date: Wed, 12 Jul 2023 18:15:58 +0800 Subject: [PATCH 54/80] =?UTF-8?q?=E6=89=93log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/tuoheng/api/controller/WxController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java index 1d3c656..1a1b478 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WxController.java @@ -1,9 +1,12 @@ package com.tuoheng.api.controller; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.tuoheng.api.entity.request.WxGetUserPointsQuery; import com.tuoheng.api.entity.request.WxSubUserPointsRequest; import com.tuoheng.api.service.IWxService; import com.tuoheng.common.utils.JsonResult; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -14,6 +17,7 @@ import org.springframework.web.bind.annotation.*; * @author WangHaoran * @since 2022-09-06 */ +@Slf4j @RestController @RequestMapping("/wx") public class WxController { @@ -53,6 +57,7 @@ public class WxController { */ @PostMapping("/subUserPoints") public JsonResult subUserPoints(@Validated @RequestBody WxSubUserPointsRequest wxSubUserPointsRequest) { + log.info("消减用户积分接口入参:" + JSON.toJSONString(wxSubUserPointsRequest)); return wxService.subUserPoints(wxSubUserPointsRequest); } @@ -63,6 +68,7 @@ public class WxController { */ @PostMapping("/addUserPoints") public JsonResult addUserPoints(@Validated @RequestBody WxSubUserPointsRequest wxSubUserPointsRequest) { + log.info("增加用户积分接口入参:" + JSON.toJSONString(wxSubUserPointsRequest)); return wxService.addUserPoints(wxSubUserPointsRequest); } -- 2.27.0 From ad5e197f9cf7c70f9755ae0d6981fe645605d0a2 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Wed, 12 Jul 2023 18:24:25 +0800 Subject: [PATCH 55/80] =?UTF-8?q?=E6=9A=82=E6=97=B6=20=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E6=8E=89=EF=BC=8C=E5=8F=91=E9=80=81=E7=9F=AD=E4=BF=A1=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WestreamActivityApplyServiceImpl.java | 16 ++++++++-------- .../service/impl/WestreamSuggestServiceImpl.java | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) 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 index 15ff0e5..7cc4e6b 100644 --- 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 @@ -55,14 +55,14 @@ public class WestreamActivityApplyServiceImpl extends BaseServiceImpllambdaQuery().eq(User::getUsername, tenant.getUsername()).eq(User::getMark, 1)); - String mobile = user.getMobile(); - if (StringUtils.isNotEmpty(mobile)) { - List list = Arrays.stream(mobile.split(",")).collect(Collectors.toList()); - //发送短信 - textMessageService.sendMessage(list); - } +// Tenant tenant = tenantMapper.selectById(entity.getTenantId()); +// User user = userMapper.selectOne(Wrappers.lambdaQuery().eq(User::getUsername, tenant.getUsername()).eq(User::getMark, 1)); +// String mobile = user.getMobile(); +// if (StringUtils.isNotEmpty(mobile)) { +// List list = Arrays.stream(mobile.split(",")).collect(Collectors.toList()); +// //发送短信 +// textMessageService.sendMessage(list); +// } return JsonResult.success(); } 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 index 0eada28..4580365 100644 --- 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 @@ -55,14 +55,14 @@ public class WestreamSuggestServiceImpl extends BaseServiceImpllambdaQuery().eq(User::getUsername, tenant.getUsername()).eq(User::getMark, 1)); - String mobile = user.getMobile(); - if (StringUtils.isNotEmpty(mobile)) { - List list = Arrays.stream(mobile.split(",")).collect(Collectors.toList()); - //发送短信 - textMessageService.sendMessage(list); - } +// Tenant tenant = tenantMapper.selectById(entity.getTenantId()); +// User user = userMapper.selectOne(Wrappers.lambdaQuery().eq(User::getUsername, tenant.getUsername()).eq(User::getMark, 1)); +// String mobile = user.getMobile(); +// if (StringUtils.isNotEmpty(mobile)) { +// List list = Arrays.stream(mobile.split(",")).collect(Collectors.toList()); +// //发送短信 +// textMessageService.sendMessage(list); +// } return super.add(entity); } -- 2.27.0 From 3e692eebd7e2013dedf23e15e646c3337f2280f1 Mon Sep 17 00:00:00 2001 From: xiaoying Date: Thu, 13 Jul 2023 08:59:35 +0800 Subject: [PATCH 56/80] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WestreamActivityApplyServiceImpl.java | 42 ++++++++++++------- .../impl/WestreamSuggestServiceImpl.java | 40 +++++++++++------- 2 files changed, 51 insertions(+), 31 deletions(-) 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 index 15ff0e5..e473d8a 100644 --- 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 @@ -1,19 +1,18 @@ package com.tuoheng.api.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.tuoheng.api.entity.domain.Tenant; -import com.tuoheng.api.entity.domain.User; -import com.tuoheng.api.entity.domain.WestreamActivityApply; +import com.tuoheng.api.constants.DictConstants; +import com.tuoheng.api.entity.domain.*; import com.tuoheng.api.entity.request.WestreamActivityQuery; -import com.tuoheng.api.mapper.TenantMapper; -import com.tuoheng.api.mapper.UserMapper; -import com.tuoheng.api.mapper.WestreamActivityApplyMapper; +import com.tuoheng.api.mapper.*; import com.tuoheng.api.service.IWestreamActivityApplyService; import com.tuoheng.api.service.TextMessageService; 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.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -22,14 +21,15 @@ import java.util.List; import java.util.stream.Collectors; @Service +@Slf4j public class WestreamActivityApplyServiceImpl extends BaseServiceImpl implements IWestreamActivityApplyService { @Autowired private WestreamActivityApplyMapper westreamActivityApplyMapper; @Autowired - private TenantMapper tenantMapper; + private ThDictMapper thDictMapper; @Autowired - private UserMapper userMapper; + private ThDictDataMapper thDictDataMapper; @Autowired private TextMessageService textMessageService; @@ -55,15 +55,25 @@ public class WestreamActivityApplyServiceImpl extends BaseServiceImpllambdaQuery().eq(User::getUsername, tenant.getUsername()).eq(User::getMark, 1)); - String mobile = user.getMobile(); - if (StringUtils.isNotEmpty(mobile)) { - List list = Arrays.stream(mobile.split(",")).collect(Collectors.toList()); - //发送短信 - textMessageService.sendMessage(list); + ThDict thDict = thDictMapper.selectOne(new LambdaQueryWrapper() + .eq(ThDict::getTenantId, entity.getTenantId()) + .eq(ThDict::getMark, 1) + .eq(ThDict::getCode, DictConstants.MSG_RULE_CODE)); + if (ObjectUtils.isNotNull(thDict)) { + Integer dictId = thDict.getId(); + ThDictData phoneData = thDictDataMapper.selectOne(new LambdaQueryWrapper() + .eq(ThDictData::getMark, 1) + .eq(ThDictData::getDictId, dictId) + .eq(ThDictData::getName, DictConstants.MSG_RULE_PHONE)); + if (ObjectUtils.isNotNull(phoneData)) { + String phones = phoneData.getValue(); + List list = Arrays.stream(phones.split(",")).collect(Collectors.toList()); + Integer success = textMessageService.sendMessage(list); + if (success.equals(list.size())) { + log.info("短信全部发送成功!"); + } + } } - return JsonResult.success(); } 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 index 0eada28..e771ac5 100644 --- 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 @@ -1,12 +1,11 @@ package com.tuoheng.api.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.tuoheng.api.entity.domain.Tenant; -import com.tuoheng.api.entity.domain.User; -import com.tuoheng.api.entity.domain.WestreamSuggest; -import com.tuoheng.api.mapper.TenantMapper; -import com.tuoheng.api.mapper.UserMapper; -import com.tuoheng.api.mapper.WestreamSuggestMapper; +import com.tuoheng.api.constants.DictConstants; +import com.tuoheng.api.entity.domain.*; +import com.tuoheng.api.mapper.*; import com.tuoheng.api.service.IWestreamSuggestService; import com.tuoheng.api.service.TextMessageService; import com.tuoheng.common.common.BaseServiceImpl; @@ -32,9 +31,9 @@ public class WestreamSuggestServiceImpl extends BaseServiceImpllambdaQuery().eq(User::getUsername, tenant.getUsername()).eq(User::getMark, 1)); - String mobile = user.getMobile(); - if (StringUtils.isNotEmpty(mobile)) { - List list = Arrays.stream(mobile.split(",")).collect(Collectors.toList()); - //发送短信 - textMessageService.sendMessage(list); + ThDict thDict = thDictMapper.selectOne(new LambdaQueryWrapper() + .eq(ThDict::getTenantId, entity.getTenantId()) + .eq(ThDict::getMark, 1) + .eq(ThDict::getCode, DictConstants.MSG_RULE_CODE)); + if (ObjectUtils.isNotNull(thDict)) { + Integer dictId = thDict.getId(); + ThDictData phoneData = thDictDataMapper.selectOne(new LambdaQueryWrapper() + .eq(ThDictData::getMark, 1) + .eq(ThDictData::getDictId, dictId) + .eq(ThDictData::getName, DictConstants.MSG_RULE_PHONE)); + if (ObjectUtils.isNotNull(phoneData)) { + String phones = phoneData.getValue(); + List list = Arrays.stream(phones.split(",")).collect(Collectors.toList()); + Integer success = textMessageService.sendMessage(list); + if (success.equals(list.size())) { + log.info("短信全部发送成功!"); + } + } } return super.add(entity); } -- 2.27.0 From 3be8d10e4983fe3c61abf23a5e5ebab0915b7134 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Wed, 2 Aug 2023 17:18:12 +0800 Subject: [PATCH 57/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BE=8E=E6=99=AF?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WestreamSceneryServiceImpl.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamSceneryServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamSceneryServiceImpl.java index 098c46e..a8b3cf6 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamSceneryServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamSceneryServiceImpl.java @@ -94,21 +94,16 @@ public class WestreamSceneryServiceImpl extends BaseServiceImpl() - .eq(ThDict::getTenantId, stream.getTenantId()) + .eq(ThDict::getTenantId, westreamScenery.getTenantId()) .eq(ThDict::getCode, DictConstants.MSG_RULE_CODE) .eq(ThDict::getMark, 1)); if(ObjectUtils.isNotNull(thDict)){ -- 2.27.0 From 180e889b1654092b73d7182ea8c298bb9b47d6bd Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Thu, 9 Nov 2023 14:35:30 +0800 Subject: [PATCH 58/80] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/GoodsController.java | 36 +++++++++ .../com/tuoheng/api/entity/domain/Goods.java | 75 +++++++++++++++++++ .../api/entity/request/GoodsQuery.java | 28 +++++++ .../com/tuoheng/api/mapper/GoodsMapper.java | 13 ++++ .../tuoheng/api/service/IGoodsService.java | 12 +++ .../api/service/impl/GoodsServiceImpl.java | 57 ++++++++++++++ 6 files changed, 221 insertions(+) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Goods.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/request/GoodsQuery.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/mapper/GoodsMapper.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/IGoodsService.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java new file mode 100644 index 0000000..0d460cf --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java @@ -0,0 +1,36 @@ +package com.tuoheng.api.controller; + +import com.tuoheng.api.entity.request.GoodsQuery; +import com.tuoheng.api.service.IGoodsService; +import com.tuoheng.common.utils.JsonResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** + * 商品表 前端控制器 + * + * @author WangHaoran + * @since 2023-11-03 + */ +@RestController +@RequestMapping("/goods") +public class GoodsController { + + @Autowired + IGoodsService goodsService; + + /** + * 获取商品列表(分页) + * + * @param goodsQuery 查询条件 + * @return + */ + @GetMapping("/index") + public JsonResult index(GoodsQuery goodsQuery) { + return goodsService.queryPage(goodsQuery); + } + + + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Goods.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Goods.java new file mode 100644 index 0000000..bb7e538 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Goods.java @@ -0,0 +1,75 @@ +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.experimental.Accessors; + +import java.io.Serializable; + +/** + * 商品表 + * + * @author WangHaoran + * @since 2023-11-06 + */ +@Data +@Accessors(chain = true) +@TableName("th_goods") +public class Goods extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 租户ID + */ + private Integer tenantId; + + /** + * 商户ID + */ + private Integer merchantId; + + /** + * 商品名称 + */ + private String goodsName; + + /** + * 商品图片 + */ + private String goodsImage; + + /** + * 商品类型id + */ + private Integer goodsTypeId; + + /** + * 商品类型名称 + */ + @TableField(exist = false) + private String goodsTypeName; + + /** + * 商品规格 + */ + private String goodsSpec; + + /** + * 商品积分 + */ + private Integer goodsPoints; + + /** + * 商品详情图片 + */ + private String goodsDetailImage; + + /** + * 商品状态:0下架 1正常 + */ + private Integer status; + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/GoodsQuery.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/GoodsQuery.java new file mode 100644 index 0000000..f317612 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/GoodsQuery.java @@ -0,0 +1,28 @@ +package com.tuoheng.api.entity.request; + +import com.tuoheng.common.common.BaseQuery; +import lombok.Data; + +@Data +public class GoodsQuery extends BaseQuery { + + /** + * 商品名称 + */ + private String goodsName; + + /** + * 商品类型id + */ + private Integer goodsTypeId; + + /** + * 租户ID + */ + private Integer tenantId; + + /** + * 用户openid + */ + private String openid; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/GoodsMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/GoodsMapper.java new file mode 100644 index 0000000..7143241 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/GoodsMapper.java @@ -0,0 +1,13 @@ +package com.tuoheng.api.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.tuoheng.api.entity.domain.Goods; + +/** + * 商品表 + * + * @author WangHaoran + * @since 2023-11-07 + */ +public interface GoodsMapper extends BaseMapper { +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/IGoodsService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IGoodsService.java new file mode 100644 index 0000000..942c226 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IGoodsService.java @@ -0,0 +1,12 @@ +package com.tuoheng.api.service; + + +import com.tuoheng.api.entity.domain.Goods; +import com.tuoheng.api.entity.request.GoodsQuery; +import com.tuoheng.common.common.IBaseService; +import com.tuoheng.common.utils.JsonResult; + +public interface IGoodsService extends IBaseService { + JsonResult queryPage(GoodsQuery goodsQuery); + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java new file mode 100644 index 0000000..4294fb9 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java @@ -0,0 +1,57 @@ +package com.tuoheng.api.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.tuoheng.api.entity.domain.Goods; +import com.tuoheng.api.entity.request.GoodsQuery; +import com.tuoheng.api.mapper.GoodsMapper; +import com.tuoheng.api.service.IGoodsService; +import com.tuoheng.common.common.BaseServiceImpl; +import com.tuoheng.common.exception.ServiceException; +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.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +public class GoodsServiceImpl extends BaseServiceImpl implements IGoodsService { + + @Autowired + private GoodsMapper goodsMapper; + + + @Override + public JsonResult queryPage(GoodsQuery goodsQuery) { + if (null == goodsQuery.getPage() || null == goodsQuery.getLimit()) { + return JsonResult.error("参数为空!"); + } + if(null == goodsQuery.getTenantId()){ + return JsonResult.error("租户ID为空!"); + } + // 获取分页数据 + IPage page = new Page<>(goodsQuery.getPage(), goodsQuery.getLimit()); + IPage pageData = goodsMapper.selectPage(page, new LambdaQueryWrapper() + .eq(Goods::getMark, 1) + .eq(Goods::getStatus, 1) + .eq(Goods::getTenantId, goodsQuery.getTenantId()) + .like(StringUtils.isNotEmpty(goodsQuery.getGoodsName()), Goods::getGoodsName, goodsQuery.getGoodsName()) + .orderByDesc(Goods::getCreateTime)); + + for (Goods record : pageData.getRecords()) { + if(StringUtils.isNotEmpty(record.getGoodsImage())){ + record.setGoodsImage(CommonUtils.getMultipleUrl(record.getGoodsImage())); + } + if(StringUtils.isNotEmpty(record.getGoodsDetailImage())){ + record.setGoodsDetailImage(CommonUtils.getMultipleUrl(record.getGoodsDetailImage())); + } + } + + return JsonResult.success(pageData); + } + +} -- 2.27.0 From 093b957ad096399e3f59f14388ccd089f37be155 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Thu, 9 Nov 2023 15:42:08 +0800 Subject: [PATCH 59/80] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=95=86=E9=93=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/GoodsController.java | 12 ++++++++-- .../com/tuoheng/api/entity/domain/Goods.java | 7 ++++++ .../api/entity/request/GoodsQuery.java | 5 ++++ .../tuoheng/api/service/IGoodsService.java | 1 + .../api/service/impl/GoodsServiceImpl.java | 23 ++++++++++++++++++- 5 files changed, 45 insertions(+), 3 deletions(-) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java index 0d460cf..a9bb1d4 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java @@ -31,6 +31,14 @@ public class GoodsController { return goodsService.queryPage(goodsQuery); } - - + /** + * 获取商铺信息 + * + * @param goodsQuery 查询条件 + * @return + */ + @GetMapping("/merchantInfo") + public JsonResult merchantInfo(GoodsQuery goodsQuery) { + return goodsService.merchantInfo(goodsQuery); + } } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Goods.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Goods.java index bb7e538..7f2cf5c 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Goods.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Goods.java @@ -72,4 +72,11 @@ public class Goods extends BaseEntity implements Serializable { */ private Integer status; + /** + * 商铺信息 + */ + @TableField(exist = false) + private Merchant merchant; + + } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/GoodsQuery.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/GoodsQuery.java index f317612..9ac6fb4 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/GoodsQuery.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/GoodsQuery.java @@ -6,6 +6,11 @@ import lombok.Data; @Data public class GoodsQuery extends BaseQuery { + /** + * 商户ID + */ + private Integer merchantId; + /** * 商品名称 */ diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/IGoodsService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IGoodsService.java index 942c226..12d08e3 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/IGoodsService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IGoodsService.java @@ -9,4 +9,5 @@ import com.tuoheng.common.utils.JsonResult; public interface IGoodsService extends IBaseService { JsonResult queryPage(GoodsQuery goodsQuery); + JsonResult merchantInfo(GoodsQuery goodsQuery); } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java index 4294fb9..a43131e 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java @@ -5,11 +5,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.tuoheng.api.entity.domain.Goods; +import com.tuoheng.api.entity.domain.Merchant; import com.tuoheng.api.entity.request.GoodsQuery; import com.tuoheng.api.mapper.GoodsMapper; +import com.tuoheng.api.mapper.MerchantMapper; import com.tuoheng.api.service.IGoodsService; import com.tuoheng.common.common.BaseServiceImpl; -import com.tuoheng.common.exception.ServiceException; import com.tuoheng.common.utils.CommonUtils; import com.tuoheng.common.utils.JsonResult; import com.tuoheng.common.utils.StringUtils; @@ -24,6 +25,10 @@ public class GoodsServiceImpl extends BaseServiceImpl implem @Autowired private GoodsMapper goodsMapper; + @Autowired + private MerchantMapper merchantMapper; + + @Override public JsonResult queryPage(GoodsQuery goodsQuery) { @@ -54,4 +59,20 @@ public class GoodsServiceImpl extends BaseServiceImpl implem return JsonResult.success(pageData); } + @Override + public JsonResult merchantInfo(GoodsQuery goodsQuery) { + if(null == goodsQuery.getMerchantId()){ + return JsonResult.error("商户ID为空!"); + } + + Merchant merchant = merchantMapper.selectById(goodsQuery.getMerchantId()); + if(ObjectUtil.isNull(merchant)){ + return JsonResult.error("商户信息为空!"); + } + if(StringUtils.isNotEmpty(merchant.getShopsImage())){ + merchant.setShopsImage(CommonUtils.getImageURL(merchant.getShopsImage())); + } + return JsonResult.success(merchant); + } + } -- 2.27.0 From e3c37c616ae1f534280ba45d09c30a5feb099146 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Mon, 13 Nov 2023 14:18:50 +0800 Subject: [PATCH 60/80] =?UTF-8?q?=E6=88=91=E7=9A=84=E5=85=91=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/GoodsController.java | 17 ++++++ .../api/entity/domain/UserPointsDetail.java | 15 ++---- .../api/entity/request/ExchangeRequest.java | 24 +++++++++ .../tuoheng/api/service/IGoodsService.java | 3 ++ .../api/service/impl/GoodsServiceImpl.java | 54 +++++++++++++++++++ .../impl/UserPointsDetailServiceImpl.java | 8 +-- 6 files changed, 104 insertions(+), 17 deletions(-) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ExchangeRequest.java diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java index a9bb1d4..c469a5e 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java @@ -1,5 +1,7 @@ package com.tuoheng.api.controller; +import com.tuoheng.api.entity.domain.IdentityApply; +import com.tuoheng.api.entity.request.ExchangeRequest; import com.tuoheng.api.entity.request.GoodsQuery; import com.tuoheng.api.service.IGoodsService; import com.tuoheng.common.utils.JsonResult; @@ -41,4 +43,19 @@ public class GoodsController { public JsonResult merchantInfo(GoodsQuery goodsQuery) { return goodsService.merchantInfo(goodsQuery); } + + + + /** + * 立即兑换 + * + * @param exchangeRequest + * @return + */ + @PostMapping("/exchange") + public JsonResult submit(@RequestBody ExchangeRequest exchangeRequest){ + return goodsService.exchange(exchangeRequest); + } + + } 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 c103338..40e3bc8 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 @@ -68,20 +68,13 @@ public class UserPointsDetail extends BaseEntity implements Serializable { private String changeName; /** - * 商铺名称 + * 核销标识,0待核销,1已核销 */ - @TableField(exist = false) - private String shopsName; - - /** - * 商铺图片 - */ - @TableField(exist = false) - private String shopsImage; + private Integer exchangeFlag; /** - * 区域名称 + * 商铺信息 */ @TableField(exist = false) - private String areaName; + private Merchant merchant; } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ExchangeRequest.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ExchangeRequest.java new file mode 100644 index 0000000..2a64dfe --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ExchangeRequest.java @@ -0,0 +1,24 @@ +package com.tuoheng.api.entity.request; + +import lombok.Data; + +@Data +public class ExchangeRequest { + + private String openid; + + /** + * 租户ID + */ + private Integer tenantId; + + /** + * 商品id + */ + private Integer goodsId; + + /** + * 商品id + */ + private Integer goodsCount; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/IGoodsService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/IGoodsService.java index 12d08e3..8fada98 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/IGoodsService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/IGoodsService.java @@ -2,6 +2,7 @@ package com.tuoheng.api.service; import com.tuoheng.api.entity.domain.Goods; +import com.tuoheng.api.entity.request.ExchangeRequest; import com.tuoheng.api.entity.request.GoodsQuery; import com.tuoheng.common.common.IBaseService; import com.tuoheng.common.utils.JsonResult; @@ -10,4 +11,6 @@ public interface IGoodsService extends IBaseService { JsonResult queryPage(GoodsQuery goodsQuery); JsonResult merchantInfo(GoodsQuery goodsQuery); + + JsonResult exchange(ExchangeRequest exchangeRequest); } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java index a43131e..3d37096 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java @@ -6,15 +6,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.tuoheng.api.entity.domain.Goods; import com.tuoheng.api.entity.domain.Merchant; +import com.tuoheng.api.entity.domain.UserPointsDetail; +import com.tuoheng.api.entity.domain.WestreamUser; +import com.tuoheng.api.entity.request.ExchangeRequest; import com.tuoheng.api.entity.request.GoodsQuery; import com.tuoheng.api.mapper.GoodsMapper; import com.tuoheng.api.mapper.MerchantMapper; +import com.tuoheng.api.mapper.UserPointsDetailMapper; +import com.tuoheng.api.mapper.WestreamUserMapper; import com.tuoheng.api.service.IGoodsService; 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; @@ -28,6 +34,12 @@ public class GoodsServiceImpl extends BaseServiceImpl implem @Autowired private MerchantMapper merchantMapper; + @Autowired + private UserPointsDetailMapper userPointsDetailMapper; + + @Autowired + private WestreamUserMapper westreamUserMapper; + @Override @@ -75,4 +87,46 @@ public class GoodsServiceImpl extends BaseServiceImpl implem return JsonResult.success(merchant); } + @Override + public JsonResult exchange(ExchangeRequest exchangeRequest) { + if(StringUtils.isEmpty(exchangeRequest.getOpenid())){ + return JsonResult.error("openid为空!"); + } + if(null == exchangeRequest.getTenantId()){ + return JsonResult.error("租户ID为空!"); + } + if(null == exchangeRequest.getGoodsId()){ + return JsonResult.error("商品ID为空!"); + } + if(null == exchangeRequest.getGoodsCount() || exchangeRequest.getGoodsCount()<1){ + return JsonResult.error("商品数量为空!"); + } + Goods goods = goodsMapper.selectById(exchangeRequest.getGoodsId()); + if(ObjectUtil.isNull(goods)){ + return JsonResult.error("商品不存在!"); + } + + WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() + .eq(WestreamUser::getTenantId, exchangeRequest.getTenantId()) + .eq(WestreamUser::getOpenid, exchangeRequest.getOpenid()) + .eq(WestreamUser::getMark, 1).last("limit 1")); + + if(ObjectUtil.isNull(westreamUser)){ + return JsonResult.error("用户不存在!"); + } + int exchangePoints = exchangeRequest.getGoodsCount().intValue()*goods.getGoodsPoints().intValue(); + int mallPoints = westreamUser.getMallPoints().intValue(); + int residuePoints = mallPoints - exchangePoints; + if(residuePoints < 0){ + return JsonResult.error("用户积分不足!"); + } + + UserPointsDetail userPointsDetail = new UserPointsDetail(); + userPointsDetail.setChangeName(goods.getGoodsName()+"*"+exchangeRequest.getGoodsCount()); + + BeanUtils.copyProperties(exchangeRequest,userPointsDetail); + userPointsDetailMapper.insert(userPointsDetail); + return null; + } + } 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 fd387ba..52fef1b 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 @@ -57,9 +57,6 @@ public class UserPointsDetailServiceImpl extends BaseServiceImpl() @@ -68,10 +65,9 @@ public class UserPointsDetailServiceImpl extends BaseServiceImpl Date: Mon, 13 Nov 2023 15:22:39 +0800 Subject: [PATCH 61/80] =?UTF-8?q?=E7=AB=8B=E5=8D=B3=E5=85=91=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/GoodsController.java | 2 -- .../api/entity/domain/UserPointsDetail.java | 15 ++++++++++ .../api/entity/request/ExchangeRequest.java | 2 +- .../api/service/impl/GoodsServiceImpl.java | 28 ++++++++++++++++--- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java index c469a5e..7839b93 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/GoodsController.java @@ -44,8 +44,6 @@ public class GoodsController { return goodsService.merchantInfo(goodsQuery); } - - /** * 立即兑换 * 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 40e3bc8..759ef89 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 @@ -72,6 +72,21 @@ public class UserPointsDetail extends BaseEntity implements Serializable { */ private Integer exchangeFlag; + /** + * 商品ID + */ + private Integer goodsId; + + /** + * 商品积分 + */ + private Integer goodsPoints; + + /** + * 商品数量 + */ + private Integer goodsCount; + /** * 商铺信息 */ diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ExchangeRequest.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ExchangeRequest.java index 2a64dfe..761c0e4 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ExchangeRequest.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ExchangeRequest.java @@ -18,7 +18,7 @@ public class ExchangeRequest { private Integer goodsId; /** - * 商品id + * 商品数量 */ private Integer goodsCount; } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java index 3d37096..2bbfc2e 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java @@ -15,6 +15,7 @@ import com.tuoheng.api.mapper.MerchantMapper; import com.tuoheng.api.mapper.UserPointsDetailMapper; import com.tuoheng.api.mapper.WestreamUserMapper; import com.tuoheng.api.service.IGoodsService; +import com.tuoheng.api.utils.PointsTitleConstants; import com.tuoheng.common.common.BaseServiceImpl; import com.tuoheng.common.utils.CommonUtils; import com.tuoheng.common.utils.JsonResult; @@ -24,6 +25,8 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Date; + @Service @Slf4j public class GoodsServiceImpl extends BaseServiceImpl implements IGoodsService { @@ -121,12 +124,29 @@ public class GoodsServiceImpl extends BaseServiceImpl implem return JsonResult.error("用户积分不足!"); } - UserPointsDetail userPointsDetail = new UserPointsDetail(); - userPointsDetail.setChangeName(goods.getGoodsName()+"*"+exchangeRequest.getGoodsCount()); + Merchant merchant = merchantMapper.selectById(goods.getMerchantId()); - BeanUtils.copyProperties(exchangeRequest,userPointsDetail); + UserPointsDetail userPointsDetail = new UserPointsDetail(); + userPointsDetail.setNickname(westreamUser.getNickname()); + userPointsDetail.setChangeName(goods.getGoodsName()); + userPointsDetail.setPointsChange(exchangePoints); + userPointsDetail.setPointsTime(new Date()); + userPointsDetail.setType(1); + if(ObjectUtil.isNotNull(merchant)){ + userPointsDetail.setOperatorId(merchant.getUserId()); + userPointsDetail.setOperatorName(merchant.getShopsName()); + } + userPointsDetail.setCreateTime(new Date()); + userPointsDetail.setExchangeFlag(0); + userPointsDetail.setGoodsPoints(goods.getGoodsPoints()); + BeanUtils.copyProperties(exchangeRequest, userPointsDetail); userPointsDetailMapper.insert(userPointsDetail); - return null; + + //更新用户积分 + westreamUser.setMallPoints(residuePoints); + westreamUserMapper.updateById(westreamUser); + + return JsonResult.success(); } } -- 2.27.0 From c928621580f7987d6b472c7dbd78e47701f94ae3 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Mon, 13 Nov 2023 16:34:12 +0800 Subject: [PATCH 62/80] =?UTF-8?q?=E7=AB=8B=E5=8D=B3=E5=85=91=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/entity/domain/UserPointsDetail.java | 6 ++++++ .../api/service/impl/GoodsServiceImpl.java | 2 +- .../impl/UserPointsDetailServiceImpl.java | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) 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 759ef89..d668fe6 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 @@ -92,4 +92,10 @@ public class UserPointsDetail extends BaseEntity implements Serializable { */ @TableField(exist = false) private Merchant merchant; + + /** + * 商品信息 + */ + @TableField(exist = false) + private Goods goods; } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java index 2bbfc2e..5129e17 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/GoodsServiceImpl.java @@ -131,7 +131,7 @@ public class GoodsServiceImpl extends BaseServiceImpl implem userPointsDetail.setChangeName(goods.getGoodsName()); userPointsDetail.setPointsChange(exchangePoints); userPointsDetail.setPointsTime(new Date()); - userPointsDetail.setType(1); + userPointsDetail.setType(2); if(ObjectUtil.isNotNull(merchant)){ userPointsDetail.setOperatorId(merchant.getUserId()); userPointsDetail.setOperatorName(merchant.getShopsName()); 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 52fef1b..1ec818b 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 @@ -4,9 +4,11 @@ import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.tuoheng.api.entity.domain.Goods; import com.tuoheng.api.entity.domain.Merchant; import com.tuoheng.api.entity.domain.UserPointsDetail; import com.tuoheng.api.entity.request.UserPointsDetailQuery; +import com.tuoheng.api.mapper.GoodsMapper; import com.tuoheng.api.mapper.MerchantMapper; import com.tuoheng.api.mapper.UserPointsDetailMapper; import com.tuoheng.api.service.IUserPointsDetailService; @@ -35,6 +37,9 @@ public class UserPointsDetailServiceImpl extends BaseServiceImpl Date: Thu, 23 Nov 2023 14:44:03 +0800 Subject: [PATCH 63/80] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=BF=97=E6=84=BF?= =?UTF-8?q?=E8=80=85=E6=9C=8D=E5=8A=A1=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tuoheng-api/pom.xml | 16 +++ .../tuoheng/api/controller/MyController.java | 2 +- .../api/controller/UserPointsController.java | 37 +++++ .../controller/WestreamSubmitController.java | 38 +++++ .../WestreamVolunteerController.java | 36 +++++ .../conver/WestreamSubmitConverMapper.java | 15 ++ .../conver/WestreamVolunteerConverMapper.java | 15 ++ .../api/entity/domain/WestreamKnowUser.java | 40 ++++++ .../api/entity/domain/WestreamSubmit.java | 61 ++++++++ .../api/entity/domain/WestreamVolunteer.java | 79 +++++++++++ .../request/AddWestreamSubmitRequest.java | 47 +++++++ .../request/AddWestreamVolunteerRequest.java | 67 +++++++++ .../entity/request/ReceivePonitsRequest.java | 35 +++++ .../java/com/tuoheng/api/enums/DictEnum.java | 26 ++++ .../java/com/tuoheng/api/enums/MarkEnum.java | 25 ++++ .../api/mapper/WestreamKnowUserMapper.java | 15 ++ .../api/mapper/WestreamSubmitMapper.java | 14 ++ .../api/mapper/WestreamVolunteerMapper.java | 14 ++ .../IUserPointsDetailService.java | 5 +- .../UserPointsDetailServiceImpl.java | 16 ++- .../points/receive/ReceivePonitsService.java | 133 ++++++++++++++++++ .../submit/WestreamSubmitService.java | 21 +++ .../submit/WestreamSubmitServiceImpl.java | 21 +++ .../report/ReportWestreamSubmitService.java | 75 ++++++++++ .../volunteer/WestreamVolunteerService.java | 21 +++ .../WestreamVolunteerServiceImpl.java | 27 ++++ .../add/AddWestreamVolunteerService.java | 85 +++++++++++ .../src/main/resources/application-local.yml | 2 + .../common/exception/ServiceException.java | 11 ++ .../com/tuoheng/common/utils/JsonResult.java | 10 +- 30 files changed, 997 insertions(+), 12 deletions(-) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/controller/UserPointsController.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamSubmitController.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVolunteerController.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/conver/WestreamSubmitConverMapper.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/conver/WestreamVolunteerConverMapper.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamKnowUser.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamSubmit.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamVolunteer.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/request/AddWestreamSubmitRequest.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/request/AddWestreamVolunteerRequest.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ReceivePonitsRequest.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/enums/DictEnum.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/enums/MarkEnum.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamKnowUserMapper.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamSubmitMapper.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamVolunteerMapper.java rename tuoheng-api/src/main/java/com/tuoheng/api/service/{ => points}/IUserPointsDetailService.java (77%) rename tuoheng-api/src/main/java/com/tuoheng/api/service/{impl => points}/UserPointsDetailServiceImpl.java (93%) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/WestreamSubmitService.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/WestreamSubmitServiceImpl.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/report/ReportWestreamSubmitService.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/westream/volunteer/WestreamVolunteerService.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/westream/volunteer/WestreamVolunteerServiceImpl.java create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/service/westream/volunteer/add/AddWestreamVolunteerService.java diff --git a/tuoheng-api/pom.xml b/tuoheng-api/pom.xml index b76dcf1..a0ba738 100644 --- a/tuoheng-api/pom.xml +++ b/tuoheng-api/pom.xml @@ -124,6 +124,22 @@ aliyun-java-sdk-core 4.4.6 + + + + + + org.mapstruct + mapstruct + 1.5.3.Final + + + + + org.mapstruct + mapstruct-processor + 1.5.3.Final + 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 82b643f..f2cd6bd 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 @@ -1,7 +1,7 @@ package com.tuoheng.api.controller; import com.tuoheng.api.entity.request.UserPointsDetailQuery; -import com.tuoheng.api.service.IUserPointsDetailService; +import com.tuoheng.api.service.points.IUserPointsDetailService; import com.tuoheng.common.utils.JsonResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/UserPointsController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/UserPointsController.java new file mode 100644 index 0000000..ed6a972 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/UserPointsController.java @@ -0,0 +1,37 @@ +package com.tuoheng.api.controller; + +import com.tuoheng.api.entity.request.ReceivePonitsRequest; +import com.tuoheng.api.service.points.IUserPointsDetailService; +import com.tuoheng.common.utils.JsonResult; +import lombok.RequiredArgsConstructor; +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 wanjing + * @since 2023-11-23 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/userPoints") +public class UserPointsController { + + private final IUserPointsDetailService userPointsDetailService; + + /** + * 领取积分 + * + * @param request + * @return + */ + @PostMapping("/receive") + public JsonResult add(@RequestBody ReceivePonitsRequest request) { + return userPointsDetailService.receive(request); + } + + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamSubmitController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamSubmitController.java new file mode 100644 index 0000000..78276c1 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamSubmitController.java @@ -0,0 +1,38 @@ +package com.tuoheng.api.controller; + +import com.tuoheng.api.entity.request.AddWestreamSubmitRequest; +import com.tuoheng.api.entity.request.AddWestreamVolunteerRequest; +import com.tuoheng.api.service.westream.submit.WestreamSubmitService; +import com.tuoheng.common.utils.JsonResult; +import lombok.RequiredArgsConstructor; +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 wanjing + * @since 2023-11-23 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/westreamSubmit") +public class WestreamSubmitController { + + private final WestreamSubmitService westreamSubmitService; + + /** + * 上报 + * + * @param request + * @return + */ + @PostMapping("/report") + public JsonResult report(@RequestBody AddWestreamSubmitRequest request){ + return westreamSubmitService.report(request); + } + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVolunteerController.java b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVolunteerController.java new file mode 100644 index 0000000..773a0d2 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamVolunteerController.java @@ -0,0 +1,36 @@ +package com.tuoheng.api.controller; + +import com.tuoheng.api.entity.request.AddWestreamVolunteerRequest; +import com.tuoheng.api.service.westream.volunteer.WestreamVolunteerService; +import com.tuoheng.common.utils.JsonResult; +import lombok.RequiredArgsConstructor; +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 wanjing + * @since 2023-11-23 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/westreamVolunteer") +public class WestreamVolunteerController { + + private final WestreamVolunteerService westreamVolunteerService; + + /** + * 志愿服务提交 + * + * @param request + * @return + */ + @PostMapping("/add") + public JsonResult add(@RequestBody AddWestreamVolunteerRequest request) { + return westreamVolunteerService.add(request); + } + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/conver/WestreamSubmitConverMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/conver/WestreamSubmitConverMapper.java new file mode 100644 index 0000000..cadfc17 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/conver/WestreamSubmitConverMapper.java @@ -0,0 +1,15 @@ +package com.tuoheng.api.conver; + +import com.tuoheng.api.entity.domain.WestreamSubmit; +import com.tuoheng.api.entity.request.AddWestreamSubmitRequest; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface WestreamSubmitConverMapper { + + WestreamSubmitConverMapper INSTANCE = Mappers.getMapper(WestreamSubmitConverMapper.class); + + WestreamSubmit addRequestToWestreamSubmit(AddWestreamSubmitRequest request); + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/conver/WestreamVolunteerConverMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/conver/WestreamVolunteerConverMapper.java new file mode 100644 index 0000000..9ad6bbb --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/conver/WestreamVolunteerConverMapper.java @@ -0,0 +1,15 @@ +package com.tuoheng.api.conver; + +import com.tuoheng.api.entity.request.AddWestreamVolunteerRequest; +import com.tuoheng.api.entity.domain.WestreamVolunteer; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface WestreamVolunteerConverMapper { + + WestreamVolunteerConverMapper INSTANCE = Mappers.getMapper(WestreamVolunteerConverMapper.class); + + WestreamVolunteer addRequestToWestreamVolunteer(AddWestreamVolunteerRequest request); + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamKnowUser.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamKnowUser.java new file mode 100644 index 0000000..accd5a0 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamKnowUser.java @@ -0,0 +1,40 @@ +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 wanjing + * @since 2023-11-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("th_westream_know_user") +public class WestreamKnowUser extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 租户ID + */ + private Integer tenantId; + + /** + * openid + */ + private String openid; + + /** + * 全民护河知识表ID + */ + private Integer knowId; + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamSubmit.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamSubmit.java new file mode 100644 index 0000000..6093618 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamSubmit.java @@ -0,0 +1,61 @@ +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 lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +/** + * 全民护河上报表 + * + * @author wanjing + * @since 2023-11-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("th_westream_submit") +public class WestreamSubmit extends BaseEntity implements Serializable { + + /** + * 租户id + */ + private Integer tenantId; + + /** + * openid + */ + private String openid; + + /** + * 上传照片 + */ + private String photoUrl; + + /** + * 问题描述 + */ + private String problemDesc; + + /** + * 经度 + */ + private String longitude; + + /** + * 纬度 + */ + private String latitude; + + /** + * 审核状态 0待审核 1审核通过 2审核不通过 + */ + private Integer status; + + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamVolunteer.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamVolunteer.java new file mode 100644 index 0000000..0acbee6 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/WestreamVolunteer.java @@ -0,0 +1,79 @@ +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 lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * 全民护河志愿服务表 + * + * @author wanjing + * @since 2023-11-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("th_westream_volunteer") +public class WestreamVolunteer extends BaseEntity implements Serializable { + + /** + * 租户id + */ + private Integer tenantId; + + /** + * openid + */ + private String openid; + + /** + * 活动人数 + */ + private Integer activityNum; + + /** + * 活动日期 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date activityDate; + + /** + * 活动积分 + */ + private Integer activityPoints; + + /** + * 单位名称 + */ + private String companyName; + + /** + * 联系人 + */ + private String contactName; + + /** + * 电话 + */ + private String contactPhone; + + /** + * 上传照片 + */ + private String photoUrl; + + /** + * 审核状态 0待审核 1审核通过 2审核不通过 + */ + private Integer status; + + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/AddWestreamSubmitRequest.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/AddWestreamSubmitRequest.java new file mode 100644 index 0000000..13746b1 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/AddWestreamSubmitRequest.java @@ -0,0 +1,47 @@ +package com.tuoheng.api.entity.request; + +import lombok.Data; + +import java.util.List; + +/** + * 全民护河上报表 + * + * @author wanjing + * @since 2023-11-23 + */ +@Data +public class AddWestreamSubmitRequest { + + /** + * 租户id + */ + private Integer tenantId; + + /** + * openid + */ + private String openid; + + /** + * 上传照片 + */ + private List photoUrlList; + + /** + * 问题描述 + */ + private String problemDesc; + + /** + * 经度 + */ + private String longitude; + + /** + * 纬度 + */ + private String latitude; + + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/AddWestreamVolunteerRequest.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/AddWestreamVolunteerRequest.java new file mode 100644 index 0000000..f3c8a39 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/AddWestreamVolunteerRequest.java @@ -0,0 +1,67 @@ +package com.tuoheng.api.entity.request; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + +/** + * 全民护河志愿服务表 + * + * @author wanjing + * @since 2023-11-23 + */ +@Data +public class AddWestreamVolunteerRequest { + + /** + * 租户id + */ + private Integer tenantId; + + /** + * openid + */ + private String openid; + + /** + * 活动人数 + */ + private Integer activityNum; + + /** + * 活动日期 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date activityDate; + + /** + * 活动积分 + */ + private Integer activityPoints; + + /** + * 单位名称 + */ + private String companyName; + + /** + * 联系人 + */ + private String contactName; + + /** + * 电话 + */ + private String contactPhone; + + /** + * 上传照片 + */ + private String photoUrl; + + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ReceivePonitsRequest.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ReceivePonitsRequest.java new file mode 100644 index 0000000..c3c923b --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ReceivePonitsRequest.java @@ -0,0 +1,35 @@ +package com.tuoheng.api.entity.request; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + +/** + * 全民护河志愿服务表 + * + * @author wanjing + * @since 2023-11-23 + */ +@Data +public class ReceivePonitsRequest { + + /** + * 租户id + */ + private Integer tenantId; + + /** + * openid + */ + private String openid; + + /** + * 活知ID + */ + private Integer knowId; + + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/enums/DictEnum.java b/tuoheng-api/src/main/java/com/tuoheng/api/enums/DictEnum.java new file mode 100644 index 0000000..8dd4c25 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/enums/DictEnum.java @@ -0,0 +1,26 @@ +package com.tuoheng.api.enums; + +import lombok.Getter; + +/** + * @Author xiaoying + * @Date 2023/7/10 9:27 + */ +public enum DictEnum { + + SCREEN("screen", "大屏信息展示"), + TASK_STATUS("task_status", "任务状态"), + POINTS_RULE("points_rule", "积分规则"), + MSG_RULE("msg_rule", "短信规则"); + + DictEnum(String code, String description) { + this.code = code; + this.description = description; + } + + @Getter + private String code; + + @Getter + private String description; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/enums/MarkEnum.java b/tuoheng-api/src/main/java/com/tuoheng/api/enums/MarkEnum.java new file mode 100644 index 0000000..4ab3561 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/enums/MarkEnum.java @@ -0,0 +1,25 @@ +package com.tuoheng.api.enums; + +import lombok.Getter; + +/** + * 逻辑删除标记类型 + * @author chenyukun + */ + +public enum MarkEnum { + VALID(1,"有效"), + + NOTVALID(0,"失效"); + + MarkEnum(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/WestreamKnowUserMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamKnowUserMapper.java new file mode 100644 index 0000000..8ac9be7 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamKnowUserMapper.java @@ -0,0 +1,15 @@ +package com.tuoheng.api.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.tuoheng.api.entity.domain.WestreamKnow; +import com.tuoheng.api.entity.domain.WestreamKnowUser; + +/** + * 全民护河知识用户表 Mapper 接口 + * + * @author wanjing + * @since 2023-11-23 + */ +public interface WestreamKnowUserMapper extends BaseMapper { + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamSubmitMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamSubmitMapper.java new file mode 100644 index 0000000..69894c6 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamSubmitMapper.java @@ -0,0 +1,14 @@ +package com.tuoheng.api.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.tuoheng.api.entity.domain.WestreamSubmit; + +/** + * 全民护河上报表 Mapper 接口 + * + * @author wanjing + * @since 2023-11-23 + */ +public interface WestreamSubmitMapper extends BaseMapper { + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamVolunteerMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamVolunteerMapper.java new file mode 100644 index 0000000..f2f6184 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/WestreamVolunteerMapper.java @@ -0,0 +1,14 @@ +package com.tuoheng.api.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.tuoheng.api.entity.domain.WestreamVolunteer; + +/** + * 全民护河志愿服务表 Mapper 接口 + * + * @author wanjing + * @since 2023-11-23 + */ +public interface WestreamVolunteerMapper 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/points/IUserPointsDetailService.java similarity index 77% rename from tuoheng-api/src/main/java/com/tuoheng/api/service/IUserPointsDetailService.java rename to tuoheng-api/src/main/java/com/tuoheng/api/service/points/IUserPointsDetailService.java index 91a3c83..256f26b 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/IUserPointsDetailService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/IUserPointsDetailService.java @@ -1,6 +1,7 @@ -package com.tuoheng.api.service; +package com.tuoheng.api.service.points; import com.tuoheng.api.entity.domain.UserPointsDetail; +import com.tuoheng.api.entity.request.ReceivePonitsRequest; import com.tuoheng.api.entity.request.UserPointsDetailQuery; import com.tuoheng.common.common.IBaseService; import com.tuoheng.common.utils.JsonResult; @@ -15,4 +16,6 @@ public interface IUserPointsDetailService extends IBaseService JsonResult exchange(UserPointsDetailQuery userPointsDetailQuery); JsonResult pointsDetail(UserPointsDetailQuery userPointsDetailQuery); + + JsonResult receive(ReceivePonitsRequest request); } 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/points/UserPointsDetailServiceImpl.java similarity index 93% rename from tuoheng-api/src/main/java/com/tuoheng/api/service/impl/UserPointsDetailServiceImpl.java rename to tuoheng-api/src/main/java/com/tuoheng/api/service/points/UserPointsDetailServiceImpl.java index 1ec818b..81fae80 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/impl/UserPointsDetailServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/UserPointsDetailServiceImpl.java @@ -1,4 +1,4 @@ -package com.tuoheng.api.service.impl; +package com.tuoheng.api.service.points; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -7,11 +7,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.tuoheng.api.entity.domain.Goods; import com.tuoheng.api.entity.domain.Merchant; import com.tuoheng.api.entity.domain.UserPointsDetail; +import com.tuoheng.api.entity.request.ReceivePonitsRequest; import com.tuoheng.api.entity.request.UserPointsDetailQuery; import com.tuoheng.api.mapper.GoodsMapper; import com.tuoheng.api.mapper.MerchantMapper; import com.tuoheng.api.mapper.UserPointsDetailMapper; -import com.tuoheng.api.service.IUserPointsDetailService; +import com.tuoheng.api.service.points.receive.ReceivePonitsService; import com.tuoheng.common.common.BaseServiceImpl; import com.tuoheng.common.utils.CommonUtils; import com.tuoheng.common.utils.JsonResult; @@ -19,9 +20,6 @@ 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; - /** * 全民护河公告表 服务实现类 * @@ -40,6 +38,9 @@ public class UserPointsDetailServiceImpl extends BaseServiceImpl() + .eq(WestreamKnowUser::getTenantId, request.getTenantId()) + .eq(WestreamKnowUser::getOpenid, request.getOpenid()) + .eq(WestreamKnowUser::getKnowId, request.getKnowId()) + .eq(WestreamKnowUser::getMark, MarkEnum.VALID.getCode())); + + if (ObjectUtil.isNotEmpty(westreamKnowUser)) { + return JsonResult.success("已经领取,不用重复领取"); + } + + WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() + .eq(WestreamUser::getTenantId, request.getTenantId()) + .eq(WestreamUser::getOpenid, request.getOpenid()) + .eq(WestreamUser::getMark, MarkEnum.VALID.getCode())); + + if (ObjectUtil.isEmpty(westreamUser)) { + + } + + ThDict dict = dictMapper.selectOne(new LambdaQueryWrapper() + .eq(ThDict::getTenantId, request.getTenantId()) + .eq(ThDict::getCode, DictEnum.POINTS_RULE.getCode()) + .eq(ThDict::getMark, MarkEnum.VALID.getCode())); + + if (ObjectUtil.isEmpty(dict)) { + + } + + ThDictData dictData = dictDataMapper.selectOne(new LambdaQueryWrapper() + .eq(ThDictData::getTenantId, request.getTenantId()) + .eq(ThDictData::getDictId, dict.getId()) + .eq(ThDictData::getName, "") + .eq(ThDictData::getMark, MarkEnum.VALID.getCode())); + + + + UserPointsDetail userPointsDetail = new UserPointsDetail(); + userPointsDetail.setTenantId(request.getTenantId()); + userPointsDetail.setOpenid(request.getOpenid()); + userPointsDetail.setChangeName(westreamUser.getNickname()); + + if (ObjectUtil.isNotEmpty(dictData)) { + userPointsDetail.setPointsChange(Integer.parseInt(dictData.getValue())); + } + + userPointsDetail.setPointsTime(DateUtils.now()); + + + Integer row = userPointsDetailMapper.insert(userPointsDetail); + if (row <= 0) { + return JsonResult.error("领取积分失败"); + } + + + westreamUser.setMallPoints(westreamUser.getMallPoints() + 0); + + row = westreamUserMapper.updateById(westreamUser); + if (row <= 0) { + return JsonResult.error("领取积分,修改用户总积分失败"); + } + + return JsonResult.success(); + } + + /** + * 检查参数 + * + * @param request + * @return + */ + private JsonResult check(ReceivePonitsRequest request) { + if (ObjectUtil.isEmpty(request.getTenantId()) || 0 == request.getTenantId()) { + throw new ServiceException("租户Id为空"); + } + if (StringUtils.isEmpty(request.getOpenid())) { + throw new ServiceException("OpenId为空"); + } + if (ObjectUtil.isEmpty(request.getKnowId()) || 0 == request.getKnowId()) { + throw new ServiceException("知识ID为空"); + } + return JsonResult.success(); + } + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/WestreamSubmitService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/WestreamSubmitService.java new file mode 100644 index 0000000..da0fd70 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/WestreamSubmitService.java @@ -0,0 +1,21 @@ +package com.tuoheng.api.service.westream.submit; + +import com.tuoheng.api.entity.request.AddWestreamSubmitRequest; +import com.tuoheng.common.utils.JsonResult; + +/** + * 全民护河上报 服务类 + * + * @author wanjing + * @since 2023-11-23 + */ +public interface WestreamSubmitService { + + /** + * 上报 + * + * @return + */ + JsonResult report(AddWestreamSubmitRequest request); + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/WestreamSubmitServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/WestreamSubmitServiceImpl.java new file mode 100644 index 0000000..66972a5 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/WestreamSubmitServiceImpl.java @@ -0,0 +1,21 @@ +package com.tuoheng.api.service.westream.submit; + +import com.tuoheng.api.entity.request.AddWestreamSubmitRequest; +import com.tuoheng.api.service.westream.submit.report.ReportWestreamSubmitService; +import com.tuoheng.common.utils.JsonResult; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +@Slf4j +@Service +@RequiredArgsConstructor +public class WestreamSubmitServiceImpl implements WestreamSubmitService { + + private final ReportWestreamSubmitService reportWestreamSubmitService; + + @Override + public JsonResult report(AddWestreamSubmitRequest request) { + return reportWestreamSubmitService.add(request); + } +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/report/ReportWestreamSubmitService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/report/ReportWestreamSubmitService.java new file mode 100644 index 0000000..44f6911 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/report/ReportWestreamSubmitService.java @@ -0,0 +1,75 @@ +package com.tuoheng.api.service.westream.submit.report; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +import com.tuoheng.api.conver.WestreamSubmitConverMapper; +import com.tuoheng.api.entity.domain.WestreamSubmit; +import com.tuoheng.api.entity.request.AddWestreamSubmitRequest; +import com.tuoheng.api.mapper.WestreamSubmitMapper; +import com.tuoheng.common.exception.ServiceException; +import com.tuoheng.common.utils.DateUtils; +import com.tuoheng.common.utils.JsonResult; +import com.tuoheng.common.utils.StringUtils; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * 全民护河上报 业务类 + * + * @author wanjing + * @since 2023-11-23 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class ReportWestreamSubmitService { + + private final WestreamSubmitMapper westreamSubmitMapper; + + public JsonResult add(AddWestreamSubmitRequest request) { + JsonResult result = this.check(request); + if (0 != result.getCode()) { + log.info("全民护河上报:校验失败:{}", result.getMsg()); + return result; + } + WestreamSubmit westreamSubmit = WestreamSubmitConverMapper.INSTANCE.addRequestToWestreamSubmit(request); + westreamSubmit.setCreateUser(0); + westreamSubmit.setCreateTime(DateUtils.now()); + Integer rowId = westreamSubmitMapper.insert(westreamSubmit); + if (rowId <= 0) { + log.info("全民护河上报:添加失败:{}", result.getMsg()); + return JsonResult.error("全民护河上报失败"); + } + return JsonResult.success(); + } + + /** + * 检查参数 + * + * @param request + * @return + */ + private JsonResult check(AddWestreamSubmitRequest request) { + if (ObjectUtil.isEmpty(request.getTenantId()) || 0 == request.getTenantId()) { + throw new ServiceException("租户Id为空"); + } + if (StringUtils.isEmpty(request.getOpenid())) { + throw new ServiceException("OpenId为空"); + } + if (StringUtils.isEmpty(request.getLongitude())) { + throw new ServiceException("经度为空"); + } + if (StringUtils.isEmpty(request.getLatitude())) { + throw new ServiceException("纬度为空"); + } + if (StringUtils.isEmpty(request.getProblemDesc())) { + throw new ServiceException("问题描述为空"); + } + if (CollectionUtil.isEmpty(request.getPhotoUrlList())) { + throw new ServiceException("图片为空"); + } + return JsonResult.success(); + } + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/volunteer/WestreamVolunteerService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/volunteer/WestreamVolunteerService.java new file mode 100644 index 0000000..c018777 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/volunteer/WestreamVolunteerService.java @@ -0,0 +1,21 @@ +package com.tuoheng.api.service.westream.volunteer; + +import com.tuoheng.api.entity.request.AddWestreamVolunteerRequest; +import com.tuoheng.common.utils.JsonResult; + +/** + * 全民护河志愿服务 服务类 + * + * @author wanjing + * @since 2023-11-23 + */ +public interface WestreamVolunteerService { + + /** + * 上报 + * + * @return + */ + JsonResult add(AddWestreamVolunteerRequest request); + +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/volunteer/WestreamVolunteerServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/volunteer/WestreamVolunteerServiceImpl.java new file mode 100644 index 0000000..2017be2 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/volunteer/WestreamVolunteerServiceImpl.java @@ -0,0 +1,27 @@ +package com.tuoheng.api.service.westream.volunteer; + +import com.tuoheng.api.entity.request.AddWestreamVolunteerRequest; +import com.tuoheng.api.service.westream.volunteer.add.AddWestreamVolunteerService; +import com.tuoheng.common.utils.JsonResult; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * 全民护河志愿服务 服务类 + * + * @author wanjing + * @since 2023-11-23 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class WestreamVolunteerServiceImpl implements WestreamVolunteerService { + + private final AddWestreamVolunteerService addWestreamVolunteerService; + + @Override + public JsonResult add(AddWestreamVolunteerRequest request) { + return addWestreamVolunteerService.add(request); + } +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/volunteer/add/AddWestreamVolunteerService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/volunteer/add/AddWestreamVolunteerService.java new file mode 100644 index 0000000..d315db4 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/volunteer/add/AddWestreamVolunteerService.java @@ -0,0 +1,85 @@ +package com.tuoheng.api.service.westream.volunteer.add; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +import com.tuoheng.api.conver.WestreamVolunteerConverMapper; +import com.tuoheng.api.entity.request.AddWestreamVolunteerRequest; +import com.tuoheng.api.entity.domain.WestreamVolunteer; +import com.tuoheng.api.mapper.WestreamVolunteerMapper; +import com.tuoheng.common.exception.ServiceException; +import com.tuoheng.common.utils.DateUtils; +import com.tuoheng.common.utils.JsonResult; +import com.tuoheng.common.utils.StringUtils; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * 全民护河志愿服务 业务类 + * + * @author wanjing + * @since 2023-11-23 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class AddWestreamVolunteerService { + + private final WestreamVolunteerMapper westreamVolunteerMapper; + + public JsonResult add(AddWestreamVolunteerRequest request) { + JsonResult result = this.check(request); + if (0 != result.getCode()) { + log.info("全民护河志愿服务申请:校验失败:{}", result.getMsg()); + return result; + } + WestreamVolunteer westreamVolunteer = WestreamVolunteerConverMapper.INSTANCE.addRequestToWestreamVolunteer(request); + westreamVolunteer.setCreateUser(0); + westreamVolunteer.setCreateTime(DateUtils.now()); + Integer rowId = westreamVolunteerMapper.insert(westreamVolunteer); + if (rowId <= 0) { + log.info("全民护河志愿服务:添加失败:{}", result.getMsg()); + return JsonResult.error("全民护河志愿服务申请失败"); + } + return JsonResult.success(); + } + + /** + * 检查参数 + * + * @param request + * + * @return + */ + private JsonResult check(AddWestreamVolunteerRequest request) { + if (ObjectUtil.isEmpty(request.getTenantId()) || 0 == request.getTenantId()) { + throw new ServiceException("租户Id为空"); + } + if (StringUtils.isEmpty(request.getOpenid())) { + throw new ServiceException("OpenId为空"); + } + if (ObjectUtil.isEmpty(request.getActivityNum()) || 0 == request.getActivityNum()) { + throw new ServiceException("活动人数为空"); + } + if (ObjectUtil.isEmpty(request.getActivityDate())) { + throw new ServiceException("活动日期为空"); + } + if (ObjectUtil.isEmpty(request.getActivityPoints())) { + throw new ServiceException("获取积分为空"); + } + if (StringUtils.isEmpty(request.getCompanyName())) { + throw new ServiceException("单位名称为空"); + } + if (StringUtils.isEmpty(request.getContactName())) { + throw new ServiceException("联系人为空"); + } + if (StringUtils.isEmpty(request.getContactPhone())) { + throw new ServiceException("电话为空"); + } + if (StringUtils.isEmpty(request.getPhotoUrl())) { + throw new ServiceException("图片为空"); + } + return JsonResult.success(); + } + +} diff --git a/tuoheng-api/src/main/resources/application-local.yml b/tuoheng-api/src/main/resources/application-local.yml index 5134ddf..e954e72 100644 --- a/tuoheng-api/src/main/resources/application-local.yml +++ b/tuoheng-api/src/main/resources/application-local.yml @@ -15,6 +15,8 @@ tuoheng: video-url: http://vod.play.t-aaron.com/ # 高德Key gaodeKey: 5a1f63e7563cba471a9d0773e218144a + # DSP服务域名 + dsp-domain-url: http://192.168.11.11:7011/ #阿里云 aliyuncsVod: diff --git a/tuoheng-common/src/main/java/com/tuoheng/common/exception/ServiceException.java b/tuoheng-common/src/main/java/com/tuoheng/common/exception/ServiceException.java index 0b9d5e5..d530b43 100644 --- a/tuoheng-common/src/main/java/com/tuoheng/common/exception/ServiceException.java +++ b/tuoheng-common/src/main/java/com/tuoheng/common/exception/ServiceException.java @@ -1,5 +1,6 @@ package com.tuoheng.common.exception; import com.tuoheng.common.common.ExceptionInterface; +import com.tuoheng.common.utils.JsonResult; /** * 业务异常类(业务处理时手动抛出异常) @@ -42,5 +43,15 @@ public class ServiceException extends RuntimeException { this.code = code; } + /** + * 构造器 + * + * @param msg + */ + public ServiceException(String msg) { + super(msg); + this.msg = msg; + this.code = JsonResult.ERROR; + } } diff --git a/tuoheng-common/src/main/java/com/tuoheng/common/utils/JsonResult.java b/tuoheng-common/src/main/java/com/tuoheng/common/utils/JsonResult.java index 03437d6..6c88a84 100644 --- a/tuoheng-common/src/main/java/com/tuoheng/common/utils/JsonResult.java +++ b/tuoheng-common/src/main/java/com/tuoheng/common/utils/JsonResult.java @@ -22,7 +22,7 @@ public class JsonResult implements Serializable { /** * 失败 */ - public static final int error = CommonConstants.FAIL; + public static final int ERROR = CommonConstants.FAIL; private int code; @@ -43,19 +43,19 @@ public class JsonResult implements Serializable { } public static JsonResult error() { - return jsonResult(null, error, "操作失败"); + return jsonResult(null, ERROR, "操作失败"); } public static JsonResult error(String msg) { - return jsonResult(null, error, msg); + return jsonResult(null, ERROR, msg); } public static JsonResult error(T data) { - return jsonResult(data, error, "操作失败"); + return jsonResult(data, ERROR, "操作失败"); } public static JsonResult error(T data, String msg) { - return jsonResult(data, error, msg); + return jsonResult(data, ERROR, msg); } public static JsonResult error(int code, String msg) { -- 2.27.0 From 3d741f5f05eabd55828789f3592b22f0eec87165 Mon Sep 17 00:00:00 2001 From: wanjing <“wanjing5234@163.com”> Date: Thu, 23 Nov 2023 15:25:55 +0800 Subject: [PATCH 64/80] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=88=91=E8=A6=81?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/AddWestreamSubmitRequest.java | 17 ++++++++--------- .../submit/WestreamSubmitServiceImpl.java | 2 +- .../report/ReportWestreamSubmitService.java | 11 +++++------ 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/AddWestreamSubmitRequest.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/AddWestreamSubmitRequest.java index 13746b1..7cb69af 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/AddWestreamSubmitRequest.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/AddWestreamSubmitRequest.java @@ -24,24 +24,23 @@ public class AddWestreamSubmitRequest { private String openid; /** - * 上传照片 + * 经度 */ - private List photoUrlList; + private String longitude; /** - * 问题描述 + * 纬度 */ - private String problemDesc; + private String latitude; /** - * 经度 + * 问题描述 */ - private String longitude; + private String problemDesc; /** - * 纬度 + * 上传照片 */ - private String latitude; - + private String photoUrl; } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/WestreamSubmitServiceImpl.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/WestreamSubmitServiceImpl.java index 66972a5..f79c4fe 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/WestreamSubmitServiceImpl.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/WestreamSubmitServiceImpl.java @@ -16,6 +16,6 @@ public class WestreamSubmitServiceImpl implements WestreamSubmitService { @Override public JsonResult report(AddWestreamSubmitRequest request) { - return reportWestreamSubmitService.add(request); + return reportWestreamSubmitService.report(request); } } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/report/ReportWestreamSubmitService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/report/ReportWestreamSubmitService.java index 44f6911..4856fec 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/report/ReportWestreamSubmitService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/westream/submit/report/ReportWestreamSubmitService.java @@ -1,6 +1,5 @@ package com.tuoheng.api.service.westream.submit.report; -import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import com.tuoheng.api.conver.WestreamSubmitConverMapper; import com.tuoheng.api.entity.domain.WestreamSubmit; @@ -27,10 +26,10 @@ public class ReportWestreamSubmitService { private final WestreamSubmitMapper westreamSubmitMapper; - public JsonResult add(AddWestreamSubmitRequest request) { + public JsonResult report(AddWestreamSubmitRequest request) { JsonResult result = this.check(request); if (0 != result.getCode()) { - log.info("全民护河上报:校验失败:{}", result.getMsg()); + log.info("全民护河我要上报:校验失败:{}", result.getMsg()); return result; } WestreamSubmit westreamSubmit = WestreamSubmitConverMapper.INSTANCE.addRequestToWestreamSubmit(request); @@ -38,8 +37,8 @@ public class ReportWestreamSubmitService { westreamSubmit.setCreateTime(DateUtils.now()); Integer rowId = westreamSubmitMapper.insert(westreamSubmit); if (rowId <= 0) { - log.info("全民护河上报:添加失败:{}", result.getMsg()); - return JsonResult.error("全民护河上报失败"); + log.info("全民护河我要上报:添加失败:{}", result.getMsg()); + return JsonResult.error("全民护河我要上报失败"); } return JsonResult.success(); } @@ -66,7 +65,7 @@ public class ReportWestreamSubmitService { if (StringUtils.isEmpty(request.getProblemDesc())) { throw new ServiceException("问题描述为空"); } - if (CollectionUtil.isEmpty(request.getPhotoUrlList())) { + if (StringUtils.isEmpty(request.getPhotoUrl())) { throw new ServiceException("图片为空"); } return JsonResult.success(); -- 2.27.0 From 3bbf0b2e9feb9a94e4181ce4c81e15ea95e3188e Mon Sep 17 00:00:00 2001 From: wanjing <“wanjing5234@163.com”> Date: Thu, 23 Nov 2023 16:17:38 +0800 Subject: [PATCH 65/80] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=A2=86=E5=8F=96?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/request/ReceivePonitsRequest.java | 2 +- .../com/tuoheng/api/enums/DictDataEnum.java | 30 +++++++++++++ .../com/tuoheng/api/enums/DictDateEnum.java | 25 ----------- .../service/impl/WestreamUserServiceImpl.java | 21 +++++----- .../points/receive/ReceivePonitsService.java | 42 ++++++++++--------- 5 files changed, 63 insertions(+), 57 deletions(-) create mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/enums/DictDataEnum.java delete mode 100644 tuoheng-api/src/main/java/com/tuoheng/api/enums/DictDateEnum.java diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ReceivePonitsRequest.java b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ReceivePonitsRequest.java index c3c923b..16a71ba 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ReceivePonitsRequest.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/entity/request/ReceivePonitsRequest.java @@ -27,7 +27,7 @@ public class ReceivePonitsRequest { private String openid; /** - * 活知ID + * 知识ID */ private Integer knowId; diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/enums/DictDataEnum.java b/tuoheng-api/src/main/java/com/tuoheng/api/enums/DictDataEnum.java new file mode 100644 index 0000000..b82d5d8 --- /dev/null +++ b/tuoheng-api/src/main/java/com/tuoheng/api/enums/DictDataEnum.java @@ -0,0 +1,30 @@ +package com.tuoheng.api.enums; + +import lombok.Getter; + +/** + * @Author xiaoying + * @Date 2023/7/10 9:27 + */ +public enum DictDataEnum { + + VOLUNTEER_ACTIVITY("volunteer_activity", "志愿者活动"), + TIKTOK("tiktok", "关注抖音"), + VIDEO("video", "学习视频"), + WESTREAM_KNOW("westream_know", "阅读知识"), + DAILY_LIMIT_WESTREAM_KNOW("daily_limit_westream_know", "阅读知识每日最大限额"), + WESTREAM_SUBMIT("westream_submit", "我要上"), + DAILY_LIMIT_WESTREAM_SUBMIT("daily_limit_westream_submit", "我要上报每日最大限额"),; + + + DictDataEnum(String code, String description) { + this.code = code; + this.description = description; + } + + @Getter + private String code; + + @Getter + private String description; +} diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/enums/DictDateEnum.java b/tuoheng-api/src/main/java/com/tuoheng/api/enums/DictDateEnum.java deleted file mode 100644 index 86e1b2d..0000000 --- a/tuoheng-api/src/main/java/com/tuoheng/api/enums/DictDateEnum.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.tuoheng.api.enums; - -import lombok.Getter; - -/** - * @Author xiaoying - * @Date 2023/7/10 9:27 - */ -public enum DictDateEnum { - - VOLUNTEER_ACTIVITY("volunteer_activity", "志愿者活动"), - TIKTOK("tiktok", "关注抖音"), - VIDEO("video", "学习视频"); - - DictDateEnum(String code, String description) { - this.code = code; - this.description = description; - } - - @Getter - private String code; - - @Getter - private String description; -} 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 ce2b4e3..4e6c0ee 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 @@ -8,12 +8,11 @@ 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.enums.DictDateEnum; +import com.tuoheng.api.enums.DictDataEnum; 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; @@ -184,9 +183,9 @@ public class WestreamUserServiceImpl extends BaseServiceImpl StringUtils.isNotEmpty(t.getNote())).collect(Collectors.toList()); diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java index fb6ddb2..ac2fc22 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java @@ -2,10 +2,9 @@ package com.tuoheng.api.service.points.receive; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.tuoheng.api.constants.DictConstants; -import com.tuoheng.api.conver.WestreamSubmitConverMapper; import com.tuoheng.api.entity.domain.*; import com.tuoheng.api.entity.request.ReceivePonitsRequest; +import com.tuoheng.api.enums.DictDataEnum; import com.tuoheng.api.enums.DictEnum; import com.tuoheng.api.enums.MarkEnum; import com.tuoheng.api.mapper.*; @@ -43,7 +42,7 @@ public class ReceivePonitsService { public JsonResult receive(ReceivePonitsRequest request) { JsonResult result = this.check(request); if (0 != result.getCode()) { - log.info("全民护河领取:校验失败:{}", result.getMsg()); + log.info("全民护河领取积分:校验失败:{}", result.getMsg()); return result; } @@ -52,62 +51,65 @@ public class ReceivePonitsService { .eq(WestreamKnowUser::getOpenid, request.getOpenid()) .eq(WestreamKnowUser::getKnowId, request.getKnowId()) .eq(WestreamKnowUser::getMark, MarkEnum.VALID.getCode())); - if (ObjectUtil.isNotEmpty(westreamKnowUser)) { - return JsonResult.success("已经领取,不用重复领取"); + return JsonResult.success("已经领取积分,不用重复领取"); } WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() .eq(WestreamUser::getTenantId, request.getTenantId()) .eq(WestreamUser::getOpenid, request.getOpenid()) .eq(WestreamUser::getMark, MarkEnum.VALID.getCode())); - if (ObjectUtil.isEmpty(westreamUser)) { - + log.info("领取积分,该用户不存在,tenantId:{}, openid:{}", request.getTenantId(), request.getOpenid()); + return JsonResult.success("该用户不存在"); } ThDict dict = dictMapper.selectOne(new LambdaQueryWrapper() .eq(ThDict::getTenantId, request.getTenantId()) .eq(ThDict::getCode, DictEnum.POINTS_RULE.getCode()) .eq(ThDict::getMark, MarkEnum.VALID.getCode())); - if (ObjectUtil.isEmpty(dict)) { - + log.info("领取积分,该字典类型不存在,tenantId:{}, dictCode:{}", request.getTenantId(), DictEnum.POINTS_RULE.getCode()); + return JsonResult.success("积分规则未设置"); } ThDictData dictData = dictDataMapper.selectOne(new LambdaQueryWrapper() .eq(ThDictData::getTenantId, request.getTenantId()) .eq(ThDictData::getDictId, dict.getId()) - .eq(ThDictData::getName, "") + .eq(ThDictData::getName, DictDataEnum.WESTREAM_KNOW.getCode()) .eq(ThDictData::getMark, MarkEnum.VALID.getCode())); - - + if (ObjectUtil.isEmpty(dictData)) { + log.info("领取积分,该字典项不存在,tenantId:{}, dictDataName:{}", request.getTenantId(), DictDataEnum.WESTREAM_KNOW.getCode()); + return JsonResult.success("积分规则未设置"); + } UserPointsDetail userPointsDetail = new UserPointsDetail(); userPointsDetail.setTenantId(request.getTenantId()); userPointsDetail.setOpenid(request.getOpenid()); - userPointsDetail.setChangeName(westreamUser.getNickname()); + userPointsDetail.setNickname(westreamUser.getNickname()); + Integer points = 0; if (ObjectUtil.isNotEmpty(dictData)) { - userPointsDetail.setPointsChange(Integer.parseInt(dictData.getValue())); + points = Integer.parseInt(dictData.getValue()); + userPointsDetail.setPointsChange(points); } - userPointsDetail.setPointsTime(DateUtils.now()); - Integer row = userPointsDetailMapper.insert(userPointsDetail); if (row <= 0) { - return JsonResult.error("领取积分失败"); + return JsonResult.error("领取积分,失败"); } - - westreamUser.setMallPoints(westreamUser.getMallPoints() + 0); + if (ObjectUtil.isEmpty(westreamUser.getMallPoints())) { + westreamUser.setMallPoints(points); + } else { + westreamUser.setMallPoints(westreamUser.getMallPoints() + points); + } row = westreamUserMapper.updateById(westreamUser); if (row <= 0) { return JsonResult.error("领取积分,修改用户总积分失败"); } - return JsonResult.success(); } -- 2.27.0 From 52e1bf403557a8579519feca37b099438b3e09c8 Mon Sep 17 00:00:00 2001 From: wanjing <“wanjing5234@163.com”> Date: Thu, 23 Nov 2023 17:01:26 +0800 Subject: [PATCH 66/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/points/receive/ReceivePonitsService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java index ac2fc22..ab2a468 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java @@ -52,7 +52,7 @@ public class ReceivePonitsService { .eq(WestreamKnowUser::getKnowId, request.getKnowId()) .eq(WestreamKnowUser::getMark, MarkEnum.VALID.getCode())); if (ObjectUtil.isNotEmpty(westreamKnowUser)) { - return JsonResult.success("已经领取积分,不用重复领取"); + return JsonResult.success("您已获得过积分了,仅能获取一次积分。"); } WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() -- 2.27.0 From 4b49b5c843a14e3d20ea2767cd6d3c3a086517de Mon Sep 17 00:00:00 2001 From: wanjing <“wanjing5234@163.com”> Date: Thu, 23 Nov 2023 17:10:03 +0800 Subject: [PATCH 67/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/points/receive/ReceivePonitsService.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java index ab2a468..39ca70c 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java @@ -53,6 +53,14 @@ public class ReceivePonitsService { .eq(WestreamKnowUser::getMark, MarkEnum.VALID.getCode())); if (ObjectUtil.isNotEmpty(westreamKnowUser)) { return JsonResult.success("您已获得过积分了,仅能获取一次积分。"); + } else { + westreamKnowUser = new WestreamKnowUser(); + westreamKnowUser.setTenantId(request.getTenantId()); + westreamKnowUser.setOpenid(request.getOpenid()); + westreamKnowUser.setKnowId(request.getKnowId()); + westreamKnowUser.setCreateUser(0); + westreamKnowUser.setCreateTime(DateUtils.now()); + westreamKnowUserMapper.insert(westreamKnowUser); } WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() -- 2.27.0 From d808165d0363926c61a9936b13d30204252f3520 Mon Sep 17 00:00:00 2001 From: wanjing <“wanjing5234@163.com”> Date: Thu, 23 Nov 2023 17:12:44 +0800 Subject: [PATCH 68/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/points/receive/ReceivePonitsService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java index 39ca70c..43cf90f 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java @@ -52,7 +52,7 @@ public class ReceivePonitsService { .eq(WestreamKnowUser::getKnowId, request.getKnowId()) .eq(WestreamKnowUser::getMark, MarkEnum.VALID.getCode())); if (ObjectUtil.isNotEmpty(westreamKnowUser)) { - return JsonResult.success("您已获得过积分了,仅能获取一次积分。"); + return JsonResult.error("您已获得过积分了,仅能获取一次积分。"); } else { westreamKnowUser = new WestreamKnowUser(); westreamKnowUser.setTenantId(request.getTenantId()); -- 2.27.0 From 717f6d86e2c7220109c9e598aead835194c40260 Mon Sep 17 00:00:00 2001 From: wanjing <“wanjing5234@163.com”> Date: Wed, 29 Nov 2023 10:34:16 +0800 Subject: [PATCH 69/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E4=B8=AD=E7=BC=BA=E5=B0=91=E9=98=85=E8=AF=BB?= =?UTF-8?q?=E7=9F=A5=E8=AF=86=E7=A7=AF=E5=88=86=E8=AE=B0=E5=BD=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/points/receive/ReceivePonitsService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java index 43cf90f..79269f1 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java @@ -95,7 +95,8 @@ public class ReceivePonitsService { userPointsDetail.setTenantId(request.getTenantId()); userPointsDetail.setOpenid(request.getOpenid()); userPointsDetail.setNickname(westreamUser.getNickname()); - + userPointsDetail.setChangeName("阅读知识"); + userPointsDetail.setType(1); Integer points = 0; if (ObjectUtil.isNotEmpty(dictData)) { points = Integer.parseInt(dictData.getValue()); -- 2.27.0 From 813440bcba5ad2d7e13499e51b8440885c79cb72 Mon Sep 17 00:00:00 2001 From: wanghaoran Date: Thu, 30 Nov 2023 09:43:59 +0800 Subject: [PATCH 70/80] =?UTF-8?q?=E9=A2=86=E5=8F=96=E7=A7=AF=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/points/receive/ReceivePonitsService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java index 79269f1..17d7f79 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java @@ -17,6 +17,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Date; + /** * 全民护河领取积分 业务类 * @@ -97,6 +99,7 @@ public class ReceivePonitsService { userPointsDetail.setNickname(westreamUser.getNickname()); userPointsDetail.setChangeName("阅读知识"); userPointsDetail.setType(1); + userPointsDetail.setCreateTime(new Date()); Integer points = 0; if (ObjectUtil.isNotEmpty(dictData)) { points = Integer.parseInt(dictData.getValue()); -- 2.27.0 From e3cd96bd4e4a064e312b4f1c0b1568474b20944d Mon Sep 17 00:00:00 2001 From: wanjing <“wanjing5234@163.com”> Date: Thu, 30 Nov 2023 13:52:58 +0800 Subject: [PATCH 71/80] =?UTF-8?q?=E9=A2=86=E5=8F=96=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E4=B8=8E=E6=AF=8F=E5=A4=A9=E4=B8=8A=E9=99=90=E5=81=9A=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/mapper/UserPointsDetailMapper.java | 6 ++ .../points/receive/ReceivePonitsService.java | 78 ++++++++++++------- .../mapper/UserPointsDetailMapper.xml | 44 +++++++++++ 3 files changed, 102 insertions(+), 26 deletions(-) create mode 100644 tuoheng-api/src/main/resources/mapper/UserPointsDetailMapper.xml diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/UserPointsDetailMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/UserPointsDetailMapper.java index 4d2e1cf..6ce84ce 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/UserPointsDetailMapper.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/UserPointsDetailMapper.java @@ -2,6 +2,9 @@ package com.tuoheng.api.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.tuoheng.api.entity.domain.UserPointsDetail; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; /** * 用户积分明细表 Mapper 接口 @@ -10,4 +13,7 @@ import com.tuoheng.api.entity.domain.UserPointsDetail; * @since 2023-05-06 */ public interface UserPointsDetailMapper extends BaseMapper { + + Integer selectTotalPointsByToDay(@Param("openid") String openid, @Param("pointsTime") String pointsTime); + } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java index 79269f1..a4dd026 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java @@ -17,6 +17,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Date; + /** * 全民护河领取积分 业务类 * @@ -46,32 +48,6 @@ public class ReceivePonitsService { return result; } - WestreamKnowUser westreamKnowUser = westreamKnowUserMapper.selectOne(new LambdaQueryWrapper() - .eq(WestreamKnowUser::getTenantId, request.getTenantId()) - .eq(WestreamKnowUser::getOpenid, request.getOpenid()) - .eq(WestreamKnowUser::getKnowId, request.getKnowId()) - .eq(WestreamKnowUser::getMark, MarkEnum.VALID.getCode())); - if (ObjectUtil.isNotEmpty(westreamKnowUser)) { - return JsonResult.error("您已获得过积分了,仅能获取一次积分。"); - } else { - westreamKnowUser = new WestreamKnowUser(); - westreamKnowUser.setTenantId(request.getTenantId()); - westreamKnowUser.setOpenid(request.getOpenid()); - westreamKnowUser.setKnowId(request.getKnowId()); - westreamKnowUser.setCreateUser(0); - westreamKnowUser.setCreateTime(DateUtils.now()); - westreamKnowUserMapper.insert(westreamKnowUser); - } - - WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() - .eq(WestreamUser::getTenantId, request.getTenantId()) - .eq(WestreamUser::getOpenid, request.getOpenid()) - .eq(WestreamUser::getMark, MarkEnum.VALID.getCode())); - if (ObjectUtil.isEmpty(westreamUser)) { - log.info("领取积分,该用户不存在,tenantId:{}, openid:{}", request.getTenantId(), request.getOpenid()); - return JsonResult.success("该用户不存在"); - } - ThDict dict = dictMapper.selectOne(new LambdaQueryWrapper() .eq(ThDict::getTenantId, request.getTenantId()) .eq(ThDict::getCode, DictEnum.POINTS_RULE.getCode()) @@ -91,6 +67,56 @@ public class ReceivePonitsService { return JsonResult.success("积分规则未设置"); } + ThDictData dailyLimitWestreamSubmitDictData = dictDataMapper.selectOne(new LambdaQueryWrapper() + .eq(ThDictData::getTenantId, request.getTenantId()) + .eq(ThDictData::getDictId, dict.getId()) + .eq(ThDictData::getName, DictDataEnum.DAILY_LIMIT_WESTREAM_SUBMIT.getCode()) + .eq(ThDictData::getMark, MarkEnum.VALID.getCode())); + if (ObjectUtil.isEmpty(dailyLimitWestreamSubmitDictData)) { + log.info("领取积分,每日上报最大限额字典项不存在,tenantId:{}, dictDataName:{}", request.getTenantId(), DictDataEnum.DAILY_LIMIT_WESTREAM_SUBMIT.getCode()); + return JsonResult.success("积分规则未设置"); + } + + Integer dailyLimitWestreamSubmit = 0; + if (ObjectUtil.isNotEmpty(dailyLimitWestreamSubmitDictData)) { + dailyLimitWestreamSubmit = Integer.parseInt(dailyLimitWestreamSubmitDictData.getValue()); + } + + String pointsTime = DateUtils.getDate(); + Integer totalPointsByToDay = userPointsDetailMapper.selectTotalPointsByToDay(request.getOpenid(), pointsTime); + if (ObjectUtil.isNotEmpty(totalPointsByToDay)) { + if (totalPointsByToDay >= dailyLimitWestreamSubmit) { + log.info("领取积分,已超过每日积分上限,totalPointsByToDay:{}, dailyLimitWestreamSubmit:{}", totalPointsByToDay, dailyLimitWestreamSubmit); + return JsonResult.success("已超过每日积分上限"); + } + } + + WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper() + .eq(WestreamUser::getTenantId, request.getTenantId()) + .eq(WestreamUser::getOpenid, request.getOpenid()) + .eq(WestreamUser::getMark, MarkEnum.VALID.getCode())); + if (ObjectUtil.isEmpty(westreamUser)) { + log.info("领取积分,该用户不存在,tenantId:{}, openid:{}", request.getTenantId(), request.getOpenid()); + return JsonResult.success("该用户不存在"); + } + + WestreamKnowUser westreamKnowUser = westreamKnowUserMapper.selectOne(new LambdaQueryWrapper() + .eq(WestreamKnowUser::getTenantId, request.getTenantId()) + .eq(WestreamKnowUser::getOpenid, request.getOpenid()) + .eq(WestreamKnowUser::getKnowId, request.getKnowId()) + .eq(WestreamKnowUser::getMark, MarkEnum.VALID.getCode())); + if (ObjectUtil.isNotEmpty(westreamKnowUser)) { + return JsonResult.error("您已获得过积分了,仅能获取一次积分。"); + } else { + westreamKnowUser = new WestreamKnowUser(); + westreamKnowUser.setTenantId(request.getTenantId()); + westreamKnowUser.setOpenid(request.getOpenid()); + westreamKnowUser.setKnowId(request.getKnowId()); + westreamKnowUser.setCreateUser(0); + westreamKnowUser.setCreateTime(DateUtils.now()); + westreamKnowUserMapper.insert(westreamKnowUser); + } + UserPointsDetail userPointsDetail = new UserPointsDetail(); userPointsDetail.setTenantId(request.getTenantId()); userPointsDetail.setOpenid(request.getOpenid()); diff --git a/tuoheng-api/src/main/resources/mapper/UserPointsDetailMapper.xml b/tuoheng-api/src/main/resources/mapper/UserPointsDetailMapper.xml new file mode 100644 index 0000000..e8f6bf5 --- /dev/null +++ b/tuoheng-api/src/main/resources/mapper/UserPointsDetailMapper.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, tenant_id, openid, nickname, + points_change, points_time, type, operator_id, operator_name, change_name, exchange_flag, goods_id, goods_points, goods_count, + create_user, create_time, update_user, update_time, mark + + + + -- 2.27.0 From 0e812823c0ac0c6f8bc6139c505cdc7ff5117b94 Mon Sep 17 00:00:00 2001 From: wanjing <“wanjing5234@163.com”> Date: Thu, 30 Nov 2023 15:10:18 +0800 Subject: [PATCH 72/80] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=86=E5=8F=96?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/points/receive/ReceivePonitsService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java index 54242c1..1726d49 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java @@ -123,7 +123,7 @@ public class ReceivePonitsService { userPointsDetail.setNickname(westreamUser.getNickname()); userPointsDetail.setChangeName("阅读知识"); userPointsDetail.setType(1); - userPointsDetail.setCreateTime(new Date()); + userPointsDetail.setCreateTime(DateUtils.now()); Integer points = 0; if (ObjectUtil.isNotEmpty(dictData)) { points = Integer.parseInt(dictData.getValue()); -- 2.27.0 From 2f7ce117cf2db0ca2a6acc3f52fd253b34f2a210 Mon Sep 17 00:00:00 2001 From: wanjing <“wanjing5234@163.com”> Date: Thu, 30 Nov 2023 15:21:56 +0800 Subject: [PATCH 73/80] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=A2=86=E5=8F=96?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuoheng/api/mapper/UserPointsDetailMapper.java | 2 +- .../points/receive/ReceivePonitsService.java | 13 +++++++------ .../resources/mapper/UserPointsDetailMapper.xml | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/UserPointsDetailMapper.java b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/UserPointsDetailMapper.java index 6ce84ce..f7a5c05 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/mapper/UserPointsDetailMapper.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/mapper/UserPointsDetailMapper.java @@ -14,6 +14,6 @@ import java.util.Date; */ public interface UserPointsDetailMapper extends BaseMapper { - Integer selectTotalPointsByToDay(@Param("openid") String openid, @Param("pointsTime") String pointsTime); + Integer selectTotalPointsByToDay(@Param("openid") String openid, @Param("pointsTime") String pointsTime, @Param("changeName") String changeName); } diff --git a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java index 1726d49..b9447b1 100644 --- a/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java +++ b/tuoheng-api/src/main/java/com/tuoheng/api/service/points/receive/ReceivePonitsService.java @@ -54,7 +54,7 @@ public class ReceivePonitsService { .eq(ThDict::getMark, MarkEnum.VALID.getCode())); if (ObjectUtil.isEmpty(dict)) { log.info("领取积分,该字典类型不存在,tenantId:{}, dictCode:{}", request.getTenantId(), DictEnum.POINTS_RULE.getCode()); - return JsonResult.success("积分规则未设置"); + return JsonResult.error("积分规则未设置"); } ThDictData dictData = dictDataMapper.selectOne(new LambdaQueryWrapper() @@ -64,7 +64,7 @@ public class ReceivePonitsService { .eq(ThDictData::getMark, MarkEnum.VALID.getCode())); if (ObjectUtil.isEmpty(dictData)) { log.info("领取积分,该字典项不存在,tenantId:{}, dictDataName:{}", request.getTenantId(), DictDataEnum.WESTREAM_KNOW.getCode()); - return JsonResult.success("积分规则未设置"); + return JsonResult.error("积分规则未设置"); } ThDictData dailyLimitWestreamSubmitDictData = dictDataMapper.selectOne(new LambdaQueryWrapper() @@ -74,7 +74,7 @@ public class ReceivePonitsService { .eq(ThDictData::getMark, MarkEnum.VALID.getCode())); if (ObjectUtil.isEmpty(dailyLimitWestreamSubmitDictData)) { log.info("领取积分,每日上报最大限额字典项不存在,tenantId:{}, dictDataName:{}", request.getTenantId(), DictDataEnum.DAILY_LIMIT_WESTREAM_SUBMIT.getCode()); - return JsonResult.success("积分规则未设置"); + return JsonResult.error("积分规则未设置"); } Integer dailyLimitWestreamSubmit = 0; @@ -83,11 +83,12 @@ public class ReceivePonitsService { } String pointsTime = DateUtils.getDate(); - Integer totalPointsByToDay = userPointsDetailMapper.selectTotalPointsByToDay(request.getOpenid(), pointsTime); + String changeName = "阅读知识"; + Integer totalPointsByToDay = userPointsDetailMapper.selectTotalPointsByToDay(request.getOpenid(), pointsTime, changeName); if (ObjectUtil.isNotEmpty(totalPointsByToDay)) { if (totalPointsByToDay >= dailyLimitWestreamSubmit) { log.info("领取积分,已超过每日积分上限,totalPointsByToDay:{}, dailyLimitWestreamSubmit:{}", totalPointsByToDay, dailyLimitWestreamSubmit); - return JsonResult.success("已超过每日积分上限"); + return JsonResult.error("已超过每日积分上限"); } } @@ -97,7 +98,7 @@ public class ReceivePonitsService { .eq(WestreamUser::getMark, MarkEnum.VALID.getCode())); if (ObjectUtil.isEmpty(westreamUser)) { log.info("领取积分,该用户不存在,tenantId:{}, openid:{}", request.getTenantId(), request.getOpenid()); - return JsonResult.success("该用户不存在"); + return JsonResult.error("该用户不存在"); } WestreamKnowUser westreamKnowUser = westreamKnowUserMapper.selectOne(new LambdaQueryWrapper() diff --git a/tuoheng-api/src/main/resources/mapper/UserPointsDetailMapper.xml b/tuoheng-api/src/main/resources/mapper/UserPointsDetailMapper.xml index e8f6bf5..aa33b54 100644 --- a/tuoheng-api/src/main/resources/mapper/UserPointsDetailMapper.xml +++ b/tuoheng-api/src/main/resources/mapper/UserPointsDetailMapper.xml @@ -38,7 +38,8 @@ and mark = 1 and type = 1 and openid = #{openid} - and points_time = #{pointsTime} + and points_time = #{pointsTime} + and change_name = #{changeName} -- 2.27.0 From 6832a8b6dfd44848f1c66b7b7bcf39ac4746642e Mon Sep 17 00:00:00 2001 From: wanjing <“wanjing5234@163.com”> Date: Thu, 30 Nov 2023 15:35:03 +0800 Subject: [PATCH 74/80] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=A2=86=E5=8F=96?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/UserPointsDetailMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tuoheng-api/src/main/resources/mapper/UserPointsDetailMapper.xml b/tuoheng-api/src/main/resources/mapper/UserPointsDetailMapper.xml index aa33b54..405dfc2 100644 --- a/tuoheng-api/src/main/resources/mapper/UserPointsDetailMapper.xml +++ b/tuoheng-api/src/main/resources/mapper/UserPointsDetailMapper.xml @@ -33,7 +33,7 @@