后台程序

This commit is contained in:
liuh
2022-07-11 23:28:11 +08:00
parent cadd2785ac
commit 99a1a78388
8 changed files with 247 additions and 48 deletions

View File

@ -77,5 +77,27 @@ public class PartyEventMaintainController {
return BaseResponse.success(eventMockDataService.queryRightData()); return BaseResponse.success(eventMockDataService.queryRightData());
} }
@ApiOperation("后台查询列表")
@PostMapping("/styleProject/list")
public BaseResponse<List<EventMaintainOutVO>> queryStyleAndProject(@RequestBody EventMaintainInVO inVO) {
return BaseResponse.success(eventStyleService.queryStyleAndProject(inVO));
}
@ApiOperation("保存风采或项目")
@PostMapping("/styleProject/save")
public BaseResponse<Boolean> saveStyleOrProject(@RequestBody EventMaintainOutVO inVO) {
return BaseResponse.success(eventStyleService.saveStyleOrProject(inVO));
}
@ApiOperation("发送风采或项目")
@GetMapping("/styleProject/send")
public BaseResponse<Boolean> sendStyleOrProject(@RequestParam String id) {
return BaseResponse.success(eventStyleService.sendStyleOrProject(id));
}
@ApiOperation("删除风采或项目")
@GetMapping("/styleProject/delete")
public BaseResponse<Boolean> deleteStyleOrProject(@RequestParam String id) {
return BaseResponse.success(eventStyleService.deleteStyleOrProject(id));
}
} }

View File

@ -39,53 +39,22 @@ public class EventMaintainInVO implements Serializable {
@ApiModelProperty(value = "类别 1-首页2-活动风采3-攻坚克难") @ApiModelProperty(value = "类别 1-首页2-活动风采3-攻坚克难")
private String type; private String type;
/**
* 活动内容正文
*/
@ApiModelProperty(value = "活动内容正文")
private String content;
/**
* 活动图片
*/
@ApiModelProperty(value = "活动图片")
private String image;
/**
* 显示排序
*/
@ApiModelProperty(value = "显示排序")
private Integer sort;
/**
* 是否轮播广告0-否1-是
*/
@ApiModelProperty(value = "是否轮播广告0-否1-是")
private String banner;
/** /**
* 页面显示状态: 0-隐藏 1-显示 * 页面显示状态: 0-隐藏 1-显示
*/ */
@ApiModelProperty(value = "页面显示状态: 0-隐藏 1-显示") @ApiModelProperty(value = "页面显示状态: 0-草稿 1-发布")
private String status; private String status;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField(typeHandler = CustomLocalDateTimeTypeHandler.class)
private java.time.LocalDateTime createTime;
/** /**
* 发布时间 * 发布时间
*/ */
@ApiModelProperty(value = "发布时间") @ApiModelProperty(value = "开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField(typeHandler = CustomLocalDateTimeTypeHandler.class) @TableField(typeHandler = CustomLocalDateTimeTypeHandler.class)
private java.time.LocalDateTime sendTime; private java.time.LocalDateTime startTime;
/** /**
* 创建时间 * 创建时间

View File

@ -5,11 +5,13 @@ import com.chinaunicom.mall.ebtp.common.config.CustomLocalDateTimeTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
/** /**
* 实体类 EventMaintainOutVO * 实体类 EventMaintainOutVO
@ -19,11 +21,17 @@ import java.io.Serializable;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel @ApiModel
@Builder
public class EventMaintainOutVO implements Serializable { public class EventMaintainOutVO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* id
*/
@ApiModelProperty(value = "id")
private String id;
/** /**
* 标题 * 标题
*/ */
@ -42,7 +50,11 @@ public class EventMaintainOutVO implements Serializable {
*/ */
@ApiModelProperty(value = "活动内容正文") @ApiModelProperty(value = "活动内容正文")
private String content; private String content;
/**
* 二级标题
*/
@ApiModelProperty(value = "二级标题")
private String secordTitle;
/** /**
* 活动图片 * 活动图片
*/ */
@ -64,7 +76,7 @@ public class EventMaintainOutVO implements Serializable {
/** /**
* 页面显示状态: 0-隐藏 1-显示 * 页面显示状态: 0-隐藏 1-显示
*/ */
@ApiModelProperty(value = "页面显示状态: 0-隐藏 1-显示") @ApiModelProperty(value = "页面显示状态: 0-草稿 1-发布")
private String status; private String status;
/** /**
@ -74,7 +86,7 @@ public class EventMaintainOutVO implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField(typeHandler = CustomLocalDateTimeTypeHandler.class) @TableField(typeHandler = CustomLocalDateTimeTypeHandler.class)
private java.time.LocalDateTime createTime; private LocalDateTime createTime;
/** /**
* 发布时间 * 发布时间
@ -83,16 +95,13 @@ public class EventMaintainOutVO implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField(typeHandler = CustomLocalDateTimeTypeHandler.class) @TableField(typeHandler = CustomLocalDateTimeTypeHandler.class)
private java.time.LocalDateTime sendTime; private LocalDateTime sendTime;
/** /**
* 创建时间 * 发布人
*/ */
@ApiModelProperty(value = "结束时间") @ApiModelProperty(value = "发布人")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private String createBy;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField(typeHandler = CustomLocalDateTimeTypeHandler.class)
private java.time.LocalDateTime endTime;
} }

View File

@ -117,4 +117,17 @@ public class EventStyle implements Serializable {
@ApiModelProperty(value = "文件地址") @ApiModelProperty(value = "文件地址")
@TableField(exist = false) @TableField(exist = false)
private String filePath; private String filePath;
/**
* 发布人
*/
@ApiModelProperty(value = "发布人")
private String createBy;
/**
* 删除标识
*/
@ApiModelProperty(value = "删除标识")
private String deleteFlag;
} }

View File

@ -88,6 +88,18 @@ public class EventSubject implements Serializable {
@TableField(typeHandler = CustomLocalDateTimeTypeHandler.class) @TableField(typeHandler = CustomLocalDateTimeTypeHandler.class)
private java.time.LocalDateTime sendTime; private java.time.LocalDateTime sendTime;
/**
* 发布人
*/
@ApiModelProperty(value = "发布人")
private String createBy;
/**
* 删除标识
*/
@ApiModelProperty(value = "删除标识")
private String deleteFlag;
/** /**
* 项目名称 * 项目名称
*/ */

View File

@ -12,6 +12,7 @@ public enum PartyEventExceptionEnum implements BusinessExceptionAssert {
*/ */
FRAME_EXCEPTION_NO_BRANCH_INFO_FAIL(2200001, "没有党支部信息!"), FRAME_EXCEPTION_NO_BRANCH_INFO_FAIL(2200001, "没有党支部信息!"),
FRAME_EXCEPTION_NO_IMAGE_INFO_FAIL(2200002, "文档中心异常!"), FRAME_EXCEPTION_NO_IMAGE_INFO_FAIL(2200002, "文档中心异常!"),
FRAME_EXCEPTION_PARAM_IS_NULL_FAIL(2200003, "缺少必要参数!"),

View File

@ -1,6 +1,8 @@
package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service; package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventMaintainInVO;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventMaintainOutVO;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventQueryInVO; import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventQueryInVO;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventStyle; import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventStyle;
@ -17,4 +19,12 @@ public interface EventStyleService extends IService<EventStyle>{
List<EventStyle> getEventStyle(String type, EventQueryInVO inVO); List<EventStyle> getEventStyle(String type, EventQueryInVO inVO);
boolean saveStyle(EventStyle inVO); boolean saveStyle(EventStyle inVO);
List<EventMaintainOutVO> queryStyleAndProject(EventMaintainInVO inVO);
boolean saveStyleOrProject(EventMaintainOutVO inVO);
boolean sendStyleOrProject(String id);
boolean deleteStyleOrProject(String id);
} }

View File

@ -1,4 +1,6 @@
package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.impl; package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.impl;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventContact;
import com.google.common.collect.Lists;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
@ -11,15 +13,17 @@ import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
import com.chinaunicom.mall.ebtp.extend.feign.client.DocumentCenterService; import com.chinaunicom.mall.ebtp.extend.feign.client.DocumentCenterService;
import com.chinaunicom.mall.ebtp.extend.feign.entity.DocumentDataVO; import com.chinaunicom.mall.ebtp.extend.feign.entity.DocumentDataVO;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.dao.EventStyleMapper; import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.dao.EventStyleMapper;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventQueryInVO; import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.*;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventStyle;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.enums.PartyEventExceptionEnum; import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.enums.PartyEventExceptionEnum;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.EventStyleService; import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.EventStyleService;
import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.EventSubjectService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
@ -36,6 +40,8 @@ public class EventStyleServiceImpl extends ServiceImpl<EventStyleMapper, EventSt
@Resource @Resource
private DocumentCenterService documentCenterService; private DocumentCenterService documentCenterService;
@Resource
private EventSubjectService eventSubjectService;
@Override @Override
public List<EventStyle> getEventStyle(String type, EventQueryInVO inVO) { public List<EventStyle> getEventStyle(String type, EventQueryInVO inVO) {
@ -76,4 +82,161 @@ public class EventStyleServiceImpl extends ServiceImpl<EventStyleMapper, EventSt
inVO.setCreateTime(LocalDateTime.now()); inVO.setCreateTime(LocalDateTime.now());
return this.save(inVO); return this.save(inVO);
} }
@Override
public List<EventMaintainOutVO> queryStyleAndProject(EventMaintainInVO inVO) {
if (ObjectUtil.isNotNull(inVO)) {
inVO = new EventMaintainInVO();
}
List<EventMaintainOutVO> outVOList = new ArrayList<>();
List<EventStyle> styleList = new ArrayList<>();
if (StrUtil.isNotBlank(inVO.getType()) && !"3".equals(inVO.getType()) ) {
LambdaQueryWrapper<EventStyle> queryStyle = Wrappers.lambdaQuery();
queryStyle.ne(EventStyle::getDeleteFlag, "1");
if (StrUtil.isNotBlank(inVO.getTitle())) {
queryStyle.like(EventStyle::getTitle, inVO.getTitle());
}
if (StrUtil.isNotBlank(inVO.getType())) {
queryStyle.eq(EventStyle::getBanner, "1".equals(inVO.getType()) ? "1" : "0");
}
if (StrUtil.isNotBlank(inVO.getStatus())) {
queryStyle.eq(EventStyle::getStatus, inVO.getStatus());
}
if (ObjectUtil.isNotNull(inVO.getStartTime())) {
queryStyle.gt(EventStyle::getSendTime, inVO.getStartTime());
}
if (ObjectUtil.isNotNull(inVO.getEndTime())) {
queryStyle.lt(EventStyle::getSendTime, inVO.getEndTime());
}
styleList = this.list(queryStyle);
}
List<EventSubject> subjectList = new ArrayList<>();
if (StrUtil.isNotBlank(inVO.getType()) && !"1".equals(inVO.getType()) && !"2".equals(inVO.getType())) {
LambdaQueryWrapper<EventSubject> queryProject = Wrappers.lambdaQuery();
queryProject.ne(EventSubject::getDeleteFlag, "1");
if (StrUtil.isNotBlank(inVO.getTitle())) {
queryProject.like(EventSubject::getTitle, inVO.getTitle());
}
if (StrUtil.isNotBlank(inVO.getStatus())) {
queryProject.eq(EventSubject::getStatus, inVO.getStatus());
}
if (ObjectUtil.isNotNull(inVO.getStartTime())) {
queryProject.gt(EventSubject::getSendTime, inVO.getStartTime());
}
if (ObjectUtil.isNotNull(inVO.getEndTime())) {
queryProject.lt(EventSubject::getSendTime, inVO.getEndTime());
}
subjectList = eventSubjectService.list(queryProject);
}
if (!styleList.isEmpty()) {
styleList.forEach(s -> outVOList.add(
EventMaintainOutVO.builder()
.id(s.getId())
.sort(s.getSort())
.status(s.getStatus())
.image(s.getImage())
.title(s.getTitle())
.secordTitle(s.getSecordTitle())
.content(s.getContent())
.type("1".equals(s.getBanner())? "1" : "2")
.createTime(s.getCreateTime())
.createBy(s.getCreateBy())
.sendTime(s.getSendTime())
.build()));
}
if (!subjectList.isEmpty()) {
subjectList.forEach(s -> outVOList.add(
EventMaintainOutVO.builder()
.id(s.getId())
.sort(s.getSort())
.status(s.getStatus())
.image(s.getImage())
.title(s.getTitle())
.content(s.getContent())
.type("3")
.createTime(s.getCreateTime())
.createBy(s.getCreateBy())
.sendTime(s.getSendTime())
.build()));
}
return outVOList.stream().sorted(Comparator.comparing(EventMaintainOutVO::getSendTime).reversed()).collect(Collectors.toList());
}
@Override
public boolean saveStyleOrProject(EventMaintainOutVO inVO) {
if (ObjectUtil.isNull(inVO) || StrUtil.isBlank(inVO.getType())) {
PartyEventExceptionEnum.FRAME_EXCEPTION_PARAM_IS_NULL_FAIL.customValid(true);
return false;
}
if (StrUtil.isBlank(inVO.getId())) {
inVO.setId(PropertyUtils.getSnowflakeId());
}
if ("3".equals(inVO.getType())) {
EventSubject subject = new EventSubject();
subject.setId(inVO.getId());
subject.setTitle(inVO.getTitle());
subject.setContent(inVO.getContent());
subject.setSort(1);
subject.setStatus("0");
subject.setCreateTime(LocalDateTime.now());
subject.setCreateBy(inVO.getCreateBy());
return eventSubjectService.saveOrUpdate(subject);
}
EventStyle style = new EventStyle();
style.setId(inVO.getId());
style.setTitle(inVO.getTitle());
style.setSecordTitle(inVO.getSecordTitle());
style.setImageWord(inVO.getTitle());
style.setTitleImage(inVO.getImage());
style.setCategory("1");
style.setContent(inVO.getContent());
style.setImage(inVO.getImage());
style.setSort(1);
style.setBanner("1".equals(inVO.getType()) ? "1" : "0");
style.setStatus("0");
style.setCreateTime(LocalDateTime.now());
style.setCreateBy(inVO.getCreateBy());
return this.saveOrUpdate(style);
}
@Override
public boolean sendStyleOrProject(String id) {
EventSubject subject = eventSubjectService.getById(id);
if (ObjectUtil.isNotNull(subject) && StrUtil.isNotBlank(subject.getId())) {
subject.setStatus("1");
subject.setSendTime(LocalDateTime.now());
return eventSubjectService.updateById(subject);
}
EventStyle style = this.getById(id);
if (ObjectUtil.isNotNull(style) && StrUtil.isNotBlank(style.getId())) {
style.setStatus("1");
style.setSendTime(LocalDateTime.now());
return this.updateById(style);
}
return false;
}
@Override
public boolean deleteStyleOrProject(String id) {
EventSubject subject = eventSubjectService.getById(id);
if (ObjectUtil.isNotNull(subject) && StrUtil.isNotBlank(subject.getId())) {
subject.setDeleteFlag("1");
return eventSubjectService.updateById(subject);
}
EventStyle style = this.getById(id);
if (ObjectUtil.isNotNull(style) && StrUtil.isNotBlank(style.getId())) {
subject.setDeleteFlag("1");
return this.updateById(style);
}
return false;
}
} }