@ -9,6 +9,7 @@ import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg ;
import com.epmet.commons.tools.exception.EpmetErrorCode ;
import com.epmet.commons.tools.exception.RenException ;
import com.epmet.commons.tools.page.PageData ;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis ;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache ;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO ;
@ -27,6 +28,7 @@ import com.epmet.dto.*;
import com.epmet.dto.form.SystemMsgFormDTO ;
import com.epmet.dto.form.UserMessageFormDTO ;
import com.epmet.dto.form.WxSubscribeMessageFormDTO ;
import com.epmet.dto.form.resi.ResiActContentFormDTO ;
import com.epmet.dto.form.work.* ;
import com.epmet.dto.result.ActSponsorResultDTO ;
import com.epmet.dto.result.demand.OptionDTO ;
@ -35,6 +37,9 @@ import com.epmet.entity.*;
import com.epmet.feign.EpmetMessageOpenFeignClient ;
import com.epmet.feign.GovOrgOpenFeignClient ;
import com.epmet.service.* ;
import com.github.pagehelper.PageHelper ;
import com.github.pagehelper.PageInfo ;
import org.apache.commons.collections4.CollectionUtils ;
import org.apache.commons.lang3.StringUtils ;
import org.apache.logging.log4j.LogManager ;
import org.apache.logging.log4j.Logger ;
@ -108,7 +113,8 @@ public class WorkActServiceImpl implements WorkActService {
private IcActivityUnitRelationService icActivityUnitRelationService ;
@Resource
private IcActivityServiceRelationService icActivityServiceRelationService ;
@Autowired
private ActPointLogService actPointLogService ;
/ * *
* @author yinzuomei
@ -304,6 +310,10 @@ public class WorkActServiceImpl implements WorkActService {
* @Date 2020 / 7 / 21 19 : 20
* * /
private void auditAct ( PublishActInfoFormDTO formDTO ) {
if ( formDTO . getRichTextFlag ( ) ) {
// true:富文本;false: 原来小程序那种发布内容
return ;
}
//1、活动标题
if ( StringUtils . isNotBlank ( formDTO . getTitle ( ) ) ) {
this . auditActTitle ( formDTO . getTitle ( ) ) ;
@ -341,6 +351,9 @@ public class WorkActServiceImpl implements WorkActService {
* @Date 2020 / 7 / 27 14 : 01
* * /
private void auditRePublishAct ( RePublishFormDTO formDTO ) {
if ( formDTO . getRichTextFlag ( ) ) {
return ;
}
//1、活动标题
if ( StringUtils . isNotBlank ( formDTO . getTitle ( ) ) ) {
this . auditActTitle ( formDTO . getTitle ( ) ) ;
@ -1346,7 +1359,11 @@ public class WorkActServiceImpl implements WorkActService {
imgList . add ( actContent . getContent ( ) ) ;
}
}
this . auditActContent ( textList , imgList ) ;
//
if ( ! actInfoDTO . getRichTextFlag ( ) ) {
//不是富文本的走审核
this . auditActContent ( textList , imgList ) ;
}
//插入act_summary记录
int orderNum = 1 ;
for ( PublishActContentFormDTO actContentFormDTO : formDTO . getActSummary ( ) ) {
@ -1621,4 +1638,126 @@ public class WorkActServiceImpl implements WorkActService {
} ) ;
return content . get ( ) ;
}
/ * *
* @param formDTO
* @return 数字社区 - 爱心互助活动列表 : 查询当前客户下的所有活动 , 限制活动类型是爱心活动
* /
@Override
public PageData < ActPageResDTO > pageList ( ActPageFormDTO formDTO ) {
PageHelper . startPage ( formDTO . getPageNo ( ) , formDTO . getPageSize ( ) , formDTO . getIsPage ( ) ) ;
List < ActPageResDTO > list = actInfoDao . pageList ( formDTO ) ;
if ( CollectionUtils . isNotEmpty ( list ) ) {
Date nowDate = new Date ( ) ;
for ( ActPageResDTO actPageResDTO : list ) {
// 进行中的重新设置状态
if ( ActConstant . ACT_STATUS_PUBLISHED . equals ( actPageResDTO . getStatus ( ) ) ) {
// 活动状态:报名中:signing_up;截止报名: end_sign_up; 已开始: in_progress; 已报满: enough
if ( ! NumConstant . ONE_STR . equals ( DateUtils . comparteDate ( nowDate , actPageResDTO . getSignUpEndTime ( ) ) ) ) {
logger . info ( String . format ( "当前时间%s报名截止时间%s处于报名中" ,
DateUtils . format ( nowDate , DateUtils . DATE_TIME_PATTERN ) ,
DateUtils . format ( actPageResDTO . getSignUpEndTime ( ) , DateUtils . DATE_TIME_PATTERN ) ) ) ;
// 截止报名时间之前(包含报名时间截止时间点)
if ( ! actPageResDTO . getActQuotaCategory ( ) ) {
// 如果是不限制名额,则显示报名中
actPageResDTO . setStatus ( "signing_up" ) ;
logger . info ( "活动不限制名额,界面显示 报名中" ) ;
continue ;
} else {
// 固定名额,且已报名人数<活动需要人数显示报名中
if ( actPageResDTO . getActQuota ( ) > actPageResDTO . getSignedUp ( ) ) {
logger . info ( "活动限制名额,未报满,界面显示报名中" ) ;
actPageResDTO . setStatus ( "signing_up" ) ;
continue ;
} else if ( actPageResDTO . getActQuota ( ) . equals ( actPageResDTO . getSignedUp ( ) ) ) {
actPageResDTO . setStatus ( "enough" ) ;
logger . info ( "活动限制名额,且已报满,界面显示已报满" ) ;
continue ;
}
}
} else if ( NumConstant . ONE_STR . equals ( DateUtils . comparteDate ( nowDate , actPageResDTO . getSignUpEndTime ( ) ) )
& & NumConstant . ONE_NEG_STR . equals ( DateUtils . comparteDate ( nowDate , actPageResDTO . getActStartTime ( ) ) ) ) {
logger . info ( String . format ( "当前时间%s报名截止时间%s活动预计开始时间%s界面显示截止报名" ,
DateUtils . format ( nowDate , DateUtils . DATE_TIME_PATTERN ) ,
DateUtils . format ( actPageResDTO . getSignUpEndTime ( ) , DateUtils . DATE_TIME_PATTERN ) ,
DateUtils . format ( actPageResDTO . getActStartTime ( ) , DateUtils . DATE_TIME_PATTERN ) ) ) ;
// 活动报名截止-活动预计开始之间显示截止报名
actPageResDTO . setStatus ( "end_sign_up" ) ;
continue ;
} else if ( ! NumConstant . ONE_NEG_STR . equals ( DateUtils . comparteDate ( nowDate , actPageResDTO . getActStartTime ( ) ) ) ) {
logger . info ( String . format ( "当前时间%s活动预计开始时间%s界面显示已开始" ,
DateUtils . format ( nowDate , DateUtils . DATE_TIME_PATTERN ) ,
DateUtils . format ( actPageResDTO . getActStartTime ( ) , DateUtils . DATE_TIME_PATTERN ) ) ) ;
// 活动预计开始时间点之后,包含活动预计开始时间点,显示 已开始
actPageResDTO . setStatus ( "in_progress" ) ;
continue ;
}
}
}
}
PageInfo < ActPageResDTO > pageInfo = new PageInfo < > ( list ) ;
return new PageData < > ( list , pageInfo . getTotal ( ) ) ;
}
/ * *
* 数字社区查看活动详情
*
* @param actId
* @param userId
* @return
* /
@Override
public ActDetailResultDTO queryActDetail ( String actId , String userId ) {
ActInfoEntity actInfoEntity = actInfoDao . selectById ( actId ) ;
ActDetailResultDTO resultDTO = ConvertUtils . sourceToTarget ( actInfoEntity , ActDetailResultDTO . class ) ;
resultDTO . setActId ( actId ) ;
//查询活动详情
List < ActPreviewContentResultDTO > list = actContentDao . selectByActId ( actId ) ;
resultDTO . setActContent ( list ) ;
//当前活动是否是我发布的
if ( resultDTO . getCreatedBy ( ) . equals ( loginUserUtil . getLoginUserId ( ) ) ) {
resultDTO . setIsMyPublish ( true ) ;
} else {
resultDTO . setIsMyPublish ( false ) ;
}
if ( resultDTO . getSummaryFlag ( ) ) {
ResiActContentFormDTO resiActContentFormDTO = new ResiActContentFormDTO ( ) ;
resiActContentFormDTO . setActId ( actId ) ;
resultDTO . setSummaryContent ( actSummaryDao . selectListSummary ( resiActContentFormDTO ) ) ;
}
return resultDTO ;
}
/ * *
* @param formDTO
* /
@Transactional ( rollbackFor = Exception . class )
@Override
public void finish ( FinishActFormDTO formDTO ) {
// 1、保存活动实际开始、结束时间
saveActualTime ( formDTO ) ;
// 2、积分大于0的->发放积分
if ( formDTO . getReward ( ) > NumConstant . ZERO ) {
for ( GrantPointsFormDTO grantPointsFormDTO : formDTO . getUserList ( ) ) {
ActUserRelationDTO actUserRelationDTO = actUserRelationService . get ( grantPointsFormDTO . getActUserRelationId ( ) ) ;
// 更新act_user_relation改为已处理,给分
actUserRelationDTO . setProcessFlag ( ActConstant . HANDLED ) ;
actUserRelationDTO . setRewardFlag ( grantPointsFormDTO . getGrantPoint ( ) ? ActConstant . ACT_USER_STATUS_AGREE : ActConstant . ACT_USER_STATUS_DENY ) ;
actUserRelationDTO . setDenyRewardReason ( StrConstant . EPMETY_STR ) ;
actUserRelationService . update ( actUserRelationDTO ) ;
// 增加一条act_point_log
ActPointLogDTO actPointLogDTO = new ActPointLogDTO ( ) ;
actPointLogDTO . setActId ( actUserRelationDTO . getActId ( ) ) ;
actPointLogDTO . setUserId ( actUserRelationDTO . getUserId ( ) ) ;
actPointLogDTO . setPoints ( formDTO . getReward ( ) ) ;
actPointLogDTO . setOperateType ( grantPointsFormDTO . getGrantPoint ( ) ? ActConstant . ACT_USER_STATUS_AGREE : ActConstant . ACT_USER_STATUS_DENY ) ;
actPointLogDTO . setRemark ( grantPointsFormDTO . getGrantPoint ( ) ? StrConstant . EPMETY_STR : grantPointsFormDTO . getDenyRewardReason ( ) ) ;
actPointLogService . save ( actPointLogDTO ) ;
}
}
// 3、结束活动
finishAct ( formDTO . getActId ( ) ) ;
}
}