From c1235cdb3626b7d6949e78970bd8b3e5cd693e02 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 2 Feb 2023 14:02:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=AE=E9=A2=98=E8=AF=84=E8=AE=BA=E7=9B=B8?= =?UTF-8?q?=E5=85=B3push?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/IssueCommentDTO.java | 100 ++++++++++++++++++ .../dto/form/IssueCommentPageFormDTO.java | 18 ++++ .../controller/IssueCommentController.java | 61 +++++++++++ .../java/com/epmet/dao/IssueCommentDao.java | 20 ++++ .../com/epmet/entity/IssueCommentEntity.java | 54 ++++++++++ .../epmet/service/IssueCommentService.java | 37 +++++++ .../service/impl/IssueCommentServiceImpl.java | 72 +++++++++++++ .../main/resources/mapper/IssueCommentDao.xml | 36 +++++++ .../epmet/service/impl/GuideServiceImpl.java | 2 +- 9 files changed, 399 insertions(+), 1 deletion(-) create mode 100644 epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueCommentDTO.java create mode 100644 epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCommentPageFormDTO.java create mode 100644 epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCommentController.java create mode 100644 epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCommentDao.java create mode 100644 epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueCommentEntity.java create mode 100644 epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCommentService.java create mode 100644 epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCommentServiceImpl.java create mode 100644 epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCommentDao.xml diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueCommentDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueCommentDTO.java new file mode 100644 index 0000000000..45b27c1eba --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueCommentDTO.java @@ -0,0 +1,100 @@ +package com.epmet.dto; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.Date; + + +/** + * 议题评论表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-02 + */ +@Data +public class IssueCommentDTO implements Serializable { + + private static final long serialVersionUID = 1L; + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + /** + * 议题ID + */ + @NotBlank(message = "issueId不能为空",groups = AddUserInternalGroup.class) + private String issueId; + + /** + * 主键ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 评论内容至多200字 + */ + @Length(max = 200,message = "评论内容最多输入200字",groups = AddUserShowGroup.class) + @NotBlank(message = "content不能为空",groups = AddUserInternalGroup.class) + private String content; + + /** + * 评论用户id + */ + private String userId; + + /** + * 姓名 + */ + private String userName; + + /** + * 头像 + */ + private String headPhoto; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + private String commentId; + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCommentPageFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCommentPageFormDTO.java new file mode 100644 index 0000000000..90e7fa79a8 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCommentPageFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description + * @Author yzm + * @Date 2023/2/2 13:45 + */ +@Data +public class IssueCommentPageFormDTO extends PageFormDTO { + @NotBlank(message = "issueId不能为空",groups = AddUserInternalGroup.class) + private String issueId; +} + diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCommentController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCommentController.java new file mode 100644 index 0000000000..f579c9d1fe --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCommentController.java @@ -0,0 +1,61 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.IssueCommentDTO; +import com.epmet.dto.form.IssueCommentPageFormDTO; +import com.epmet.service.IssueCommentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 议题评论表 + * 目前只有烟台客户,钉钉居民端,议事厅,可以发表评论 + * 产品没有此功能 + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-02 + */ +@RestController +@RequestMapping("issuecomment") +public class IssueCommentController { + + @Autowired + private IssueCommentService issueCommentService; + + /** + * 议题评论列表 + * @param formDTO + * @return + */ + @RequestMapping("page") + public Result> page(@RequestBody IssueCommentPageFormDTO formDTO){ + PageData page = issueCommentService.page(formDTO); + return new Result>().ok(page); + } + + /** + * 议题评论 + * @param tokenDto + * @param dto + * @return + */ + @NoRepeatSubmit + @PostMapping("save") + public Result save(@LoginUser TokenDto tokenDto, @RequestBody IssueCommentDTO dto){ + dto.setCustomerId(tokenDto.getCustomerId()); + dto.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(dto,IssueCommentDTO.AddUserShowGroup.class,IssueCommentDTO.AddUserInternalGroup.class); + issueCommentService.save(dto); + return new Result(); + } + + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCommentDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCommentDao.java new file mode 100644 index 0000000000..beaca75c6a --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCommentDao.java @@ -0,0 +1,20 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IssueCommentDTO; +import com.epmet.entity.IssueCommentEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 议题评论表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-02 + */ +@Mapper +public interface IssueCommentDao extends BaseDao { + + List selectCommentList(String issueId); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueCommentEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueCommentEntity.java new file mode 100644 index 0000000000..4ad01c7038 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueCommentEntity.java @@ -0,0 +1,54 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 议题评论表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-02 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_comment") +public class IssueCommentEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 议题ID + */ + private String issueId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 评论内容至多200字 + */ + private String content; + + /** + * 评论用户id + */ + private String userId; + + /** + * 姓名 + */ + private String userName; + + /** + * 头像 + */ + private String headPhoto; + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCommentService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCommentService.java new file mode 100644 index 0000000000..3fa35a8077 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCommentService.java @@ -0,0 +1,37 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.IssueCommentDTO; +import com.epmet.dto.form.IssueCommentPageFormDTO; +import com.epmet.entity.IssueCommentEntity; + +/** + * 议题评论表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-02 + */ +public interface IssueCommentService extends BaseService { + + /** + * 默认分页 + * + * @param formDTO + * @return PageData + * @author generator + * @date 2023-02-02 + */ + PageData page(IssueCommentPageFormDTO formDTO); + + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2023-02-02 + */ + void save(IssueCommentDTO dto); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCommentServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCommentServiceImpl.java new file mode 100644 index 0000000000..863c589f82 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCommentServiceImpl.java @@ -0,0 +1,72 @@ +package com.epmet.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.IssueCommentDao; +import com.epmet.dto.IssueCommentDTO; +import com.epmet.dto.form.IssueCommentPageFormDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.entity.IssueCommentEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.service.IssueCommentService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * 议题评论表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-02 + */ +@Service +public class IssueCommentServiceImpl extends BaseServiceImpl implements IssueCommentService { + @Autowired + private EpmetUserOpenFeignClient userOpenFeignClient; + + /** + * 议题评论列表 + * @param formDTO + * @return + */ + @Override + public PageData page(IssueCommentPageFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list = baseDao.selectCommentList(formDTO.getIssueId()); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + + /** + * 议题评论 + * 需求来源于烟台:https://modao.cc/app/Uz9nPVerhvcupzLnhoiY#screen=sl8mfpxd863xmb5 + * @param dto + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IssueCommentDTO dto) { + //查询用户信息 + List userIdList=new ArrayList<>(); + userIdList.add(dto.getUserId()); + Result> userInfoRes= userOpenFeignClient.queryUserBaseInfo(userIdList); + if(!userInfoRes.success()|| CollectionUtils.isEmpty(userInfoRes.getData())){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"查询用户信息异常userId:"+dto.getUserId(),"查询用户信息异常"); + } + IssueCommentEntity entity = ConvertUtils.sourceToTarget(dto, IssueCommentEntity.class); + entity.setHeadPhoto(userInfoRes.getData().get(NumConstant.ZERO).getHeadImgUrl()); + entity.setUserName(userInfoRes.getData().get(NumConstant.ZERO).getRealName()); + insert(entity); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCommentDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCommentDao.xml new file mode 100644 index 0000000000..fc7676ed60 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCommentDao.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java index 6c22b22f8d..eadca17c92 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java @@ -388,7 +388,7 @@ public class GuideServiceImpl extends BaseServiceImpl imp if (null != guideCollectionService.getCollection(tokenDto, formDTO.getGuideId())) { result.setCollectionFlag(NumConstant.ONE_STR); } - //记录已读未读 + //记录已读未读 来源于烟台 if (null == SpringContextUtils.getBean(GuideReaderService.class).get(formDTO.getGuideId(), tokenDto.getUserId())) { GuideReaderEntity guideReaderEntity=new GuideReaderEntity(); guideReaderEntity.setGuideId(formDTO.getGuideId());