12 changed files with 265 additions and 4 deletions
@ -0,0 +1,21 @@ |
|||
package com.epmet.dto.form.work; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 描述一下 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/20 17:49 |
|||
*/ |
|||
@Data |
|||
public class PublishActInitResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 6579531592586604405L; |
|||
/** |
|||
* true:存在正在编辑的活动 false 不存在 |
|||
*/ |
|||
private Boolean existFlag; |
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.dto.form.work.PublishActInitResultDTO; |
|||
|
|||
/** |
|||
* 工作端活动草稿 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/20 17:51 |
|||
*/ |
|||
public interface WorkActDraftService { |
|||
|
|||
/** |
|||
* @return com.epmet.dto.form.work.PublishActInitResultDTO |
|||
* @param |
|||
* @author yinzuomei |
|||
* @description 发布活动初始化 |
|||
* @Date 2020/7/20 17:54 |
|||
**/ |
|||
PublishActInitResultDTO publishActInit(); |
|||
|
|||
/** |
|||
* @return void |
|||
* @param |
|||
* @author yinzuomei |
|||
* @description 发布活动-删除历史活动草稿 |
|||
* @Date 2020/7/20 18:15 |
|||
**/ |
|||
void deleteDraft(); |
|||
} |
@ -0,0 +1,64 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|||
import com.epmet.dto.form.work.PublishActInitResultDTO; |
|||
import com.epmet.service.LatestActInfoService; |
|||
import com.epmet.service.WorkActDraftService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.apache.logging.log4j.LogManager; |
|||
import org.apache.logging.log4j.Logger; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* 工作端活动草稿 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/20 17:52 |
|||
*/ |
|||
@Service |
|||
public class WorkActDraftServiceImpl implements WorkActDraftService { |
|||
private Logger logger = LogManager.getLogger(WorkActDraftServiceImpl.class); |
|||
@Autowired |
|||
private LoginUserUtil loginUserUtil; |
|||
@Autowired |
|||
private LatestActInfoService latestActInfoService; |
|||
|
|||
/** |
|||
* @return com.epmet.dto.form.work.PublishActInitResultDTO |
|||
* @param |
|||
* @author yinzuomei |
|||
* @description 发布活动初始化 |
|||
* @Date 2020/7/20 17:55 |
|||
**/ |
|||
@Override |
|||
public PublishActInitResultDTO publishActInit() { |
|||
PublishActInitResultDTO resultDTO=new PublishActInitResultDTO(); |
|||
resultDTO.setExistFlag(false); |
|||
String currentUserId=loginUserUtil.getLoginUserId(); |
|||
if(StringUtils.isNotBlank(currentUserId)){ |
|||
Integer count=latestActInfoService.countByUserId(currentUserId); |
|||
if(count>=1){ |
|||
logger.info(String.format("userId=%s存在%s条正在编辑的活动",currentUserId,count)); |
|||
resultDTO.setExistFlag(true); |
|||
} |
|||
}else{ |
|||
logger.warn("loginUserUtil.getLoginUserId()获取当前用户id为空"); |
|||
} |
|||
return resultDTO; |
|||
} |
|||
|
|||
/** |
|||
* @return void |
|||
* @author yinzuomei |
|||
* @description 发布活动-删除历史活动草稿 |
|||
* @Date 2020/7/20 18:15 |
|||
**/ |
|||
@Override |
|||
public void deleteDraft() { |
|||
String currentUserId=loginUserUtil.getLoginUserId(); |
|||
if(StringUtils.isNotBlank(currentUserId)){ |
|||
latestActInfoService.deleteAllDraft(currentUserId); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue