diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/IcMessageFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/IcMessageFormDTO.java new file mode 100644 index 0000000000..679621c430 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/IcMessageFormDTO.java @@ -0,0 +1,66 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +@Data +public class IcMessageFormDTO implements Serializable { + private static final long serialVersionUID = 2697079163476964749L; + + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空") + private String customerId; + + /** + * app=resi时,此列为gridId,其他情况暂定 * + */ + private String gridId; + + /** + * 对应用户id + */ + @NotBlank(message = "通知用户id为空") + private String userId; + + /** + * 消息通知对象:居民端用户resi、政府端工作人员gov、运营端工作人员oper + */ + @NotBlank(message = "消息通知对象不能为空") + private String app; + + /** + * 消息标题 + */ + @NotBlank(message = "消息标题不能为空") + private String title; + + /** + * 消息通知内容 + */ + @NotBlank(message = "通知内容不能为空") + private String messageContent; + + /** + * read已读、unread未读 + */ + @NotBlank(message = "readFlag不能为空") + private String readFlag; + + /** + * 调用者 【分内部调用和外部调用,内部调用值为空,外部默认为:外挂-站内信】 + */ + private String referer; + + /** + * 消息分类:info-上传下达消息 详见UserMessageTypeConstant + */ + private String messageType; + /** + * 消息对应的业务id,比如message_type=info时,此列存储的是消息id,可跳转到消息详情 + */ + private String targetId; +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java index 8b9f06198f..f1f7b5dfa5 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java @@ -127,4 +127,12 @@ public interface EpmetMessageOpenFeignClient { @PostMapping(value = "message/sms/send-msg", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result sendMsg(@RequestBody List formDTO); + + /** + * @Author sun + * @Description 党建小助手-批量插入未读消息 + **/ + @PostMapping(value = "message/icMessage/saveicmessagelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result saveIcMessageList(List msgList); + } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java index 2d5c0d9073..100dc4ff10 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java @@ -78,4 +78,10 @@ public class EpmetMessageOpenFeignClientFallback implements EpmetMessageOpenFeig public Result sendMsg(List formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "sendMsg",formDTO); } + + @Override + public Result saveIcMessageList(List msgList) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveIcMessageList", msgList); + } + } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/IcMessageController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/IcMessageController.java index 2d12517d89..034601b985 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/IcMessageController.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/IcMessageController.java @@ -9,10 +9,12 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.IcMessageDTO; +import com.epmet.dto.form.IcMessageFormDTO; import com.epmet.service.IcMessageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; import java.util.Map; @@ -67,7 +69,15 @@ public class IcMessageController { return new Result(); } - + /** + * @Author sun + * @Description 批量插入未读消息 + **/ + @PostMapping("saveicmessagelist") + public Result saveIcMessageList(@RequestBody List msgList) { + icMessageService.saveIcMessageList(msgList); + return new Result(); + } } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/IcMessageService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/IcMessageService.java index 59a374a341..04524957b4 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/IcMessageService.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/IcMessageService.java @@ -2,7 +2,9 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.IcMessageDTO; +import com.epmet.dto.form.IcMessageFormDTO; import com.epmet.entity.IcMessageEntity; import java.util.List; @@ -75,4 +77,6 @@ public interface IcMessageService extends BaseService { * @date 2022-08-19 */ void delete(String[] ids); + + void saveIcMessageList(List msgList); } \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/IcMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/IcMessageServiceImpl.java index 144d7b67ab..305dff1f02 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/IcMessageServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/IcMessageServiceImpl.java @@ -8,6 +8,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.IcMessageDao; import com.epmet.dto.IcMessageDTO; +import com.epmet.dto.form.IcMessageFormDTO; import com.epmet.entity.IcMessageEntity; import com.epmet.service.IcMessageService; import org.apache.commons.lang3.StringUtils; @@ -80,4 +81,10 @@ public class IcMessageServiceImpl extends BaseServiceImpl msgList) { + List entityList = ConvertUtils.sourceToTarget(msgList, IcMessageEntity.class); + insertBatch(entityList); + } + } \ No newline at end of file