Browse Source

爱心互助-居民端-增加事件发送

dev_shibei_match
zhangyongzhangyong 5 years ago
parent
commit
2523e7ffb3
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java
  2. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java
  3. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java
  4. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java
  5. 36
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java
  6. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java
  7. 43
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  8. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java
  9. 17
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java

@ -9,6 +9,7 @@ package com.epmet.commons.tools.enums;
public enum EventEnum { public enum EventEnum {
ACTIVE_SEND_POINT("active_send_point", "epmet_heart", "活动发放积分"), ACTIVE_SEND_POINT("active_send_point", "epmet_heart", "活动发放积分"),
REGISTER_VOLUNTEER("register_volunteer", "epmet_heart", "认证志愿者"), REGISTER_VOLUNTEER("register_volunteer", "epmet_heart", "认证志愿者"),
ACTIVE_INSERT_LIVE("active_insert_live", "epmet_heart", "添加活动实况"),
; ;
private String eventClass; private String eventClass;

6
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java

@ -95,4 +95,10 @@ public class ResiActInsertLiveFormDTO implements Serializable {
* id * id
*/ */
private String id; private String id;
/**
* 客户id
*/
@NotBlank(message = "客户id不能为空", groups = {AddUserShowGroup.class })
private String customerId;
} }

6
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java

@ -96,4 +96,10 @@ public class ResiActSignInFormDTO implements Serializable {
* 用户id * 用户id
*/ */
private String userId; private String userId;
/**
* 客户id
*/
@NotBlank(message = "客户id不能为空", groups = {AddUserShowGroup.class })
private String customerId;
} }

10
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java

@ -22,4 +22,14 @@ public interface ActMessageConstant {
String ACT_CANCELED="您报名的活动%s,已取消,原因:%s"; String ACT_CANCELED="您报名的活动%s,已取消,原因:%s";
String ACT_POINTS_EVENT_REMARK="参与%s"; String ACT_POINTS_EVENT_REMARK="参与%s";
/**
* 居民端-用户认证志愿者发送消息
*/
String POINTS_EVENT_VOLUNTEER_AUTHENTICATE="用户%s,认证志愿者";
/**
* 居民端-添加实况发送消息
*/
String ACT_POINTS_EVENT_VOLUNTEER_LIVE="用户%s,添加活动实况,活动:%s";
} }

36
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java

@ -17,10 +17,17 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.MqConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
import com.epmet.commons.tools.dto.form.mq.eventmsg.ActPointEventMsg;
import com.epmet.commons.tools.enums.EventEnum;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SendMqMsgUtils;
import com.epmet.constant.ActMessageConstant;
import com.epmet.dao.ActLivePicDao; import com.epmet.dao.ActLivePicDao;
import com.epmet.dao.ActLiveRecDao; import com.epmet.dao.ActLiveRecDao;
import com.epmet.dto.ActLivePicDTO; import com.epmet.dto.ActLivePicDTO;
@ -34,6 +41,8 @@ import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.ActLiveRecRedis; import com.epmet.redis.ActLiveRecRedis;
import com.epmet.service.ActLiveRecService; import com.epmet.service.ActLiveRecService;
import com.epmet.utils.ValidityVerification; import com.epmet.utils.ValidityVerification;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -48,6 +57,7 @@ import java.util.*;
*/ */
@Service @Service
public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiveRecEntity> implements ActLiveRecService { public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiveRecEntity> implements ActLiveRecService {
private Logger logger = LogManager.getLogger(VolunteerInfoServiceImpl.class);
@Autowired @Autowired
private ActLiveRecRedis actLiveRecRedis; private ActLiveRecRedis actLiveRecRedis;
@ -121,6 +131,32 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiv
actLivePicDao.insert(actLivePicEntity); actLivePicDao.insert(actLivePicEntity);
} }
} }
// 发送消息 由积分系统消费消息(需要使用规则)
this.grantActPoints(formDTO);
return new Result<String>().ok(uuid); return new Result<String>().ok(uuid);
} }
private void grantActPoints(ResiActInsertLiveFormDTO formDTO){
//备注
String remark=String.format(ActMessageConstant.ACT_POINTS_EVENT_VOLUNTEER_LIVE,formDTO.getUserId(),formDTO.getActId());
MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO();
//mq的事件类型
mqBaseMsgDTO.setEventClass(EventEnum.ACTIVE_INSERT_LIVE.getEventClass());
//事件code
mqBaseMsgDTO.setEventTag(EventEnum.ACTIVE_INSERT_LIVE.getEventTag());
List<ActPointEventMsg> actPointEventMsgList=new ArrayList<>();
ActPointEventMsg actPointEventMsg=new ActPointEventMsg();
actPointEventMsg.setCustomerId(formDTO.getCustomerId());
actPointEventMsg.setUserId(formDTO.getUserId());
actPointEventMsg.setActionFlag(MqConstant.PLUS);
actPointEventMsg.setIsCommon(false);
actPointEventMsg.setRemark(remark);
actPointEventMsgList.add(actPointEventMsg);
mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList));
Result result= SendMqMsgUtils.sendMsg(mqBaseMsgDTO);
if(!result.success()){
logger.error("添加活动实况,事件发送失败");
}
}
} }

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java

@ -202,7 +202,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
// 查询活动信息 // 查询活动信息
ActInfoDTO actInfoDTO = actInfoService.get(formDTO.getActId()); ActInfoDTO actInfoDTO = actInfoService.get(formDTO.getActId());
// >0 当前用户是志愿者 // >0 当前用户是志愿者
Integer volunteerFlag = volunteerInfoDao.queryVolunteerFlagByUserId(formDTO.getActId()); Integer volunteerFlag = volunteerInfoDao.queryVolunteerFlagByUserId(formDTO.getUserId());
if (actInfoDTO.getVolunteerLimit()){ if (actInfoDTO.getVolunteerLimit()){
// 活动只能志愿者参加, 当前用户是否满足条件 // 活动只能志愿者参加, 当前用户是否满足条件
satisfy = this.volunteerParticipationAct(volunteerFlag); satisfy = this.volunteerParticipationAct(volunteerFlag);

43
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java

@ -17,24 +17,37 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.MqConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
import com.epmet.commons.tools.dto.form.mq.eventmsg.ActPointEventMsg;
import com.epmet.commons.tools.enums.EventEnum;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SendMqMsgUtils;
import com.epmet.constant.ActMessageConstant;
import com.epmet.dao.VolunteerInfoDao; import com.epmet.dao.VolunteerInfoDao;
import com.epmet.dto.HeartUserInfoDTO; import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.form.WxUserInfoFormDTO; import com.epmet.dto.form.WxUserInfoFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.entity.ActUserRelationEntity;
import com.epmet.entity.VolunteerInfoEntity; import com.epmet.entity.VolunteerInfoEntity;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.VolunteerInfoRedis; import com.epmet.redis.VolunteerInfoRedis;
import com.epmet.service.HeartUserInfoService; import com.epmet.service.HeartUserInfoService;
import com.epmet.service.VolunteerInfoService; import com.epmet.service.VolunteerInfoService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/** /**
* 志愿者信息 * 志愿者信息
* *
@ -43,6 +56,7 @@ import org.springframework.transaction.annotation.Transactional;
*/ */
@Service @Service
public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao, VolunteerInfoEntity> implements VolunteerInfoService { public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao, VolunteerInfoEntity> implements VolunteerInfoService {
private Logger logger = LogManager.getLogger(VolunteerInfoServiceImpl.class);
@Autowired @Autowired
private VolunteerInfoRedis volunteerInfoRedis; private VolunteerInfoRedis volunteerInfoRedis;
@ -66,17 +80,42 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
} else { } else {
// 不是志愿者:插入志愿者信息表 // 不是志愿者:插入志愿者信息表
baseDao.insert(volunteerInfoEntity); baseDao.insert(volunteerInfoEntity);
// 发送消息 由积分系统消费消息(需要使用规则)
//?
// 更新用户信息表的 是否是志愿者标识 // 更新用户信息表的 是否是志愿者标识
HeartUserInfoDTO userInfoDTO = new HeartUserInfoDTO(); HeartUserInfoDTO userInfoDTO = new HeartUserInfoDTO();
userInfoDTO.setUserId(tokenDto.getUserId()); userInfoDTO.setUserId(tokenDto.getUserId());
userInfoDTO.setVolunteerFlag(true); userInfoDTO.setVolunteerFlag(true);
heartUserInfoService.updateHeartUserInfoByUserId(userInfoDTO); heartUserInfoService.updateHeartUserInfoByUserId(userInfoDTO);
// 发送消息 由积分系统消费消息(需要使用规则)
this.grantActPoints(formDTO);
} }
// 更新用户基础信息表 并 更新用户微信表 // 更新用户基础信息表 并 更新用户微信表
WxUserInfoFormDTO wxUserInfoFormDTO = ConvertUtils.sourceToTarget(formDTO, WxUserInfoFormDTO.class); WxUserInfoFormDTO wxUserInfoFormDTO = ConvertUtils.sourceToTarget(formDTO, WxUserInfoFormDTO.class);
return epmetUserOpenFeignClient.updateUserBaseAndWxUserInfo(wxUserInfoFormDTO); return epmetUserOpenFeignClient.updateUserBaseAndWxUserInfo(wxUserInfoFormDTO);
} }
private void grantActPoints(ResiVolunteerAuthenticateFormDTO formDTO){
//备注
String remark=String.format(ActMessageConstant.POINTS_EVENT_VOLUNTEER_AUTHENTICATE,formDTO.getUserId());
MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO();
//mq的事件类型
mqBaseMsgDTO.setEventClass(EventEnum.REGISTER_VOLUNTEER.getEventClass());
//事件code
mqBaseMsgDTO.setEventTag(EventEnum.REGISTER_VOLUNTEER.getEventTag());
List<ActPointEventMsg> actPointEventMsgList=new ArrayList<>();
ActPointEventMsg actPointEventMsg=new ActPointEventMsg();
actPointEventMsg.setCustomerId(formDTO.getCustomerId());
actPointEventMsg.setUserId(formDTO.getUserId());
actPointEventMsg.setActionFlag(MqConstant.PLUS);
actPointEventMsg.setIsCommon(false);
actPointEventMsg.setRemark(remark);
actPointEventMsgList.add(actPointEventMsg);
mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList));
Result result= SendMqMsgUtils.sendMsg(mqBaseMsgDTO);
if(!result.success()){
logger.error("志愿者认证事件发送失败");
}
}
} }

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java

@ -71,7 +71,7 @@ public class ValidityVerification {
* @Date 14:42 2020-07-15 * @Date 14:42 2020-07-15
**/ **/
public void imgScanVerification(List<String> imgList, String businessEnum){ public void imgScanVerification(List<String> imgList, String businessEnum){
if (NumConstant.ZERO != imgList.size()){ if (null != imgList && NumConstant.ZERO != imgList.size()){
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
imgList.forEach(url -> { imgList.forEach(url -> {
ImgTaskDTO task = new ImgTaskDTO(); ImgTaskDTO task = new ImgTaskDTO();

17
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml

@ -66,9 +66,10 @@
IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag
FROM act_info i FROM act_info i
LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0'
LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND (re.`STATUS` = 'auditing' OR re.`STATUS` = 'passed') GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
WHERE i.DEL_FLAG = '0' WHERE i.DEL_FLAG = '0'
AND i.ACT_STATUS = 'published' AND i.ACT_STATUS = 'published'
AND <![CDATA[ DATE_FORMAT(i.SIGN_UP_END_TIME,'%Y-%m-%d %H:%i:%s') >= ]]> NOW() -- 报名截止时间 >= 当前时间
AND (i.ACT_QUOTA_CATEGORY = 0 OR i.ACT_QUOTA > IFNULL(c.signupNum, 0)) -- 不限名额或者报名人数未报满 AND (i.ACT_QUOTA_CATEGORY = 0 OR i.ACT_QUOTA > IFNULL(c.signupNum, 0)) -- 不限名额或者报名人数未报满
AND i.CUSTOMER_ID = #{customerId} AND i.CUSTOMER_ID = #{customerId}
ORDER BY i.ACT_QUOTA_CATEGORY DESC,i.CREATED_TIME DESC ORDER BY i.ACT_QUOTA_CATEGORY DESC,i.CREATED_TIME DESC
@ -91,9 +92,10 @@
IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag
FROM act_info i FROM act_info i
LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0'
LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND (re.`STATUS` = 'auditing' OR re.`STATUS` = 'passed') GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
WHERE i.DEL_FLAG = '0' WHERE i.DEL_FLAG = '0'
AND i.ACT_STATUS = 'published' AND i.ACT_STATUS = 'published'
AND <![CDATA[ DATE_FORMAT(i.SIGN_UP_END_TIME,'%Y-%m-%d %H:%i:%s') >= ]]> NOW() -- 报名截止时间 >= 当前时间
AND i.ACT_QUOTA_CATEGORY = 1 -- 固定名额 AND i.ACT_QUOTA_CATEGORY = 1 -- 固定名额
AND i.ACT_QUOTA = IFNULL(c.signupNum, 0) -- 名额已满 AND i.ACT_QUOTA = IFNULL(c.signupNum, 0) -- 名额已满
AND i.CUSTOMER_ID = #{customerId} AND i.CUSTOMER_ID = #{customerId}
@ -117,7 +119,7 @@
IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag
FROM act_info i FROM act_info i
LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0'
LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND (re.`STATUS` = 'auditing' OR re.`STATUS` = 'passed') GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
WHERE i.DEL_FLAG = '0' WHERE i.DEL_FLAG = '0'
-- 活动开始时间 > 当前时间 并且 报名截止时间 &lt; 当前时间 报名已结束,活动未开始 未开始 -- 活动开始时间 > 当前时间 并且 报名截止时间 &lt; 当前时间 报名已结束,活动未开始 未开始
AND ( <![CDATA[ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i:%s') > ]]> NOW() AND <![CDATA[ DATE_FORMAT(i.SIGN_UP_END_TIME,'%Y-%m-%d %H:%i:%s') < ]]> NOW() ) AND ( <![CDATA[ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i:%s') > ]]> NOW() AND <![CDATA[ DATE_FORMAT(i.SIGN_UP_END_TIME,'%Y-%m-%d %H:%i:%s') < ]]> NOW() )
@ -143,10 +145,10 @@
IF(u.USER_ID = #{userId},'1','0') as signupFlag -- 用户报名状态(0-未报名,1已报名) IF(u.USER_ID = #{userId},'1','0') as signupFlag -- 用户报名状态(0-未报名,1已报名)
FROM act_info i FROM act_info i
LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0'
LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` = 'passed' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
WHERE i.DEL_FLAG = '0' WHERE i.DEL_FLAG = '0'
-- 活动开始时间 &lt;= 当前时间 并且活动结束时间 >= 当前时间 进行中 -- 活动开始时间 &lt;= 当前时间 并且活动结束时间 >= 当前时间 进行中
AND ( <![CDATA[ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i:%s') <= ]]> NOW() AND <![CDATA[ DATE_FORMAT(i.SIGN_UP_END_TIME,'%Y-%m-%d %H:%i:%s') >= ]]> NOW() ) AND ( <![CDATA[ DATE_FORMAT(i.ACT_START_TIME,'%Y-%m-%d %H:%i:%s') <= ]]> NOW() AND <![CDATA[ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i:%s') >= ]]> NOW() )
AND i.ACT_STATUS != 'canceled' AND i.ACT_STATUS != 'canceled'
AND i.CUSTOMER_ID = #{customerId} AND i.CUSTOMER_ID = #{customerId}
ORDER BY i.CREATED_TIME DESC ORDER BY i.CREATED_TIME DESC
@ -169,9 +171,10 @@
IF(u.USER_ID = #{userId},'1','0') as signupFlag -- 用户报名状态(0-未报名,1已报名) IF(u.USER_ID = #{userId},'1','0') as signupFlag -- 用户报名状态(0-未报名,1已报名)
FROM act_info i FROM act_info i
LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0'
LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` = 'passed' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
WHERE i.DEL_FLAG = '0' WHERE i.DEL_FLAG = '0'
AND i.ACT_STATUS = 'finished' AND i.ACT_STATUS != 'canceled'
AND <![CDATA[ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i:%s') < ]]> NOW()
AND i.CUSTOMER_ID = #{customerId} AND i.CUSTOMER_ID = #{customerId}
ORDER BY i.CREATED_TIME DESC ORDER BY i.CREATED_TIME DESC
LIMIT #{pageNo}, #{pageSize} LIMIT #{pageNo}, #{pageSize}

Loading…
Cancel
Save