Commit 926aa4d7 authored by gaoyingwei's avatar gaoyingwei

Merge remote-tracking branch 'origin/master' into master

parents d2d19fbb ac2bfd2a
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -50,12 +50,24 @@ public class AppActivityController extends CyPaginationController<CmsActivity> {
/**
* 活动-查看活动列表
*/
// @PreAuthorize("@cyPerm.hasPerm('app:activity:query')")
@CyOpeLogAnno(title = "system-活动管理-查询活动", businessType = CyLogTypeEnum.QUERY)
@Operation(summary = "分页查询活动集合", description = "分页查询活动集合")
@GetMapping(value = "/open/cmsActivity/queryCmsActivityByPagination")
public CyGridModel listByPagination(CmsActivity cmsActivity) {
cmsActivityServiceImpl.findAllByPagination(getPaginationUtility(), cmsActivity);
cmsActivityServiceImpl.findAllByPagination(getPaginationUtility(), cmsActivity,"app");
return getGridModelResponse();
}
/**
* 活动-查询是否已报名
*/
@CyOpeLogAnno(title = "system-活动管理-查询是否已报名", businessType = CyLogTypeEnum.QUERY)
@Operation(summary = "查询是否已报名", description = "查询是否已报名")
@GetMapping(value = "/cmsActivity/getActivityIsApplication")
public CyResult getActivityIsApplication(Integer activityId) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
cmsActivityServiceImpl.getIsApplication(activityId));
}
}
......@@ -81,12 +81,12 @@ public class AppMemInfoController extends CyPaginationController<MemInfo> {
}
@CyOpeLogAnno(title = "system-会员表管理-查询会员表", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="查询单一会员表", description="查询单一会员表")
@CyOpeLogAnno(title = "system-会员表管理-查询其他人的会员详情", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="查询其他人的会员详情", description="查询其他人的会员详情")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true, schema = @Schema(type = "string"))})
@GetMapping("/memInfo/detail/{businessId:\\w+}")
public CyResult detail(@PathVariable int businessId) {
MemInfo info = memInfoServiceImpl.findById(businessId);
MemInfo info = memInfoServiceImpl.findById(businessId,"app");
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
......@@ -338,6 +338,7 @@ public class AppMemInfoController extends CyPaginationController<MemInfo> {
@CyEncryptSm4Anno
public CyResult like( @RequestBody MemLikeDTO likeDTO) {
CyPersistModel data = memInfoServiceImpl.addLike(likeDTO);
likeDTO.setWxOpenid(null);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
......@@ -387,4 +388,34 @@ public class AppMemInfoController extends CyPaginationController<MemInfo> {
CyMessCons.MESSAGE_ALERT_ERROR,
memUserTask);
}
/**
* 根据token查询user信息
*/
@PreAuthorize("@cyPerm.hasPerm('app:mem:query')")
@CyOpeLogAnno(title = "system-查询用户详情-查询登录人用户详情", businessType = CyLogTypeEnum.INSERT)
@Operation(summary="查询登录人用户详情", description="查询登录人用户详情")
@GetMapping(value = "/memInfo/getUserInfo")
public CyResult getUserInfo() {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
memInfoServiceImpl.getUserInfo());
}
/**
* 查询当前用户是否已被停用
*/
@PreAuthorize("@cyPerm.hasPerm('app:mem:query')")
@CyOpeLogAnno(title = "system-查询用户停用状态-查询用户停用状态", businessType = CyLogTypeEnum.INSERT)
@Operation(summary="查询用户停用状态", description="查询用户停用状态")
@GetMapping(value = "/memInfo/getUserIsStop")
public CyResult getUserIsStop() {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
memInfoServiceImpl.getUserIsStop());
}
}
......@@ -64,13 +64,12 @@ public class AppOpmBlackListController extends CyPaginationController<OpmBlackLi
@CyOpeLogAnno(title = "system-黑名单表管理-删除黑名单表", businessType = CyLogTypeEnum.DELETE)
@Operation(summary="删除黑名单表", description="删除黑名单表")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true, schema = @Schema(type = "string"))})
@DeleteMapping("/opmBlackList/delete/{businessId:\\w+}")
public CyResult delete(@PathVariable int businessId,OpmBlackList opmBlackList) {
opmBlackList.setBusinessId(businessId);
@DeleteMapping("/opmBlackList/delete")
public CyResult delete(@RequestBody OpmBlackList opmBlackList) {
CyPersistModel data = opmBlackListServiceImpl.remove(opmBlackList);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
opmBlackList);
}
}
......@@ -36,6 +36,6 @@ public class AppOpmTopicController extends CyPaginationController<OpmTopic> {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
opmTopicServiceImpl.findAll(opmTopic));
opmTopicServiceImpl.findAll(opmTopic,"app"));
}
}
......@@ -11,6 +11,7 @@ import org.rcisoft.business.cmsOrder.dao.CmsOrderRepository;
import org.rcisoft.business.cmsOrder.entity.CmsOrder;
import org.rcisoft.business.memInfo.dao.MemInfoRepository;
import org.rcisoft.business.memInfo.entity.MemInfo;
import org.rcisoft.business.memInfo.service.impl.MemInfoServiceImpl;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.rabbitmq.bean.RabbitMQConfigBean;
......@@ -77,7 +78,10 @@ public class WxPayServiceImpl implements WxPayService {
@Autowired
private MemInfoRepository memInfoRepository;
@Autowired
private MemInfoServiceImpl memInfoServiceImpl;
@Autowired
private UserUtil userUtil;
@Value("${wx.appId}")
private String appId;
......@@ -97,10 +101,7 @@ public class WxPayServiceImpl implements WxPayService {
@Override
public JSONObject wxPay(Long orderId, Long activityId, Integer type, HttpServletRequest request) throws IOException, JDOMException {
//添加实名判断
String userId = CyUserUtil.getAuthenBusinessId();
MemInfo memInfo = memInfoRepository.getInfoByUserId(userId);
if (!"1".equals(memInfo.getMemRealAuthen()))
throw new CyServiceException("您未实名认证,不能报名");
userUtil.checkUserAuth("请先进行实名认证!");
JSONObject json = new JSONObject();
// try{
//redis key: 【order:activity:${aid}:${oid}】 value 【hash】;status -> 待支付 ,可以进行支付
......
......@@ -106,7 +106,7 @@ public class CmsActivityController extends CyPaginationController<CmsActivity> {
@Operation(summary = "分页查询活动集合", description = "分页查询活动集合")
@GetMapping(value = "/queryCmsActivityByPagination")
public CyGridModel listByPagination(CmsActivity cmsActivity) {
cmsActivityServiceImpl.findAllByPagination(getPaginationUtility(), cmsActivity);
cmsActivityServiceImpl.findAllByPagination(getPaginationUtility(), cmsActivity,"web");
return getGridModelResponse();
}
......
......@@ -19,10 +19,15 @@ public interface CmsActivityRepository extends CyBaseMapper<CmsActivity> {
List<CmsActivity> queryCmsActivity(@Param("entity") CmsActivity cmsActivity);
/**
* 分页查询 cmsActivity
* web端-分页查询 cmsActivity
*
*/
IPage<CmsActivity> queryCmsActivityPaged(CyPageInfo cyPageInfo, @Param("entity") CmsActivity cmsActivity);
/**
* app端-分页查询 cmsActivity
*
*/
IPage<CmsActivity> appQueryCmsActivityPaged(CyPageInfo<CmsActivity> paginationUtility, CmsActivity cmsActivity);
//根据id逻辑删除
int deleteCmsActivity(@Param("businessId")Integer businessId);
//修改状态
......@@ -30,7 +35,9 @@ public interface CmsActivityRepository extends CyBaseMapper<CmsActivity> {
//查询活动详情
CmsActivity selectById(@Param("businessId")Integer businessId);
//权重验重
CmsActivity checkWeight(@Param("weight")Integer weight);
CmsActivity checkWeight(@Param("weight") Integer weight);
//查询当前用户是否已报名该活动
Integer getIsApplication(@Param("userId") String userId, @Param("activityId") Integer activityId);
}
......@@ -22,70 +22,7 @@ import java.util.Date;
@TableName("cms_activity")
public class CmsActivity extends CyIdIncreEntity<CmsActivity> {
/**
* @desc 创建人
* @column create_by
* @default
*/
@Excel(name = "创建人")
@TableField("create_by")
private String createBy;
/**
* @desc 创建时间
* @column create_date
* @default
*/
@Excel(name = "创建时间")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("create_date")
private Date createDate;
/**
* @desc 更新人
* @column update_by
* @default
*/
@Excel(name = "更新人")
@TableField("update_by")
private String updateBy;
/**
* @desc 更新时间
* @column update_date
* @default
*/
@Excel(name = "更新时间")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("update_date")
private Date updateDate;
/**
* @desc 启动状态(0禁用、1启动)
* @column flag
* @default
*/
@Excel(name = "启动状态(0禁用、1启动)")
@TableField("flag")
private String flag;
/**
* @desc 删除标志(0删除,1已删除)
* @column del_flag
* @default
*/
@Excel(name = "删除标志(0删除,1已删除)")
@TableField("del_flag")
private String delFlag;
/**
* @desc 备注
* @column remarks
* @default
*/
@JsonIgnore
@Excel(name = "备注")
@TableField("remarks")
private String remarks;
/**
* @desc 活动标题
* @column title
......
......@@ -46,7 +46,7 @@ public interface CmsActivityService {
* @return
*/
IPage<CmsActivity> findAllByPagination(CyPageInfo<CmsActivity> paginationUtility,
CmsActivity cmsActivity);
CmsActivity cmsActivity,String type);
/**
......@@ -74,4 +74,9 @@ public interface CmsActivityService {
* @return 结果
*/
CyPersistModel pushActivityInfo(Integer businessId, String status);
/**
* 查询当前用户是否已报名该活动
*/
String getIsApplication(Integer activityId);
}
package org.rcisoft.business.cmsActivity.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -8,10 +9,12 @@ import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.cmsActivity.dao.CmsActivityRepository;
import org.rcisoft.business.cmsActivity.entity.CmsActivity;
import org.rcisoft.business.cmsActivity.service.CmsActivityService;
import org.rcisoft.business.cmsOrder.entity.CmsOrder;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.service.CyRedisService;
import org.rcisoft.core.service.impl.CyRedisServiceImpl;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.util.RedisCons;
import org.rcisoft.core.util.TimeUtil;
......@@ -55,12 +58,6 @@ public class CmsActivityServiceImpl extends ServiceImpl<CmsActivityRepository, C
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel persist(CmsActivity cmsActivity) {
//增加操作
cmsActivity.setDelFlag("0");
//当图片字段没有时增加默认1
/* if (ObjectUtil.isNull(cmsActivity.getPictureId())) {
cmsActivity.setPictureId(global.getDEFAULT_NEWS_LOCATION());
}*/
CmsActivity check = baseMapper.checkWeight(cmsActivity.getWeight());
if (ObjectUtil.isNotNull(check)) {
throw new CyServiceException(500, "权重已存在");
......@@ -129,10 +126,14 @@ public class CmsActivityServiceImpl extends ServiceImpl<CmsActivityRepository, C
*/
@Override
public IPage<CmsActivity> findAllByPagination(CyPageInfo<CmsActivity> paginationUtility,
CmsActivity cmsActivity) {
CmsActivity cmsActivity,String type) {
if (type.equals("app")){
IPage<CmsActivity> cmsActivityIPage = baseMapper.appQueryCmsActivityPaged(paginationUtility, cmsActivity);
return cmsActivityIPage;
} else {
IPage<CmsActivity> cmsActivityIPage = baseMapper.queryCmsActivityPaged(paginationUtility, cmsActivity);
return cmsActivityIPage;
}
}
/**
......@@ -221,10 +222,47 @@ public class CmsActivityServiceImpl extends ServiceImpl<CmsActivityRepository, C
}
private void extracted(Integer businessId, CmsActivity info) {
Set<String> map = redisTemplate.keys(RedisCons.ORDER_ACTIVITY + ":" + businessId + "*");
Set<String> map = redisTemplate.keys(RedisCons.ORDER_ACTIVITY + ":" + businessId + ":" +"*");
if (CollectionUtils.isNotEmpty(map)) //报名人数和实际剩余报名人数不等
throw new CyServiceException("活动已经报名,不允许取消发布");
if ("0".equals(info.getPublishStatus()))
throw new CyServiceException("活动未发布,不能取消");
}
/**
* 查询当前用户是否已报名该活动
*
* @param activityId
*/
@Override
public String getIsApplication(Integer activityId) {
//先查redis 再查数据库
Set<String> map = redisTemplate.keys(RedisCons.ORDER_ACTIVITY + ":" + activityId + ":" +"*");
if (map == null){
//再查数据库 免费的活动报名
String userId = CyUserUtil.getAuthenBusinessId();
Integer isApplication = baseMapper.getIsApplication(userId,activityId);
return String.valueOf(isApplication);
} else {
//遍历map
for (String key : map) {
Object obj = cyRedisServiceImpl.get(key);
if (obj != null){
CmsOrder order = JSON.parseObject(JSON.toJSONString(obj), CmsOrder.class);
if (order.getUserId().equals(Integer.valueOf(CyUserUtil.getAuthenBusinessId()))){
//说明当前活动已报名
return "1";
} else {
return "0";
}
}
}
//走到这说明 redis中没有 查询数据库
//再查数据库 免费的活动报名
String userId = CyUserUtil.getAuthenBusinessId();
Integer isApplication = baseMapper.getIsApplication(userId,activityId);
return String.valueOf(isApplication);
}
}
}
......@@ -20,74 +20,6 @@ import java.util.Date;
@Data
@TableName("cms_notice")
public class CmsNotice extends CyIdIncreEntity<CmsNotice> {
/**
* @desc 创建人
* @column create_by
* @default
*/
@Excel(name = "创建人")
@TableField("create_by")
private String createBy;
/**
* @desc 创建时间
* @column create_date
* @default
*/
@Excel(name = "创建时间")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("create_date")
private Date createDate;
/**
* @desc 更新人
* @column update_by
* @default
*/
@Excel(name = "更新人")
@TableField("update_by")
private String updateBy;
/**
* @desc 更新时间
* @column update_date
* @default
*/
@Excel(name = "更新时间")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("update_date")
private Date updateDate;
/**
* @desc 备注
* @column remarks
* @default
*/
@JsonIgnore
@Excel(name = "备注")
@TableField("remarks")
private String remarks;
/**
* @desc 启动状态(0禁用、1启动)
* @column flag
* @default
*/
@Excel(name = "启动状态(0禁用、1启动)")
@TableField("flag")
private String flag;
/**
* @desc 删除标志(0删除,1已删除)
* @column del_flag
* @default
*/
@Excel(name = "删除标志(0删除,1已删除)")
@TableField("del_flag")
private String delFlag;
/**
* @desc 标题
* @column title
......@@ -174,8 +106,6 @@ public class CmsNotice extends CyIdIncreEntity<CmsNotice> {
@TableField(exist = false)
private String url;
}
......@@ -17,6 +17,7 @@ import org.rcisoft.business.memGoldCoinFlow.dao.MemGoldCoinFlowRepository;
import org.rcisoft.business.memGoldCoinFlow.entity.MemGoldCoinFlow;
import org.rcisoft.business.memInfo.dao.MemInfoRepository;
import org.rcisoft.business.memInfo.entity.MemInfo;
import org.rcisoft.business.memInfo.service.impl.MemInfoServiceImpl;
import org.rcisoft.business.sysScheduledTaskLog.entity.SysScheduledTaskLog;
import org.rcisoft.business.sysScheduledTaskLog.service.SysScheduledTaskLogService;
import org.rcisoft.core.async.AsyncFactory;
......@@ -103,7 +104,10 @@ public class CmsOrderServiceImpl extends ServiceImpl<CmsOrderRepository,CmsOrder
private MemGoldCoinFlowRepository memGoldCoinFlowRepository;
@Autowired
private SysScheduledTaskLogService sysScheduledTaskLogServiceImpl;
@Autowired
private MemInfoServiceImpl memInfoServiceImpl;
@Autowired
private UserUtil userUtil;
/**
* 保存 订单信息表
* @param cmsOrder
......@@ -115,10 +119,7 @@ public class CmsOrderServiceImpl extends ServiceImpl<CmsOrderRepository,CmsOrder
//增加操作
int line = 1;
//添加实名判断
String userId = CyUserUtil.getAuthenBusinessId();
MemInfo memInfo = memInfoRepository.getInfoByUserId(userId);
if (!"1".equals(memInfo.getMemRealAuthen()))
throw new CyServiceException("您未实名认证,不能报名");
userUtil.checkUserAuth("请先进行实名认证!");
//加redis锁
boolean isGetLock = false;
RLock lock = redissonClient.getLock(RedisCons.ACTIVITY_INFO + cmsOrder.getGoodsId());
......@@ -185,12 +186,6 @@ public class CmsOrderServiceImpl extends ServiceImpl<CmsOrderRepository,CmsOrder
//计算价格 -开始
if (info.getApplicationFee() != null && info.getApplicationFee().compareTo(BigDecimal.ZERO) > 0) {
calculatePrice(orderInfo,info);
} else { //免费 --> 支付完成
orderInfo.setPrice(BigDecimal.ZERO);
orderInfo.setPayPrice(BigDecimal.ZERO);
orderInfo.setStatus(9);
orderInfo.setApplicationStatus("1");
}
orderInfo.setType(0);
orderInfo.setOrderTime(new Date());
orderInfo.setDelFlag("0");
......@@ -201,6 +196,17 @@ public class CmsOrderServiceImpl extends ServiceImpl<CmsOrderRepository,CmsOrder
// orderInfo.setStoreId(info.getSource());
// orderInfo.setActivityPrice(info.getApplicationFee());
cyRedisServiceImpl.set(RedisCons.ORDER_ACTIVITY +":"+ orderInfo.getGoodsId() + ":" + orderId,orderInfo);
} else { //免费 --> 支付完成 不插入订单表 插入报名表
//添加报名信息
CmsApplication application = new CmsApplication();
application.setUserId(Integer.valueOf(CyUserUtil.getAuthenBusinessId()));
application.setActivityId(info.getBusinessId());
application.setStatus("1");
application.setApplicationFee(BigDecimal.ZERO);
applicationRepository.insert(application);
//设置价格
orderInfo.setPrice(BigDecimal.ZERO);
}
// return orderInfo;
} else
throw new CyServiceException("超出人数限制,报名失败");
......@@ -1192,6 +1198,8 @@ public class CmsOrderServiceImpl extends ServiceImpl<CmsOrderRepository,CmsOrder
memGoldCoinFlow.setEndCount(memGoldCoinFlow.getCount() + memInfo.getGoldCoinsCount());
memGoldCoinFlow.setOrderId(BigInteger.valueOf(orderDetail.getBusinessId()));
memGoldCoinFlow.setTargetId(BigInteger.valueOf(orderDetail.getUserId()));
memGoldCoinFlow.setCreateBy(String.valueOf(orderDetail.getUserId()));
memGoldCoinFlow.setUpdateBy(String.valueOf(orderDetail.getUserId()));
memGoldCoinFlowRepository.insert(memGoldCoinFlow);
//修改会员表的金币余额
memInfo.setGoldCoinsCount(memGoldCoinFlow.getCount() + memInfo.getGoldCoinsCount());
......@@ -1898,9 +1906,7 @@ public class CmsOrderServiceImpl extends ServiceImpl<CmsOrderRepository,CmsOrder
int line = 1;
//添加实名判断
String userId = CyUserUtil.getAuthenBusinessId();
MemInfo memInfo = memInfoRepository.getInfoByUserId(userId);
if (!"1".equals(memInfo.getMemRealAuthen()))
throw new CyServiceException("您未实名认证,不能充值");
userUtil.checkUserAuth("请先进行实名认证!");
long orderId = cyIdGenUtil.getSnowFlakedId();
CmsOrder orderInfo = new CmsOrder();
orderInfo.setBusinessId(orderId);
......
......@@ -110,7 +110,7 @@ public class MemInfoController extends CyPaginationController<MemInfo> {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
memInfoServiceImpl.findById(businessId));
memInfoServiceImpl.findById(businessId,"web"));
}
@PreAuthorize("@cyPerm.hasPerm('mem:info:list')")
......
......@@ -156,6 +156,11 @@ public interface MemInfoRepository extends CyBaseMapper<MemInfo> {
*/
Integer addMemLikeCount(@Param("entity") MemLikeDTO likeDTO);
/**
* 点赞表 点赞数+1
*/
Integer addLikeCount(@Param("entity") MemLikeDTO likeDTO);
/**
* 查询关注的id集合
*/
......@@ -191,5 +196,40 @@ public interface MemInfoRepository extends CyBaseMapper<MemInfo> {
* 查询互换微信任务记录
*/
MemUserTaskDTO selectWeChatTask(@Param("entity") MemUserTaskDTO memUserTaskDTO);
/**
* 查询所有用户id
*/
List<Integer> selectUserIdList();
/**
* 查询当前用户的总被点赞数
*/
Integer selectUserLikedCount(Integer userId);
/**
* 查询当前用户的总被点赞数
*/
Integer selectUserFollowedCount(Integer userId);
/**
* 查询当前对话的未回复的微信任务数量
*/
int queryTalkWeChatTaskNoReplyCount(@Param("createBy") Integer createBy,@Param("targetId") Integer targetId,@Param("loginUserId") Integer loginUserId);
/**
* 查询未回复的微信任务数量
*/
int queryWeChatTaskNoReplyCount(String userId);
/**
* 根据token获取用户信息
*/
MemInfo getUserInfo(String userId);
/**
* 查询当前用户是否已被停用
*/
String getUserIsStop(String userId);
}
......@@ -596,5 +596,17 @@ public class MemInfo extends CyIdIncreEntity<MemInfo> {
*/
@TableField(exist = false)
private Integer memSort;
/**
* 会员id
*/
@TableField(exist = false)
private Integer memberId;
/**
* 微信昵称
*/
@TableField(exist = false)
private String wxNickName;
}
package org.rcisoft.business.memInfo.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
@Data
......
package org.rcisoft.business.memInfo.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class UserInfoVO {
/**
* 用户id
*/
private Integer businessId;
/**
* 登录名
*/
private String username;
/**
* 用户昵称
*/
private String nickName;
/**
* 用户类型(0系统用户 1普通用户)
*/
private String userType;
/**
* 用户姓名
*/
private String name;
/**
* 邮箱
*/
private String email;
/**
* 手机号
*/
private String phone;
/**
* 性别
*/
private String sex;
/**
* 会员id
*/
private Integer memberId;
/**
* wx昵称
*/
private String wxNickName;
/**
* wx头像
*/
private String wxHead;
/**
* 身份(00 管理用户, 10 会员)
*/
private String userIdentity;
/**
* openId
*/
private String wxOpenid;
/**
* wx性别
*/
private String wxSex;
/**
* wx号
*/
private String memWxCode;
/**
* @desc 创建时间
* @column create_date
* @default
*/
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@Excel(name = "创建时间", orderNum = "2", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createDate;
/**
* @desc 创建时间
* @column update_date
* @default
*/
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@Excel(name = "创建时间", orderNum = "2", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateDate;
private String flag;
private String delFlag;
private String createBy;
private String updateBy;
private String remarks;
}
......@@ -45,7 +45,7 @@ public interface MemInfoService {
* @param id
* @return
*/
MemInfo findById(int id);
MemInfo findById(int id,String type);
/**
* 分页查询 会员表
......@@ -126,4 +126,14 @@ public interface MemInfoService {
* 查询互换微信任务
*/
MemUserTaskDTO queryWeChatTaskRecord(MemUserTaskDTO memUserTaskDTO);
/**
* 查询用户信息
*/
MemInfo getUserInfo();
/**
* 查询当前用户是否已被禁用
*/
String getUserIsStop();
}
......@@ -7,6 +7,7 @@ import org.rcisoft.business.memGoldCoinFlow.dao.MemGoldCoinFlowRepository;
import org.rcisoft.business.memGoldCoinFlow.entity.MemGoldCoinFlow;
import org.rcisoft.business.memInfo.dao.MemInfoRepository;
import org.rcisoft.business.memInfo.entity.MemInfo;
import org.rcisoft.business.memInfo.service.impl.MemInfoServiceImpl;
import org.rcisoft.business.memLeaveMessage.bean.MemLeaveMessageRedisBean;
import org.rcisoft.business.memLeaveMessage.dao.MemLeaveMessageRepository;
import org.rcisoft.business.memLeaveMessage.entity.*;
......@@ -18,6 +19,7 @@ import org.rcisoft.core.service.impl.CyRedisServiceImpl;
import org.rcisoft.core.util.CyIdGenUtil;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.util.RedisCons;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.dictionary.entity.DictData;
import org.rcisoft.sys.dictionary.service.impl.DictionaryServiceImpl;
import org.redisson.api.RLock;
......@@ -71,6 +73,10 @@ public class MemLeaveMessageServiceImpl extends ServiceImpl<MemLeaveMessageRepos
@Autowired
private RedissonClient redissonClient;
@Autowired
private MemInfoServiceImpl memInfoServiceImpl;
@Autowired
private UserUtil userUtil;
/**
* 留言
* @param memLeaveMessage
......@@ -81,9 +87,7 @@ public class MemLeaveMessageServiceImpl extends ServiceImpl<MemLeaveMessageRepos
public CyPersistModel leaveMessage(MemLeaveMessage memLeaveMessage) {
//添加实名判断
String userId = CyUserUtil.getAuthenBusinessId();
MemInfo info = memInfoRepository.getInfoByUserId(userId);
if (!"1".equals(info.getMemRealAuthen()))
throw new CyServiceException("请先进行实名认证");
userUtil.checkUserAuth("请先进行实名认证!");
//获取当前日期 例2025/2/20 获取02和20
LocalDate today = LocalDate.now();
DateTimeFormatter monthFormatter = DateTimeFormatter.ofPattern("MM");
......@@ -151,7 +155,7 @@ public class MemLeaveMessageServiceImpl extends ServiceImpl<MemLeaveMessageRepos
}
} else {
//不进行留言
throw new CyServiceException(1001,"今日对该用户留言次数超出限制");
throw new CyServiceException(1001,"今日对该用户留言次数已达上限,请明日再试!");
}
}
//先插入到留言表
......@@ -229,7 +233,7 @@ public class MemLeaveMessageServiceImpl extends ServiceImpl<MemLeaveMessageRepos
}
return new CyPersistModel(line);
} else {
throw new CyServiceException(1001,"今日对该用户留言次数超出限制");
throw new CyServiceException(1001,"今日对该用户留言次数已达上限,请明日再试!");
}
} else if (redisLeaveMessageCountAll == null){
//当天第一次进行留言
......@@ -269,7 +273,7 @@ public class MemLeaveMessageServiceImpl extends ServiceImpl<MemLeaveMessageRepos
return new CyPersistModel(line1);
} else {
//超出总次数限制
throw new CyServiceException(1002,"今日留言次数超出限制");
throw new CyServiceException(1002,"今日留言次数已达上限,请明日再试!");
}
}
......@@ -287,8 +291,10 @@ public class MemLeaveMessageServiceImpl extends ServiceImpl<MemLeaveMessageRepos
talks.forEach(item->{
//查询每一个对话的我的未读留言数量
//1.查询该对话的所有留言 并且计算出当前用户对该留言的未读信息数量 对话的createBy和targetId会随时变 所以当前人id要手动获取
int count = memLeaveMessageRepository.queryTalkNoReadCount(item.getCreateBy(),item.getTargetId(),Integer.valueOf(CyUserUtil.getAuthenBusinessId()));
item.setNoReadCount(count);
int count1 = memLeaveMessageRepository.queryTalkNoReadCount(item.getCreateBy(),item.getTargetId(),Integer.valueOf(CyUserUtil.getAuthenBusinessId()));
//查询互换微信未回应数量
int count2 = memInfoRepository.queryTalkWeChatTaskNoReplyCount(item.getCreateBy(),item.getTargetId(),Integer.valueOf(CyUserUtil.getAuthenBusinessId()));
item.setNoReadCount(count1 + count2);
});
return userLeaveMessageIPage;
}
......@@ -337,9 +343,11 @@ public class MemLeaveMessageServiceImpl extends ServiceImpl<MemLeaveMessageRepos
public int noReadMessageAllCount() {
//获取当前登录人
String userId = CyUserUtil.getAuthenBusinessId();
//查询未读的留言数
int count = memLeaveMessageRepository.leaveMessageNoReadAllCount(Integer.valueOf(userId));
//查询未读的留言数 在有一方被拉黑的情况下 不算此数量
int count1 = memLeaveMessageRepository.leaveMessageNoReadAllCount(Integer.valueOf(userId));
//查询互换微信未回应数量 在有一方被拉黑的情况下 不算此数量
int count2 = memInfoRepository.queryWeChatTaskNoReplyCount(userId);
//查询未读的要微信请求数
return count;
return count1 + count2;
}
}
......@@ -116,7 +116,7 @@ public class MemTrafficServiceImpl extends ServiceImpl<MemTrafficRepository,MemT
//将redis中存储的点赞数同步到opm_user_like表中
Set<String> keys = redisTemplate.keys(MemTrafficRedisBean.USER_MEMTRAFFIC + "*");
try {
if (keys != null && !keys.isEmpty()) {
for (String key : keys) {
// 提取 userId
......@@ -137,10 +137,7 @@ public class MemTrafficServiceImpl extends ServiceImpl<MemTrafficRepository,MemT
memTraffic.setBeginTime(beginTime);
memTraffic.setEndTime(endTime);
baseMapper.updateMemTraffic(memTraffic);
}
} else {
System.out.println("No keys found.");
}
SysScheduledTaskLog sysScheduledTaskLog = new SysScheduledTaskLog();
sysScheduledTaskLog.setTaskName("用户访问数据定时任务");
......@@ -148,7 +145,14 @@ public class MemTrafficServiceImpl extends ServiceImpl<MemTrafficRepository,MemT
sysScheduledTaskLog.setTaskTime("每20分钟执行一次");
sysScheduledTaskLog.setCreateDate(new Date());
sysScheduledTaskLogServiceImpl.persist(sysScheduledTaskLog);
log.info("用户访问数据定时任务结束---");
} catch (Exception e){
SysScheduledTaskLog sysScheduledTaskLog = new SysScheduledTaskLog();
sysScheduledTaskLog.setTaskName("用户访问数据定时任务");
sysScheduledTaskLog.setTaskState("失败");
sysScheduledTaskLog.setTaskTime("每20分钟执行一次");
sysScheduledTaskLog.setCreateDate(new Date());
sysScheduledTaskLogServiceImpl.persist(sysScheduledTaskLog);
}
}
/**
......
......@@ -9,9 +9,12 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.baidu.censor.dto.CensorResult;
import org.rcisoft.baidu.censor.service.ContentCensorService;
import org.rcisoft.business.memGoldCoinFlow.dao.MemGoldCoinFlowRepository;
import org.rcisoft.business.memGoldCoinFlow.entity.MemGoldCoinFlow;
import org.rcisoft.business.memInfo.bean.MemberInfoRedisBean;
import org.rcisoft.business.memInfo.dao.MemInfoRepository;
import org.rcisoft.business.memInfo.entity.MemInfo;
import org.rcisoft.business.memInfo.service.impl.MemInfoServiceImpl;
import org.rcisoft.business.opmArticle.bean.OpmArticleRedisBean;
import org.rcisoft.business.opmArticle.dao.OpmArticleRepository;
import org.rcisoft.business.opmArticle.entity.ArticleCommentDTO;
......@@ -26,6 +29,7 @@ import org.rcisoft.core.service.CyFileStorageService;
import org.rcisoft.core.service.impl.CyRedisServiceImpl;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.util.TimeUtil;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.dictionary.entity.DictData;
import org.rcisoft.sys.dictionary.service.DictionaryService;
import org.redisson.api.RLock;
......@@ -37,6 +41,7 @@ import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigInteger;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
......@@ -70,6 +75,10 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
private RedissonClient redissonClient;
@Autowired
private StringRedisTemplate redisTemplate;
@Autowired
private MemGoldCoinFlowRepository memGoldCoinFlowRepository;
@Autowired
private UserUtil userUtil;
/**
* 保存 opmArticle管理
* @param opmArticle
......@@ -78,11 +87,9 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel persist(OpmArticle opmArticle){
//1、实名判断
String userId = CyUserUtil.getAuthenBusinessId();
MemInfo info = memInfoRepository.getInfoByUserId(userId);
if (!"1".equals(info.getMemRealAuthen()))
throw new CyServiceException("请先进行实名认证");
//1、实名判断
userUtil.checkUserAuth("请先进行实名认证");
//2、判断今日发布动态的数量限制
//获取当天时间 例2025/2/20 后获取0220
LocalDate today = LocalDate.now();
......@@ -94,8 +101,8 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
String date = month + day;
List<DictData> articleConfig = dictionaryService.selectByTypes("article_config");
DictData dictData1 = articleConfig.stream().filter(item -> item.getDictLabel().equals("publish_article_count")).findFirst().orElse(null);
DictData dictData2 = articleConfig.stream().filter(item -> item.getDictLabel().equals("publish_article_count")).findFirst().orElse(null);
DictData dictData3 = articleConfig.stream().filter(item -> item.getDictLabel().equals("publish_article_count")).findFirst().orElse(null);
DictData dictData2 = articleConfig.stream().filter(item -> item.getDictLabel().equals("pay_publish_article_count")).findFirst().orElse(null);
DictData dictData3 = articleConfig.stream().filter(item -> item.getDictLabel().equals("pay_count")).findFirst().orElse(null);
Integer publishCount = Integer.valueOf(dictData1.getDictValue());//每天最多发a条动态(免费)
Integer payPublishCount = Integer.valueOf(dictData2.getDictValue());//每天最多发b条动态(付费)
Integer publishCountAll = publishCount + payPublishCount;//免费+付费总数
......@@ -127,6 +134,14 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
}
memInfo.setGoldCoinsCount(memInfo.getGoldCoinsCount() - payCount);
memInfoRepository.updateById(memInfo);
//添加消费记录
MemGoldCoinFlow memGoldCoinFlow = new MemGoldCoinFlow();
memGoldCoinFlow.setType("2");
memGoldCoinFlow.setActionType("21");
memGoldCoinFlow.setCount(payCount);
memGoldCoinFlow.setEndCount(memInfo.getGoldCoinsCount());
memGoldCoinFlow.setTargetId(BigInteger.valueOf(Long.parseLong(userId)));
memGoldCoinFlowRepository.insert(memGoldCoinFlow);
//增加操作
redisTemplate.opsForValue().increment(OpmArticleRedisBean.USER_ARTICLE_COUNT + date + ":" + userId,1L);
}
......@@ -411,9 +426,7 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
public CyPersistModel likeAdd(Integer articleId,String praiseType){
//添加实名判断
String userId = CyUserUtil.getAuthenBusinessId();
MemInfo info = memInfoRepository.getInfoByUserId(userId);
if (!"1".equals(info.getMemRealAuthen()))
throw new CyServiceException("请先进行实名认证");
userUtil.checkUserAuth("请先进行实名认证!");
int line = 0;
if (praiseType.equals("praise")){
//点赞
......@@ -447,9 +460,7 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
public CyPersistModel likeCommentAdd(Integer commentId,String praiseType){
//添加实名判断
String userId = CyUserUtil.getAuthenBusinessId();
MemInfo info = memInfoRepository.getInfoByUserId(userId);
if (!"1".equals(info.getMemRealAuthen()))
throw new CyServiceException("请先进行实名认证");
userUtil.checkUserAuth("请先进行实名认证!");
int line = 0;
if (praiseType.equals("praise")){
//点赞
......@@ -481,9 +492,7 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
public CyPersistModel addComment(ArticleCommentDTO dto) {
//添加实名判断
String userId = CyUserUtil.getAuthenBusinessId();
MemInfo info = memInfoRepository.getInfoByUserId(userId);
if (!"1".equals(info.getMemRealAuthen()))
throw new CyServiceException("请先进行实名认证");
userUtil.checkUserAuth("请先进行实名认证!");
//校验 超过规定的时间不能评论 计算天数对应的秒数
List<DictData> articleConfig = dictionaryService.selectByTypes("article_config");
DictData dictData = articleConfig.stream().filter(item -> item.getDictLabel().equals("comment_limit_days")).findFirst().orElse(null);
......
......@@ -23,8 +23,6 @@ import java.util.List;
@Data
@TableName("opm_black_list")
public class OpmBlackList extends CyIdIncreNotDataEntity<OpmBlackList> {
/**
* @desc 创建时间
* @column create_date
......
......@@ -88,11 +88,18 @@ public class OpmBlackListServiceImpl extends ServiceImpl<OpmBlackListRepository,
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel remove(OpmBlackList opmBlackList){
//删除黑名单
int line = baseMapper.realDelete(opmBlackList);
log.debug(CyUserUtil.getAuthenUsername()+"删除了ID为"+
opmBlackList.getBusinessId()+"的黑名单表信息");
//修改对话表 拉黑状态
MemLeaveMessage userTalk = memLeaveMessageRepository.queryUserTalk(opmBlackList.getUserId().intValue(), opmBlackList.getTargetId().intValue());
if (userTalk != null) {
//当前登录人拉黑了对方 修改对话状态为互相都没拉黑的情况
userTalk.setBlackUser(0);
memLeaveMessageRepository.updateTalkBlack(userTalk);
return new CyPersistModel(line);
}
return new CyPersistModel(1);
}
/**
* 修改 黑名单表
......
......@@ -97,7 +97,7 @@ public class OpmTopicController extends CyPaginationController<OpmTopic> {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
opmTopicServiceImpl.findAll(opmTopic));
opmTopicServiceImpl.findAll(opmTopic,"web"));
}
@PreAuthorize("@cyPerm.hasPerm('opm:topic:query')")
......
......@@ -15,9 +15,16 @@ import java.util.List;
public interface OpmTopicRepository extends CyBaseMapper<OpmTopic> {
/**
* web端-查询所有话题
*/
List<OpmTopic> queryOpmTopic(@Param("entity") OpmTopic opmTopic);
/**
* app端-查询所有话题
*/
List<OpmTopic> appQueryOpmTopic(@Param("entity") OpmTopic opmTopic);
/**
* 分页查询 cmsActivity
*
......
......@@ -54,7 +54,7 @@ public interface OpmTopicService {
* @param opmTopic
* @return
*/
List<OpmTopic> findAll(OpmTopic opmTopic);
List<OpmTopic> findAll(OpmTopic opmTopic,String type);
/**
......
......@@ -121,8 +121,6 @@ public class OpmTopicServiceImpl extends ServiceImpl<OpmTopicRepository, OpmTopi
public IPage<OpmTopic> findAllByPagination(CyPageInfo<OpmTopic> paginationUtility,
OpmTopic opmTopic) {
IPage<OpmTopic> opmTopicIPage = baseMapper.queryOpmTopicPaged(paginationUtility, opmTopic);
List<OpmTopic> newsInformation = opmTopicIPage.getRecords();
opmTopicIPage.setRecords(newsInformation);
return opmTopicIPage;
}
......@@ -134,9 +132,12 @@ public class OpmTopicServiceImpl extends ServiceImpl<OpmTopicRepository, OpmTopi
* @return
*/
@Override
public List<OpmTopic> findAll(OpmTopic opmTopic) {
public List<OpmTopic> findAll(OpmTopic opmTopic,String type) {
if (type.equals("app")){
return baseMapper.appQueryOpmTopic(opmTopic);
} else {
return baseMapper.queryOpmTopic(opmTopic);
}
}
/**
......
......@@ -40,15 +40,6 @@ public class ScheduleTasks {
@Autowired
private OpmTopicServiceImpl opmTopicServiceImpl;
/**
* 每俩小时 执行一次点赞数据定时任务 将点赞数据同步到点赞表表中
*/
@Scheduled(cron = "0 0 */2 * * ?")
public void userLikeSchedule() {
memInfoService.userLikeSchedule();
}
/**
* redis订单落库
*/
......@@ -98,6 +89,7 @@ public class ScheduleTasks {
orderService.executeDeleteOrder();
}
/**
* 定时更新访问量表
*/
......@@ -115,4 +107,11 @@ public class ScheduleTasks {
opmTopicServiceImpl.opmTopicSchedule();
}
/**
* 定时更新会员表 刷新会员的被关注数和被点赞数
* 每2小时执行一次
*/
@Scheduled(cron = "0 0 */2 * * ?")
public void refreshMemLikeAndFollowCountSchedule() { memInfoService.refreshMemLikeAndFollowCountSchedule(); }
}
package org.rcisoft.core.util;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.memInfo.dao.MemInfoRepository;
import org.rcisoft.business.memInfo.entity.MemInfo;
import org.rcisoft.core.exception.CyServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import java.util.Random;
@Configuration
public class UserUtil {
@Autowired
MemInfoRepository memInfoRepository;
/**
* 校验当前登录人是否已实名
*/
public void checkUserAuth(String message){
//添加实名判断
String userId = CyUserUtil.getAuthenBusinessId();
MemInfo memInfo = memInfoRepository.getInfoByUserId(userId);
if (!"1".equals(memInfo.getMemRealAuthen()))
throw new CyServiceException(message);
}
}
......@@ -181,7 +181,35 @@
and ca.publish_status = #{entity.publishStatus}
</if>
ORDER BY
ca.publish_date DESC
ca.is_top DESC,ca.is_recommended DESC,ca.weight DESC
</select>
<select id="appQueryCmsActivityPaged" resultMap="BaseResultMap">
SELECT
ca.business_id,
ca.is_top,
ca.is_recommended,
ca.weight,
ca.publish_date,
ca.create_by,
ca.create_date,
ca.title,
ca.picture_id,
ca.application_fee,
ca.publish_status,
ca.is_application,
ca.start_time,
ca.end_time,
ca.summary,
oi.url
FROM
cms_activity ca
LEFT JOIN oss_info oi ON ca.picture_id = oi.business_id
WHERE 1=1
and ca.del_flag = '0'
and ca.flag = '1'
and ca.publish_status = '1'
ORDER BY
ca.is_top DESC,ca.is_recommended DESC,ca.weight DESC
</select>
<update id="deleteCmsActivity" parameterType="java.lang.Integer">
update cms_activity
......@@ -207,4 +235,17 @@
and del_flag = '0'
and weight = #{weight}
</select>
<select id="getIsApplication" resultType="java.lang.Integer">
SELECT
CASE
WHEN COUNT(ca.business_id) > 0 THEN 1
ELSE 0
END AS isApplication
FROM cms_application ca
WHERE ca.activity_id = #{activityId}
AND ca.user_id = #{userId}
AND ca.status = '1'
AND ca.flag = '1'
AND ca.del_flag = '0'
</select>
</mapper>
......@@ -88,7 +88,10 @@
and mi.mem_nick_name like concat('%',#{entity.memNickName},'%')
</if>
<if test="entity.status !=null and entity.status != '' ">
and status = #{entity.status}
and ca2.status = #{entity.status}
</if>
<if test="entity.activityId !=null and entity.activityId != '' ">
and ca2.activity_id = #{entity.activityId}
</if>
ORDER BY business_id DESC
</select>
......
......@@ -42,27 +42,27 @@
</select>
<select id="queryCmsBannersPaged" resultMap="BaseResultMap">
select smb.*,oi.url
from cms_banner smb
left join oss_info oi on smb.picture_id = oi.business_id
select cb.*,oi.url
from cms_banner cb
left join oss_info oi on cb.picture_id = oi.business_id
where 1=1
and smb.del_flag = '0'
and cb.del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
and smb.flag = #{entity.flag}
and cb.flag = #{entity.flag}
</if>
<if test="entity.pictureId !=null and entity.pictureId != '' ">
and smb.picture_id = #{entity.pictureId}
and cb.picture_id = #{entity.pictureId}
</if>
<if test="entity.bannerName !=null and entity.bannerName != '' ">
and smb.banner_name like concat('%',#{entity.bannerName},'%')
and cb.banner_name like concat('%',#{entity.bannerName},'%')
</if>
<if test="entity.type !=null and entity.type != '' ">
and smb.type like concat('%',#{entity.type},'%')
and cb.type = #{entity.type}
</if>
<if test="entity.weight !=null and entity.weight != '' ">
and smb.weight = #{entity.weight}
and cb.weight = #{entity.weight}
</if>
ORDER BY smb.weight DESC
ORDER BY cb.weight DESC
</select>
<select id="selectByIdWithUrl" resultType="org.rcisoft.business.cmsBanner.entity.CmsBanner">
SELECT smb.*,
......
......@@ -415,6 +415,11 @@
from opm_black_list obl
where obl.user_id = #{entity.loginUserId}
)
and m.user_id not in (
select obl.user_id
from opm_black_list obl
where obl.target_id = #{entity.loginUserId}
)
</if>
ORDER BY m.mem_level desc,m.mem_real_authen desc,m.is_recommended desc,m.sort,m.mem_code desc,m.business_id DESC
</select>
......@@ -439,29 +444,11 @@
select m.business_id,m.user_id,m.mem_code,m.mem_sex,m.mem_birthday,m.mem_constellation,m.mem_height,m.mem_weight,m.mem_max_education,
m.mem_college,m.mem_career,m.mem_year_income,m.mem_work_place,m.mem_residence_province,m.mem_residence_city,m.mem_native_province,
m.mem_native_city,m.mem_introduce,m.mem_hobby,m.mem_future_plan,m.mem_half_desire,m.mem_marriage,m.mem_marriage_remarks,
m.mem_mbti,m.mem_wx_code,m.mem_real_authen,m.mem_real_authen_date,m.mem_education_authen,m.mem_education_authen_date,m.mem_education_picture_id,m.mem_level,m.mem_level_begin_date,m.mem_level_end_date,
m.mem_code_level,m.flag,m.del_flag,m.create_by,m.create_date,m.update_by,m.update_date,m.remarks,m.mem_nation,m.wx_openid,m.avatar,
oi.url AS avatarUrl,m.sort,m.is_recommended,m.avatar_open,
m.mem_picture_id,m.mem_education_picture_id,
IFNULL(m.mem_nick_name, su.wx_nick_name) AS mem_nick_name,
GROUP_CONCAT( DISTINCT pic_urls.url ORDER BY pic_urls.business_id DESC SEPARATOR ',' ) AS pictureUrls,
oss.url AS educationPictureUrl,m.gold_coins_count
m.mem_mbti,m.mem_real_authen,m.mem_real_authen_date,m.mem_education_authen,m.mem_education_authen_date,m.mem_education_picture_id,m.mem_level,m.mem_level_begin_date,m.mem_level_end_date,
m.mem_code_level,m.flag,m.del_flag,m.create_by,m.create_date,m.update_by,m.update_date,m.remarks,m.mem_nation,m.avatar,
m.sort,m.is_recommended,m.avatar_open,
IFNULL(m.mem_nick_name, su.wx_nick_name) AS mem_nick_name
from mem_info m
LEFT JOIN oss_info oi on oi.business_id = m.avatar
LEFT JOIN (
SELECT
mem_info.business_id,
CAST( JSON_UNQUOTE( JSON_EXTRACT( mem_picture_id, CONCAT( '$.id[', jt_ids.idx - 1, ']' ))) AS UNSIGNED ) AS mem_picture_id
FROM
mem_info,
JSON_TABLE (
JSON_EXTRACT( mem_info.mem_picture_id, '$.id' ),
'$[*]' COLUMNS ( idx FOR ORDINALITY )) AS jt_ids
WHERE
mem_info.del_flag = '0'
) AS pic_ids ON m.business_id = pic_ids.business_id
LEFT JOIN oss_info pic_urls ON pic_ids.mem_picture_id = pic_urls.business_id
LEFT JOIN oss_info oss ON m.mem_education_picture_id = oss.business_id
LEFT JOIN sys_user su ON su.business_id = m.user_id
where m.business_id = #{businessId}
......@@ -600,23 +587,22 @@
and ouf.target_id = #{entity.targetId}),0) AS isFollowed;
</select>
<select id="queryRankPaged" resultType="org.rcisoft.business.memInfo.entity.MemInfo">
select
m.mem_nick_name,
m.mem_liked_count,
m.mem_code,
m.avatar
from mem_info m
where m.del_flag = 0
SELECT mi.business_id,mi.avatar,mi.mem_code,mi.mem_nick_name,SUM(oul.like_count) as memLikedCount
from opm_user_like oul
LEFT JOIN mem_info mi ON mi.user_id = oul.target_id
where 1=1
and mi.del_flag = '0'
<if test="entity.memSex !=null and entity.memSex != '' ">
and m.mem_sex = #{entity.memSex}
and mi.mem_sex = #{entity.memSex}
</if>
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and m.create_date &gt;= #{entity.beginTime}
and oul.create_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and m.create_date &lt;= #{entity.endTime}
and oul.create_date &lt;= #{entity.endTime}
</if>
order by m.mem_liked_count desc
group by oul.target_id
order by memLikedCount desc
</select>
<select id="queryFollowIdById" resultType="java.lang.Integer">
select ouf.target_id from opm_user_follow ouf WHERE ouf.user_id = #{userId}
......@@ -689,6 +675,15 @@
where 1=1
and user_id = #{entity.targetId}
</insert>
<insert id="addLikeCount">
update opm_user_like
set like_count = like_count + 1
where 1=1
and user_id = #{entity.userId}
and target_id = #{entity.targetId}
and create_date &gt;= #{entity.beginTime}
and create_date &lt;= #{entity.endTime}
</insert>
<insert id="leaveMessage">
insert into mem_user_leave_message (target_id,create_by,create_date,update_by,update_date,content)
values(#{targetId},#{userId},NOW(),#{userId},NOW(),#{content})
......@@ -748,6 +743,8 @@
select *
from mem_info mi
where 1=1
and mi.del_flag = '0'
and mi.user_id != 1
<if test="entity.memCode !=null and entity.memCode != '' ">
and mi.mem_code = #{entity.memCode}
</if>
......@@ -785,4 +782,88 @@
(mut.create_by = #{entity.createBy} and mut.target_id = #{entity.targetId})
OR (mut.create_by = #{entity.targetId} and mut.target_id = #{entity.createBy})
</select>
<select id="selectUserIdList" resultType="java.lang.Integer">
select sys_user.business_id
from sys_user
where 1=1
and del_flag = '0'
</select>
<select id="selectUserLikedCount" resultType="java.lang.Integer">
select SUM(like_count)
from opm_user_like
where 1=1
and target_id = #{userId}
GROUP BY target_id
</select>
<select id="selectUserFollowedCount" resultType="java.lang.Integer">
select count(business_id)
from opm_user_follow
where 1=1
and target_id = #{userId}
</select>
<select id="queryTalkWeChatTaskNoReplyCount" resultType="java.lang.Integer">
SELECT count(*)
FROM (
select *
from mem_user_task
where 1=1
and (create_by = #{createBy} and target_id = #{targetId}) OR (create_by = #{targetId} and target_id = #{createBy})
and status = '0'
) table1
where 1=1
and table1.target_id = #{loginUserId}
AND NOT EXISTS (
SELECT 1 FROM opm_black_list obl
WHERE (obl.user_id = table1.create_by AND obl.target_id = table1.target_id)
OR (obl.user_id = table1.target_id AND obl.target_id = table1.create_by)
)
</select>
<select id="queryWeChatTaskNoReplyCount" resultType="java.lang.Integer">
select count(*)
from mem_user_task mut
where 1=1
and mut.target_id = #{userId}
and mut.status = '0'
AND NOT EXISTS (
SELECT 1 FROM opm_black_list obl
WHERE (obl.user_id = mut.create_by AND obl.target_id = mut.target_id)
OR (obl.user_id = mut.target_id AND obl.target_id = mut.create_by)
)
</select>
<select id="getUserInfo" resultType="org.rcisoft.business.memInfo.entity.MemInfo">
select m.business_id as memberId,m.user_id as businessId,m.mem_code,m.mem_sex,m.mem_birthday,m.mem_constellation,m.mem_height,m.mem_weight,m.mem_max_education,
m.mem_college,m.mem_career,m.mem_year_income,m.mem_work_place,m.mem_residence_province,m.mem_residence_city,m.mem_native_province,
m.mem_native_city,m.mem_introduce,m.mem_hobby,m.mem_future_plan,m.mem_half_desire,m.mem_marriage,m.mem_marriage_remarks,
m.mem_mbti,m.mem_wx_code,m.mem_real_authen,m.mem_real_authen_date,m.mem_education_authen,m.mem_education_authen_date,m.mem_education_picture_id,m.mem_level,m.mem_level_begin_date,m.mem_level_end_date,
m.mem_code_level,m.flag,m.del_flag,m.create_by,m.create_date,m.update_by,m.update_date,m.remarks,m.mem_nation,m.wx_openid,m.avatar,
oi.url AS avatarUrl,m.sort,m.is_recommended,m.avatar_open,
m.mem_picture_id,m.mem_education_picture_id,su.wx_nick_name,
IFNULL(m.mem_nick_name, su.wx_nick_name) AS mem_nick_name,
GROUP_CONCAT( DISTINCT pic_urls.url ORDER BY pic_urls.business_id DESC SEPARATOR ',' ) AS pictureUrls,
oss.url AS educationPictureUrl,m.gold_coins_count
from mem_info m
LEFT JOIN oss_info oi on oi.business_id = m.avatar
LEFT JOIN (
SELECT
mem_info.business_id,
CAST( JSON_UNQUOTE( JSON_EXTRACT( mem_picture_id, CONCAT( '$.id[', jt_ids.idx - 1, ']' ))) AS UNSIGNED ) AS mem_picture_id
FROM
mem_info,
JSON_TABLE (
JSON_EXTRACT( mem_info.mem_picture_id, '$.id' ),
'$[*]' COLUMNS ( idx FOR ORDINALITY )) AS jt_ids
WHERE
mem_info.del_flag = '0'
) AS pic_ids ON m.business_id = pic_ids.business_id
LEFT JOIN oss_info pic_urls ON pic_ids.mem_picture_id = pic_urls.business_id
LEFT JOIN oss_info oss ON m.mem_education_picture_id = oss.business_id
LEFT JOIN sys_user su ON su.business_id = m.user_id
where m.user_id = #{userId}
</select>
<select id="getUserIsStop" resultType="java.lang.String">
SELECT su.flag
FROM sys_user su
WHERE 1=1
AND su.business_id = #{userId}
</select>
</mapper>
......@@ -108,20 +108,31 @@
<select id="queryTalkNoReadCount" resultType="java.lang.Integer">
SELECT count(*)
FROM (
SELECT mulm.target_id,mulm.read_status
SELECT mulm.target_id,mulm.read_status,mulm.create_by
FROM mem_user_leave_message mulm
WHERE
(mulm.create_by = #{createBy} and mulm.target_id = #{targetId})
OR (mulm.create_by = #{targetId} and mulm.target_id = #{createBy})
) table1
WHERE table1.target_id = #{loginUserId} and table1.read_status = '0'
WHERE 1=1
AND table1.target_id = #{loginUserId}
AND table1.read_status = '0'
AND NOT EXISTS (
SELECT 1 FROM opm_black_list obl
WHERE (obl.user_id = table1.create_by AND obl.target_id = table1.target_id)
OR (obl.user_id = table1.target_id AND obl.target_id = table1.create_by)
);
</select>
<select id="leaveMessageNoReadAllCount" resultType="java.lang.Integer">
SELECT COUNT(*)
from mem_user_leave_message mulm
where 1=1
and mulm.target_id = #{userId}
and mulm.read_status = '0'
SELECT count(*)
FROM mem_user_leave_message mulm
WHERE mulm.target_id = #{userId}
AND mulm.read_status = '0'
AND NOT EXISTS (
SELECT 1 FROM opm_black_list obl
WHERE (obl.user_id = mulm.create_by AND obl.target_id = mulm.target_id)
OR (obl.user_id = mulm.target_id AND obl.target_id = mulm.create_by)
);
</select>
<delete id="deleteTalkById">
delete from mem_user_talk where business_id = #{entity.businessId}
......
......@@ -241,6 +241,11 @@
from opm_black_list obl
where obl.user_id = #{entity.loginUserId}
)
and opa.create_by not in (
select obl.user_id
from opm_black_list obl
where obl.target_id = #{entity.loginUserId}
)
<if test="entity.topicId !=null and entity.topicId != 0 ">
and opa.topic_id = #{entity.topicId}
</if>
......
......@@ -63,6 +63,24 @@
ORDER BY cn.exam_status,cn.weight,cn.business_id DESC
</select>
<select id="appQueryOpmTopic" resultMap="BaseResultMap">
SELECT cn.business_id,
cn.create_by,
cn.create_date,
cn.update_by,
cn.del_flag,
cn.flag,
cn.topic_name,
cn.exam_status,
cn.weight,
cn.article_count
FROM opm_topic cn
where 1=1
and cn.del_flag = '0'
and cn.flag = '1'
ORDER BY cn.weight DESC
</select>
<select id="queryOpmTopicPaged" resultMap="BaseResultMap">
SELECT cn.business_id,
cn.create_by,
......@@ -77,7 +95,8 @@
su.nick_name as nickName
FROM opm_topic cn
LEFT JOIN sys_user su on su.business_id = cn.create_by
where cn.del_flag='0'
where 1=1
and cn.del_flag='0'
<if test="entity.flag!=null and entity.flag != '' ">
and cn.flag = #{entity.flag}
</if>
......@@ -99,14 +118,13 @@
<if test="entity.weight !=null and entity.weight != '' ">
and weight like concat('%',#{entity.weight},'%')
</if>
<if test="entity.articleCount !=null and entity.articleCount != '' ">
and article_count like concat('%',#{entity.articleCount},'%')
</if>
<if test="entity.topicName !=null and entity.topicName != '' ">
and topic_name like concat('%',#{entity.topicName},'%')
</if>
ORDER BY cn.exam_status,cn.weight,cn.business_id DESC
ORDER BY cn.exam_status ASC,cn.weight DESC,cn.article_count DESC
</select>
<update id="deleteOpmTopic" parameterType="java.lang.Integer">
update opm_topic
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment