diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
index ef2e916937..944c8afb2f 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
@@ -63,4 +63,14 @@ public interface StrConstant {
* true
*/
String FALSE = "false";
+
+ /**
+ * *
+ */
+ String STAR="*";
+
+ /**
+ * 空字符串
+ */
+ String EPMETY_STR="";
}
diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditUserFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditUserFormDTO.java
new file mode 100644
index 0000000000..580aa5ea7c
--- /dev/null
+++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditUserFormDTO.java
@@ -0,0 +1,31 @@
+package com.epmet.dto.form.work;
+
+import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * 审核通过、拒绝入参DTO
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2020/7/23 17:28
+ */
+@Data
+public class AuditUserFormDTO implements Serializable {
+ private static final long serialVersionUID = 243279409415285207L;
+ public interface AddUserInternalGroup {
+ }
+ public interface UserShowGroup extends CustomerClientShowGroup {
+ }
+ /**
+ * 列表页返回的主键
+ */
+ @NotBlank(message = "主键不能为空", groups = {AddUserInternalGroup.class})
+ private String actUserRelationId;
+
+ @NotBlank(message = "拒绝理由不能为空", groups = {UserShowGroup.class})
+ private String rejectReason;
+
+}
diff --git a/epmet-module/epmet-heart/epmet-heart-server/pom.xml b/epmet-module/epmet-heart/epmet-heart-server/pom.xml
index e245a2cdc9..ea9bf2cfa6 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/pom.xml
+++ b/epmet-module/epmet-heart/epmet-heart-server/pom.xml
@@ -76,6 +76,12 @@
2.0.0
compile
+
+ com.epmet
+ epmet-message-client
+ 2.0.0
+ compile
+
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java
index 5b6016b8b1..a13c2bed23 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java
@@ -49,22 +49,22 @@ public interface ActConstant {
String SPONSOR_GRID="grid";
/**
- * 活动操作日志:取消活动
+ * act_operation_rec活动操作日志:取消活动
*/
String ACT_OPER_TYPE_CANCEL="cancel";
/**
- * 活动操作日志:发布活动
+ * act_operation_rec活动操作日志:发布活动
*/
String ACT_OPER_TYPE_PUBLISH="publish";
/**
- * 活动操作日志:结束活动
+ * act_operation_rec活动操作日志:结束活动
*/
String ACT_OPER_TYPE_FINISH="finish";
/**
- * 活动操作日志:重新发布活动
+ * act_operation_rec活动操作日志:重新发布活动
*/
String ACT_OPER_TYPE_UPDATE="update";
@@ -87,4 +87,28 @@ public interface ActConstant {
* (4)act_user_relation表的status:取消报名canceld,
*/
String ACT_USER_STATUS_CANCELD="canceld";
+
+ /*操作类型(已报名/待审核auditing,
+ 审核通过passed,
+ 审核不通过refused
+ 取消报名canceld,
+ 已签到signedin
+ 发放积分rewarded
+ 拒绝发放积分refuse_reward
+ 重新处理processing
+ )*/
+ String ACT_USER_LOG_OPER_AUDITING="auditing";
+ String ACT_USER_LOG_OPER_PASSED="passed";
+ String ACT_USER_LOG_OPER_REFUSED="refused";
+ String ACT_USER_LOG_OPER_CANCELD="canceld";
+ String ACT_USER_LOG_OPER_SIGNEDIN="signedin";
+ String ACT_USER_LOG_OPER_REWARDED="rewarded";
+ String ACT_USER_LOG_OPER_REFUSE_REWARD="refuse_reward";
+ String ACT_USER_LOG_OPER_PROCESSING="processing";
+
+ /**
+ * 审核通过类型:auto, manual
+ */
+ String PASSEDTYPE_AUTO="auto";
+ String PASSEDTYPE_MANUAL="manual";
}
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java
new file mode 100644
index 0000000000..be7530973c
--- /dev/null
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java
@@ -0,0 +1,13 @@
+package com.epmet.constant;
+
+/**
+ * 描述一下
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2020/7/23 17:55
+ */
+public interface ActMessageConstant {
+ String TITLE="您有一条活动消息";
+ String AUDIT_PASSED="您报名的活动%s,已审核通过";
+ String AUDIT_REFUSED="您报名的活动%s,审核未通过,原因:%s";
+}
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java
index 2e280d6cce..e3a6c97e49 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java
@@ -3,6 +3,7 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
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.work.*;
@@ -98,7 +99,7 @@ public class WorkActUserController {
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author yinzuomei
- * @description 报名审核-人员详情
+ * @description 报名审核-人员详情(待审核、已通过,已拒绝,已取消报名用的是一个api)
* @Date 2020/7/22 22:44
**/
@PostMapping("userdetail")
@@ -119,4 +120,32 @@ public class WorkActUserController {
ValidatorUtils.validateEntity(formDTO, UserHistoricalActFormDTO.AddUserInternalGroup.class);
return new Result().ok(workActUserService.queryUserHistoricalAct(formDTO));
}
+
+ /**
+ * @return com.epmet.commons.tools.utils.Result
+ * @param formDTO
+ * @author yinzuomei
+ * @description 报名审核-审核通过
+ * @Date 2020/7/23 17:31
+ **/
+ @PostMapping("auditpass")
+ public Result auditPass(@RequestBody AuditUserFormDTO formDTO){
+ ValidatorUtils.validateEntity(formDTO, AuditUserFormDTO.AddUserInternalGroup.class);
+ workActUserService.auditPass(formDTO.getActUserRelationId());
+ return new Result();
+ }
+
+ /**
+ * @return com.epmet.commons.tools.utils.Result
+ * @param formDTO
+ * @author yinzuomei
+ * @description 报名审核-拒绝报名
+ * @Date 2020/7/23 18:08
+ **/
+ @PostMapping("auditrefuse")
+ public Result auditrefuse(@RequestBody AuditUserFormDTO formDTO){
+ ValidatorUtils.validateEntity(formDTO, AuditUserFormDTO.UserShowGroup.class,AuditUserFormDTO.AddUserInternalGroup.class);
+ workActUserService.auditRefuse(formDTO);
+ return new Result();
+ }
}
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java
index cfa875b824..0d125567c4 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java
@@ -1,6 +1,7 @@
package com.epmet.service;
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.work.*;
@@ -76,4 +77,22 @@ public interface WorkActUserService {
* @Date 2020/7/23 16:16
**/
UserHistoricalActResultDTO queryUserHistoricalAct(UserHistoricalActFormDTO formDTO);
+
+ /**
+ * @return void
+ * @param actUserRelationId
+ * @author yinzuomei
+ * @description 报名审核-审核通过
+ * @Date 2020/7/23 17:30
+ **/
+ void auditPass(String actUserRelationId);
+
+ /**
+ * @return void
+ * @param formDTO
+ * @author yinzuomei
+ * @description 报名审核-拒绝报名
+ * @Date 2020/7/23 18:14
+ **/
+ void auditRefuse(AuditUserFormDTO formDTO);
}
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java
index 50dd295bf1..94754726ac 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java
@@ -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
@@ -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