|
|
|
@ -11,19 +11,12 @@ import com.epmet.commons.tools.scan.param.TextScanParamDTO; |
|
|
|
import com.epmet.commons.tools.scan.param.TextTaskDTO; |
|
|
|
import com.epmet.commons.tools.scan.result.SyncScanResult; |
|
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.ScanContentUtils; |
|
|
|
import com.epmet.commons.tools.utils.*; |
|
|
|
import com.epmet.constant.ActConstant; |
|
|
|
import com.epmet.constant.ActMessageConstant; |
|
|
|
import com.epmet.constant.ReadFlagConstant; |
|
|
|
import com.epmet.dao.ActContentDao; |
|
|
|
import com.epmet.dao.ActInfoDao; |
|
|
|
import com.epmet.dao.ActOperationRecDao; |
|
|
|
import com.epmet.dao.ActUserRelationDao; |
|
|
|
import com.epmet.dto.ActInfoDTO; |
|
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
|
import com.epmet.dao.*; |
|
|
|
import com.epmet.dto.*; |
|
|
|
import com.epmet.dto.form.UserMessageFormDTO; |
|
|
|
import com.epmet.dto.form.work.*; |
|
|
|
import com.epmet.dto.result.ActSponsorResultDTO; |
|
|
|
@ -33,9 +26,7 @@ import com.epmet.entity.ActInfoEntity; |
|
|
|
import com.epmet.entity.ActOperationRecEntity; |
|
|
|
import com.epmet.feign.EpmetMessageOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.service.ActInfoService; |
|
|
|
import com.epmet.service.LatestActInfoService; |
|
|
|
import com.epmet.service.WorkActService; |
|
|
|
import com.epmet.service.*; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.logging.log4j.LogManager; |
|
|
|
import org.apache.logging.log4j.Logger; |
|
|
|
@ -84,6 +75,14 @@ public class WorkActServiceImpl implements WorkActService { |
|
|
|
private ActUserRelationDao actUserRelationDao; |
|
|
|
@Autowired |
|
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private ActStatisticalService actStatisticalService; |
|
|
|
@Autowired |
|
|
|
private ActUserRelationService actUserRelationService; |
|
|
|
@Autowired |
|
|
|
private HeartUserInfoDao heartUserInfoDao; |
|
|
|
@Autowired |
|
|
|
private HeartUserInfoService heartUserInfoService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @return void |
|
|
|
@ -247,13 +246,22 @@ public class WorkActServiceImpl implements WorkActService { |
|
|
|
**/ |
|
|
|
private ActInfoEntity constructActInfo(PublishActInfoFormDTO formDTO) { |
|
|
|
ActInfoEntity actInfoEntity = ConvertUtils.sourceToTarget(formDTO, ActInfoEntity.class); |
|
|
|
//报名开始、报名截止、活动预计开始、活动预计截止、签到开始、签到截止
|
|
|
|
actInfoEntity.setSignUpEndTime(DateUtils.minStrToSecondDate(formDTO.getSignUpEndTime())); |
|
|
|
actInfoEntity.setSignInStartTime(DateUtils.minStrToSecondDate(formDTO.getSignInStartTime())); |
|
|
|
actInfoEntity.setSignInEndTime(DateUtils.minStrToSecondDate(formDTO.getSignInEndTime())); |
|
|
|
actInfoEntity.setActStartTime(DateUtils.minStrToSecondDate(formDTO.getActStartTime())); |
|
|
|
actInfoEntity.setActEndTime(DateUtils.minStrToSecondDate(formDTO.getActEndTime())); |
|
|
|
//活动名额类型(0-不限名额,1-固定名额)
|
|
|
|
if(actInfoEntity.getActQuota()==0){ |
|
|
|
actInfoEntity.setActQuotaCategory(false); |
|
|
|
}else{ |
|
|
|
actInfoEntity.setActQuotaCategory(true); |
|
|
|
} |
|
|
|
actInfoEntity.setSignUpStartTime(new Date()); |
|
|
|
Date nowDate=new Date(); |
|
|
|
actInfoEntity.setSignUpStartTime(nowDate); |
|
|
|
actInfoEntity.setCreatedTime(nowDate); |
|
|
|
actInfoEntity.setUpdatedTime(nowDate); |
|
|
|
actInfoEntity.setActStatus(ActConstant.ACT_STATUS_PUBLISHED); |
|
|
|
|
|
|
|
//1已经总结0未总结
|
|
|
|
@ -267,7 +275,7 @@ public class WorkActServiceImpl implements WorkActService { |
|
|
|
logger.warn("根据agencyId查询组织信息失败,agencyId=",formDTO.getSponsorId()); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
actInfoEntity.setPid(""); |
|
|
|
actInfoEntity.setPid(StrConstant.EPMETY_STR); |
|
|
|
} |
|
|
|
return actInfoEntity; |
|
|
|
} |
|
|
|
@ -507,6 +515,9 @@ public class WorkActServiceImpl implements WorkActService { |
|
|
|
logger.error("act_info is null"); |
|
|
|
return ; |
|
|
|
} |
|
|
|
if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ |
|
|
|
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); |
|
|
|
} |
|
|
|
//插入取消活动操作日志
|
|
|
|
ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); |
|
|
|
actOperationRecEntity.setActId(formDTO.getActId()); |
|
|
|
@ -613,4 +624,99 @@ public class WorkActServiceImpl implements WorkActService { |
|
|
|
} |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param actId |
|
|
|
* @return void |
|
|
|
* @author yinzuomei |
|
|
|
* @description 已结束-确认结束活动 |
|
|
|
* @Date 2020/7/26 21:48 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void finishAct(String actId) { |
|
|
|
ActInfoDTO actInfoDTO=actInfoService.get(actId); |
|
|
|
//校验是否可以结束
|
|
|
|
this.checkActInfoDTO(actInfoDTO); |
|
|
|
//act_info表改为已完成
|
|
|
|
actInfoDTO.setActStatus(ActConstant.ACT_STATUS_FINISHED); |
|
|
|
actInfoService.update(actInfoDTO); |
|
|
|
//发放爱心时长、参与活动并获得积分的次数
|
|
|
|
updateHeartUserInfo(actInfoDTO); |
|
|
|
//保存结束活动日志
|
|
|
|
this.saveActOperationRec(actId); |
|
|
|
//生成统计表
|
|
|
|
this.saveActStatistical(actId); |
|
|
|
//发放积分调用事件 TODO
|
|
|
|
} |
|
|
|
|
|
|
|
private void updateHeartUserInfo(ActInfoDTO actInfoDTO) { |
|
|
|
List<ActUserRelationDTO> actUserRelationDTOList=actUserRelationService.getUserList(actInfoDTO.getId(),StrConstant.EPMETY_STR); |
|
|
|
for(ActUserRelationDTO actUserRelation:actUserRelationDTOList){ |
|
|
|
HeartUserInfoDTO heartUserInfoDTO=heartUserInfoDao.selectByUserId(actUserRelation.getUserId()); |
|
|
|
if(null==heartUserInfoDTO){ |
|
|
|
continue; |
|
|
|
} |
|
|
|
if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){ |
|
|
|
heartUserInfoDTO.setObtainPointNum(heartUserInfoDTO.getObtainPointNum()+1); |
|
|
|
} |
|
|
|
//爱心时长发放(签到的。未签到但是有积分的)
|
|
|
|
if(ActConstant.ACT_USER_STATUS_SIGNED_IN.equals(actUserRelation.getSignInFlag())){ |
|
|
|
//已签到的
|
|
|
|
heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin()); |
|
|
|
}else{ |
|
|
|
//未签到,但是有积分的
|
|
|
|
if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){ |
|
|
|
heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin()); |
|
|
|
} |
|
|
|
} |
|
|
|
heartUserInfoService.update(heartUserInfoDTO); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void saveActStatistical(String actId) { |
|
|
|
ActStatisticalDTO actStatisticalDTO=new ActStatisticalDTO(); |
|
|
|
actStatisticalDTO.setActId(actId); |
|
|
|
//报名总人数(已报名/待审核auditing,审核通过passed,审核不通过refused取消报名canceld总人数)
|
|
|
|
actStatisticalDTO.setSignupNum(actUserRelationDao.selectCountUser(actId,StrConstant.EPMETY_STR)); |
|
|
|
// 待审核总数
|
|
|
|
actStatisticalDTO.setAuditingNum(actUserRelationDao.selectCountUser(actId,ActConstant.ACT_USER_STATUS_AUDITING)); |
|
|
|
//审核不通过总人数
|
|
|
|
actStatisticalDTO.setPassedNum(actUserRelationDao.selectCountUser(actId,ActConstant.ACT_USER_STATUS_PASSED)); |
|
|
|
//审核不通过总人数
|
|
|
|
actStatisticalDTO.setRefusedNum(actUserRelationDao.selectCountUser(actId,ActConstant.ACT_USER_STATUS_REFUSED)); |
|
|
|
//取消报名的人数
|
|
|
|
actStatisticalDTO.setCanceldNum(actUserRelationDao.selectCountUser(actId,ActConstant.ACT_USER_STATUS_CANCELD)); |
|
|
|
//活动已签到人数
|
|
|
|
actStatisticalDTO.setSignedInUserNum(actUserRelationDao.selectCountSinedIn(actId)); |
|
|
|
//发放积分总人数
|
|
|
|
actStatisticalDTO.setRewardUserNum(actUserRelationDao.selectCountByReward(actId,ActConstant.ACT_USER_STATUS_AGREE)); |
|
|
|
//拒绝发放积分总人数
|
|
|
|
actStatisticalDTO.setDenyRewardUserNum(actUserRelationDao.selectCountByReward(actId,ActConstant.ACT_USER_STATUS_DENY)); |
|
|
|
actStatisticalService.save(actStatisticalDTO); |
|
|
|
} |
|
|
|
|
|
|
|
private void saveActOperationRec(String actId) { |
|
|
|
ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); |
|
|
|
actOperationRecEntity.setActId(actId); |
|
|
|
actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_FINISH); |
|
|
|
actOperationRecEntity.setNoticeUser(false); |
|
|
|
actOperationRecEntity.setRemark(StrConstant.EPMETY_STR); |
|
|
|
actOperationRecDao.insert(actOperationRecEntity); |
|
|
|
} |
|
|
|
|
|
|
|
private ActInfoDTO checkActInfoDTO(ActInfoDTO actInfoDTO) { |
|
|
|
if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ |
|
|
|
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); |
|
|
|
} |
|
|
|
List<ActUserRelationDTO> list=actUserRelationDao.selectInProgress(actInfoDTO.getId()); |
|
|
|
if(null!=list&&list.size()>0){ |
|
|
|
throw new RenException(EpmetErrorCode.HAVE_HANDLE.getCode()); |
|
|
|
} |
|
|
|
if(null==actInfoDTO.getActualStartTime()||null==actInfoDTO.getActualEndTime()){ |
|
|
|
throw new RenException(EpmetErrorCode.ACTUAL_TIME.getCode()); |
|
|
|
} |
|
|
|
return actInfoDTO; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|