Compare commits
6 Commits
162779bf92
...
ef376535ea
Author | SHA1 | Date |
---|---|---|
|
ef376535ea | |
|
ab059c7dde | |
|
3d680d5a68 | |
|
1f50a33c78 | |
|
f432697d94 | |
|
80fcfd12ea |
|
@ -119,14 +119,4 @@ public class PublishController {
|
|||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 举报
|
||||
*/
|
||||
@ApiOperation(value = "举报")
|
||||
@PostMapping("report")
|
||||
public R<Object> reportPublish(@RequestBody @Valid PublishReportRes publishReportRes) {
|
||||
publishService.reportPublish(publishReportRes);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package com.mcwl.web.controller.communityCenter;
|
||||
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.dto.PublishReportRes;
|
||||
import com.mcwl.communityCenter.service.PublishReportService;
|
||||
import com.mcwl.communityCenter.service.PublishService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 发布举报
|
||||
*/
|
||||
@Api(tags = "发布举报")
|
||||
@RestController
|
||||
@RequestMapping("publishReport")
|
||||
@RequiredArgsConstructor
|
||||
public class PublishReportController {
|
||||
|
||||
private final PublishService publishService;
|
||||
|
||||
private final PublishReportService publishReportService;
|
||||
|
||||
|
||||
/**
|
||||
* 举报
|
||||
*/
|
||||
@ApiOperation(value = "举报")
|
||||
@PostMapping("report")
|
||||
public R<Object> reportPublish(@RequestBody @Valid PublishReportRes publishReportRes) {
|
||||
publishService.reportPublish(publishReportRes);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取举报列表
|
||||
*/
|
||||
@ApiOperation(value = "获取举报列表")
|
||||
@PostMapping("list")
|
||||
public TableDataInfo getReportList(@RequestBody @Valid PageDomain pageDomain) {
|
||||
return publishReportService.getReportList(pageDomain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -30,6 +30,11 @@ public class IncomeInfo extends BaseEntity {
|
|||
*/
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 类型 0付费加入 1付费问答
|
||||
*/
|
||||
|
|
|
@ -41,17 +41,17 @@ public class PublishReport extends BaseEntity {
|
|||
/**
|
||||
* 举报类型 字典值
|
||||
*/
|
||||
private Long reportType;
|
||||
private Integer reportType;
|
||||
|
||||
/**
|
||||
* 举报内容
|
||||
*/
|
||||
private Long content;
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 状态(0未处理 1已处理 )
|
||||
*/
|
||||
private Long status;
|
||||
private Integer status;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -41,6 +41,12 @@ public class CommunityDetailVo {
|
|||
@ApiModelProperty(value = "社区名称")
|
||||
private String communityName;
|
||||
|
||||
/**
|
||||
* 社区标签
|
||||
*/
|
||||
@ApiModelProperty(value = "社区标签")
|
||||
private Integer communityTag;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
|
@ -53,6 +59,18 @@ public class CommunityDetailVo {
|
|||
@ApiModelProperty(value = "描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 社区类型
|
||||
*/
|
||||
@ApiModelProperty(value = "社区类型")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 有效期天数
|
||||
*/
|
||||
@ApiModelProperty(value = "有效期天数")
|
||||
private Integer validityDay;
|
||||
|
||||
/**
|
||||
* 创建天数
|
||||
*/
|
||||
|
|
|
@ -25,7 +25,7 @@ public interface IncomeInfoMapper extends BaseMapper<IncomeInfo> {
|
|||
@InterceptorIgnore(tenantLine = "true")
|
||||
IncomeAmountVo questionIncome(@Param("userId") Long userId);
|
||||
|
||||
Double totalIncome();
|
||||
Double totalIncome(@Param("userId") Long userId);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
List<IncomeInfoListVo> incomeList(Page<IncomeInfo> page,
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.communityCenter.service;
|
|||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Publish;
|
||||
import com.mcwl.communityCenter.domain.PublishReport;
|
||||
|
@ -14,4 +15,6 @@ import javax.validation.Valid;
|
|||
public interface PublishReportService extends IService<PublishReport> {
|
||||
|
||||
void saveReport(PublishReport publishReport);
|
||||
|
||||
TableDataInfo getReportList(@Valid PageDomain pageDomain);
|
||||
}
|
||||
|
|
|
@ -14,10 +14,7 @@ import com.mcwl.common.exception.ServiceException;
|
|||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.communityCenter.constant.AdviceConstant;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import com.mcwl.communityCenter.domain.CommunityAdvice;
|
||||
import com.mcwl.communityCenter.domain.CommunityUser;
|
||||
import com.mcwl.communityCenter.domain.Publish;
|
||||
import com.mcwl.communityCenter.domain.*;
|
||||
import com.mcwl.communityCenter.domain.dto.*;
|
||||
import com.mcwl.communityCenter.domain.vo.CommunityDetailVo;
|
||||
import com.mcwl.communityCenter.domain.vo.CommunityVo;
|
||||
|
@ -25,15 +22,19 @@ import com.mcwl.communityCenter.mapper.CommunityAdviceMapper;
|
|||
import com.mcwl.communityCenter.mapper.CommunityMapper;
|
||||
import com.mcwl.communityCenter.mapper.CommunityUserMapper;
|
||||
import com.mcwl.communityCenter.service.CommunityService;
|
||||
import com.mcwl.communityCenter.service.IncomeInfoService;
|
||||
import com.mcwl.communityCenter.service.PublishService;
|
||||
import com.mcwl.myInvitation.domain.CommissionRatio;
|
||||
import com.mcwl.myInvitation.domain.Consume;
|
||||
import com.mcwl.myInvitation.mapper.ConsumeMapper;
|
||||
import com.mcwl.myInvitation.service.CommissionRatioService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
@ -58,6 +59,10 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
|
||||
private final ConsumeMapper consumeMapper;
|
||||
|
||||
private final IncomeInfoService incomeInfoService;
|
||||
|
||||
private final CommissionRatioService commissionRatioService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -142,6 +147,29 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
|
||||
sysUserService.updateUser(user);
|
||||
|
||||
|
||||
|
||||
// 从redis获取提成比例
|
||||
// 抽取社区比例
|
||||
String commissionRationCommunity = redisCache.getCacheObject("CommissionRationCommunity");
|
||||
if (Objects.isNull(commissionRationCommunity)) {
|
||||
CommissionRatio commissionRatio = commissionRatioService.lambdaQuery()
|
||||
.eq(CommissionRatio::getType, 2)
|
||||
.one();
|
||||
commissionRationCommunity = commissionRatio.getRatio().toString();
|
||||
redisCache.setCacheObject("CommissionRationCommunity", commissionRationCommunity);
|
||||
}
|
||||
|
||||
SysUser tenantUser = sysUserService.selectUserById(tenantId);
|
||||
BigDecimal getWallet = priceBigDecimal
|
||||
.multiply(new BigDecimal("1").subtract(new BigDecimal(commissionRationCommunity)));
|
||||
tenantUser.setWallet(getWallet
|
||||
.add(new BigDecimal(tenantUser.getWallet().toString()))
|
||||
.setScale(2, RoundingMode.HALF_UP)
|
||||
.doubleValue());
|
||||
sysUserService.updateUser(tenantUser);
|
||||
|
||||
|
||||
Calendar now = Calendar.getInstance();
|
||||
Date startTime = now.getTime();
|
||||
now.add(Calendar.YEAR, community.getValidityDay());
|
||||
|
@ -170,7 +198,7 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
communityAdvice.setAdviceType(AdviceConstant.COMMUNITY_NOTICE);
|
||||
communityAdvice.setUserId(tenantId);
|
||||
communityAdvice.setContent(StringUtils.format("{}加入{}社区,金币+{}",
|
||||
SecurityUtils.getLoginUser().getUser().getNickName(), community.getCommunityName(), price));
|
||||
SecurityUtils.getLoginUser().getUser().getNickName(), community.getCommunityName(), getWallet));
|
||||
communityAdviceMapper.insert(communityAdvice);
|
||||
|
||||
Consume consume = new Consume();
|
||||
|
@ -183,12 +211,20 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
|
||||
consume = new Consume();
|
||||
consume.setUserId(community.getTenantId());
|
||||
consume.setAmount(price);
|
||||
consume.setAmount(getWallet.doubleValue());
|
||||
consume.setProductId(communityId);
|
||||
consume.setType(3);
|
||||
consume.setWallet(sysUserService.selectUserById(community.getTenantId()).getWallet());
|
||||
consumeMapper.insert(consume);
|
||||
|
||||
IncomeInfo incomeInfo = new IncomeInfo();
|
||||
incomeInfo.setTenantId(tenantId);
|
||||
incomeInfo.setCommunityId(communityId);
|
||||
incomeInfo.setUserId(tenantId);
|
||||
incomeInfo.setType(0);
|
||||
incomeInfo.setAmount(getWallet.doubleValue());
|
||||
incomeInfoService.save(incomeInfo);
|
||||
|
||||
redisCache.deleteObject("communityJoinNumMap");
|
||||
|
||||
|
||||
|
@ -299,7 +335,7 @@ public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community
|
|||
|
||||
List<Community> myJoinCommunityList = baseMapper.getMyJoinCommunity(new Page<>(1, 100),
|
||||
SecurityUtils.getUserId(),
|
||||
new JoinCommunityListPageRes());
|
||||
JoinCommunityListPageRes.builder().isMyCreate(1).build());
|
||||
|
||||
Map<Long, Community> myJoinCommunityMap = myJoinCommunityList.stream()
|
||||
.collect(Collectors.toMap(Community::getId, Function.identity()));
|
||||
|
|
|
@ -49,7 +49,7 @@ public class IncomeInfoServiceImpl extends ServiceImpl<IncomeInfoMapper, IncomeI
|
|||
IncomeAmountVo questionIncome = baseMapper.questionIncome(SecurityUtils.getUserId());
|
||||
|
||||
// 累计收益
|
||||
Double totalIncome = baseMapper.totalIncome();
|
||||
Double totalIncome = baseMapper.totalIncome(SecurityUtils.getUserId());
|
||||
|
||||
IncomeInfoVo incomeInfoVo = IncomeInfoVo.builder()
|
||||
.communityIncome(communityIncome)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.communityCenter.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -41,4 +42,17 @@ public class PublishReportServiceImpl extends ServiceImpl<PublishReportMapper, P
|
|||
baseMapper.insertReport(publishReport);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo getReportList(PageDomain pageDomain) {
|
||||
Page<PublishReport> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
baseMapper.selectPage(page, new LambdaQueryWrapper<PublishReport>());
|
||||
List<PublishReport> records = page.getRecords();
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setRows(records);
|
||||
tableDataInfo.setTotal(page.getTotal());
|
||||
tableDataInfo.setCode(HttpStatus.SUCCESS);
|
||||
tableDataInfo.setMsg("查询成功");
|
||||
return tableDataInfo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.mcwl.communityCenter.domain.dto.*;
|
|||
import com.mcwl.communityCenter.domain.vo.QuestionCommentVo;
|
||||
import com.mcwl.communityCenter.domain.vo.QuestionVo;
|
||||
import com.mcwl.communityCenter.mapper.*;
|
||||
import com.mcwl.communityCenter.service.IncomeInfoService;
|
||||
import com.mcwl.communityCenter.service.QuestionCommentService;
|
||||
import com.mcwl.communityCenter.service.QuestionService;
|
||||
import com.mcwl.myInvitation.domain.Consume;
|
||||
|
@ -46,6 +47,8 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
|
|||
|
||||
private final ConsumeMapper consumeMapper;
|
||||
|
||||
private final IncomeInfoService incomeInfoService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R<Object> comment(QuestionCommentRes questionCommentRes) {
|
||||
|
@ -157,7 +160,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
|
|||
questionMapper.updateById(question);
|
||||
|
||||
|
||||
SysUser sysUser = sysUserService.selectUserById(tenantId);
|
||||
SysUser sysUser = sysUserService.selectUserById(questionComment.getUserId());
|
||||
BigDecimal sysWallet = new BigDecimal(sysUser.getWallet().toString());
|
||||
BigDecimal amount = new BigDecimal(question.getAmount().toString());
|
||||
// 添加钱包
|
||||
|
@ -167,12 +170,20 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
|
|||
|
||||
|
||||
Consume consume = new Consume();
|
||||
consume.setUserId(SecurityUtils.getUserId());
|
||||
consume.setUserId(questionComment.getUserId());
|
||||
consume.setAmount(question.getAmount());
|
||||
consume.setType(4);
|
||||
consume.setWallet(sysUser.getWallet());
|
||||
consumeMapper.insert(consume);
|
||||
|
||||
IncomeInfo incomeInfo = new IncomeInfo();
|
||||
incomeInfo.setTenantId(tenantId);
|
||||
incomeInfo.setCommunityId(communityId);
|
||||
incomeInfo.setUserId(questionComment.getUserId());
|
||||
incomeInfo.setType(1);
|
||||
incomeInfo.setAmount(question.getAmount());
|
||||
incomeInfoService.save(incomeInfo);
|
||||
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</resultMap>
|
||||
<update id="quitCommunity">
|
||||
update cc_community_user
|
||||
set del_flag = '1'
|
||||
set del_flag = '2'
|
||||
where tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and user_id = #{userId}
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
<update id="deleteCommunity">
|
||||
update cc_community
|
||||
set del_flag = '1'
|
||||
set del_flag = '2'
|
||||
where tenant_id = #{tenantId}
|
||||
and id = #{communityId}
|
||||
and del_flag = '0';
|
||||
|
@ -47,6 +47,8 @@
|
|||
select cu.community_id as id, COALESCE(count(*), 0) as join_num
|
||||
from cc_community_user cu
|
||||
where cu.del_flag = '0'
|
||||
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))
|
||||
group by cu.community_id
|
||||
</select>
|
||||
|
||||
|
@ -102,6 +104,8 @@
|
|||
and (c.community_name like concat('%', #{joinCommunityListPageRes.searchContent}, '%')
|
||||
or c.description like concat('%', #{joinCommunityListPageRes.searchContent}, '%'))
|
||||
</if>
|
||||
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))
|
||||
</select>
|
||||
<select id="getCommunity" resultType="com.mcwl.communityCenter.domain.Community">
|
||||
select *
|
||||
|
|
|
@ -103,7 +103,6 @@
|
|||
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 (black_end_time is null or NOW() >= black_end_time)
|
||||
and del_flag = '0';
|
||||
</select>
|
||||
<select id="getAllCommunityUser" resultType="com.mcwl.communityCenter.domain.CommunityUser">
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
SELECT SUM(IF(DATE(create_time) = CURDATE(), amount, 0)) AS today_income,
|
||||
SUM(IF(DATE(create_time) = CURDATE() - INTERVAL 1 DAY, amount, 0)) AS yesterday_income
|
||||
FROM cc_income_info
|
||||
WHERE tenant_id = #{userId}
|
||||
WHERE user_id = #{userId}
|
||||
AND type = 0
|
||||
AND del_flag = '0'
|
||||
</select>
|
||||
|
@ -18,14 +18,14 @@
|
|||
SELECT SUM(IF(DATE(create_time) = CURDATE(), amount, 0)) AS today_income,
|
||||
SUM(IF(DATE(create_time) = CURDATE() - INTERVAL 1 DAY, amount, 0)) AS yesterday_income
|
||||
FROM cc_income_info
|
||||
WHERE tenant_id = #{userId}
|
||||
WHERE user_id = #{userId}
|
||||
AND type = 1
|
||||
AND del_flag = '0'
|
||||
</select>
|
||||
<select id="totalIncome" resultType="java.lang.Double">
|
||||
SELECT SUM(amount)
|
||||
FROM cc_income_info
|
||||
WHERE del_flag = '0'
|
||||
WHERE del_flag = '0' and user_id = #{userId}
|
||||
</select>
|
||||
<select id="incomeList" resultType="com.mcwl.communityCenter.domain.vo.IncomeInfoListVo">
|
||||
SELECT u.nick_name as user_name,
|
||||
|
@ -39,7 +39,7 @@
|
|||
on ii.tenant_id = c.tenant_id
|
||||
and ii.community_id = c.id
|
||||
left join sys_user u on c.tenant_id = u.user_id
|
||||
where ii.tenant_id = #{userId}
|
||||
where ii.user_id = #{userId}
|
||||
<if test="incomeInfoListPageRes.type != null ">
|
||||
and ii.type = #{incomeInfoListPageRes.type}
|
||||
</if>
|
||||
|
|
|
@ -34,6 +34,10 @@ public class CommissionRatio extends BaseEntity {
|
|||
* 类型 0邀请人-被邀请人 1公司-商家
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class CommissionRatioVo {
|
|||
*/
|
||||
private Double ratio;
|
||||
/**
|
||||
* 提成类型,平台手续费、邀请人提成
|
||||
* 提成类型,平台手续费、邀请人提成、星球手续费
|
||||
*/
|
||||
private String ratioName;
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ public class CommissionRatioServiceImpl extends ServiceImpl<CommissionRatioMappe
|
|||
|
||||
redisCache.deleteObject("CommissionRationInviterUser");
|
||||
redisCache.deleteObject("CommissionRationMerchant");
|
||||
redisCache.deleteObject("CommissionRationCommunity");
|
||||
|
||||
return this.getCommissionRatioVo(commissionRatio);
|
||||
}
|
||||
|
@ -66,11 +67,7 @@ public class CommissionRatioServiceImpl extends ServiceImpl<CommissionRatioMappe
|
|||
private CommissionRatioVo getCommissionRatioVo(CommissionRatio commissionRatio) {
|
||||
CommissionRatioVo vo = new CommissionRatioVo();
|
||||
BeanUtil.copyProperties(commissionRatio, vo);
|
||||
if (commissionRatio.getType() == 0) {
|
||||
vo.setRatioName("平台手续费");
|
||||
} else if (commissionRatio.getType() == 1) {
|
||||
vo.setRatioName("邀请人提成");
|
||||
}
|
||||
vo.setRatioName(commissionRatio.getDescription());
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue