Browse Source

heart-work:发布活动修改

dev_shibei_match
yinzuomei 5 years ago
parent
commit
51d8e62877
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java
  3. 15
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActStatisticalDTO.java
  4. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java
  5. 19
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java
  6. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java
  7. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActStatisticalEntity.java
  8. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java
  9. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java
  10. 136
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  11. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml
  12. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActStatisticalDao.xml
  13. 24
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -58,6 +58,9 @@ public enum EpmetErrorCode {
ACT_SIGN_IN_START_TIME_ERROR(8120,"签到开始时间应早于签到结束时间"),
ACT_SIGN_UP_END_TIME_ERROR(8121,"活动报名截止时间应早于活动预计开始时间"),
ACT_ACTUAL_START_TIME_ERROR(8122,"实际开始时间应早于实际结束时间"),
HAVE_HANDLE(8123,"存在待处理事项,请先处理"),
ACTUAL_TIME(8124,"请录入实际开始时间,实际结束时间"),
CANNOT_AUDIT_WARM(8201, "请完善居民信息"),
NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"),

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java

@ -94,9 +94,4 @@ public class ActPointLogDTO implements Serializable {
* 更新时间
*/
private Date updatedTime;
/**
* 1有效0无效只有在活动真正结束后才是1
* true有效 false无效
*/
private Boolean effectFlag;
}

15
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActStatisticalDTO.java

@ -17,9 +17,10 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
@ -44,7 +45,7 @@ public class ActStatisticalDTO implements Serializable {
private String actId;
/**
* 报名总人数已报名/待审核auditing审核通过passed审核不通过refused取消报名canceld总人数
* 报名总人数已报名/待审核auditing审核通过passed审核不通过refused取消报名canceld总人数
*/
private Integer signupNum;
@ -73,16 +74,6 @@ public class ActStatisticalDTO implements Serializable {
*/
private Integer signedInUserNum;
/**
* 添加实况总人数
*/
private Integer liveUserNum;
/**
* 实况总记录数
*/
private Integer liveCount;
/**
* 发放积分总人数
*/

14
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java

@ -176,4 +176,18 @@ public class WorkActController {
ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class);
return new Result<InProgressActDetailResultDTO>().ok(workActService.inProgressDetail(formDTO.getActId()));
}
/**
* @return com.epmet.commons.tools.utils.Result
* @param formDTO
* @author yinzuomei
* @description 已结束-确认结束活动
* @Date 2020/7/26 21:48
**/
@PostMapping("finishact")
public Result finishAct(@RequestBody ActIdFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class);
workActService.finishAct(formDTO.getActId());
return new Result();
}
}

19
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java

@ -156,4 +156,23 @@ public interface ActUserRelationDao extends BaseDao<ActUserRelationEntity> {
* @Date 2020/7/26 19:11
**/
List<DeniedUserResultDTO> selectDeniedList(String actId);
/**
* @return java.lang.Integer
* @param actId
* @author yinzuomei
* @description 活动已签到人数
* @Date 2020/7/26 22:34
**/
Integer selectCountSinedIn(String actId);
/**
* @return java.lang.Integer
* @param actId
* @param rewardFlag
* @author yinzuomei
* @description 查询发放积分的总人数拒绝发放积分的总人数
* @Date 2020/7/26 22:38
**/
Integer selectCountByReward(@Param("actId") String actId, @Param("rewardFlag")String rewardFlag);
}

6
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java

@ -61,10 +61,4 @@ public class ActPointLogEntity extends BaseEpmetEntity {
*/
private String remark;
/**
* 1有效0无效只有在活动真正结束后才是1
* true有效 false无效
*/
private Boolean effectFlag;
}

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActStatisticalEntity.java

@ -18,13 +18,10 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 活动统计信息
*
@ -44,7 +41,7 @@ public class ActStatisticalEntity extends BaseEpmetEntity {
private String actId;
/**
* 报名总人数已报名/待审核auditing审核通过passed审核不通过refused取消报名canceld总人数
* 报名总人数已报名/待审核auditing审核通过passed审核不通过refused取消报名canceld总人数
*/
private Integer signupNum;
@ -73,16 +70,6 @@ public class ActStatisticalEntity extends BaseEpmetEntity {
*/
private Integer signedInUserNum;
/**
* 添加实况总人数
*/
private Integer liveUserNum;
/**
* 实况总记录数
*/
private Integer liveCount;
/**
* 发放积分总人数
*/

9
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java

@ -110,4 +110,13 @@ public interface WorkActService {
* @Date 2020/7/26 21:34
**/
InProgressActDetailResultDTO inProgressDetail(String actId);
/**
* @return void
* @param actId
* @author yinzuomei
* @description 已结束-确认结束活动
* @Date 2020/7/26 21:48
**/
void finishAct(String actId);
}

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java

@ -137,11 +137,6 @@ public class GrantPointsServiceImpl implements GrantPointsService {
actPointLogDTO.setPoints(actInfoDTO.getReward());
actPointLogDTO.setOperateType(ActConstant.ACT_USER_STATUS_AGREE);
actPointLogDTO.setRemark(StrConstant.EPMETY_STR);
/**
* 1有效0无效只有在活动真正结束后才是1
* true有效 false无效
*/
actPointLogDTO.setEffectFlag(false);
actPointLogService.save(actPointLogDTO);
}
@ -186,11 +181,6 @@ public class GrantPointsServiceImpl implements GrantPointsService {
actPointLogDTO.setPoints(actInfoDTO.getReward());
actPointLogDTO.setOperateType(ActConstant.ACT_USER_STATUS_DENY);
actPointLogDTO.setRemark(formDTO.getDenyRewardReason());
/**
* 1有效0无效只有在活动真正结束后才是1
* true有效 false无效
*/
actPointLogDTO.setEffectFlag(false);
actPointLogService.save(actPointLogDTO);
}
@ -229,11 +219,6 @@ public class GrantPointsServiceImpl implements GrantPointsService {
actPointLogDTO.setPoints(actInfoDTO.getReward());
actPointLogDTO.setOperateType(ActConstant.RESET);
actPointLogDTO.setRemark(StrConstant.EPMETY_STR);
/**
* 1有效0无效只有在活动真正结束后才是1
* true有效 false无效
*/
actPointLogDTO.setEffectFlag(false);
actPointLogService.save(actPointLogDTO);
}

136
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java

@ -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;
}
}

1
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml

@ -10,7 +10,6 @@
<result property="points" column="POINTS"/>
<result property="operateType" column="OPERATE_TYPE"/>
<result property="remark" column="REMARK"/>
<result property="effectFlag" column="EFFECT_FLAG"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>

2
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActStatisticalDao.xml

@ -12,8 +12,6 @@
<result property="refusedNum" column="REFUSED_NUM"/>
<result property="canceldNum" column="CANCELD_NUM"/>
<result property="signedInUserNum" column="SIGNED_IN_USER_NUM"/>
<result property="liveUserNum" column="LIVE_USER_NUM"/>
<result property="liveCount" column="LIVE_COUNT"/>
<result property="rewardUserNum" column="REWARD_USER_NUM"/>
<result property="denyRewardUserNum" column="DENY_REWARD_USER_NUM"/>
<result property="delFlag" column="DEL_FLAG"/>

24
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml

@ -228,4 +228,28 @@
AND aur.ACT_ID = #{actId}
order by aur.UPDATED_TIME desc
</select>
<!-- 活动已签到人数 -->
<select id="selectCountSinedIn" resultType="java.lang.Integer" parameterType="java.lang.String">
SELECT
count( aur.id ) as total
FROM
act_user_relation aur
WHERE
aur.DEL_FLAG = '0'
AND aur.SIGN_IN_FLAG = 'signed_in'
AND aur.ACT_ID = #{actId}
</select>
<!-- 查询发放积分的总人数、拒绝发放积分的总人数 -->
<select id="selectCountByReward" parameterType="map" resultType="java.lang.Integer">
SELECT
count( aur.id ) as total
FROM
act_user_relation aur
WHERE
aur.DEL_FLAG = '0'
and aur.REWARD_FLAG=#{rewardFlag}
AND aur.ACT_ID = #{actId}
</select>
</mapper>

Loading…
Cancel
Save