|
|
@ -1,19 +1,31 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.constant.AppClientConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.ActConstant; |
|
|
|
import com.epmet.constant.ActMessageConstant; |
|
|
|
import com.epmet.constant.ReadFlagConstant; |
|
|
|
import com.epmet.dao.ActInfoDao; |
|
|
|
import com.epmet.dao.ActUserLogDao; |
|
|
|
import com.epmet.dao.ActUserRelationDao; |
|
|
|
import com.epmet.dto.ActUserLogDTO; |
|
|
|
import com.epmet.dto.ActUserRelationDTO; |
|
|
|
import com.epmet.dto.HeartUserInfoDTO; |
|
|
|
import com.epmet.dto.form.UserMessageFormDTO; |
|
|
|
import com.epmet.dto.form.work.AactUserDetailFormDTO; |
|
|
|
import com.epmet.dto.form.work.AuditUserFormDTO; |
|
|
|
import com.epmet.dto.form.work.AuditingActUserFormDTO; |
|
|
|
import com.epmet.dto.form.work.UserHistoricalActFormDTO; |
|
|
|
import com.epmet.dto.result.UserBaseInfoResultDTO; |
|
|
|
import com.epmet.dto.result.work.*; |
|
|
|
import com.epmet.entity.ActInfoEntity; |
|
|
|
import com.epmet.entity.ActUserLogEntity; |
|
|
|
import com.epmet.entity.ActUserRelationEntity; |
|
|
|
import com.epmet.feign.EpmetMessageOpenFeignClient; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.service.ActUserRelationService; |
|
|
|
import com.epmet.service.HeartUserInfoService; |
|
|
@ -24,6 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -47,6 +60,10 @@ public class WorkActUserServiceImpl implements WorkActUserService { |
|
|
|
private ActUserLogDao actUserLogDao; |
|
|
|
@Autowired |
|
|
|
private ActUserRelationDao actUserRelationDao; |
|
|
|
@Autowired |
|
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private LoginUserUtil loginUserUtil; |
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return java.util.List<com.epmet.dto.result.work.AuditingActUserResultDTO> |
|
|
@ -333,6 +350,112 @@ public class WorkActUserServiceImpl implements WorkActUserService { |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param actUserRelationId |
|
|
|
* @return void |
|
|
|
* @author yinzuomei |
|
|
|
* @description 报名审核-审核通过 |
|
|
|
* @Date 2020/7/23 17:30 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void auditPass(String actUserRelationId) { |
|
|
|
ActUserRelationEntity actUserRelationEntity=actUserRelationDao.selectById(actUserRelationId); |
|
|
|
if(null==actUserRelationEntity||!ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserRelationEntity.getStatus())){ |
|
|
|
logger.info("当前用户不处理待审核状态"); |
|
|
|
return ; |
|
|
|
} |
|
|
|
ActInfoEntity actInfo = actInfoDao.selectById(actUserRelationEntity.getActId()); |
|
|
|
if(!actInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ |
|
|
|
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); |
|
|
|
} |
|
|
|
Date auditTime=new Date(); |
|
|
|
actUserRelationEntity.setStatus(ActConstant.ACT_USER_STATUS_PASSED); |
|
|
|
actUserRelationEntity.setPassedType(ActConstant.PASSEDTYPE_MANUAL); |
|
|
|
actUserRelationEntity.setAuditTime(auditTime); |
|
|
|
actUserRelationEntity.setFailureReason(StrConstant.EPMETY_STR); |
|
|
|
//更新关系记录表改为已通过
|
|
|
|
actUserRelationDao.updateById(actUserRelationEntity); |
|
|
|
|
|
|
|
ActUserLogEntity actUserLogEntity=new ActUserLogEntity(); |
|
|
|
actUserLogEntity.setActId(actUserRelationEntity.getActId()); |
|
|
|
actUserLogEntity.setUserId(actUserRelationEntity.getUserId()); |
|
|
|
actUserLogEntity.setOperationType(ActConstant.ACT_USER_LOG_OPER_PASSED); |
|
|
|
actUserLogEntity.setReason(StrConstant.EPMETY_STR); |
|
|
|
actUserLogEntity.setCreatedTime(auditTime); |
|
|
|
//插入一条日志
|
|
|
|
actUserLogDao.insert(actUserLogEntity); |
|
|
|
//给居民发消息
|
|
|
|
this.saveUserMessage(actUserRelationEntity,ActConstant.ACT_USER_STATUS_PASSED,actInfo); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return void |
|
|
|
* @author yinzuomei |
|
|
|
* @description 报名审核-拒绝报名 |
|
|
|
* @Date 2020/7/23 18:14 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void auditRefuse(AuditUserFormDTO formDTO) { |
|
|
|
ActUserRelationEntity actUserRelationEntity=actUserRelationDao.selectById(formDTO.getActUserRelationId()); |
|
|
|
if(null==actUserRelationEntity||!ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserRelationEntity.getStatus())){ |
|
|
|
logger.info("当前用户不处理待审核状态"); |
|
|
|
return ; |
|
|
|
} |
|
|
|
ActInfoEntity actInfo = actInfoDao.selectById(actUserRelationEntity.getActId()); |
|
|
|
if(!actInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ |
|
|
|
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); |
|
|
|
} |
|
|
|
Date auditTime=new Date(); |
|
|
|
actUserRelationEntity.setStatus(ActConstant.ACT_USER_STATUS_REFUSED); |
|
|
|
actUserRelationEntity.setPassedType(ActConstant.PASSEDTYPE_MANUAL); |
|
|
|
actUserRelationEntity.setAuditTime(auditTime); |
|
|
|
//拒绝理由必填
|
|
|
|
actUserRelationEntity.setFailureReason(formDTO.getRejectReason()); |
|
|
|
//更新关系记录表改为已拒绝
|
|
|
|
actUserRelationDao.updateById(actUserRelationEntity); |
|
|
|
ActUserLogEntity actUserLogEntity=new ActUserLogEntity(); |
|
|
|
actUserLogEntity.setActId(actUserRelationEntity.getActId()); |
|
|
|
actUserLogEntity.setUserId(actUserRelationEntity.getUserId()); |
|
|
|
actUserLogEntity.setOperationType(ActConstant.ACT_USER_LOG_OPER_REFUSED); |
|
|
|
actUserLogEntity.setReason(StrConstant.EPMETY_STR); |
|
|
|
actUserLogEntity.setCreatedTime(auditTime); |
|
|
|
//插入一条日志
|
|
|
|
actUserLogDao.insert(actUserLogEntity); |
|
|
|
//给居民发消息
|
|
|
|
this.saveUserMessage(actUserRelationEntity,ActConstant.ACT_USER_STATUS_REFUSED,actInfo); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param actUserRelationEntity |
|
|
|
* @param type |
|
|
|
* @return void |
|
|
|
* @author yinzuomei |
|
|
|
* @description 报名审核通过,拒绝通知居民 |
|
|
|
* @Date 2020/7/23 18:01 |
|
|
|
**/ |
|
|
|
private void saveUserMessage(ActUserRelationEntity actUserRelationEntity, String type,ActInfoEntity actInfo) { |
|
|
|
try { |
|
|
|
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); |
|
|
|
userMessageFormDTO.setUserId(actUserRelationEntity.getUserId()); |
|
|
|
userMessageFormDTO.setGridId(StrConstant.STAR); |
|
|
|
userMessageFormDTO.setApp(AppClientConstant.APP_RESI); |
|
|
|
userMessageFormDTO.setTitle(ActMessageConstant.TITLE); |
|
|
|
userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
|
if (ActConstant.ACT_USER_STATUS_PASSED.equals(type)) { |
|
|
|
userMessageFormDTO.setMessageContent(String.format(ActMessageConstant.AUDIT_PASSED, actInfo.getTitle())); |
|
|
|
} else if (ActConstant.ACT_USER_STATUS_REFUSED.equals(type)) { |
|
|
|
userMessageFormDTO.setMessageContent(String.format(ActMessageConstant.AUDIT_REFUSED, actInfo.getTitle(), actUserRelationEntity.getFailureReason())); |
|
|
|
} |
|
|
|
Result result = epmetMessageOpenFeignClient.saveUserMessage(userMessageFormDTO); |
|
|
|
if (result.success()) { |
|
|
|
logger.info("审核成功,已成功发送站内信"); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("审核结果,发送站内信异常", e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return com.epmet.dto.result.work.HistoricalActInfo |
|
|
|
* @param userId |
|
|
|