diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/BizServiceEbtpExtendApplication.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/BizServiceEbtpExtendApplication.java index 05651ce..e799bce 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/BizServiceEbtpExtendApplication.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/BizServiceEbtpExtendApplication.java @@ -23,7 +23,6 @@ import org.springframework.scheduling.annotation.EnableAsync; @EnableEurekaClient @MapperScan({"com.chinaunicom.mall.ebtp.extend.**.dao"}) @ComponentScan("com.chinaunicom.mall.ebtp.*") -@EnableApolloConfig @EnableAsync public class BizServiceEbtpExtendApplication { diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/controller/PartyEventMaintainController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/controller/PartyEventMaintainController.java index fa5852e..3360e58 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/controller/PartyEventMaintainController.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/controller/PartyEventMaintainController.java @@ -2,19 +2,25 @@ package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.controller; import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse; +import com.chinaunicom.mall.ebtp.common.poiExport.constant.ExportConstant; +import com.chinaunicom.mall.ebtp.common.poiExport.entity.ExcelTable; import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.*; import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.*; import java.util.List; -import java.util.Map; @RestController @Api(tags = "活动运维接口") +@Slf4j @RequestMapping("/v1/eventmaintain") public class PartyEventMaintainController { @@ -28,6 +34,8 @@ public class PartyEventMaintainController { private EventSubjectService eventSubjectService; @Resource private EventContactService eventContactService; + @Resource + private EventContactSuggestionService eventContactSuggestionService; @@ -77,5 +85,84 @@ public class PartyEventMaintainController { return BaseResponse.success(eventMockDataService.queryRightData()); } + @ApiOperation("后台查询列表") + @PostMapping("/styleProject/list") + public BaseResponse> queryStyleAndProject(@RequestBody(required = false) EventMaintainInVO inVO) { + return BaseResponse.success(eventStyleService.queryStyleAndProject(inVO)); + } + + @ApiOperation("保存风采或项目") + @PostMapping("/styleProject/save") + public BaseResponse saveStyleOrProject(@RequestBody EventMaintainOutVO inVO) { + return BaseResponse.success(eventStyleService.saveStyleOrProject(inVO)); + } + + @ApiOperation("发送风采或项目") + @GetMapping("/styleProject/send") + public BaseResponse sendStyleOrProject(@RequestParam("id") String id,@RequestParam("status") String status) { + return BaseResponse.success(eventStyleService.sendStyleOrProject(id, status)); + } + + @ApiOperation("删除风采或项目") + @GetMapping("/styleProject/delete") + public BaseResponse deleteStyleOrProject(@RequestParam("id") String id) { + return BaseResponse.success(eventStyleService.deleteStyleOrProject(id)); + } + + + @ApiOperation("后台查询列表") + @PostMapping("/suggestion/list") + public BaseResponse> querySuggestion(@RequestBody(required = false) EventMaintainInVO inVO) { + return BaseResponse.success(eventContactSuggestionService.querySuggestion(inVO)); + } + + @GetMapping(value = "/suggestion/export/") + public BaseResponse export(@RequestParam(value = "ids",required = false) List ids) { + ExcelTable table = eventContactSuggestionService.export(ids); + ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletResponse response = requestAttributes.getResponse(); + this.exportGetlist(response, table); + return BaseResponse.success(true); + } + + public void exportGetlist(HttpServletResponse response, ExcelTable table) { + + OutputStream out = null; + InputStream is = null; + File file = null; + try { + file = ExportConstant.generateExcelByTable(table); + response.addHeader("content-disposition", "attachment;filename=" + + java.net.URLEncoder.encode(file.getName(), "utf-8")); + out = response.getOutputStream(); + is = new FileInputStream(file); + + byte[] b = new byte[4096]; + int size = is.read(b); + while (size > 0) { + out.write(b, 0, size); + size = is.read(b); + } + out.close(); + is.close(); + } catch (Exception e) { + log.error("error: {}, {}", table.toString(), e.getMessage()); + } finally { + try { + if (is != null) { + is.close(); + } + if (out != null) { + out.close(); + } + } catch (IOException e) { + log.error("error: {}, {}", table.toString(), e.getMessage()); + } + if (file != null) { + boolean delete = file.delete(); + log.info("delete:{}", delete); + } + } + } } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventContactSuggestion.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventContactSuggestion.java index cca10c1..b008dcf 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventContactSuggestion.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventContactSuggestion.java @@ -12,6 +12,7 @@ import lombok.experimental.Accessors; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; +import java.time.LocalDateTime; /** * 实体类 EventContactSuggestion @@ -107,7 +108,7 @@ public class EventContactSuggestion implements Serializable { @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; + private LocalDateTime createTime; } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventMaintainInVO.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventMaintainInVO.java index 4bc0079..c61b08d 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventMaintainInVO.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventMaintainInVO.java @@ -39,53 +39,22 @@ public class EventMaintainInVO implements Serializable { @ApiModelProperty(value = "类别 1-首页,2-活动风采,3-攻坚克难") 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-显示 */ - @ApiModelProperty(value = "页面显示状态: 0-隐藏 1-显示") + @ApiModelProperty(value = "页面显示状态: 0-草稿 1-发布") 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") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @TableField(typeHandler = CustomLocalDateTimeTypeHandler.class) - private java.time.LocalDateTime sendTime; + private java.time.LocalDateTime startTime; /** * 创建时间 diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventMaintainOutVO.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventMaintainOutVO.java index 4e2134a..c557e5d 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventMaintainOutVO.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventMaintainOutVO.java @@ -5,11 +5,13 @@ import com.chinaunicom.mall.ebtp.common.config.CustomLocalDateTimeTypeHandler; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; import lombok.Data; import lombok.experimental.Accessors; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; +import java.time.LocalDateTime; /** * 实体类 EventMaintainOutVO @@ -19,11 +21,17 @@ import java.io.Serializable; @Data @Accessors(chain = true) @ApiModel +@Builder public class EventMaintainOutVO implements Serializable { private static final long serialVersionUID = 1L; - + + /** + * id + */ + @ApiModelProperty(value = "id") + private String id; /** * 标题 */ @@ -42,7 +50,11 @@ public class EventMaintainOutVO implements Serializable { */ @ApiModelProperty(value = "活动内容正文") private String content; - + /** + * 二级标题 + */ + @ApiModelProperty(value = "二级标题") + private String secordTitle; /** * 活动图片 */ @@ -64,7 +76,7 @@ public class EventMaintainOutVO implements Serializable { /** * 页面显示状态: 0-隐藏 1-显示 */ - @ApiModelProperty(value = "页面显示状态: 0-隐藏 1-显示") + @ApiModelProperty(value = "页面显示状态: 0-草稿 1-发布") private String status; /** @@ -74,7 +86,7 @@ public class EventMaintainOutVO implements Serializable { @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; + private LocalDateTime createTime; /** * 发布时间 @@ -83,16 +95,18 @@ public class EventMaintainOutVO implements Serializable { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @TableField(typeHandler = CustomLocalDateTimeTypeHandler.class) - private java.time.LocalDateTime sendTime; + private LocalDateTime sendTime; + /** + * 发布人 + */ + @ApiModelProperty(value = "发布人") + private String createBy; /** - * 创建时间 + * 正文图片id */ - @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 endTime; + @ApiModelProperty(value = "正文图片id") + private String contentImageId; } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventStyle.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventStyle.java index 3f96ac1..a6c1795 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventStyle.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventStyle.java @@ -117,4 +117,24 @@ public class EventStyle implements Serializable { @ApiModelProperty(value = "文件地址") @TableField(exist = false) private String filePath; + + /** + * 发布人 + */ + @ApiModelProperty(value = "发布人") + private String createBy; + + + /** + * 删除标识 + */ + @ApiModelProperty(value = "删除标识") + private String deleteFlag; + + + /** + * 正文图片id + */ + @ApiModelProperty(value = "正文图片id") + private String contentImageId; } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventSubject.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventSubject.java index 5374b60..351a179 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventSubject.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/entity/EventSubject.java @@ -52,6 +52,12 @@ public class EventSubject implements Serializable { @ApiModelProperty(value = "活动内容正文") private String content; + /** + * 正文图片id + */ + @ApiModelProperty(value = "正文图片id") + private String contentImageId; + /** * 活动图片 */ @@ -88,6 +94,18 @@ public class EventSubject implements Serializable { @TableField(typeHandler = CustomLocalDateTimeTypeHandler.class) private java.time.LocalDateTime sendTime; + /** + * 发布人 + */ + @ApiModelProperty(value = "发布人") + private String createBy; + + + /** + * 删除标识 + */ + @ApiModelProperty(value = "删除标识") + private String deleteFlag; /** * 项目名称 */ diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/enums/PartyEventExceptionEnum.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/enums/PartyEventExceptionEnum.java index da7d85b..cb6f5d4 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/enums/PartyEventExceptionEnum.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/enums/PartyEventExceptionEnum.java @@ -12,6 +12,7 @@ public enum PartyEventExceptionEnum implements BusinessExceptionAssert { */ FRAME_EXCEPTION_NO_BRANCH_INFO_FAIL(2200001, "没有党支部信息!"), FRAME_EXCEPTION_NO_IMAGE_INFO_FAIL(2200002, "文档中心异常!"), + FRAME_EXCEPTION_PARAM_IS_NULL_FAIL(2200003, "缺少必要参数!"), diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/EventContactSuggestionService.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/EventContactSuggestionService.java index e8ff99a..29cf17a 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/EventContactSuggestionService.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/EventContactSuggestionService.java @@ -1,7 +1,11 @@ package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.chinaunicom.mall.ebtp.common.poiExport.entity.ExcelTable; import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventContactSuggestion; +import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventMaintainInVO; + +import java.util.List; /** * 对数据表 event_contact_suggestion 操作的 service @@ -13,4 +17,7 @@ public interface EventContactSuggestionService extends IService querySuggestion(EventMaintainInVO inVO); + + ExcelTable export(List ids); } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/EventStyleService.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/EventStyleService.java index f3600e6..838ad6d 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/EventStyleService.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/EventStyleService.java @@ -1,6 +1,8 @@ package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service; 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.EventStyle; @@ -17,4 +19,12 @@ public interface EventStyleService extends IService{ List getEventStyle(String type, EventQueryInVO inVO); boolean saveStyle(EventStyle inVO); + + List queryStyleAndProject(EventMaintainInVO inVO); + + boolean saveStyleOrProject(EventMaintainOutVO inVO); + + boolean sendStyleOrProject(String id,String status); + + boolean deleteStyleOrProject(String id); } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventContactSuggestionServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventContactSuggestionServiceImpl.java index 7ce1a54..265b054 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventContactSuggestionServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventContactSuggestionServiceImpl.java @@ -1,18 +1,35 @@ package com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.impl; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser; import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService; +import com.chinaunicom.mall.ebtp.common.poiExport.entity.ExcelTable; +import com.chinaunicom.mall.ebtp.common.poiExport.entity.ExcelTd; +import com.chinaunicom.mall.ebtp.common.poiExport.entity.ExcelTr; import com.chinaunicom.mall.ebtp.common.util.PropertyUtils; import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.dao.EventContactSuggestionMapper; import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventContactSuggestion; +import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventMaintainInVO; +import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.EventSubject; import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.service.EventContactSuggestionService; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import javax.annotation.Resource; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.time.LocalDateTime; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; /** * 对数据表 event_contact_suggestion 操作的 serviceImpl @@ -38,4 +55,76 @@ public class EventContactSuggestionServiceImpl extends ServiceImpl querySuggestion(EventMaintainInVO inVO) { + if (ObjectUtil.isNull(inVO)) { + return this.list(); + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(); + if (ObjectUtil.isNotNull(inVO.getStartTime())) { + query.gt(EventContactSuggestion::getCreateTime, inVO.getStartTime()); + } + + if (ObjectUtil.isNotNull(inVO.getEndTime())) { + query.lt(EventContactSuggestion::getCreateTime, inVO.getEndTime()); + } + if (StrUtil.isNotBlank(inVO.getType())) { + query.eq(EventContactSuggestion::getSuggestionType, inVO.getType()); + } + return this.list(query); + } + + + @Override + public ExcelTable export(List ids) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(); + if (ids != null) { + query.in(EventContactSuggestion::getId, ids); + } + List list = this.list(query); + Map titleMap = new LinkedHashMap<>(16); + titleMap.put("num", "序号"); + titleMap.put("contactName", "联系人名称"); + titleMap.put("suggestionType", "意见类型"); + titleMap.put("suggestionContent", "意见内容"); + titleMap.put("instructions", "补充说明"); + titleMap.put("suggestionSponsor", "意见提出人"); + titleMap.put("suggestionSponsorId", "意见提出人id"); + titleMap.put("suggestionSponsorUnit", "意见提出人组织机构"); + titleMap.put("createTime", "创建时间"); + titleMap.put("company", "公司"); + //制作表格 + ExcelTable table = new ExcelTable("第一页"); + DateFormat df = new SimpleDateFormat("yyyyMMddhhmmss"); + table.setFileName(df.format(new Date())); + + + + /*第4行开始投递数据表头*/ + ExcelTr tr4 = new ExcelTr(); + tr4.setHeight(480); + for (String key : titleMap.keySet()) { + tr4.add(new ExcelTd().setTdValue(titleMap.get(key)).setCellStyleKey("title1").setWidth(6000)); + } + table.add(tr4); + AtomicInteger num = new AtomicInteger(1); + List> mapList = JSON.parseObject(JSON.toJSONString(list), List.class); + mapList.forEach(info -> { + ExcelTr tr5 = new ExcelTr(); + for (String key : titleMap.keySet()) { + String tValue = ""; + if ("num".equals(key)) { + tValue = num.toString(); + } else { + tValue = info.get(key) != null ? String.valueOf(info.get(key)) : ""; + } + tr5.add(new ExcelTd().setTdValue(tValue).setCellStyleKey("title1").setWidth(6000)); + } + num.addAndGet(1); + table.add(tr5); + }); + + return table; + } } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventMockDataServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventMockDataServiceImpl.java index 9c387ff..1a91a74 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventMockDataServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventMockDataServiceImpl.java @@ -65,28 +65,28 @@ public class EventMockDataServiceImpl extends ServiceImpl list = this.list(query.eq(EventMockData::getStatus, "1")); list.forEach(l -> { String dataPy = l.getDataPy(); - if ("ddjyze".equals(dataPy)) { + if ("ddjyze".equals(dataPy) && StrUtil.isNotBlank(inVO.getDdjyze())) { l.setDataValue(inVO.getDdjyze()); } - if ("ddzsl".equals(dataPy)) { + if ("ddzsl".equals(dataPy) && StrUtil.isNotBlank(inVO.getDdzsl())) { l.setDataValue(inVO.getDdzsl()); } - if ("spsl".equals(dataPy)) { + if ("spsl".equals(dataPy) && StrUtil.isNotBlank(inVO.getSpsl())) { l.setDataValue(inVO.getSpsl()); } - if ("xysl".equals(dataPy)) { + if ("xysl".equals(dataPy) && StrUtil.isNotBlank(inVO.getXysl())) { l.setDataValue(inVO.getXysl()); } - if ("yxdy".equals(dataPy)) { + if ("yxdy".equals(dataPy) && StrUtil.isNotBlank(inVO.getYxdy())) { l.setDataValue(inVO.getYxdy()); } - if ("ftrs".equals(dataPy)) { + if ("ftrs".equals(dataPy) && StrUtil.isNotBlank(inVO.getFtrs())) { l.setDataValue(inVO.getFtrs()); } - if ("bzxq".equals(dataPy)) { + if ("bzxq".equals(dataPy) && StrUtil.isNotBlank(inVO.getBzxq())) { l.setDataValue(inVO.getBzxq()); } - if ("gjknxm".equals(dataPy)) { + if ("gjknxm".equals(dataPy) && StrUtil.isNotBlank(inVO.getGjknxm())) { l.setDataValue(inVO.getGjknxm()); } }); diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventStyleServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventStyleServiceImpl.java index 00cb293..fd9c4df 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventStyleServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventStyleServiceImpl.java @@ -1,4 +1,6 @@ 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; @@ -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.entity.DocumentDataVO; 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.EventStyle; +import com.chinaunicom.mall.ebtp.extend.partyMemberEvent.entity.*; 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.EventSubjectService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.function.Function; @@ -36,6 +40,8 @@ public class EventStyleServiceImpl extends ServiceImpl getEventStyle(String type, EventQueryInVO inVO) { @@ -50,6 +56,7 @@ public class EventStyleServiceImpl extends ServiceImpl imageIdList = list.stream().map(EventStyle::getImage).distinct().collect(Collectors.toList()); BaseResponse> queryReturn = documentCenterService.queryReturn(imageIdList); @@ -76,4 +83,165 @@ public class EventStyleServiceImpl extends ServiceImpl queryStyleAndProject(EventMaintainInVO inVO) { + List styleList = new ArrayList<>(); + List subjectList = new ArrayList<>(); + LambdaQueryWrapper queryStyle = Wrappers.lambdaQuery(); + queryStyle.ne(EventStyle::getDeleteFlag, "1"); + + LambdaQueryWrapper queryProject = Wrappers.lambdaQuery(); + queryProject.ne(EventSubject::getDeleteFlag, "1"); + if (ObjectUtil.isNull(inVO)) { + styleList = this.list(queryStyle); + subjectList = eventSubjectService.list(queryProject); + } else { + if (StrUtil.isNotBlank(inVO.getType()) && !"3".equals(inVO.getType()) ) { + 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); + } + + + if (StrUtil.isNotBlank(inVO.getType()) && !"1".equals(inVO.getType()) && !"2".equals(inVO.getType())) { + + 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); + } + } + List outVOList = new ArrayList<>(); + + 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, Comparator.nullsLast(LocalDateTime::compareTo)).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()); + subject.setContentImageId(inVO.getContentImageId()); + 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()); + style.setContentImageId(inVO.getContentImageId()); + + return this.saveOrUpdate(style); + } + + @Override + public boolean sendStyleOrProject(String id, String status) { + EventSubject subject = eventSubjectService.getById(id); + if (ObjectUtil.isNotNull(subject) && StrUtil.isNotBlank(subject.getId())) { + subject.setStatus(status); + subject.setSendTime(LocalDateTime.now()); + return eventSubjectService.updateById(subject); + } + EventStyle style = this.getById(id); + if (ObjectUtil.isNotNull(style) && StrUtil.isNotBlank(style.getId())) { + style.setStatus(status); + 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; + } } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventSubjectServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventSubjectServiceImpl.java index fb95ced..807b722 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventSubjectServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/partyMemberEvent/service/impl/EventSubjectServiceImpl.java @@ -46,6 +46,7 @@ public class EventSubjectServiceImpl extends ServiceImpl list = this.list(query); // List subjectIdList = list.stream().map(EventSubject::getId).collect(Collectors.toList());