Merge branch 'feature/community-center' into preview

feature/admin
yang 2025-04-27 15:16:34 +08:00
commit dfa4f4d245
7 changed files with 43 additions and 12 deletions

View File

@ -31,6 +31,12 @@
<groupId>com.mcwl</groupId> <groupId>com.mcwl</groupId>
<artifactId>mcwl-system</artifactId> <artifactId>mcwl-system</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.mcwl</groupId>
<artifactId>mcwl-myInvitation</artifactId>
<version>3.8.8</version>
<scope>compile</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/dashscope-sdk-java --> <!-- https://mvnrepository.com/artifact/com.alibaba/dashscope-sdk-java -->
<!-- <dependency>--> <!-- <dependency>-->

View File

@ -87,12 +87,6 @@ public class CommunityVo {
@ApiModelProperty(value = "加入人数") @ApiModelProperty(value = "加入人数")
private Integer joinNum; private Integer joinNum;
/**
*
*/
@ApiModelProperty(value = "发布数量")
private Integer publishNum;
/** /**
* *
*/ */

View File

@ -26,6 +26,8 @@ import com.mcwl.communityCenter.mapper.CommunityMapper;
import com.mcwl.communityCenter.mapper.CommunityUserMapper; import com.mcwl.communityCenter.mapper.CommunityUserMapper;
import com.mcwl.communityCenter.service.CommunityService; import com.mcwl.communityCenter.service.CommunityService;
import com.mcwl.communityCenter.service.PublishService; import com.mcwl.communityCenter.service.PublishService;
import com.mcwl.myInvitation.domain.Consume;
import com.mcwl.myInvitation.mapper.ConsumeMapper;
import com.mcwl.system.service.ISysUserService; import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -54,6 +56,9 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
private final PublishService publishService; private final PublishService publishService;
private final ConsumeMapper consumeMapper;
@Override @Override
public TableDataInfo listByPage(CommunityListPageRes communityListPageRes) { public TableDataInfo listByPage(CommunityListPageRes communityListPageRes) {
@ -93,6 +98,7 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
.userId(SecurityUtils.getUserId()) .userId(SecurityUtils.getUserId())
.userType(2) .userType(2)
.build()); .build());
redisCache.deleteObject("communityJoinNumMap");
} catch (Exception e) { } catch (Exception e) {
throw new ServiceException(e.getMessage(), HttpStatus.SHOW_ERROR_MSG); throw new ServiceException(e.getMessage(), HttpStatus.SHOW_ERROR_MSG);
@ -112,7 +118,7 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
Long communityId = joinCommunityRes.getCommunityId(); Long communityId = joinCommunityRes.getCommunityId();
Community community = baseMapper.getByTenantIdAndCommunityId(tenantId, communityId); Community community = baseMapper.getByTenantIdAndCommunityId(tenantId, communityId);
if (Objects.isNull(community)) { if (Objects.isNull(community)) {
return R.fail("社区不存在,请重新加入"); return R.fail(HttpStatus.SHOW_ERROR_MSG,"社区不存在,请重新加入");
} }
CommunityUser communityUser = communityUserMapper.selectByTenantIdAndCommunityIdAndUserId(tenantId, CommunityUser communityUser = communityUserMapper.selectByTenantIdAndCommunityIdAndUserId(tenantId,
@ -120,14 +126,14 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
SecurityUtils.getUserId()); SecurityUtils.getUserId());
if (Objects.nonNull(communityUser)) { if (Objects.nonNull(communityUser)) {
return R.fail("您已加入该社区,不能重复加入"); return R.fail(HttpStatus.SHOW_ERROR_MSG,"您已加入该社区,不能重复加入");
} }
SysUser user = SecurityUtils.getLoginUser().getUser(); SysUser user = sysUserService.selectUserById(SecurityUtils.getUserId());
Double wallet = user.getWallet(); Double wallet = user.getWallet();
Double price = community.getPrice(); Double price = community.getPrice();
if (wallet < price) { if (wallet < price) {
return R.fail("钱包余额不足,请充值"); return R.fail(HttpStatus.SHOW_ERROR_MSG,"钱包余额不足,请充值");
} }
// 扣费 // 扣费
BigDecimal priceBigDecimal = new BigDecimal(price.toString()); BigDecimal priceBigDecimal = new BigDecimal(price.toString());
@ -167,6 +173,18 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
SecurityUtils.getLoginUser().getUser().getNickName(), community.getCommunityName(), price)); SecurityUtils.getLoginUser().getUser().getNickName(), community.getCommunityName(), price));
communityAdviceMapper.insert(communityAdvice); communityAdviceMapper.insert(communityAdvice);
Consume consume = new Consume();
consume.setUserId(SecurityUtils.getUserId());
consume.setAmount(price);
consume.setProductId(communityId);
consume.setType(3);
consume.setWallet(user.getWallet());
consume.setConsumeDate(new Date());
consumeMapper.insert(consume);
redisCache.deleteObject("communityJoinNumMap");
return R.ok("加入成功"); return R.ok("加入成功");
} }
@ -213,6 +231,8 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
if (communityJoinNum == 1) { if (communityJoinNum == 1) {
baseMapper.deleteCommunity(tenantId, communityId); baseMapper.deleteCommunity(tenantId, communityId);
} else {
redisCache.deleteObject("communityJoinNumMap");
} }
return R.ok(); return R.ok();
@ -299,7 +319,7 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
communityVo.setNickName(sysUser.getNickName()); communityVo.setNickName(sysUser.getNickName());
communityVo.setCreateDay(daysBetween); communityVo.setCreateDay(daysBetween);
communityVo.setJoinNum(this.getCommunityJoinNum(community.getId())); communityVo.setJoinNum(this.getCommunityJoinNum(community.getId()));
communityVo.setPublishNum(this.getCommunityPublishNum(community.getId())); // communityVo.setPublishNum(this.getCommunityPublishNum(community.getId()));
if (myJoinCommunityMap.get(community.getId()) != null) { if (myJoinCommunityMap.get(community.getId()) != null) {
communityVo.setIsJoin(1); communityVo.setIsJoin(1);
} else { } else {

View File

@ -12,6 +12,7 @@ import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.PageDomain;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.core.redis.RedisCache;
import com.mcwl.common.exception.BusinessException; import com.mcwl.common.exception.BusinessException;
import com.mcwl.common.exception.ServiceException; import com.mcwl.common.exception.ServiceException;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
@ -60,6 +61,8 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
private final PublishReportMapper publishReportMapper; private final PublishReportMapper publishReportMapper;
private final RedisCache redisCache;
@Override @Override
public PublishVo getDetail(PublishDetailRes publishDetailRes) { public PublishVo getDetail(PublishDetailRes publishDetailRes) {
@ -111,6 +114,8 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
publish.setPublishTime(new Date()); publish.setPublishTime(new Date());
} }
baseMapper.insertPublish(publish); baseMapper.insertPublish(publish);
redisCache.deleteObject("communityPublishNumMap");
return R.ok(); return R.ok();
} }

View File

@ -104,6 +104,7 @@
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= start_time and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= start_time
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &lt;= end_time) or (start_time is null and end_time is null)) AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &lt;= end_time) or (start_time is null and end_time is null))
and (black_end_time is null or NOW() &gt;= black_end_time) and (black_end_time is null or NOW() &gt;= black_end_time)
and del_flag = '0';
</select> </select>
<select id="getAllCommunityUser" resultType="com.mcwl.communityCenter.domain.CommunityUser"> <select id="getAllCommunityUser" resultType="com.mcwl.communityCenter.domain.CommunityUser">
select id, select id,
@ -131,6 +132,7 @@
and user_id = #{userId} and user_id = #{userId}
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= start_time and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= start_time
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &lt;= end_time) or (start_time is null and end_time is null)) AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &lt;= end_time) or (start_time is null and end_time is null))
and del_flag = '0';
</select> </select>
<select id="getCommunityUserAvatar" resultType="java.lang.String"> <select id="getCommunityUserAvatar" resultType="java.lang.String">
select u.avatar select u.avatar
@ -141,6 +143,7 @@
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= cu.start_time and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &gt;= cu.start_time
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &lt;= cu.end_time) or AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') &lt;= cu.end_time) or
(cu.start_time is null and cu.end_time is null)) (cu.start_time is null and cu.end_time is null))
and cu.del_flag = '0'
order by cu.create_time desc order by cu.create_time desc
limit 5 limit 5
</select> </select>

View File

@ -29,7 +29,7 @@ public class Consume extends BaseEntity {
// 商品id // 商品id
private Long productId; private Long productId;
// 商品类型 0模型 1工作流 2图片 // 商品类型 0模型 1工作流 2图片 3社区
private Integer type; private Integer type;
// 剩余金币 // 剩余金币

View File

@ -81,6 +81,9 @@ public class ConsumeServiceImpl extends ServiceImpl<ConsumeMapper, Consume> impl
case 2: case 2:
consumeVo.setProductName("图片"); consumeVo.setProductName("图片");
break; break;
case 3:
consumeVo.setProductName("社区");
break;
} }
consumeVoList.add(consumeVo); consumeVoList.add(consumeVo);