From 8320d501370e02618570551117103c808f5b65c3 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期四, 31 十月 2024 16:10:10 +0800 Subject: [PATCH] 2024-10-31 农户问题上报回复接口,问题上报回复查询接口 --- pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/dto/DtoReportReply.java | 35 +++++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeReportReplyMapper.xml | 114 +++++++++++++++++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoIssueReportReply.java | 45 +++++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeReportReply.java | 59 +++++++++ pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueSv.java | 25 ++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeReportReplyMapper.java | 35 +++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoIssueReport.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueCtrl.java | 44 +++++++ 8 files changed, 358 insertions(+), 1 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeReportReplyMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeReportReplyMapper.java new file mode 100644 index 0000000..b85e4a5 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeReportReplyMapper.java @@ -0,0 +1,35 @@ +package com.dy.pipIrrGlobal.daoSe; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoSe.SeReportReply; +import com.dy.pipIrrGlobal.voSe.VoIssueReportReply; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ZhuBaoMin + * @date 2024-10-31 14:59 + * @LastEditTime 2024-10-31 14:59 + * @Description + */ + +@Mapper +public interface SeReportReplyMapper extends BaseMapper<SeReportReply> { + int deleteByPrimaryKey(Long id); + + int insert(SeReportReply record); + + int insertSelective(SeReportReply record); + + SeReportReply selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(SeReportReply record); + + int updateByPrimaryKey(SeReportReply record); + + /** + * 鏍规嵁闂涓婃姤ID鑾峰彇涓婃姤鍥炲淇℃伅 + * @param reportId + * @return + */ + VoIssueReportReply getReportReplyByReportId(Long reportId); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeReportReply.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeReportReply.java new file mode 100644 index 0000000..3c13a8f --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeReportReply.java @@ -0,0 +1,59 @@ +package com.dy.pipIrrGlobal.pojoSe; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.dy.common.po.BaseEntity; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.*; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2024-10-31 14:59 + * @LastEditTime 2024-10-31 14:59 + * @Description 鍐滄埛闂涓婃姤鍥炲瀹炰綋绫� + */ + +@TableName(value="se_report_reply", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class SeReportReply implements BaseEntity { + public static final long serialVersionUID = 202410311502001L; + + /** + * 涓婚敭 + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + private Long id; + + /** + * 闂涓婃姤ID + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + private Long reportId; + + /** + * 绛斿鍐呭 + */ + private String replyContent; + + /** + * 绛斿鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date replyTime; + + /** + * 绛斿浜篒D + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + private Long replierId; +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoIssueReport.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoIssueReport.java index 950ddf2..2b343d8 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoIssueReport.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoIssueReport.java @@ -17,7 +17,7 @@ */ @Data -@JsonPropertyOrder({"issueReportId", "clientName", "phone", "reportTime", "content", "images", "audios", "videos", "state"}) +@JsonPropertyOrder({"issueReportId", "clientName", "phone", "reportTime", "content", "images", "audios", "videos", "stateId", "state"}) public class VoIssueReport implements BaseEntity { private static final long serialVersionUID = 202410301354001L; diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoIssueReportReply.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoIssueReportReply.java new file mode 100644 index 0000000..790ff9b --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoIssueReportReply.java @@ -0,0 +1,45 @@ +package com.dy.pipIrrGlobal.voSe; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.dy.common.po.BaseEntity; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.Data; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2024-10-31 15:46 + * @LastEditTime 2024-10-31 15:46 + * @Description 鍐滄埛闂涓婃姤鍥炲瑙嗗浘瀵硅薄 + */ + +@Data +@JsonPropertyOrder({"replyContent", "replyTime", "replierId", "replier"}) +public class VoIssueReportReply implements BaseEntity { + private static final long serialVersionUID = 202410311548001L; + + /** + * 鍥炲鍐呭 + */ + private String replyContent; + + /** + * 鍥炲鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date replyTime; + + /** + * 鍥炲浜篒D + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + private Long replierId; + + /** + * 鍥炲浜哄鍚� + */ + private String replier; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeReportReplyMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeReportReplyMapper.xml new file mode 100644 index 0000000..bb58259 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeReportReplyMapper.xml @@ -0,0 +1,114 @@ +<?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.dy.pipIrrGlobal.daoSe.SeReportReplyMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeReportReply"> + <!--@mbg.generated--> + <!--@Table se_report_reply--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="report_id" jdbcType="BIGINT" property="reportId" /> + <result column="reply_content" jdbcType="VARCHAR" property="replyContent" /> + <result column="reply_time" jdbcType="TIMESTAMP" property="replyTime" /> + <result column="replier_id" jdbcType="BIGINT" property="replierId" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, report_id, reply_content, reply_time, replier_id + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from se_report_reply + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from se_report_reply + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeReportReply"> + <!--@mbg.generated--> + insert into se_report_reply (id, report_id, reply_content, + reply_time, replier_id) + values (#{id,jdbcType=BIGINT}, #{reportId,jdbcType=BIGINT}, #{replyContent,jdbcType=VARCHAR}, + #{replyTime,jdbcType=TIMESTAMP}, #{replierId,jdbcType=BIGINT}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeReportReply"> + <!--@mbg.generated--> + insert into se_report_reply + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="reportId != null"> + report_id, + </if> + <if test="replyContent != null"> + reply_content, + </if> + <if test="replyTime != null"> + reply_time, + </if> + <if test="replierId != null"> + replier_id, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="reportId != null"> + #{reportId,jdbcType=BIGINT}, + </if> + <if test="replyContent != null"> + #{replyContent,jdbcType=VARCHAR}, + </if> + <if test="replyTime != null"> + #{replyTime,jdbcType=TIMESTAMP}, + </if> + <if test="replierId != null"> + #{replierId,jdbcType=BIGINT}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeReportReply"> + <!--@mbg.generated--> + update se_report_reply + <set> + <if test="reportId != null"> + report_id = #{reportId,jdbcType=BIGINT}, + </if> + <if test="replyContent != null"> + reply_content = #{replyContent,jdbcType=VARCHAR}, + </if> + <if test="replyTime != null"> + reply_time = #{replyTime,jdbcType=TIMESTAMP}, + </if> + <if test="replierId != null"> + replier_id = #{replierId,jdbcType=BIGINT}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeReportReply"> + <!--@mbg.generated--> + update se_report_reply + set report_id = #{reportId,jdbcType=BIGINT}, + reply_content = #{replyContent,jdbcType=VARCHAR}, + reply_time = #{replyTime,jdbcType=TIMESTAMP}, + replier_id = #{replierId,jdbcType=BIGINT} + where id = #{id,jdbcType=BIGINT} + </update> + + <!--鏍规嵁闂涓婃姤ID鑾峰彇涓婃姤鍥炲淇℃伅--> + <select id="getReportReplyByReportId" resultType="com.dy.pipIrrGlobal.voSe.VoIssueReportReply"> + SELECT + rpy.reply_content AS replyContent, + rpy.reply_time AS replyTime, + rpy.replier_id AS replierId, + user.name AS replier + FROM se_report_reply rpy + INNER JOIN ba_user user ON user.id = rpy.replier_id + WHERE rpy.report_id = #{reportId} + </select> +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueCtrl.java index 8ea2eec..305f725 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueCtrl.java @@ -5,8 +5,11 @@ import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.pojoSe.SeIssueReport; +import com.dy.pipIrrGlobal.pojoSe.SeReportReply; import com.dy.pipIrrGlobal.voSe.VoIssueReport; +import com.dy.pipIrrGlobal.voSe.VoIssueReportReply; import com.dy.pipIrrWechat.issue.dto.DtoIssueReport; +import com.dy.pipIrrWechat.issue.dto.DtoReportReply; import com.dy.pipIrrWechat.issue.qo.QoIssueReport; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -116,4 +119,45 @@ return BaseResponseUtils.buildException(e.getMessage()); } } + + /** + * 鍥炲鍐滄埛闂涓婃姤 + * @param po + * @param bindingResult + * @return + */ + @PostMapping(path = "replyReport") + @Transactional(rollbackFor = Exception.class) + public BaseResponse<Boolean> replyReport(@RequestBody @Valid DtoReportReply po, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + + SeReportReply seReportReply = new SeReportReply(); + seReportReply.setReportId(po.getReportId()); + seReportReply.setReplyContent(po.getReplyContent()); + seReportReply.setReplyTime(new Date()); + seReportReply.setReplierId(po.getReplierId()); + Long reportReplyId = issueSv.insertReportReply(seReportReply); + if(reportReplyId == null) { + return BaseResponseUtils.buildErrorMsg("鍥炲鍐滄埛闂涓婃姤澶辫触"); + } + + return BaseResponseUtils.buildSuccess(true) ; + } + + /** + * 鏍规嵁闂涓婃姤ID鑾峰彇涓婃姤鍥炲淇℃伅 + * @param reportId + * @return + */ + @GetMapping(path = "/getReportReply") + public BaseResponse<VoIssueReportReply> getReportReply(@RequestParam("reportId") Long reportId) { + try { + return BaseResponseUtils.buildSuccess(issueSv.getReportReplyByReportId(reportId)); + } catch (Exception e) { + log.error("鑾峰彇涓婃姤鍥炲淇℃伅褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueSv.java index dc3836c..101be67 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueSv.java @@ -2,8 +2,11 @@ import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoSe.SeIssueReportMapper; +import com.dy.pipIrrGlobal.daoSe.SeReportReplyMapper; import com.dy.pipIrrGlobal.pojoSe.SeIssueReport; +import com.dy.pipIrrGlobal.pojoSe.SeReportReply; import com.dy.pipIrrGlobal.voSe.VoIssueReport; +import com.dy.pipIrrGlobal.voSe.VoIssueReportReply; import com.dy.pipIrrWechat.issue.qo.QoIssueReport; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.PojoUtils; @@ -25,6 +28,9 @@ public class IssueSv { @Autowired private SeIssueReportMapper seIssueReportMapper; + + @Autowired + private SeReportReplyMapper seReportReplyMapper; /** * 娣诲姞闂涓婃姤淇℃伅 @@ -76,4 +82,23 @@ return seIssueReportMapper.deleteIssueReport(issueReportId); } + /** + * 娣诲姞鍐滄埛闂涓婃姤鍥炲 + * @param po + * @return + */ + public Long insertReportReply(SeReportReply po) { + seReportReplyMapper.insert(po); + return po.getId(); + } + + /** + * 鏍规嵁闂涓婃姤ID鑾峰彇涓婃姤鍥炲淇℃伅 + * @param reportId + * @return + */ + public VoIssueReportReply getReportReplyByReportId(Long reportId) { + return seReportReplyMapper.getReportReplyByReportId(reportId); + } + } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/dto/DtoReportReply.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/dto/DtoReportReply.java new file mode 100644 index 0000000..4adf5ca --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/dto/DtoReportReply.java @@ -0,0 +1,35 @@ +package com.dy.pipIrrWechat.issue.dto; + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-10-31 15:18 + * @LastEditTime 2024-10-31 15:18 + * @Description 鍐滄埛闂涓婃姤鍥炲浼犺緭绫� + */ + +@Data +public class DtoReportReply { + public static final long serialVersionUID = 202410311519001L; + + /** + * 闂涓婃姤ID + */ + @NotNull(message = "蹇呴』閫夋嫨涓�涓棶棰樹笂鎶�") + private Long reportId; + + /** + * 绛斿鍐呭 + */ + @NotBlank(message = "绛斿鍐呭涓嶈兘涓虹┖") + private String replyContent; + + /** + * 绛斿浜篒D + */ + @NotNull(message = "绛斿浜轰笉鑳戒负绌�") + private Long replierId; +} -- Gitblit v1.8.0