crm功能开发
This commit is contained in:
parent
9409bbd6d2
commit
048ec0d0be
@ -101,7 +101,7 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
busiNoticeVoIPage.getRecords().forEach(item->{
|
||||
try {
|
||||
item.setUserNickName(userService.selectUserById(item.getUserId()).getNickName());
|
||||
MemberUserVO memberUserVO = memberUserService.queryByUserId(item.getUserId(), "01");
|
||||
MemberUserVO memberUserVO = memberUserService.queryByUserIdEasy(item.getUserId(), "01");
|
||||
item.setIdentityType(memberUserVO.getIdentityType());
|
||||
LambdaQueryWrapper<BusiNoticeSign> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BusiNoticeSign::getNoticeId,item.getId());
|
||||
@ -158,7 +158,11 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
data.setApprovalStatus("1");
|
||||
data.setApprovalUserId(null);
|
||||
data.setApprovalTime(new Date());
|
||||
if (StringUtils.isNotEmpty(data.getThirdUrl())){
|
||||
if (data.getEndDate().before(new Date())){
|
||||
data.setApprovalStatus("8");
|
||||
result.put("code",500);
|
||||
result.put("msg","截至时间不能早于当前时间!");
|
||||
} else if (StringUtils.isNotEmpty(data.getThirdUrl())){
|
||||
//如果以问号或eid=结尾驳回
|
||||
if (data.getThirdUrl().endsWith("eid=") || data.getThirdUrl().endsWith("?")){
|
||||
data.setApprovalStatus("8");
|
||||
@ -265,25 +269,53 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
result.put("code",100);
|
||||
result.put("msg","草稿数据暂存成功");
|
||||
}else {
|
||||
//判断 内容重复度 是否大于70%
|
||||
//先获取 当前系统中截止日期之前的
|
||||
LambdaQueryWrapper<BusiNotice> queryWrapper =new LambdaQueryWrapper<>();
|
||||
queryWrapper.gt(BusiNotice::getEndDate, DateUtil.format(new Date(),"yyyy-MM-dd")).eq(BusiNotice::getApprovalStatus,1)
|
||||
.ne(BusiNotice::getId,data.getId());
|
||||
List<BusiNotice> list = this.list(queryWrapper);
|
||||
//无问题数据直接审核通过
|
||||
data.setApprovalStatus("1");
|
||||
data.setApprovalUserId(null);
|
||||
data.setApprovalTime(new Date());
|
||||
if (data.getEndDate().before(new Date())){
|
||||
data.setApprovalStatus("8");
|
||||
result.put("code",500);
|
||||
result.put("msg","截至时间不能早于当前时间!");
|
||||
} else if (StringUtils.isNotEmpty(data.getThirdUrl())){
|
||||
//如果以问号或eid=结尾驳回
|
||||
if (data.getThirdUrl().endsWith("eid=") || data.getThirdUrl().endsWith("?")){
|
||||
data.setApprovalStatus("8");
|
||||
result.put("code",500);
|
||||
result.put("msg","第三方链接格式非法!");
|
||||
}else{
|
||||
//判断 内容重复度 是否大于70%
|
||||
//先获取 当前系统中截止日期之前的
|
||||
LambdaQueryWrapper<BusiNotice> queryWrapper =new LambdaQueryWrapper<>();
|
||||
queryWrapper.gt(BusiNotice::getEndDate, DateUtil.format(new Date(),"yyyy-MM-dd")).eq(BusiNotice::getApprovalStatus,1).ne(BusiNotice::getId,data.getId());
|
||||
List<BusiNotice> list = this.list(queryWrapper);
|
||||
//遍历 list的每条数据与data对比,如果两条数据相似度大于70% 提出预警
|
||||
for (BusiNotice busiNotice : list) {
|
||||
//过滤掉换行和空格符
|
||||
if (StringUtils.isNotEmpty(data.getThirdUrl())&&StringUtils.isNotEmpty(busiNotice.getThirdUrl())){
|
||||
if (data.getThirdUrl().equals(busiNotice.getThirdUrl())){
|
||||
//title 和 detail 相似度大于70% 待审核
|
||||
if (data.getThirdUrl().replaceAll("\\s*|\t|\r|\n","").equals(busiNotice.getThirdUrl().replaceAll("\\s*|\t|\r|\n",""))){
|
||||
//两条thirdurl相等
|
||||
data.setApprovalStatus("8");
|
||||
data.setSimilarityIds(Optional.ofNullable(data.getSimilarityIds()).orElse("")+busiNotice.getId()+",");
|
||||
result.put("code",500);
|
||||
result.put("msg","通告查重,下次早点上传哦!");
|
||||
}else if (busiNotice.getThirdUrl().replaceAll("\\s*|\t|\r|\n","").contains(data.getThirdUrl().replaceAll("\\s*|\t|\r|\n",""))||data.getThirdUrl().replaceAll("\\s*|\t|\r|\n","").contains(busiNotice.getThirdUrl().replaceAll("\\s*|\t|\r|\n",""))){
|
||||
//两条thirdurl存在包含情况
|
||||
data.setApprovalStatus("8");
|
||||
data.setSimilarityIds(Optional.ofNullable(data.getSimilarityIds()).orElse("")+busiNotice.getId()+",");
|
||||
result.put("code",500);
|
||||
result.put("msg","通告查重,下次早点上传哦!");
|
||||
}else if (isEidEqual(data.getThirdUrl().replaceAll("\\s*|\t|\r|\n",""),busiNotice.getThirdUrl().replaceAll("\\s*|\t|\r|\n",""))){
|
||||
//两条thirdurl都存在eid且eid相等
|
||||
data.setApprovalStatus("8");
|
||||
data.setSimilarityIds(Optional.ofNullable(data.getSimilarityIds()).orElse("")+busiNotice.getId()+",");
|
||||
result.put("code",500);
|
||||
result.put("msg","通告查重,下次早点上传哦!");
|
||||
}
|
||||
if (data.getApprovalStatus().equals("8")){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,11 +15,14 @@ import com.ruoyi.common.utils.DateUtils;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.member.domain.MemberPoints;
|
||||
import com.ruoyi.member.service.IMemberCardService;
|
||||
import com.ruoyi.member.service.IMemberPointsService;
|
||||
import com.ruoyi.member.service.IMemberUserService;
|
||||
import com.ruoyi.member.vo.MemberUserVO;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -49,6 +52,10 @@ public class BusiNoticeSignServiceImpl extends ServiceImpl<BusiNoticeSignMapper,
|
||||
private BusiNoticeMapper noticeMapper;
|
||||
@Autowired
|
||||
private IMemberUserService memberUserService;
|
||||
@Autowired
|
||||
private ISysConfigService sysConfigService;
|
||||
@Autowired
|
||||
private IMemberPointsService memberPointsService;
|
||||
|
||||
@Override
|
||||
public IPage<BusiNoticeSign> queryListPage(BusiNoticeSign pageReqVO, Page<BusiNoticeSign> page) {
|
||||
@ -106,6 +113,27 @@ public class BusiNoticeSignServiceImpl extends ServiceImpl<BusiNoticeSignMapper,
|
||||
busiNoticeSign.setAddrId(appNoticeSign.getAddressId());
|
||||
busiNoticeSignMapper.insert(busiNoticeSign);
|
||||
}
|
||||
//处理优质通告积分赠送
|
||||
try {
|
||||
MemberUserVO tgz = memberUserService.queryByUserId(busiNotice.getUserId(), "01");
|
||||
if (StringUtils.isNotEmpty(tgz.getIdentityType()) && tgz.getIdentityType().equals("05")) {
|
||||
//判断距离通告发布24小时内报名人数是否达到50人
|
||||
if (noticeMapper.selectCount(new LambdaQueryWrapper<BusiNotice>().eq(BusiNotice::getId, appNoticeSign.getNoticeId()).ge(BusiNotice::getCreateTime, DateUtils.getNowDate().getTime() - 86400000)) == 50) {
|
||||
String point = sysConfigService.selectConfigByKey("goodNotice");
|
||||
if (StringUtils.isNotEmpty(point) && Integer.parseInt(point) > 0) {
|
||||
MemberPoints memberPoints = new MemberPoints();
|
||||
memberPoints.setUserId(busiNotice.getUserId());
|
||||
memberPoints.setPoints(Integer.parseInt(point));
|
||||
memberPoints.setType("1");
|
||||
memberPoints.setTitle("发布优质通告:" + busiNotice.getTitle() + ",奖励" + Integer.parseInt(point) + "积分");
|
||||
memberPointsService.savePoints(memberPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("优质通告积分赠送失败",e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -64,6 +64,8 @@ public interface IMemberUserService extends IService<MemberUser> {
|
||||
**/
|
||||
MemberUserVO queryByUserId(Long userId,String userType);
|
||||
|
||||
MemberUserVO queryByUserIdEasy(Long userId,String userType);
|
||||
|
||||
/**
|
||||
* 微信授权登陆
|
||||
*
|
||||
|
||||
@ -2,6 +2,7 @@ package com.ruoyi.member.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -28,11 +29,13 @@ import com.ruoyi.constant.DictConstants;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.member.domain.MemberCard;
|
||||
import com.ruoyi.member.domain.MemberOrder;
|
||||
import com.ruoyi.member.domain.MemberPoints;
|
||||
import com.ruoyi.member.domain.MemberUser;
|
||||
import com.ruoyi.member.mapper.MemberUserMapper;
|
||||
import com.ruoyi.member.service.*;
|
||||
import com.ruoyi.member.vo.MemberUserVO;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@ -88,6 +91,12 @@ public class MemberUserServiceImpl extends ServiceImpl<MemberUserMapper, MemberU
|
||||
private ISysRoleService roleService;
|
||||
@Autowired
|
||||
private IMemberOrderService orderService;
|
||||
@Autowired
|
||||
private IMemberPointsService memberPointsService;
|
||||
@Autowired
|
||||
private ISysConfigService sysConfigService;
|
||||
@Autowired
|
||||
private IMemberUserService memberUserService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
@ -240,6 +249,23 @@ public class MemberUserServiceImpl extends ServiceImpl<MemberUserMapper, MemberU
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过用户id查询用户详情信息
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param userType userType
|
||||
* @return com.ruoyi.member.vo.MemberUserVO
|
||||
* @author PQZ
|
||||
* @date 11:40 2025/4/9
|
||||
**/
|
||||
@Override
|
||||
public MemberUserVO queryByUserIdEasy(Long userId, String userType) {
|
||||
//博主,通告主基本信息
|
||||
|
||||
return memberUserMapper.queryByUserId(userId, userType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 微信授权登陆
|
||||
*
|
||||
@ -283,6 +309,24 @@ public class MemberUserServiceImpl extends ServiceImpl<MemberUserMapper, MemberU
|
||||
user.setInviteId(inviteId);
|
||||
//新增 用户
|
||||
userMapper.insertUser(user);
|
||||
if (ObjectUtil.isNotEmpty(inviteId)) {
|
||||
MemberUserVO tgz = memberUserService.queryByUserId(inviteId, "01");
|
||||
if (StringUtils.isNotEmpty(tgz.getIdentityType()) && tgz.getIdentityType().equals("05")) {
|
||||
try {
|
||||
String point = sysConfigService.selectConfigByKey("inviteUser");
|
||||
if (StringUtils.isNotEmpty(point) && Integer.parseInt(point) > 0) {
|
||||
MemberPoints memberPoints = new MemberPoints();
|
||||
memberPoints.setUserId(inviteId);
|
||||
memberPoints.setPoints(Integer.parseInt(point));
|
||||
memberPoints.setType("1");
|
||||
memberPoints.setTitle("邀请新用户:" + phone + ",得" + Integer.parseInt(point) + "积分");
|
||||
memberPointsService.savePoints(memberPoints);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("邀请用户积分异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//插入用户扩展信息表数据
|
||||
this.save(new MemberUser(DictConstants.USER_TYPE_TGZ,user,dlRightsConfig.getAddNotice()));
|
||||
this.save(new MemberUser(DictConstants.USER_TYPE_BZ,user,null));
|
||||
|
||||
@ -12,17 +12,17 @@
|
||||
main.approval_remark, main.creator, main.create_time, main.updater, main.update_time, main.del_flag,main.is_platform_free,main.is_urgent,main.similarity_ids,
|
||||
bTable.title as platformName,main.third_url
|
||||
from dl_busi_notice main
|
||||
left join dl_base_category bTable on main.platform_code = bTable.code
|
||||
<if test="entity.userNickName != null ">
|
||||
left join sys_user uTable on uTable.user_id = main.user_id
|
||||
left join dl_base_category bTable on main.platform_code = bTable.code and bTable.del_flag = 0
|
||||
<if test="entity.userNickName != null and entity.userNickName != ''">
|
||||
left join sys_user uTable on uTable.user_id = main.user_id and uTable.del_flag = '0'
|
||||
</if>
|
||||
<where>
|
||||
main.del_flag = '0'
|
||||
<if test="entity.id != null "> and main.id = #{entity.id}</if>
|
||||
<if test="entity.userNickName != null "> and uTable.nick_name like concat('%', #{entity.userNickName}, '%')</if>
|
||||
main.del_flag = 0
|
||||
<if test="entity.id != null and entity.id != ''"> and main.id = #{entity.id}</if>
|
||||
<if test="entity.userNickName != null and entity.userNickName != ''"> and uTable.nick_name like concat('%', #{entity.userNickName}, '%')</if>
|
||||
<if test="entity.userId != null"> and main.user_id = #{entity.userId}</if>
|
||||
<if test="entity.province != null "> and main.province = #{entity.province}</if>
|
||||
<if test="entity.city != null "> and main.city = #{entity.city}</if>
|
||||
<if test="entity.province != null and entity.province != ''"> and main.province = #{entity.province}</if>
|
||||
<if test="entity.city != null and entity.city != ''"> and main.city = #{entity.city}</if>
|
||||
<if test="entity.thirdUrl != null and entity.thirdUrl == '01'"> and (main.third_url is not null and main.third_url != '')</if>
|
||||
<if test="entity.thirdUrl != null and entity.thirdUrl == '02'"> and (main.third_url is null or main.third_url = '')</if>
|
||||
<if test="entity.params.thirdUrl != null and entity.params.thirdUrl != ''"> and (main.third_url like concat('%', #{entity.params.thirdUrl}, '%'))</if>
|
||||
@ -59,10 +59,13 @@
|
||||
<if test="entity.bloggerTypes != null and entity.bloggerTypes != ''"> and main.blogger_types = #{entity.bloggerTypes}</if>
|
||||
<if test="entity.isUseCoupon != null"> and main.is_use_coupon = #{entity.isUseCoupon}</if>
|
||||
<if test="entity.approvalStatus != null and entity.approvalStatus != ''"> and main.approval_status = #{entity.approvalStatus}</if>
|
||||
<if test="entity.params.beginCreateTime != null and entity.params.beginCreateTime != '' and entity.params.endCreateTime != null and entity.params.endCreateTime != ''"> and main.create_time between #{entity.params.beginCreateTime} and #{entity.params.endCreateTime}</if>
|
||||
<if test="entity.params.beginCreateTime != null and entity.params.beginCreateTime != '' and entity.params.endCreateTime != null and entity.params.endCreateTime != ''">
|
||||
and main.create_time between #{entity.params.beginCreateTime} and #{entity.params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
order by FIELD(main.approval_status,0,1,9,2) asc, main.create_time desc
|
||||
order by FIELD(main.approval_status,'0','1','9','2') asc, main.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="queryListByUserId" resultType="com.ruoyi.busi.vo.BusiNoticeVo">
|
||||
SELECT
|
||||
main.*,
|
||||
@ -78,37 +81,40 @@ order by dbns.create_time desc
|
||||
<select id="queryAppListPage" resultType="com.ruoyi.busi.vo.BusiNoticeVo">
|
||||
SELECT
|
||||
dbn.*,
|
||||
-- dbnv.view_num AS viewNum,
|
||||
su.avatar,
|
||||
su.nick_name AS userNickName
|
||||
-- count(sign.id) as reportNum
|
||||
FROM
|
||||
dl_busi_notice dbn
|
||||
-- LEFT JOIN dl_busi_notice_view dbnv ON dbn.id = dbnv.id
|
||||
LEFT JOIN sys_user su ON dbn.user_id = su.user_id
|
||||
-- left join dl_busi_notice_sign sign on sign.notice_id = dbn.id and sign.del_flag = 0
|
||||
LEFT JOIN sys_user su ON dbn.user_id = su.user_id AND su.del_flag = 0
|
||||
<if test="entity.userId!=null and entity.userId!=''">
|
||||
left join dl_member_blacklist blacklist on blacklist.black_user_id = dbn.user_id and blacklist.del_flag = 0 and blacklist.user_id = #{entity.userId}
|
||||
LEFT JOIN dl_member_blacklist blacklist ON blacklist.black_user_id = dbn.user_id
|
||||
AND blacklist.del_flag = 0
|
||||
AND blacklist.user_id = #{entity.userId}
|
||||
</if>
|
||||
WHERE
|
||||
dbn.del_flag = 0 and dbn.end_date >= CURDATE()
|
||||
AND (dbn.approval_status = '1')
|
||||
dbn.del_flag = 0
|
||||
AND dbn.end_date >= CURDATE()
|
||||
AND dbn.approval_status = '1'
|
||||
<if test="entity.userId!=null and entity.userId!=''">
|
||||
and blacklist.id is null
|
||||
AND blacklist.id IS NULL
|
||||
</if>
|
||||
<if test="entity.gift!=null and entity.gift!=''">
|
||||
AND (( dbn.fee_down is null or dbn.fee_down = 0 ) and dbn.fee_up = 0)
|
||||
AND ((dbn.fee_down IS NULL OR dbn.fee_down = 0) AND dbn.fee_up = 0)
|
||||
</if>
|
||||
<if test="entity.cityName!=null and entity.cityName!=''">
|
||||
AND dbn.city = #{entity.cityName}
|
||||
</if>
|
||||
<if test="entity.platformCode!=null and entity.platformCode!=''">
|
||||
AND ( dbn.platform_code =#{entity.platformCode} )
|
||||
AND dbn.platform_code = #{entity.platformCode}
|
||||
</if>
|
||||
<if test="entity.isUrgent != null and entity.isUrgent != ''">
|
||||
AND dbn.is_urgent = #{entity.isUrgent}
|
||||
</if>
|
||||
<if test="entity.isPlatformFree != null and entity.isPlatformFree != ''">
|
||||
AND dbn.is_platform_free = #{entity.isPlatformFree}
|
||||
</if>
|
||||
<if test="entity.isUrgent != null and entity.isUrgent != ''"> and dbn.is_urgent = #{entity.isUrgent}</if>
|
||||
<if test="entity.isPlatformFree != null and entity.isPlatformFree != ''"> and dbn.is_platform_free = #{entity.isPlatformFree}</if>
|
||||
<if test="entity.bloggerType!=null and entity.bloggerType!=''">
|
||||
AND ( dbn.blogger_types LIKE CONCAT('%',#{entity.bloggerType},'%') )
|
||||
AND dbn.blogger_types LIKE CONCAT('%',#{entity.bloggerType},'%')
|
||||
</if>
|
||||
<if test="entity.searchValue!=null and entity.searchValue!=''">
|
||||
AND (dbn.title LIKE CONCAT('%',#{entity.searchValue},'%') OR
|
||||
@ -118,15 +124,13 @@ order by dbns.create_time desc
|
||||
AND (dbn.fee_down IS NOT NULL OR dbn.fee_up IS NOT NULL)
|
||||
</if>
|
||||
<if test="entity.rewardType=='gift'">
|
||||
AND ( dbn.have_gift = '1' )
|
||||
AND dbn.have_gift = '1'
|
||||
</if>
|
||||
<choose>
|
||||
<!-- 情况一:同时填写了下限和上限 -->
|
||||
<when test="entity.fansDown != null and entity.fansUp != null">
|
||||
AND (
|
||||
dbn.fans_down <![CDATA[ <= ]]> #{entity.fansUp}
|
||||
AND (dbn.fans_up IS NULL OR dbn.fans_up >= #{entity.fansDown})
|
||||
)
|
||||
AND (dbn.fans_down <![CDATA[ <= ]]> #{entity.fansUp}
|
||||
AND (dbn.fans_up IS NULL OR dbn.fans_up >= #{entity.fansDown}))
|
||||
</when>
|
||||
|
||||
<!-- 情况二:只填写了下限 -->
|
||||
@ -143,10 +147,8 @@ order by dbns.create_time desc
|
||||
<choose>
|
||||
<!-- 情况一:同时填写了下限和上限 -->
|
||||
<when test="entity.feeDown != null and entity.feeUp != null">
|
||||
AND (
|
||||
dbn.fee_down <![CDATA[ <= ]]> #{entity.feeUp}
|
||||
AND (dbn.fee_up IS NULL OR dbn.fee_up >= #{entity.feeDown})
|
||||
)
|
||||
AND (dbn.fee_down <![CDATA[ <= ]]> #{entity.feeUp}
|
||||
AND (dbn.fee_up IS NULL OR dbn.fee_up >= #{entity.feeDown}))
|
||||
</when>
|
||||
|
||||
<!-- 情况二:只填写了下限 -->
|
||||
@ -159,25 +161,21 @@ order by dbns.create_time desc
|
||||
AND dbn.fee_down <![CDATA[ <= ]]> #{entity.feeUp}
|
||||
</when>
|
||||
</choose>
|
||||
|
||||
group by dbn.id
|
||||
ORDER BY
|
||||
<choose>
|
||||
<when test="entity.sortBy=='new'">
|
||||
-- 查最新的 --
|
||||
dbn.create_time DESC
|
||||
</when>
|
||||
<when test="entity.sortBy=='money'">
|
||||
-- 查高奖励 --
|
||||
dbn.fee_up DESC
|
||||
</when>
|
||||
<otherwise>
|
||||
-- 默认正序排列 --
|
||||
dbn.create_time DESC
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectByIdVo" resultType="com.ruoyi.busi.vo.BusiNoticeVo">
|
||||
select main.*,
|
||||
uTable.nick_name as userNickName,ifnull(noticeView.view_num,0) as viewNum,
|
||||
@ -250,15 +248,13 @@ order by dbns.create_time desc
|
||||
<select id="subscribeList" resultType="com.ruoyi.busi.vo.BusiNoticeVo">
|
||||
SELECT
|
||||
dbn.*,
|
||||
-- dbnv.view_num AS viewNum,
|
||||
su.avatar,
|
||||
su.nick_name AS userNickName,
|
||||
count(sign.id) as reportNum
|
||||
(SELECT COUNT(1) FROM dl_busi_notice_sign sign
|
||||
WHERE sign.notice_id = dbn.id AND sign.del_flag = 0) as reportNum
|
||||
FROM
|
||||
dl_busi_notice dbn
|
||||
-- LEFT JOIN dl_busi_notice_view dbnv ON dbn.id = dbnv.id
|
||||
LEFT JOIN sys_user su ON dbn.user_id = su.user_id
|
||||
left join dl_busi_notice_sign sign on sign.notice_id = dbn.id and sign.del_flag = 0
|
||||
WHERE
|
||||
dbn.del_flag = 0
|
||||
AND (dbn.approval_status = '1')
|
||||
@ -266,76 +262,73 @@ order by dbns.create_time desc
|
||||
<if test="entity.platformCode!=null and entity.platformCode.size>0">
|
||||
and dbn.platform_code IN
|
||||
<foreach collection="entity.platformCode" item="it" open="(" close=")" separator=",">
|
||||
-- platform_code 包含it
|
||||
#{it}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="entity.bloggerTypeCode!=null and entity.bloggerTypeCode.size>0">
|
||||
and
|
||||
<foreach collection="entity.bloggerTypeCode" item="it" open="(" close=")" separator="or">
|
||||
and (
|
||||
<foreach collection="entity.bloggerTypeCode" item="it" separator=" OR ">
|
||||
dbn.blogger_types like concat('%',#{it},'%')
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="entity.settleTypeCode!=null and entity.settleTypeCode!=''">
|
||||
and dbn.is_platform_free = #{entity.settleTypeCode}
|
||||
</if>
|
||||
|
||||
<if test="entity.keywordsList!=null and entity.keywordsList.size>0 ">
|
||||
and
|
||||
<foreach collection="entity.keywordsList" item="it" open="(" close=")" separator="or">
|
||||
title like concat('%',#{it},'%') or detail like concat('%',#{it},'%') or brand like concat('%',#{it},'%')
|
||||
and (
|
||||
<foreach collection="entity.keywordsList" item="it" separator=" OR ">
|
||||
(title like concat('%',#{it},'%') or detail like concat('%',#{it},'%') or brand like concat('%',#{it},'%'))
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="entity.fansUp!=null">
|
||||
AND ( dbn.fans_up <=#{entity.fansUp} )
|
||||
AND dbn.fans_up <=#{entity.fansUp}
|
||||
</if>
|
||||
<if test="entity.fansDown!=null">
|
||||
AND ( dbn.fans_up >=#{entity.fansDown} )
|
||||
AND dbn.fans_up >=#{entity.fansDown}
|
||||
</if>
|
||||
<if test="entity.feeUp!=null">
|
||||
AND ( dbn.fee_up <=#{entity.feeUp} )
|
||||
AND dbn.fee_up <=#{entity.feeUp}
|
||||
</if>
|
||||
<if test="entity.feeDown!=null">
|
||||
AND ( dbn.fee_down >=#{entity.feeDown} )
|
||||
AND dbn.fee_down >=#{entity.feeDown}
|
||||
</if>
|
||||
<if test="entity.isUrgent != null and entity.isUrgent != ''"> and dbn.is_urgent = #{entity.isUrgent}</if>
|
||||
<if test="entity.isPlatformFree != null and entity.isPlatformFree != ''"> and dbn.is_platform_free = #{entity.isPlatformFree}</if>
|
||||
group by dbn.id
|
||||
ORDER BY
|
||||
|
||||
-- 默认正序排列 --
|
||||
dbn.create_time DESC
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
<select id="loveList" resultType="com.ruoyi.busi.vo.BusiNoticeVo">
|
||||
SELECT
|
||||
dbn.*,
|
||||
-- dbnv.view_num AS viewNum,
|
||||
su.avatar,
|
||||
su.nick_name AS userNickName,
|
||||
count(sign.id) as reportNum
|
||||
su.nick_name AS userNickName
|
||||
FROM
|
||||
dl_busi_notice dbn
|
||||
-- LEFT JOIN dl_busi_notice_view dbnv ON dbn.id = dbnv.id
|
||||
INNER JOIN dl_busi_user_love love ON dbn.user_id = love.love_user_id AND love.user_id = #{entity.userId}
|
||||
LEFT JOIN sys_user su ON dbn.user_id = su.user_id
|
||||
inner join dl_busi_user_love love on dbn.user_id = love.love_user_id and love.user_id = #{entity.userId}
|
||||
left join dl_busi_notice_sign sign on sign.notice_id = dbn.id and sign.del_flag = 0
|
||||
|
||||
WHERE
|
||||
dbn.del_flag = 0
|
||||
AND (dbn.approval_status = '1')
|
||||
and dbn.end_date >= CURDATE()
|
||||
group by dbn.id
|
||||
AND dbn.approval_status = '1'
|
||||
AND dbn.end_date >= CURDATE()
|
||||
ORDER BY
|
||||
dbn.create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="myNoticeList" resultType="com.ruoyi.busi.vo.BusiNoticeVo">
|
||||
SELECT
|
||||
dbn.*,
|
||||
-- dbnv.view_num AS viewNum,
|
||||
su.avatar,
|
||||
su.nick_name AS userNickName,
|
||||
count(sign.id) as reportNum,
|
||||
(SELECT COUNT(1) FROM dl_busi_notice_sign sign
|
||||
WHERE sign.notice_id = dbn.id AND sign.del_flag = 0) as reportNum,
|
||||
mySign.create_time as signTime,
|
||||
card.account_name as cardName,
|
||||
CASE
|
||||
@ -348,14 +341,12 @@ order by dbns.create_time desc
|
||||
mySign.id as signId
|
||||
FROM
|
||||
dl_busi_notice dbn
|
||||
-- LEFT JOIN dl_busi_notice_view dbnv ON dbn.id = dbnv.id
|
||||
LEFT JOIN sys_user su ON dbn.user_id = su.user_id
|
||||
LEFT join dl_busi_notice_sign sign on sign.notice_id = dbn.id and sign.del_flag = 0
|
||||
inner join dl_busi_notice_sign mySign on dbn.id = mySign.notice_id and dbn.del_flag = 0 and mySign.user_id = #{entity.userId}
|
||||
inner join dl_member_busi_card card on card.id = mySign.card_id and card.del_flag = 0
|
||||
INNER JOIN dl_busi_notice_sign mySign ON dbn.id = mySign.notice_id AND mySign.user_id = #{entity.userId}
|
||||
INNER JOIN dl_member_busi_card card ON card.id = mySign.card_id AND card.del_flag = 0
|
||||
WHERE
|
||||
dbn.del_flag = 0
|
||||
AND (dbn.approval_status = '1')
|
||||
AND dbn.approval_status = '1'
|
||||
<if test="entity.searchValue!=null and entity.searchValue!=''">
|
||||
AND (dbn.title LIKE CONCAT('%',#{entity.searchValue},'%') OR
|
||||
dbn.detail LIKE CONCAT('%',#{entity.searchValue},'%'))
|
||||
@ -363,28 +354,27 @@ order by dbns.create_time desc
|
||||
<if test="entity.reportStatus!=null and entity.reportStatus!=''">
|
||||
<choose>
|
||||
<when test="entity.reportStatus=='审核中'">
|
||||
and mySign.status ='01' and dbn.end_date >= CURDATE()
|
||||
AND mySign.status ='01' AND dbn.end_date >= CURDATE()
|
||||
</when>
|
||||
<when test="entity.reportStatus=='已通过'">
|
||||
and mySign.status ='02'
|
||||
AND mySign.status ='02'
|
||||
</when>
|
||||
<when test="entity.reportStatus=='未合作'">
|
||||
and mySign.status ='01' and dbn.end_date < CURDATE()
|
||||
AND mySign.status ='01' AND dbn.end_date < CURDATE()
|
||||
</when>
|
||||
|
||||
</choose>
|
||||
</if>
|
||||
group by dbn.id,mySign.id
|
||||
ORDER BY
|
||||
dbn.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="myPublishNoticeList" resultType="com.ruoyi.busi.vo.BusiNoticeVo">
|
||||
SELECT
|
||||
dbn.*,
|
||||
-- dbnv.view_num AS viewNum,
|
||||
su.avatar,
|
||||
su.nick_name AS userNickName,
|
||||
count(sign.id) as reportNum,
|
||||
(SELECT COUNT(1) FROM dl_busi_notice_sign sign
|
||||
WHERE sign.notice_id = dbn.id AND sign.del_flag = 0) as reportNum,
|
||||
CASE
|
||||
WHEN dbn.end_date < CURDATE() THEN '已关闭'
|
||||
WHEN dbn.approval_status = '0' THEN '审核中'
|
||||
@ -395,11 +385,9 @@ order by dbns.create_time desc
|
||||
END AS reportStatusText
|
||||
FROM
|
||||
dl_busi_notice dbn
|
||||
-- LEFT JOIN dl_busi_notice_view dbnv ON dbn.id = dbnv.id
|
||||
LEFT JOIN sys_user su ON dbn.user_id = su.user_id
|
||||
LEFT join dl_busi_notice_sign sign on sign.notice_id = dbn.id and sign.del_flag = 0
|
||||
WHERE
|
||||
dbn.del_flag = 0 and dbn.approval_status !=8 and dbn.user_id = #{entity.userId}
|
||||
dbn.del_flag = 0 AND dbn.approval_status != '8' AND dbn.user_id = #{entity.userId}
|
||||
<if test="entity.searchValue!=null and entity.searchValue!=''">
|
||||
AND (dbn.title LIKE CONCAT('%',#{entity.searchValue},'%') OR
|
||||
dbn.detail LIKE CONCAT('%',#{entity.searchValue},'%'))
|
||||
@ -407,19 +395,19 @@ order by dbns.create_time desc
|
||||
<if test="entity.status!=null and entity.status!=''">
|
||||
<choose>
|
||||
<when test="entity.status=='进行中'">
|
||||
and dbn.approval_status !='2' and dbn.end_date >= CURDATE()
|
||||
AND dbn.approval_status != '2' AND dbn.end_date >= CURDATE()
|
||||
</when>
|
||||
<when test="entity.status=='已关闭'">
|
||||
and (dbn.approval_status ='2' or dbn.end_date < CURDATE())
|
||||
AND (dbn.approval_status = '2' OR dbn.end_date < CURDATE())
|
||||
</when>
|
||||
<when test="entity.status=='审核通过'">
|
||||
and (dbn.approval_status ='1' or dbn.end_date < CURDATE())
|
||||
AND (dbn.approval_status = '1' OR dbn.end_date < CURDATE())
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
group by dbn.id
|
||||
ORDER BY
|
||||
dbn.create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -19,45 +19,69 @@
|
||||
</sql>
|
||||
<select id="getOkUser" resultType="com.alibaba.fastjson2.JSONObject"
|
||||
parameterType="com.ruoyi.busi.vo.SubscribeDataObj">
|
||||
SELECT
|
||||
distinct su.wx_open_id as wxOpenId,
|
||||
SELECT DISTINCT
|
||||
su.wx_open_id as wxOpenId,
|
||||
sub.keywords_list as keywordsList,
|
||||
'0' as allOk
|
||||
FROM
|
||||
dl_busi_subscribe sub
|
||||
inner join sys_user su on sub.user_id = su.user_id and su.wx_open_id is not null
|
||||
where sub.new_notice = '1' and sub.del_flag ='0'
|
||||
INNER JOIN sys_user su ON sub.user_id = su.user_id AND su.wx_open_id IS NOT NULL
|
||||
WHERE sub.new_notice = '1'
|
||||
AND sub.del_flag = '0'
|
||||
-- 领域
|
||||
and (sub.blogger_type_code = '-1'
|
||||
AND (
|
||||
sub.blogger_type_code = '-1'
|
||||
<if test="bloggerTypeCode != null and bloggerTypeCode.length>0">
|
||||
<foreach item="item" index="index" collection="bloggerTypeCode"
|
||||
open="(" separator="or" close=")">
|
||||
sub.blogger_type_code like concat('%',#{item},'%')
|
||||
OR <foreach item="item" index="index" collection="bloggerTypeCode"
|
||||
open="(" separator=" OR " close=")">
|
||||
sub.blogger_type_code LIKE CONCAT('%',#{item},'%')
|
||||
</foreach>
|
||||
</if>
|
||||
)
|
||||
-- 平台
|
||||
and (sub.platform_code = '-1' or sub.platform_code like concat('%',#{platformCode},'%'))
|
||||
AND (
|
||||
sub.platform_code = '-1'
|
||||
OR sub.platform_code LIKE CONCAT('%',#{platformCode},'%')
|
||||
)
|
||||
-- 结算方式
|
||||
and (sub.settle_type_code = '-1' or sub.settle_type_code like concat('%',#{settleTypeCode},'%'))
|
||||
AND (
|
||||
sub.settle_type_code = '-1'
|
||||
OR sub.settle_type_code LIKE CONCAT('%',#{settleTypeCode},'%')
|
||||
)
|
||||
-- 粉丝限制
|
||||
and (sub.fans_limit = '0' or sub.fans_limit is null
|
||||
or (sub.fans_limit = '1' and sub.fans_up <![CDATA[<= ]]> #{fansUp} and sub.fans_down <![CDATA[>= ]]> #{fansDown}))
|
||||
AND (
|
||||
sub.fans_limit = '0'
|
||||
OR sub.fans_limit IS NULL
|
||||
OR (
|
||||
sub.fans_limit = '1'
|
||||
AND sub.fans_up <![CDATA[<= ]]> #{fansUp}
|
||||
AND sub.fans_down <![CDATA[>= ]]> #{fansDown}
|
||||
)
|
||||
)
|
||||
-- 收费限制
|
||||
and (sub.fee_limit = '0' or sub.fee_limit is null
|
||||
or (sub.fee_limit = '1' and sub.fee_up <![CDATA[<= ]]> #{feeUp} and sub.fee_down <![CDATA[>= ]]> #{feeDown}))
|
||||
union
|
||||
SELECT
|
||||
distinct su.wx_open_id as wxOpenId,
|
||||
AND (
|
||||
sub.fee_limit = '0'
|
||||
OR sub.fee_limit IS NULL
|
||||
OR (
|
||||
sub.fee_limit = '1'
|
||||
AND sub.fee_up <![CDATA[<= ]]> #{feeUp}
|
||||
AND sub.fee_down <![CDATA[>= ]]> #{feeDown}
|
||||
)
|
||||
)
|
||||
|
||||
UNION
|
||||
|
||||
SELECT DISTINCT
|
||||
su.wx_open_id as wxOpenId,
|
||||
'' as keywordsList,
|
||||
'1' as allOk
|
||||
FROM
|
||||
dl_busi_subscribe sub
|
||||
inner join sys_user su on sub.user_id = su.user_id and su.wx_open_id is not null
|
||||
inner join dl_busi_user_love love on love.user_id = sub.user_id and love.love_user_id = #{loveUserId}
|
||||
where sub.new_notice = '1' and sub.del_flag ='0' and sub.fork_notice = '1'
|
||||
|
||||
|
||||
INNER JOIN sys_user su ON sub.user_id = su.user_id AND su.wx_open_id IS NOT NULL
|
||||
INNER JOIN dl_busi_user_love love ON love.user_id = sub.user_id AND love.love_user_id = #{loveUserId}
|
||||
WHERE sub.new_notice = '1'
|
||||
AND sub.del_flag = '0'
|
||||
AND sub.fork_notice = '1'
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@ -62,17 +62,10 @@
|
||||
su.status AS status,
|
||||
su.avatar AS avatar,
|
||||
su.phonenumber AS phonenumber,
|
||||
su_temp.nick_name AS inviteName,
|
||||
GROUP_CONCAT(mc.card_name SEPARATOR ', ') AS memberCardName
|
||||
su_temp.nick_name AS inviteName
|
||||
from dl_member_user main
|
||||
LEFT JOIN sys_user su ON main.user_id = su.user_id AND su.del_flag = 0
|
||||
LEFT JOIN sys_user su_temp ON su.invite_id = su_temp.user_id AND su_temp.del_flag = 0
|
||||
LEFT JOIN dl_member_card mc
|
||||
ON main.user_id = mc.user_id
|
||||
AND mc.start_date <= CURDATE()
|
||||
AND mc.end_date >= CURDATE()
|
||||
AND mc.del_flag = 0
|
||||
AND mc.user_type = #{entity.userType}
|
||||
<where>
|
||||
main.del_flag = 0
|
||||
<if test="entity.userType != null and entity.userType != ''">
|
||||
@ -97,7 +90,7 @@
|
||||
ORDER BY ${entity.params.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY mc.create_time desc
|
||||
ORDER BY main.create_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
@ -157,29 +150,39 @@
|
||||
su.avatar AS avatar,
|
||||
su.phonenumber AS phonenumber,
|
||||
su_temp.nick_name AS inviteName,
|
||||
GROUP_CONCAT(mc.card_name SEPARATOR ', ') AS memberCardName,
|
||||
sum(dmo2.goods_price) AS monthMoney,
|
||||
sum(dmo.goods_price) AS allMoney,
|
||||
mc.card_name AS memberCardName,
|
||||
dmo2.monthMoney AS monthMoney,
|
||||
dmo.allMoney AS allMoney,
|
||||
main.create_time
|
||||
from dl_member_user main
|
||||
LEFT JOIN sys_user su ON main.user_id = su.user_id AND su.del_flag = 0
|
||||
LEFT JOIN sys_user su_temp ON su.invite_id = su_temp.user_id AND su_temp.del_flag = 0
|
||||
LEFT JOIN (
|
||||
SELECT mc_inner.*
|
||||
FROM dl_member_card mc_inner
|
||||
SELECT mc1.user_id, mc1.card_name
|
||||
FROM dl_member_card mc1
|
||||
INNER JOIN (
|
||||
SELECT user_id, MAX(create_time) AS latest_time
|
||||
SELECT user_id, MAX(create_time) as latest_time
|
||||
FROM dl_member_card
|
||||
WHERE del_flag = 0 AND user_type = #{entity.userType}
|
||||
GROUP BY user_id
|
||||
) latest ON mc_inner.user_id = latest.user_id AND mc_inner.create_time = latest.latest_time
|
||||
) mc2 ON mc1.user_id = mc2.user_id AND mc1.create_time = mc2.latest_time
|
||||
WHERE mc1.start_date <= CURDATE() AND mc1.end_date >= CURDATE()
|
||||
) mc ON main.user_id = mc.user_id
|
||||
AND mc.start_date <= CURDATE()
|
||||
AND mc.end_date >= CURDATE()
|
||||
left join dl_member_order dmo on dmo.user_id = su.user_id and dmo.user_type = '02' and dmo.is_pay = 1
|
||||
left join dl_member_order dmo2 on dmo2.user_id = su.user_id and dmo2.user_type = '02' and dmo2.is_pay = 1
|
||||
and dmo.create_time <![CDATA[>=]]> DATE_FORMAT(CURDATE(), '%Y-%m-01')
|
||||
and dmo.create_time <![CDATA[<=]]> LAST_DAY(CURDATE())
|
||||
LEFT JOIN (
|
||||
SELECT user_id, SUM(goods_price) AS allMoney
|
||||
FROM dl_member_order
|
||||
WHERE user_type = '02' AND is_pay = 1
|
||||
GROUP BY user_id
|
||||
) dmo ON dmo.user_id = su.user_id
|
||||
LEFT JOIN (
|
||||
SELECT user_id, SUM(goods_price) AS monthMoney
|
||||
FROM dl_member_order
|
||||
WHERE user_type = '02'
|
||||
AND is_pay = 1
|
||||
AND create_time >= DATE_FORMAT(CURDATE(), '%Y-%m-01')
|
||||
AND create_time <= LAST_DAY(CURDATE())
|
||||
GROUP BY user_id
|
||||
) dmo2 ON dmo2.user_id = su.user_id
|
||||
<where>
|
||||
main.del_flag = 0
|
||||
<if test="entity.userType != null and entity.userType != ''">
|
||||
@ -196,25 +199,21 @@
|
||||
<if test="entity.params.minnum != null"> and main.ttotal_num >= #{entity.params.minnum} </if>
|
||||
<if test="entity.params.maxnum != null"> and main.ttotal_num <= #{entity.params.maxnum} </if>
|
||||
<if test="entity.params.isVip != null and entity.params.isVip != ''"> and mc.card_name = #{entity.params.isVip} </if>
|
||||
|
||||
</where>
|
||||
GROUP BY main.user_id
|
||||
<if test="entity.params.isXf != null and entity.params.isXf == '01'">
|
||||
having sum(dmo.goods_price)>0
|
||||
AND dmo.allMoney > 0
|
||||
</if>
|
||||
<if test="entity.params.isXf != null and entity.params.isXf == '02'">
|
||||
having sum(dmo.goods_price) is null
|
||||
AND (dmo.allMoney IS NULL OR dmo.allMoney = 0)
|
||||
</if>
|
||||
<choose>
|
||||
<when test="entity.params.orderBy != null and entity.params.orderBy != ''">
|
||||
ORDER BY ${entity.params.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY mc.create_time desc
|
||||
ORDER BY mc.card_name IS NULL, main.create_time DESC
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user