Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | package com.dy.pipIrrGlobal.pojoSe; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | * @Description 问题上报实体类 |
| | | */ |
| | | |
| | | @TableName(value="se_virtual_card", autoResultMap = true) |
| | | @TableName(value="se_issue_report", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class SeIssueReport { |
| | | public class SeIssueReport implements BaseEntity { |
| | | public static final long serialVersionUID = 202410301012001L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | private Long id; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 照片列表 |
| | | */ |
| | | private String images; |
| | | @TableField(typeHandler = JacksonTypeHandler.class) |
| | | private JSONArray images; |
| | | |
| | | /** |
| | | * 音频列表 |
| | | */ |
| | | private String audios; |
| | | @TableField(typeHandler = JacksonTypeHandler.class) |
| | | private JSONArray audios; |
| | | |
| | | /** |
| | | * 视频列表 |
| | | */ |
| | | private String videos; |
| | | @TableField(typeHandler = JacksonTypeHandler.class) |
| | | private JSONArray videos; |
| | | |
| | | /** |
| | | * 经度 |
| | |
| | | /** |
| | | * 农户ID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private Long clientId; |
| | | |
| | | /** |
| | | * 上报时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date reportTime; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private Byte state; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public String getImages() { |
| | | return images; |
| | | } |
| | | |
| | | public void setImages(String images) { |
| | | this.images = images; |
| | | } |
| | | |
| | | public String getAudios() { |
| | | return audios; |
| | | } |
| | | |
| | | public void setAudios(String audios) { |
| | | this.audios = audios; |
| | | } |
| | | |
| | | public String getVideos() { |
| | | return videos; |
| | | } |
| | | |
| | | public void setVideos(String videos) { |
| | | this.videos = videos; |
| | | } |
| | | |
| | | public BigDecimal getLng() { |
| | | return lng; |
| | | } |
| | | |
| | | public void setLng(BigDecimal lng) { |
| | | this.lng = lng; |
| | | } |
| | | |
| | | public BigDecimal getLat() { |
| | | return lat; |
| | | } |
| | | |
| | | public void setLat(BigDecimal lat) { |
| | | this.lat = lat; |
| | | } |
| | | |
| | | public Long getClientId() { |
| | | return clientId; |
| | | } |
| | | |
| | | public void setClientId(Long clientId) { |
| | | this.clientId = clientId; |
| | | } |
| | | |
| | | public Date getReportTime() { |
| | | return reportTime; |
| | | } |
| | | |
| | | public void setReportTime(Date reportTime) { |
| | | this.reportTime = reportTime; |
| | | } |
| | | |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public Byte getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Byte state) { |
| | | this.state = state; |
| | | } |
| | | } |
| | |
| | | <!--@Table se_issue_report--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="content" jdbcType="VARCHAR" property="content" /> |
| | | <result column="images" jdbcType="VARCHAR" property="images" /> |
| | | <result column="audios" jdbcType="VARCHAR" property="audios" /> |
| | | <result column="videos" jdbcType="VARCHAR" property="videos" /> |
| | | <result column="images" jdbcType="JAVA_OBJECT" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" property="images" /> |
| | | <result column="audios" jdbcType="JAVA_OBJECT" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" property="audios" /> |
| | | <result column="videos" jdbcType="JAVA_OBJECT" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" property="videos" /> |
| | | <result column="lng" jdbcType="DECIMAL" property="lng" /> |
| | | <result column="lat" jdbcType="DECIMAL" property="lat" /> |
| | | <result column="client_id" jdbcType="BIGINT" property="clientId" /> |
| | |
| | | audios, videos, lng, |
| | | lat, client_id, report_time, |
| | | phone, `state`) |
| | | values (#{id,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR}, #{images,jdbcType=VARCHAR}, |
| | | #{audios,jdbcType=VARCHAR}, #{videos,jdbcType=VARCHAR}, #{lng,jdbcType=DECIMAL}, |
| | | values (#{id,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR}, #{images,jdbcType=JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | #{audios,jdbcType=JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, #{videos,jdbcType=JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, #{lng,jdbcType=DECIMAL}, |
| | | #{lat,jdbcType=DECIMAL}, #{clientId,jdbcType=BIGINT}, #{reportTime,jdbcType=TIMESTAMP}, |
| | | #{phone,jdbcType=VARCHAR}, #{state,jdbcType=TINYINT}) |
| | | </insert> |
| | |
| | | #{content,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="images != null"> |
| | | #{images,jdbcType=VARCHAR}, |
| | | #{images,jdbcType=JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | </if> |
| | | <if test="audios != null"> |
| | | #{audios,jdbcType=VARCHAR}, |
| | | #{audios,jdbcType=JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | </if> |
| | | <if test="videos != null"> |
| | | #{videos,jdbcType=VARCHAR}, |
| | | #{videos,jdbcType=JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | #{lng,jdbcType=DECIMAL}, |
| | |
| | | content = #{content,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="images != null"> |
| | | images = #{images,jdbcType=VARCHAR}, |
| | | images = #{images,jdbcType=JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | </if> |
| | | <if test="audios != null"> |
| | | audios = #{audios,jdbcType=VARCHAR}, |
| | | audios = #{audios,jdbcType=JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | </if> |
| | | <if test="videos != null"> |
| | | videos = #{videos,jdbcType=VARCHAR}, |
| | | videos = #{videos,jdbcType=JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng = #{lng,jdbcType=DECIMAL}, |
| | |
| | | <!--@mbg.generated--> |
| | | update se_issue_report |
| | | set content = #{content,jdbcType=VARCHAR}, |
| | | images = #{images,jdbcType=VARCHAR}, |
| | | audios = #{audios,jdbcType=VARCHAR}, |
| | | videos = #{videos,jdbcType=VARCHAR}, |
| | | images = #{images,jdbcType=JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | audios = #{audios,jdbcType=JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | videos = #{videos,jdbcType=JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | lng = #{lng,jdbcType=DECIMAL}, |
| | | lat = #{lat,jdbcType=DECIMAL}, |
| | | client_id = #{clientId,jdbcType=BIGINT}, |
| | |
| | | SELECT |
| | | id, |
| | | vc_num AS vcNum, |
| | | money, |
| | | ROUND(money / 100,2) AS money, |
| | | in_use AS inUse, |
| | | (CASE |
| | | WHEN in_use = 0 THEN '未使用' |
New file |
| | |
| | | package com.dy.pipIrrWechat.issue; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeIssueReport; |
| | | import com.dy.pipIrrWechat.issue.dto.DtoIssueReport; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | 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; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-10-30 10:34 |
| | | * @LastEditTime 2024-10-30 10:34 |
| | | * @Description 农户问题上报控制类 |
| | | */ |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping(path="issue") |
| | | @RequiredArgsConstructor |
| | | public class IssueCtrl { |
| | | private final IssueSv issueSv; |
| | | |
| | | /** |
| | | * 添加农户问题上报 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "addIssueReport") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public BaseResponse<Boolean> addIssueReport(@RequestBody @Valid DtoIssueReport po, BindingResult bindingResult) { |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | Long clientId = po.getClientId(); |
| | | String phone = Optional.ofNullable(po.getPhone()).orElse(""); |
| | | BigDecimal lng = Optional.ofNullable(po.getLng()).orElse(BigDecimal.valueOf(0)); |
| | | BigDecimal lat = Optional.ofNullable(po.getLat()).orElse(BigDecimal.valueOf(0)); |
| | | String content = Optional.ofNullable(po.getContent()).orElse(""); |
| | | JSONArray images = Optional.ofNullable(po.getImages()).orElse(new JSONArray()); |
| | | JSONArray audios = Optional.ofNullable(po.getAudios()).orElse(new JSONArray()); |
| | | JSONArray videos = Optional.ofNullable(po.getVideos()).orElse(new JSONArray()); |
| | | |
| | | SeIssueReport seIssueReport = new SeIssueReport(); |
| | | seIssueReport.setClientId(clientId); |
| | | seIssueReport.setPhone(phone); |
| | | seIssueReport.setLng(lng); |
| | | seIssueReport.setLat(lat); |
| | | seIssueReport.setContent(content); |
| | | seIssueReport.setImages(images); |
| | | seIssueReport.setAudios(audios); |
| | | seIssueReport.setVideos(videos); |
| | | Long issueReportId = issueSv.insertIssueReport(seIssueReport); |
| | | if(issueReportId == null) { |
| | | return BaseResponseUtils.buildErrorMsg("农户问题上报失败"); |
| | | } |
| | | |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrWechat.issue; |
| | | |
| | | import com.dy.pipIrrGlobal.daoSe.SeIssueReportMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeIssueReport; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-10-30 10:34 |
| | | * @LastEditTime 2024-10-30 10:34 |
| | | * @Description 农户问题上报服务类 |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class IssueSv { |
| | | @Autowired |
| | | private SeIssueReportMapper seIssueReportMapper; |
| | | |
| | | /** |
| | | * 添加问题上报信息 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Long insertIssueReport(SeIssueReport po) { |
| | | seIssueReportMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrWechat.issue.dto; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-10-30 10:45 |
| | | * @LastEditTime 2024-10-30 10:45 |
| | | * @Description 农户问题上报传输类 |
| | | */ |
| | | |
| | | @Data |
| | | public class DtoIssueReport { |
| | | public static final long serialVersionUID = 202410301046001L; |
| | | |
| | | /** |
| | | * 反馈内容 |
| | | */ |
| | | private String content; |
| | | |
| | | /** |
| | | * 照片列表 |
| | | */ |
| | | //@TableField(typeHandler = JacksonTypeHandler.class) |
| | | private JSONArray images; |
| | | |
| | | /** |
| | | * 音频列表 |
| | | */ |
| | | //@TableField(typeHandler = JacksonTypeHandler.class) |
| | | private JSONArray audios; |
| | | |
| | | /** |
| | | * 视频列表 |
| | | */ |
| | | //@TableField(typeHandler = JacksonTypeHandler.class) |
| | | private JSONArray videos; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private BigDecimal lng; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private BigDecimal lat; |
| | | |
| | | /** |
| | | * 农户ID |
| | | */ |
| | | @NotNull(message = "农户不能为空") |
| | | private Long clientId; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | private String phone; |
| | | |
| | | } |