17 changed files with 1009 additions and 52 deletions
@ -0,0 +1,34 @@ |
|||
package com.elink.esua.epdc.async; |
|||
|
|||
import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO; |
|||
import com.elink.esua.epdc.feign.NewsFeignClient; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.scheduling.annotation.Async; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 新闻通知消息模块 线程任务 |
|||
* |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/9/10 10:02 |
|||
*/ |
|||
@Component |
|||
public class NewsTask { |
|||
|
|||
@Autowired |
|||
private NewsFeignClient newsFeignClient; |
|||
|
|||
/** |
|||
* 给用户发送消息 |
|||
* |
|||
* @param informationDto |
|||
* @return void |
|||
* @author yujintao |
|||
* @date 2019/9/10 10:33 |
|||
*/ |
|||
@Async |
|||
public void insertUserInformation(EpdcInformationFormDTO informationDto) { |
|||
newsFeignClient.saveInformation(informationDto); |
|||
} |
|||
} |
|||
@ -0,0 +1,119 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 我的消息 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-10 |
|||
*/ |
|||
@Data |
|||
public class InformationDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -3082151640037703859L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 消息内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 时间 |
|||
*/ |
|||
private Date time; |
|||
|
|||
/** |
|||
* AppInformationEnum |
|||
* 我的消息类型:0审核通知;1互动通知;2进度通知;3社群通知 |
|||
*/ |
|||
private String type; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* AppInformationBusinessEnum |
|||
* 消息所属业务类型:comment事件评论;reply评论回复;issue议题处理;crowd社群邀请等 |
|||
*/ |
|||
private String businessType; |
|||
|
|||
/** |
|||
* 消息所属业务ID |
|||
*/ |
|||
private String businessId; |
|||
|
|||
/** |
|||
* 消息关联业务内容(被回复的评论;被评论的议题等) |
|||
*/ |
|||
private String relBusinessContent; |
|||
|
|||
/** |
|||
* 是否已读:0否;1是 |
|||
*/ |
|||
private String readFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
/** |
|||
* 删除标记 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
} |
|||
@ -0,0 +1,81 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dto.epdc.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 我的消息 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-10 |
|||
*/ |
|||
@Data |
|||
public class EpdcInformationFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -3286304817997007892L; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
@NotBlank(message = "用户ID不能为空") |
|||
private String userId; |
|||
|
|||
/** |
|||
* 消息内容 |
|||
*/ |
|||
@NotBlank(message = "消息内容不能为空") |
|||
private String content; |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
@NotBlank(message = "标题不能为空") |
|||
private String title; |
|||
|
|||
/** |
|||
* AppInformationEnum |
|||
* 我的消息类型:0审核通知;1互动通知;2进度通知;3社群通知 |
|||
*/ |
|||
@NotBlank(message = "消息类型不能为空") |
|||
private String type; |
|||
|
|||
/** |
|||
* AppInformationBusinessEnum |
|||
* 消息所属业务类型:comment事件评论;reply评论回复;issue议题处理;crowd社群邀请等 |
|||
*/ |
|||
@NotBlank(message = "消息所属业务类型不能为空") |
|||
private String businessType; |
|||
|
|||
/** |
|||
* 消息所属业务ID |
|||
*/ |
|||
@NotBlank(message = "消息所属业务ID不能为空") |
|||
private String businessId; |
|||
|
|||
/** |
|||
* 消息关联业务内容(被回复的评论;被评论的议题等) |
|||
*/ |
|||
@NotBlank(message = "消息关联业务内容不能为空") |
|||
private String relBusinessContent; |
|||
|
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dto.epdc.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 我的消息 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-10 |
|||
*/ |
|||
@Data |
|||
public class EpdcReadInformationFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -1161009882229533832L; |
|||
|
|||
/** |
|||
* 消息ID |
|||
*/ |
|||
@NotBlank(message = "消息ID不能为空") |
|||
private String informationId; |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO; |
|||
import com.elink.esua.epdc.dto.epdc.form.EpdcReadInformationFormDTO; |
|||
import com.elink.esua.epdc.service.InformationService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
|
|||
/** |
|||
* 我的消息 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-10 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(Constant.EPDC_APP + "information") |
|||
public class EpdcAppInformationController { |
|||
|
|||
@Autowired |
|||
private InformationService informationService; |
|||
|
|||
/** |
|||
* 给用户发送消息 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author yujintao |
|||
* @date 2019/9/10 10:37 |
|||
*/ |
|||
@PostMapping("save") |
|||
public Result saveInformation(@RequestBody EpdcInformationFormDTO formDto) { |
|||
ValidatorUtils.validateEntity(formDto); |
|||
return this.informationService.saveInformation(formDto); |
|||
} |
|||
|
|||
/** |
|||
* 消息已读 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author yujintao |
|||
* @date 2019/9/10 11:01 |
|||
*/ |
|||
@PostMapping("read") |
|||
public Result readInformation(@RequestBody EpdcReadInformationFormDTO formDto) { |
|||
ValidatorUtils.validateEntity(formDto); |
|||
return this.informationService.readInformation(formDto); |
|||
} |
|||
} |
|||
@ -0,0 +1,94 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.dto.InformationDTO; |
|||
import com.elink.esua.epdc.excel.InformationExcel; |
|||
import com.elink.esua.epdc.service.InformationService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 我的消息 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-10 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("information") |
|||
public class InformationController { |
|||
|
|||
@Autowired |
|||
private InformationService informationService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<InformationDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<InformationDTO> page = informationService.page(params); |
|||
return new Result<PageData<InformationDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<InformationDTO> get(@PathVariable("id") String id){ |
|||
InformationDTO data = informationService.get(id); |
|||
return new Result<InformationDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody InformationDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
informationService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody InformationDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
informationService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
informationService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<InformationDTO> list = informationService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, InformationExcel.class); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.entity.InformationEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 我的消息 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-10 |
|||
*/ |
|||
@Mapper |
|||
public interface InformationDao extends BaseDao<InformationEntity> { |
|||
|
|||
} |
|||
@ -0,0 +1,88 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 我的消息 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-10 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("epdc_information") |
|||
public class InformationEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = -7194968067103853454L; |
|||
|
|||
/** |
|||
* 消息内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 时间 |
|||
*/ |
|||
private Date time; |
|||
|
|||
/** |
|||
* AppInformationEnum |
|||
* 我的消息类型:0审核通知;1互动通知;2进度通知;3社群通知 |
|||
*/ |
|||
private String type; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* AppInformationBusinessEnum |
|||
* 消息所属业务类型:comment事件评论;reply评论回复;issue议题处理;crowd社群邀请等 |
|||
*/ |
|||
private String businessType; |
|||
|
|||
/** |
|||
* 消息所属业务ID |
|||
*/ |
|||
private String businessId; |
|||
|
|||
/** |
|||
* 消息关联业务内容(被回复的评论;被评论的议题等) |
|||
*/ |
|||
private String relBusinessContent; |
|||
|
|||
/** |
|||
* 是否已读:0否;1是 |
|||
*/ |
|||
private String readFlag; |
|||
|
|||
} |
|||
@ -0,0 +1,83 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 我的消息 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-10 |
|||
*/ |
|||
@Data |
|||
public class InformationExcel { |
|||
|
|||
@Excel(name = "主键") |
|||
private String id; |
|||
|
|||
@Excel(name = "消息内容") |
|||
private String content; |
|||
|
|||
@Excel(name = "标题") |
|||
private String title; |
|||
|
|||
@Excel(name = "时间") |
|||
private Date time; |
|||
|
|||
@Excel(name = "我的消息类型:0审核通知;1互动通知;2进度通知;3社群通知") |
|||
private String type; |
|||
|
|||
@Excel(name = "用户ID") |
|||
private String userId; |
|||
|
|||
@Excel(name = "消息所属业务类型:comment事件评论;reply评论回复;issue议题处理;crowd社群邀请等") |
|||
private String businessType; |
|||
|
|||
@Excel(name = "消息所属业务ID") |
|||
private String businessId; |
|||
|
|||
@Excel(name = "消息关联业务内容(被回复的评论;被评论的议题等)") |
|||
private String relBusinessContent; |
|||
|
|||
@Excel(name = "是否已读:0否;1是") |
|||
private String readFlag; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
|
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
|
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
|
|||
@Excel(name = "删除标记") |
|||
private String delFlag; |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,118 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.InformationDTO; |
|||
import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO; |
|||
import com.elink.esua.epdc.dto.epdc.form.EpdcReadInformationFormDTO; |
|||
import com.elink.esua.epdc.entity.InformationEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 我的消息 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-10 |
|||
*/ |
|||
public interface InformationService extends BaseService<InformationEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<InformationDTO> |
|||
* @author |
|||
* @date |
|||
*/ |
|||
PageData<InformationDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<InformationDTO> |
|||
* @author |
|||
* @date |
|||
*/ |
|||
List<InformationDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return InformationDTO |
|||
* @author |
|||
* @date |
|||
*/ |
|||
InformationDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author |
|||
* @date |
|||
*/ |
|||
void save(InformationDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author |
|||
* @date |
|||
*/ |
|||
void update(InformationDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author |
|||
* @date |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 给用户发送消息 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author yujintao |
|||
* @date 2019/9/10 10:38 |
|||
*/ |
|||
Result saveInformation(EpdcInformationFormDTO formDto); |
|||
|
|||
/** |
|||
* 消息已读 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author yujintao |
|||
* @date 2019/9/10 11:00 |
|||
*/ |
|||
Result readInformation(EpdcReadInformationFormDTO formDto); |
|||
} |
|||
@ -0,0 +1,121 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum; |
|||
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.constant.FieldConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dao.InformationDao; |
|||
import com.elink.esua.epdc.dto.InformationDTO; |
|||
import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO; |
|||
import com.elink.esua.epdc.dto.epdc.form.EpdcReadInformationFormDTO; |
|||
import com.elink.esua.epdc.entity.InformationEntity; |
|||
import com.elink.esua.epdc.service.InformationService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 我的消息 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-10 |
|||
*/ |
|||
@Service |
|||
public class InformationServiceImpl extends BaseServiceImpl<InformationDao, InformationEntity> implements InformationService { |
|||
|
|||
@Override |
|||
public PageData<InformationDTO> page(Map<String, Object> params) { |
|||
IPage<InformationEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, InformationDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<InformationDTO> list(Map<String, Object> params) { |
|||
List<InformationEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, InformationDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<InformationEntity> getWrapper(Map<String, Object> params) { |
|||
String id = (String) params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<InformationEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public InformationDTO get(String id) { |
|||
InformationEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, InformationDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(InformationDTO dto) { |
|||
InformationEntity entity = ConvertUtils.sourceToTarget(dto, InformationEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(InformationDTO dto) { |
|||
InformationEntity entity = ConvertUtils.sourceToTarget(dto, InformationEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public Result saveInformation(EpdcInformationFormDTO formDto) { |
|||
InformationEntity entity = ConvertUtils.sourceToTarget(formDto, InformationEntity.class); |
|||
entity.setReadFlag(YesOrNoEnum.NO.value()); |
|||
entity.setTime(new Date()); |
|||
this.insert(entity); |
|||
return new Result(); |
|||
} |
|||
|
|||
@Override |
|||
public Result readInformation(EpdcReadInformationFormDTO formDto) { |
|||
InformationEntity entity = new InformationEntity(); |
|||
entity.setId(formDto.getInformationId()); |
|||
entity.setReadFlag(YesOrNoEnum.YES.value()); |
|||
this.updateById(entity); |
|||
return new Result(); |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.elink.esua.epdc.dao.InformationDao"> |
|||
|
|||
|
|||
|
|||
</mapper> |
|||
Loading…
Reference in new issue