pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeReportReplyMapper.java
New file @@ -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); } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeReportReply.java
New file @@ -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; /** * 答复人ID */ @JSONField(serializeUsing= ObjectWriterImplToString.class) private Long replierId; } 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; pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoIssueReportReply.java
New file @@ -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; /** * 回复人ID */ @JSONField(serializeUsing= ObjectWriterImplToString.class) private Long replierId; /** * 回复人姓名 */ private String replier; } pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeReportReplyMapper.xml
New file @@ -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> 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()); } } } 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); } } pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/dto/DtoReportReply.java
New file @@ -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; /** * 答复人ID */ @NotNull(message = "答复人不能为空") private Long replierId; }