Browse Source

ActUserLog去除actId、userId新增ACT_USER_RELATION_ID(用户活动关系表主键)

feature/dangjian
尹作梅 6 years ago
parent
commit
efef100ffa
  1. 67
      esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/ActUserLogDTO.java
  2. 16
      esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/constant/ActUserRelationStatusConstant.java
  3. 36
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/entity/ActUserLogEntity.java
  4. 18
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/excel/ActUserLogExcel.java
  5. 2
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/ActUserRelationService.java
  6. 10
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserClockLogServiceImpl.java
  7. 45
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserRelationServiceImpl.java
  8. 4
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActUserLogDao.xml
  9. 16
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActUserRelationDao.xml

67
esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/ActUserLogDTO.java

@ -32,51 +32,56 @@ import java.util.Date;
@Data
public class ActUserLogDTO implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/**
* 主键
*/
/**
* 主键
*/
private String id;
/**
* 活动ID
*/
private String actId;
/**
* 活动ID
*/
// private String actId;
/**
* 用户ID
*/
private String userId;
/**
* 用户ID
*/
// private String userId;
/**
* 操作类别0-报名1-审核通过2-打卡3-取消报名4-审核不通过
*/
/**
* 用户活动关系表主键ACT_USER_RELATION_ID
*/
private String actUserRelationId;
/**
* 操作类别0-报名1-审核通过2-打卡3-取消报名4-审核不通过
*/
private String operationType;
/**
* 审核不通过的原因
*/
/**
* 审核不通过的原因
*/
private String failureReason;
/**
* 操作时间
*/
/**
* 操作时间
*/
private Date operationTime;
/**
* 乐观锁
*/
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
/**
* 创建时间
*/
private Date createdTime;
/**
@ -89,4 +94,4 @@ public class ActUserLogDTO implements Serializable {
*/
private Date updatedTime;
}
}

16
esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/constant/ActUserRelationStatusConstant.java

@ -1,7 +1,7 @@
package com.elink.esua.epdc.constant;
/**
* @Description 用户活动关系表当前状态0-报名1-审核通过2-打卡3-取消报名4-审核不通过
* @Description 用户活动关系表当前状态0-报名1-审核通过2-打卡3-取消报名4-审核不通过5-确认积分6-拒绝加积分
* @Author yinzuomei
* @Date 2020/2/5 21:35
*/
@ -24,10 +24,20 @@ public interface ActUserRelationStatusConstant {
/**
* 取消报名
*/
String CANCEL_SIGN_UP="3";
String CANCEL_SIGN_UP = "3";
/**
* 审核不通过
*/
String NOT_APPROVED="4";
String NOT_APPROVED = "4";
/**
* 确认积分
*/
String CONFIRM_ADD_POINTS = "5";
/**
* 拒绝加积分
*/
String REFUSE_ADD_POINTS = "6";
}

36
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/entity/ActUserLogEntity.java

@ -18,7 +18,6 @@
package com.elink.esua.epdc.modules.activity.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -38,24 +37,29 @@ public class ActUserLogEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 活动ID
*/
private String actId;
/**
* 活动ID
*/
// private String actId;
/**
* 用户ID
*/
private String userId;
/**
* 用户ID
*/
// private String userId;
/**
* 操作类别0-报名1-审核通过2-打卡3-取消报名4-审核不通过
*/
/**
* 用户活动关系表主键ACT_USER_RELATION_ID
*/
private String actUserRelationId;
/**
* 操作类别0-报名1-审核通过2-打卡3-取消报名4-审核不通过
*/
private String operationType;
/**
* 审核不通过的原因
*/
/**
* 审核不通过的原因
*/
private String failureReason;
/**
@ -63,4 +67,4 @@ public class ActUserLogEntity extends BaseEpdcEntity {
*/
private Date operationTime;
}
}

18
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/excel/ActUserLogExcel.java

@ -34,11 +34,17 @@ public class ActUserLogExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "活动ID")
private String actId;
@Excel(name = "用户ID")
private String userId;
// @Excel(name = "活动ID")
// private String actId;
//
// @Excel(name = "用户ID")
// private String userId;
/**
* 用户活动关系表主键ACT_USER_RELATION_ID
*/
@Excel(name = "用户活动关系表主键")
private String actUserRelationId;
@Excel(name = "操作类别(0-报名,1-审核通过,2-打卡,3-取消报名,4-审核不通过)")
private String operationType;
@ -65,4 +71,4 @@ public class ActUserLogExcel {
private Date updatedTime;
}
}

2
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/ActUserRelationService.java

@ -165,4 +165,4 @@ public interface ActUserRelationService extends BaseService<ActUserRelationEntit
*/
Result updateAuditDefaultStatus(String actId);
}
}

10
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserClockLogServiceImpl.java

@ -33,6 +33,7 @@ import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.constant.ActStateConstant;
import com.elink.esua.epdc.dto.UserDTO;
import com.elink.esua.epdc.dto.logs.PointsLogsDTO;
import com.elink.esua.epdc.modules.activity.dao.ActUserClockLogDao;
import com.elink.esua.epdc.modules.activity.entity.ActUserClockLogEntity;
import com.elink.esua.epdc.modules.activity.redis.ActUserClockLogRedis;
import com.elink.esua.epdc.modules.activity.service.*;
@ -42,7 +43,6 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.elink.esua.epdc.modules.activity.dao.ActUserClockLogDao;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.Arrays;
@ -178,8 +178,7 @@ public class ActUserClockLogServiceImpl extends BaseServiceImpl<ActUserClockLogD
actUserRelationService.update(actUserRelationEntity);
//存储活动日志表 epdc_act_user_log
ActUserLogDTO actUserLogDTO = new ActUserLogDTO();
actUserLogDTO.setUserId(checkDTO.getUserId());
actUserLogDTO.setActId(dto.getActId());
actUserLogDTO.setActUserRelationId(checkDTO.getId());
actUserLogDTO.setOperationType(dto.getStatus());
actUserLogDTO.setOperationTime(new Date());
actUserLogService.save(actUserLogDTO);
@ -249,8 +248,7 @@ public class ActUserClockLogServiceImpl extends BaseServiceImpl<ActUserClockLogD
String clockId = entity.getId();
//存储活动日志表 epdc_act_user_log
ActUserLogDTO actUserLogDTO = new ActUserLogDTO();
actUserLogDTO.setUserId(actUserRelationDTO.getUserId());
actUserLogDTO.setActId(actUserRelationDTO.getActId());
actUserLogDTO.setActUserRelationId(actUserRelationDTO.getId());
actUserLogDTO.setOperationType("2");//打卡
actUserLogDTO.setOperationTime(new Date());
actUserLogService.save(actUserLogDTO);
@ -269,4 +267,4 @@ public class ActUserClockLogServiceImpl extends BaseServiceImpl<ActUserClockLogD
return new Result().ok("打卡成功");
}
}
}

45
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserRelationServiceImpl.java

@ -30,6 +30,7 @@ import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.constant.ActStateConstant;
import com.elink.esua.epdc.constant.ActUserRelationStatusConstant;
import com.elink.esua.epdc.modules.activity.dao.ActInfoDao;
import com.elink.esua.epdc.modules.activity.dao.ActUserRelationDao;
import com.elink.esua.epdc.modules.activity.entity.ActUserRelationEntity;
@ -140,8 +141,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
updateById(updateEntity);
//存储活动日志表 epdc_act_user_log
ActUserLogDTO actUserLogDTO = new ActUserLogDTO();
actUserLogDTO.setUserId(entity.getUserId());
actUserLogDTO.setActId(entity.getActId());
actUserLogDTO.setActUserRelationId(dto.getId());
actUserLogDTO.setOperationType(dto.getStatus());
actUserLogDTO.setFailureReason(dto.getFailureReason());
actUserLogDTO.setOperationTime(new Date());
@ -162,42 +162,38 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
public Result activitySignUp(ActUserRelationDTO actUserRelationDTO) {
ActInfoDTO actInfoDTO = actInfoDao.queryActSignupNum(actUserRelationDTO.getActId());
//判断报名是否已满
if (actInfoDTO.getActQuotaCategory() != 0 && actInfoDTO.getActQuota() == actInfoDTO.getSignupNum()){
return new Result().error("已报满");
if (actInfoDTO.getActQuotaCategory() != 0 && actInfoDTO.getActQuota().equals(actInfoDTO.getSignupNum())) {
return new Result().error("活动已报满");
}
//查询是否已报名
int data = baseDao.isSignUp(actUserRelationDTO.getUserId(),actUserRelationDTO.getActId());
if(data == 0){
int data = baseDao.isSignUp(actUserRelationDTO.getUserId(), actUserRelationDTO.getActId());
if (data == 0) {
//未报名该活动,进行报名
//存储活动人员关系表
ActUserRelationEntity entity = ConvertUtils.sourceToTarget(actUserRelationDTO, ActUserRelationEntity.class);
insert(entity);
//存储活动日志表
ActUserLogDTO actUserLogDTO = new ActUserLogDTO();
actUserLogDTO.setActId(actUserRelationDTO.getActId());
actUserLogDTO.setUserId(actUserRelationDTO.getUserId());
actUserLogDTO.setOperationType("0");//报名
actUserLogDTO.setOperationTime(new Date());
actUserLogDTO.setActUserRelationId(entity.getId());
actUserLogDTO.setOperationType(ActUserRelationStatusConstant.SIGN_UP);
actUserLogDTO.setOperationTime(entity.getCreatedTime());
actUserLogService.save(actUserLogDTO);
//更新epdc_act_info的已报名名额
actInfoDTO.setSignupNum(actInfoDTO.getSignupNum() + 1);
actInfoService.update(actInfoDTO);
}else{
return new Result().error("已报名");
} else {
return new Result().error("已报名");
}
return new Result().ok("报名成功");
}
@Override
public Result activityCancelSignUp(AppActUserCancelsignupDTO appActUserCancelsignupDTO) {
//查询是否已报名
List<ActUserRelationDTO> data = baseDao.selectOneActUserRelationInfo(appActUserCancelsignupDTO.getUserId(),appActUserCancelsignupDTO.getActId());
if(data != null && data.size() > 0){
List<ActUserRelationDTO> data = baseDao.selectOneActUserRelationInfo(appActUserCancelsignupDTO.getUserId(), appActUserCancelsignupDTO.getActId());
if (data != null && data.size() > 0) {
ActUserRelationDTO actUserRelationDTO = data.get(0);
actUserRelationDTO.setStatus("3");//取消报名
actUserRelationDTO.setStatus(ActUserRelationStatusConstant.CANCEL_SIGN_UP);//取消报名
actUserRelationDTO.setFailureReason(appActUserCancelsignupDTO.getFailureReason());//取消报名原因
//已报名该活动,进行取消报名
//更新活动人员关系表
@ -205,12 +201,11 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
updateById(entity);
//存储活动日志表
ActUserLogDTO actUserLogDTO = new ActUserLogDTO();
actUserLogDTO.setActId(actUserRelationDTO.getActId());
actUserLogDTO.setUserId(actUserRelationDTO.getUserId());
actUserLogDTO.setOperationType("3");//取消报名
actUserLogDTO.setActUserRelationId(actUserRelationDTO.getActId());
actUserLogDTO.setOperationType(ActUserRelationStatusConstant.CANCEL_SIGN_UP);//取消报名
actUserLogDTO.setOperationTime(new Date());
actUserLogDTO.setFailureReason(appActUserCancelsignupDTO.getFailureReason());
actUserLogService.save(actUserLogDTO);
//更新epdc_act_info的已报名名额
ActInfoDTO actInfoDTO = actInfoDao.queryActSignupNum(actUserRelationDTO.getActId());
actInfoDTO.setSignupNum(actInfoDTO.getSignupNum() - 1);
@ -218,7 +213,6 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
}else{
return new Result().error("未报名");
}
return new Result().ok("取消报名成功");
}
@ -299,8 +293,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
updateById(entity);
// 存储活动日志表
ActUserLogDTO actUserLogDTO = new ActUserLogDTO();
actUserLogDTO.setActId(actUserRelationDTO.getActId());
actUserLogDTO.setUserId(actUserRelationDTO.getUserId());
actUserLogDTO.setActUserRelationId(entity.getId());
actUserLogDTO.setOperationType(actUserDefaultState);// 默认状态
actUserLogDTO.setOperationTime(new Date());
actUserLogService.save(actUserLogDTO);
@ -312,4 +305,4 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
return new Result().ok("该活动对已报名的志愿者自动审核成功");
}
}
}

4
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActUserLogDao.xml

@ -5,8 +5,6 @@
<resultMap type="com.elink.esua.epdc.modules.activity.entity.ActUserLogEntity" id="actUserLogMap">
<result property="id" column="ID"/>
<result property="actId" column="ACT_ID"/>
<result property="userId" column="USER_ID"/>
<result property="operationType" column="OPERATION_TYPE"/>
<result property="failureReason" column="FAILURE_REASON"/>
<result property="operationTime" column="OPERATION_TIME"/>
@ -18,4 +16,4 @@
</resultMap>
</mapper>
</mapper>

16
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActUserRelationDao.xml

@ -41,17 +41,12 @@
<result property="failureReason" column="FAILURE_REASON"/>
<result property="auditTime" column="AUDIT_TIME"/>
<result property="signupTime" column="SIGNUP_TIME"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="isSignUp" resultType="int" parameterType="String">
select count(*) countNum from epdc_act_user_relation where USER_ID = #{userId}
and ACT_ID = #{actId}
and status not in ('3' ,'4')
and status in ('0' ,'1')
and DEL_FLAG = 0
</select>
@ -60,7 +55,7 @@
from epdc_act_user_relation
where USER_ID = #{userId}
and ACT_ID = #{actId}
and status not in ('3' ,'4')
and status in ('0' ,'1')
</select>
<select id="getActUserRelationPageFromPC" resultMap="actUserRelationResultMap">
SELECT
@ -117,11 +112,6 @@
<result property="failureReason" column="FAILURE_REASON"/>
<result property="auditTime" column="AUDIT_TIME"/>
<result property="signupTime" column="SIGNUP_TIME"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="getActUserClockPageFromPC" resultMap="actUserClockResultMap">
SELECT
@ -246,4 +236,4 @@
and status = '0'
</select>
</mapper>
</mapper>

Loading…
Cancel
Save