Compare commits
2 Commits
87f259cd6f
...
dfa4f4d245
Author | SHA1 | Date |
---|---|---|
|
dfa4f4d245 | |
|
e2dd7d81bd |
|
@ -31,6 +31,12 @@
|
|||
<groupId>com.mcwl</groupId>
|
||||
<artifactId>mcwl-system</artifactId>
|
||||
</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 -->
|
||||
<!-- <dependency>-->
|
||||
|
|
|
@ -87,12 +87,6 @@ public class CommunityVo {
|
|||
@ApiModelProperty(value = "加入人数")
|
||||
private Integer joinNum;
|
||||
|
||||
/**
|
||||
* 发布数量
|
||||
*/
|
||||
@ApiModelProperty(value = "发布数量")
|
||||
private Integer publishNum;
|
||||
|
||||
/**
|
||||
* 是否加入
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,8 @@ import com.mcwl.communityCenter.mapper.CommunityMapper;
|
|||
import com.mcwl.communityCenter.mapper.CommunityUserMapper;
|
||||
import com.mcwl.communityCenter.service.CommunityService;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -54,6 +56,9 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
|
||||
private final PublishService publishService;
|
||||
|
||||
private final ConsumeMapper consumeMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public TableDataInfo listByPage(CommunityListPageRes communityListPageRes) {
|
||||
|
@ -93,6 +98,7 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
.userId(SecurityUtils.getUserId())
|
||||
.userType(2)
|
||||
.build());
|
||||
redisCache.deleteObject("communityJoinNumMap");
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage(), HttpStatus.SHOW_ERROR_MSG);
|
||||
|
@ -112,7 +118,7 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
Long communityId = joinCommunityRes.getCommunityId();
|
||||
Community community = baseMapper.getByTenantIdAndCommunityId(tenantId, communityId);
|
||||
if (Objects.isNull(community)) {
|
||||
return R.fail("社区不存在,请重新加入");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"社区不存在,请重新加入");
|
||||
}
|
||||
|
||||
CommunityUser communityUser = communityUserMapper.selectByTenantIdAndCommunityIdAndUserId(tenantId,
|
||||
|
@ -120,14 +126,14 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
SecurityUtils.getUserId());
|
||||
|
||||
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 price = community.getPrice();
|
||||
if (wallet < price) {
|
||||
return R.fail("钱包余额不足,请充值");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"钱包余额不足,请充值");
|
||||
}
|
||||
// 扣费
|
||||
BigDecimal priceBigDecimal = new BigDecimal(price.toString());
|
||||
|
@ -167,6 +173,18 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
SecurityUtils.getLoginUser().getUser().getNickName(), community.getCommunityName(), price));
|
||||
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("加入成功");
|
||||
}
|
||||
|
||||
|
@ -213,6 +231,8 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
|
||||
if (communityJoinNum == 1) {
|
||||
baseMapper.deleteCommunity(tenantId, communityId);
|
||||
} else {
|
||||
redisCache.deleteObject("communityJoinNumMap");
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
|
@ -299,7 +319,7 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
communityVo.setNickName(sysUser.getNickName());
|
||||
communityVo.setCreateDay(daysBetween);
|
||||
communityVo.setJoinNum(this.getCommunityJoinNum(community.getId()));
|
||||
communityVo.setPublishNum(this.getCommunityPublishNum(community.getId()));
|
||||
// communityVo.setPublishNum(this.getCommunityPublishNum(community.getId()));
|
||||
if (myJoinCommunityMap.get(community.getId()) != null) {
|
||||
communityVo.setIsJoin(1);
|
||||
} else {
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.mcwl.common.core.domain.R;
|
|||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
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.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -60,6 +61,8 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
|
|||
|
||||
private final PublishReportMapper publishReportMapper;
|
||||
|
||||
private final RedisCache redisCache;
|
||||
|
||||
|
||||
@Override
|
||||
public PublishVo getDetail(PublishDetailRes publishDetailRes) {
|
||||
|
@ -111,6 +114,8 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
|
|||
publish.setPublishTime(new Date());
|
||||
}
|
||||
baseMapper.insertPublish(publish);
|
||||
redisCache.deleteObject("communityPublishNumMap");
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@
|
|||
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') >= start_time
|
||||
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') <= end_time) or (start_time is null and end_time is null))
|
||||
and (black_end_time is null or NOW() >= black_end_time)
|
||||
and del_flag = '0';
|
||||
</select>
|
||||
<select id="getAllCommunityUser" resultType="com.mcwl.communityCenter.domain.CommunityUser">
|
||||
select id,
|
||||
|
@ -131,6 +132,7 @@
|
|||
and user_id = #{userId}
|
||||
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') >= start_time
|
||||
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') <= end_time) or (start_time is null and end_time is null))
|
||||
and del_flag = '0';
|
||||
</select>
|
||||
<select id="getCommunityUserAvatar" resultType="java.lang.String">
|
||||
select u.avatar
|
||||
|
@ -141,6 +143,7 @@
|
|||
and ((CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') >= cu.start_time
|
||||
AND CONVERT_TZ(NOW(), 'SYSTEM', '+08:00') <= cu.end_time) or
|
||||
(cu.start_time is null and cu.end_time is null))
|
||||
and cu.del_flag = '0'
|
||||
order by cu.create_time desc
|
||||
limit 5
|
||||
</select>
|
||||
|
|
|
@ -29,7 +29,7 @@ public class Consume extends BaseEntity {
|
|||
// 商品id
|
||||
private Long productId;
|
||||
|
||||
// 商品类型 0模型 1工作流 2图片
|
||||
// 商品类型 0模型 1工作流 2图片 3社区
|
||||
private Integer type;
|
||||
|
||||
// 剩余金币
|
||||
|
|
|
@ -81,6 +81,9 @@ public class ConsumeServiceImpl extends ServiceImpl<ConsumeMapper, Consume> impl
|
|||
case 2:
|
||||
consumeVo.setProductName("图片");
|
||||
break;
|
||||
case 3:
|
||||
consumeVo.setProductName("社区");
|
||||
break;
|
||||
}
|
||||
consumeVoList.add(consumeVo);
|
||||
|
||||
|
|
Loading…
Reference in New Issue