2024-10-31 农户问题上报添加接口、查询接口、删除接口,在线查询代码优化
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | if(response == null) { |
| | | return BaseResponseUtils.buildErrorMsg("中间件调用失败"); |
| | | } |
| | | return response.getBody(); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeIssueReport; |
| | | import com.dy.pipIrrGlobal.voSe.VoIssueReport; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | int updateByPrimaryKeySelective(SeIssueReport record); |
| | | |
| | | int updateByPrimaryKey(SeIssueReport record); |
| | | |
| | | /** |
| | | * 根据指定条件获取农户问题上报数量 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getIssueReportsCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取农户问题上报 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoIssueReport> getIssueReports(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 逻辑删除一个农户问题上报 |
| | | * @param issueReportId |
| | | * @return |
| | | */ |
| | | Integer deleteIssueReport(Long issueReportId); |
| | | } |
New file |
| | |
| | | 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-30 13:51 |
| | | * @LastEditTime 2024-10-30 13:51 |
| | | * @Description 农户问题上报视图对象 |
| | | */ |
| | | |
| | | @Data |
| | | @JsonPropertyOrder({"issueReportId", "clientName", "phone", "reportTime", "content", "images", "audios", "videos", "state"}) |
| | | public class VoIssueReport implements BaseEntity { |
| | | private static final long serialVersionUID = 202410301354001L; |
| | | |
| | | /** |
| | | * 农户问题上报ID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private Long issueReportId; |
| | | |
| | | /** |
| | | * 农户姓名 |
| | | */ |
| | | private String clientName; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | private String phone; |
| | | |
| | | /** |
| | | * 上报时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date reportTime; |
| | | |
| | | /** |
| | | * 上报内容 |
| | | */ |
| | | private String content; |
| | | |
| | | /** |
| | | * 照片列表 |
| | | */ |
| | | private String images; |
| | | |
| | | /** |
| | | * 音频列表 |
| | | */ |
| | | private String audios; |
| | | |
| | | /** |
| | | * 视频列表 |
| | | */ |
| | | private String videos; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private String state; |
| | | } |
| | |
| | | |
| | | <!--获取取水口列表(在线和不在先)--> |
| | | <select id="getOnLineIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake"> |
| | | SELECT inta.id AS intakeId, |
| | | con.rtuAddr, |
| | | inta.name AS intakeNum, |
| | | inta.lng, |
| | | inta.lat, |
| | | IFNULL(hou.total_amount, 0) AS totalAmount, |
| | | (CASE |
| | | WHEN con.rtuAddr IS NULL THEN false |
| | | WHEN con.rtuAddr IS NOT NULL THEN true |
| | | END) AS isBinded, |
| | | rtus.isOnLine, |
| | | alarm.alarm |
| | | SELECT |
| | | inta.id AS intakeId, |
| | | con.rtuAddr, |
| | | inta.name AS intakeNum, |
| | | inta.lng, |
| | | inta.lat, |
| | | IFNULL(hou.total_amount, 0) AS totalAmount, |
| | | (CASE |
| | | WHEN con.rtuAddr IS NULL THEN false |
| | | WHEN con.rtuAddr IS NOT NULL THEN true |
| | | END) AS isBinded, |
| | | rtus.isOnLine, |
| | | alarm.alarm |
| | | FROM pr_intake inta |
| | | LEFT JOIN pr_controller con ON con.intakeId = inta.id |
| | | LEFT JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id |
| | | LEFT JOIN( |
| | | SELECT intake_id AS intakeId, |
| | | CONCAT( |
| | | IF(alarm_loss = 1, IF(alarm_water_meter_fault = 1, '流量计故障,', ''), |
| | | IF(alarm_water_meter_fault = 1, '流量计故障', '')), |
| | | IF(alarm_battery_volt = 1, IF(alarm_loss = 1, '漏损(偷水)报警,', ''), |
| | | IF(alarm_loss = 1, '漏损(偷水)报警', '')), |
| | | IF(alarm_valve = 1, IF(alarm_battery_volt = 1, '蓄电池电压报警,', ''), |
| | | IF(alarm_battery_volt = 1, '蓄电池电压报警', '')), |
| | | IF(alarm_valve = 1, '阀门报警', '') |
| | | ) AS alarm |
| | | FROM rm_alarm_state_last |
| | | WHERE (alarm_water_meter_fault = 1 OR alarm_loss = 1 OR alarm_battery_volt = 1 OR alarm_valve = 1) |
| | | AND dt >= DATE_SUB(NOW(), INTERVAL 12 HOUR) |
| | | ) alarm ON alarm.intakeId = inta.id |
| | | LEFT JOIN JSON_TABLE( |
| | | <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',--> |
| | | #{onLineMap}, |
| | | '$[*]' COLUMNS ( |
| | | rtuAddr VARCHAR(20) PATH '$.rtuAddr', |
| | | isOnLine BOOLEAN PATH '$.isOnLine' |
| | | ) |
| | | ) rtus ON con.rtuAddr = rtus.rtuAddr |
| | | LEFT JOIN pr_controller con ON con.intakeId = inta.id |
| | | LEFT JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id |
| | | LEFT JOIN( |
| | | SELECT intake_id AS intakeId, |
| | | CONCAT( |
| | | IF(alarm_loss = 1, IF(alarm_water_meter_fault = 1, '流量计故障,', ''), |
| | | IF(alarm_water_meter_fault = 1, '流量计故障', '')), |
| | | IF(alarm_battery_volt = 1, IF(alarm_loss = 1, '漏损(偷水)报警,', ''), |
| | | IF(alarm_loss = 1, '漏损(偷水)报警', '')), |
| | | IF(alarm_valve = 1, IF(alarm_battery_volt = 1, '蓄电池电压报警,', ''), |
| | | IF(alarm_battery_volt = 1, '蓄电池电压报警', '')), |
| | | IF(alarm_valve = 1, '阀门报警', '') |
| | | ) AS alarm |
| | | FROM rm_alarm_state_last |
| | | WHERE (alarm_water_meter_fault = 1 OR alarm_loss = 1 OR alarm_battery_volt = 1 OR alarm_valve = 1) |
| | | AND dt >= DATE_SUB(NOW(), INTERVAL 12 HOUR) |
| | | ) alarm ON alarm.intakeId = inta.id |
| | | LEFT JOIN JSON_TABLE( |
| | | <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',--> |
| | | #{onLineMap}, |
| | | '$[*]' COLUMNS ( |
| | | rtuAddr VARCHAR(20) PATH '$.rtuAddr', |
| | | isOnLine BOOLEAN PATH '$.isOnLine' |
| | | ) |
| | | ) rtus ON con.rtuAddr = rtus.rtuAddr |
| | | <where> |
| | | <if test="isOnLine != null"> |
| | | rtus.isOnLine = #{isOnLine} |
| | |
| | | <select id="getUnclosedValves" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedValve"> |
| | | SELECT |
| | | inta.name AS intakeNum, |
| | | rtus.isOnLine, |
| | | <!-- rtus.isOnLine,--> |
| | | IFNULL(rtus.isOnLine,'未知') AS isOnLine, |
| | | com.rtu_addr AS rtuAddr, |
| | | com.param ->> '$.icCardNo' AS vcNum, |
| | | ( |
| | |
| | | `state` = #{state,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据指定条件获取农户问题上报数量--> |
| | | <select id="getIssueReportsCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM se_issue_report rpt |
| | | LEFT JOIN se_client cli ON cli.id = rpt.client_id |
| | | <where> |
| | | AND rpt.state != 3 |
| | | |
| | | <if test="clientId != null"> |
| | | AND rpt.client_id = #{clientId} |
| | | </if> |
| | | |
| | | <if test="clientName != null and clientName != ''"> |
| | | AND cli.name like CONCAT('%', #{clientName}, '%') |
| | | </if> |
| | | |
| | | <if test="content != null and content != ''"> |
| | | AND rpt.content like CONCAT('%', #{content}, '%') |
| | | </if> |
| | | |
| | | <if test="timeStart != null and timeStop != null "> |
| | | AND rpt.report_time BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | |
| | | <if test="state != null"> |
| | | AND rpt.state = #{state} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取农户问题上报--> |
| | | <select id="getIssueReports" resultType="com.dy.pipIrrGlobal.voSe.VoIssueReport" > |
| | | SELECT |
| | | rpt.id AS issueReportId, |
| | | cli.name AS clientName, |
| | | rpt.phone, |
| | | rpt.report_time AS reportTime, |
| | | rpt.content, |
| | | rpt.images, |
| | | rpt.audios, |
| | | rpt.videos, |
| | | CASE |
| | | WHEN rpt.state = 1 THEN '未受理' |
| | | WHEN rpt.state = 2 THEN '已受理' |
| | | END AS state |
| | | FROM se_issue_report rpt |
| | | LEFT JOIN se_client cli ON cli.id = rpt.client_id |
| | | <where> |
| | | AND rpt.state != 3 |
| | | |
| | | <if test="clientId != null"> |
| | | AND rpt.client_id = #{clientId} |
| | | </if> |
| | | |
| | | <if test="clientName != null and clientName != ''"> |
| | | AND cli.name like CONCAT('%', #{clientName}, '%') |
| | | </if> |
| | | |
| | | <if test="content != null and content != ''"> |
| | | AND rpt.content like CONCAT('%', #{content}, '%') |
| | | </if> |
| | | |
| | | <if test="timeStart != null and timeStop != null "> |
| | | AND rpt.report_time BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | |
| | | <if test="state != null"> |
| | | AND rpt.state = #{state} |
| | | </if> |
| | | </where> |
| | | ORDER BY rpt.report_time DESC |
| | | <trim prefix="limit "> |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--逻辑删除一个农户问题上报--> |
| | | <update id="deleteIssueReport"> |
| | | UPDATE se_issue_report SET state = 3 WHERE id = #{issueReportId} |
| | | </update> |
| | | </mapper> |
| | |
| | | import com.dy.common.multiDataSource.DataSourceContext; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoPr.PrControllerMapper; |
| | | import com.dy.pipIrrGlobal.daoPr.PrIntakeControllerMapper; |
| | |
| | | import org.springframework.web.client.RestTemplate; |
| | | import org.springframework.web.util.UriComponentsBuilder; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); |
| | | |
| | | JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com)); |
| | | |
| | | |
| | | if (response != null && response.getString("code").equals("0001")) { |
| | | JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment"); |
| | | |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | if(response == null) { |
| | | return BaseResponseUtils.buildErrorMsg("中间件调用失败"); |
| | | } |
| | | |
| | | return response.getBody(); |
| | | } |
| | | } |
| | |
| | | import com.dy.common.multiDataSource.DataSourceContext; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.config.DingTalk; |
| | | import com.dy.pipIrrGlobal.daoPr.PrDivideMapper; |
| | |
| | | import org.springframework.web.client.RestTemplate; |
| | | import org.springframework.web.util.UriComponentsBuilder; |
| | | |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author wuzeyu |
| | |
| | | com.code = "LCD0001"; |
| | | com.type = "innerCommand"; |
| | | JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com)); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if (response != null && response.getString("code").equals("0001")) { |
| | | JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment"); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(attachment != null) { |
| | | attachment.forEach((key, value) -> { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("rtuAddr", key); |
| | | jsonObject.put("isOnLine", value); |
| | | jsonArray.add(jsonObject); |
| | | |
| | | }); |
| | | } |
| | | return prIntakeMapper.getUsedIntakes(jsonArray.toJSONString(), operator); |
| | | } else { |
| | | return new ArrayList<>(); |
| | | //} else { |
| | | // return new ArrayList<>(); |
| | | } |
| | | return prIntakeMapper.getUsedIntakes(jsonArray.toJSONString(), operator); |
| | | } |
| | | |
| | | /** |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | if(response == null) { |
| | | return BaseResponseUtils.buildErrorMsg("中间件调用失败"); |
| | | } |
| | | |
| | | return response.getBody(); |
| | | } |
| | | |
| | |
| | | import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.voPr.VoOnLineIntake; |
| | | import com.dy.pipIrrGlobal.voRm.VoCommand; |
| | | import com.dy.pipIrrGlobal.voRm.VoUnclosedParam; |
| | | import com.dy.pipIrrGlobal.voRm.VoUnclosedValve; |
| | |
| | | comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); |
| | | |
| | | JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com)); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(response != null && response.getString("code").equals("0001")) { |
| | | JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment"); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(attachment != null) { |
| | | attachment.forEach((key, value) -> { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("rtuAddr", key); |
| | | jsonObject.put("isOnLine", value); |
| | | jsonArray.add(jsonObject); |
| | | |
| | | }); |
| | | } |
| | | |
| | | System.out.println(jsonArray); |
| | | List<VoUnclosedValve> res = rmCommandHistoryMapper.getUnclosedValves(jsonArray.toJSONString(), operator); |
| | | if(res != null) { |
| | | return res; |
| | | } else { |
| | | return new ArrayList<>(); |
| | | } |
| | | //} else { |
| | | // return new ArrayList<>(); |
| | | } |
| | | |
| | | List<VoUnclosedValve> res = rmCommandHistoryMapper.getUnclosedValves(jsonArray.toJSONString(), operator); |
| | | if(res != null) { |
| | | return res; |
| | | } else { |
| | | QueryResultVo<List<VoOnLineIntake>> rsVo = new QueryResultVo<>(); |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | |
| | | comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); |
| | | |
| | | JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com)); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(response != null && response.getString("code").equals("0001")) { |
| | | JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment"); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(attachment != null) { |
| | | attachment.forEach((key, value) -> { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("rtuAddr", key); |
| | | jsonObject.put("isOnLine", value); |
| | | jsonArray.add(jsonObject); |
| | | |
| | | }); |
| | | } |
| | | System.out.println(jsonArray); |
| | | return rmCommandHistoryMapper.getUncloseParam(jsonArray.toJSONString(), intakeId); |
| | | } else { |
| | | QueryResultVo<List<VoOnLineIntake>> rsVo = new QueryResultVo<>(); |
| | | VoUnclosedParam voUnclosedParam = new VoUnclosedParam(); |
| | | return voUnclosedParam; |
| | | //} else { |
| | | // VoUnclosedParam voUnclosedParam = new VoUnclosedParam(); |
| | | // return voUnclosedParam; |
| | | } |
| | | |
| | | return rmCommandHistoryMapper.getUncloseParam(jsonArray.toJSONString(), intakeId); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.voPr.VoOnLineIntake; |
| | | import com.dy.pipIrrGlobal.voRm.VoIrrigaterProfile; |
| | | import com.dy.pipIrrGlobal.voRm.VoUnclosedValve; |
| | | import com.dy.pipIrrGlobal.voSe.VoVirtualCard; |
| | |
| | | comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); |
| | | |
| | | JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com)); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(response != null && response.getString("code").equals("0001")) { |
| | | JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment"); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(attachment != null) { |
| | | attachment.forEach((key, value) -> { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("rtuAddr", key); |
| | | jsonObject.put("isOnLine", value); |
| | | jsonArray.add(jsonObject); |
| | | |
| | | }); |
| | | } |
| | | |
| | | System.out.println(jsonArray.toJSONString()); |
| | | List<VoUnclosedValve> res = rmCommandHistoryMapper.getUnclosedValves(jsonArray.toJSONString(), operator); |
| | | if(res != null) { |
| | | return res; |
| | | } else { |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | |
| | | List<VoUnclosedValve> res = rmCommandHistoryMapper.getUnclosedValves(jsonArray.toJSONString(), operator); |
| | | if(res != null) { |
| | | return res; |
| | | } else { |
| | | QueryResultVo<List<VoOnLineIntake>> rsVo = new QueryResultVo<>(); |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | |
| | | import com.dy.common.multiDataSource.DataSourceContext; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper; |
| | |
| | | import org.springframework.web.client.RestTemplate; |
| | | import org.springframework.web.util.UriComponentsBuilder; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); |
| | | |
| | | JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com)); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(response != null && response.getString("code").equals("0001")) { |
| | | JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment"); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(attachment != null) { |
| | | attachment.forEach((key, value) -> { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("rtuAddr", key); |
| | | jsonObject.put("isOnLine", value); |
| | | jsonArray.add(jsonObject); |
| | | |
| | | }); |
| | | } |
| | | |
| | | qo.setOnLineMap(jsonArray.toJSONString()); |
| | | // 如果 intakeNum 不为空,则转为小写再写入qo对象 |
| | | String intakeNum = qo.getIntakeNum(); |
| | | if(intakeNum != null) { |
| | | qo.setIntakeNum(intakeNum.toLowerCase()); |
| | | } |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; |
| | | return prIntakeMapper.getIntakeByName(params); |
| | | } else { |
| | | return new VoOnLineIntake(); |
| | | //} else { |
| | | // return new VoOnLineIntake(); |
| | | } |
| | | |
| | | qo.setOnLineMap(jsonArray.toJSONString()); |
| | | // 如果 intakeNum 不为空,则转为小写再写入qo对象 |
| | | String intakeNum = qo.getIntakeNum(); |
| | | if(intakeNum != null) { |
| | | qo.setIntakeNum(intakeNum.toLowerCase()); |
| | | } |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; |
| | | return prIntakeMapper.getIntakeByName(params); |
| | | } |
| | | |
| | | /** |
| | |
| | | comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); |
| | | |
| | | JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com)); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(response != null && response.getString("code").equals("0001")) { |
| | | JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment"); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(attachment != null) { |
| | | attachment.forEach((key, value) -> { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("rtuAddr", key); |
| | | jsonObject.put("isOnLine", value); |
| | | jsonArray.add(jsonObject); |
| | | |
| | | }); |
| | | } |
| | | |
| | | qo.setOnLineMap(jsonArray.toJSONString()); |
| | | // 如果 intakeNum 不为空,则转为小写再写入qo对象 |
| | | String intakeNum = qo.getIntakeNum(); |
| | | if(intakeNum != null) { |
| | | qo.setIntakeNum(intakeNum.toLowerCase()); |
| | | } |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; |
| | | Long itemTotal = prIntakeMapper.getOnLineIntakesCount(params); |
| | | |
| | | QueryResultVo<List<VoOnLineIntake>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = qo.pageSize ; |
| | | rsVo.pageCurr = qo.pageCurr ; |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = prIntakeMapper.getOnLineIntakes(params); |
| | | return rsVo; |
| | | } else { |
| | | QueryResultVo<List<VoOnLineIntake>> rsVo = new QueryResultVo<>(); |
| | | return rsVo; |
| | | //} else { |
| | | // QueryResultVo<List<VoOnLineIntake>> rsVo = new QueryResultVo<>(); |
| | | // return rsVo; |
| | | } |
| | | |
| | | qo.setOnLineMap(jsonArray.toJSONString()); |
| | | // 如果 intakeNum 不为空,则转为小写再写入qo对象 |
| | | String intakeNum = qo.getIntakeNum(); |
| | | if(intakeNum != null) { |
| | | qo.setIntakeNum(intakeNum.toLowerCase()); |
| | | } |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; |
| | | Long itemTotal = prIntakeMapper.getOnLineIntakesCount(params); |
| | | |
| | | QueryResultVo<List<VoOnLineIntake>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = qo.pageSize ; |
| | | rsVo.pageCurr = qo.pageCurr ; |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = prIntakeMapper.getOnLineIntakes(params); |
| | | return rsVo; |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | //JSONObject response = JSON.parseObject(response_Str); |
| | | //String test = response.toJSONString(); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(response != null && response.getString("code").equals("0001")) { |
| | | JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment"); |
| | | |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(attachment != null) { |
| | | attachment.forEach((key, value) -> { |
| | | JSONObject jsonObject = new JSONObject(); |
| | |
| | | } |
| | | |
| | | System.out.println(jsonArray.toJSONString()); |
| | | return prIntakeMapper.getUsedIntakes(jsonArray.toJSONString(), operatorId); |
| | | } else { |
| | | return new ArrayList<>(); |
| | | //return prIntakeMapper.getUsedIntakes(jsonArray.toJSONString(), operatorId); |
| | | //} else { |
| | | // return new ArrayList<>(); |
| | | } |
| | | |
| | | return prIntakeMapper.getUsedIntakes(jsonArray.toJSONString(), operatorId); |
| | | } |
| | | |
| | | /** |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | if(response == null) { |
| | | return BaseResponseUtils.buildErrorMsg("中间件调用失败"); |
| | | } |
| | | |
| | | return response.getBody(); |
| | | } |
| | | |
| | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeIssueReport; |
| | | import com.dy.pipIrrGlobal.voSe.VoIssueReport; |
| | | import com.dy.pipIrrWechat.issue.dto.DtoIssueReport; |
| | | import com.dy.pipIrrWechat.issue.qo.QoIssueReport; |
| | | 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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | |
| | | seIssueReport.setImages(images); |
| | | seIssueReport.setAudios(audios); |
| | | seIssueReport.setVideos(videos); |
| | | seIssueReport.setReportTime(new Date()); |
| | | seIssueReport.setState((byte)1); |
| | | Long issueReportId = issueSv.insertIssueReport(seIssueReport); |
| | | if(issueReportId == null) { |
| | | return BaseResponseUtils.buildErrorMsg("农户问题上报失败"); |
| | |
| | | |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取农户问题上报 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "/getIssueReports") |
| | | public BaseResponse<QueryResultVo<List<VoIssueReport>>> getIssueReports(QoIssueReport vo) { |
| | | try { |
| | | QueryResultVo<List<VoIssueReport>> res = issueSv.getIssueReports(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取农户问题上报记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 逻辑删除农户问题上报 |
| | | * @param issueReportId |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "deleteIssueReport") |
| | | public BaseResponse<Boolean> deleteIssueReport(@RequestParam("issueReportId") Long issueReportId) { |
| | | if (issueReportId == null) { |
| | | return BaseResponseUtils.buildErrorMsg("未选择要删除的农户问题上报"); |
| | | } |
| | | |
| | | try { |
| | | //取水口ID |
| | | Integer recordCount = Optional.ofNullable(issueSv.deleteIssueReport(issueReportId)).orElse(0); |
| | | if (recordCount == 0) { |
| | | return BaseResponseUtils.buildErrorMsg("农户问题上报删除失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("农户问题上报删除失败", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrWechat.issue; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoSe.SeIssueReportMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeIssueReport; |
| | | import com.dy.pipIrrGlobal.voSe.VoIssueReport; |
| | | import com.dy.pipIrrWechat.issue.qo.QoIssueReport; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | seIssueReportMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取农户问题上报 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoIssueReport>> getIssueReports(QoIssueReport queryVo) { |
| | | //完善查询充值记录的起止时间 |
| | | String timeStart = queryVo.getTimeStart(); |
| | | String timeStop = queryVo.getTimeStop(); |
| | | if (timeStart != null) { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | queryVo.setTimeStart(timeStart); |
| | | } |
| | | if (timeStop != null) { |
| | | timeStop = timeStop + " 23:59:59"; |
| | | queryVo.setTimeStop(timeStop); |
| | | } |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = seIssueReportMapper.getIssueReportsCount(params); |
| | | QueryResultVo<List<VoIssueReport>> rsVo = new QueryResultVo<>(); |
| | | |
| | | rsVo.pageSize = queryVo.pageSize; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seIssueReportMapper.getIssueReports(params); |
| | | return rsVo; |
| | | } |
| | | |
| | | /** |
| | | * 删除农户问题上报 |
| | | * @param issueReportId |
| | | * @return |
| | | */ |
| | | public Integer deleteIssueReport(Long issueReportId) { |
| | | return seIssueReportMapper.deleteIssueReport(issueReportId); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrWechat.issue.qo; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-10-30 21:51 |
| | | * @LastEditTime 2024-10-30 21:51 |
| | | * @Description 农户问题上报查询对象 |
| | | */ |
| | | |
| | | @Data |
| | | public class QoIssueReport extends QueryConditionVo { |
| | | |
| | | /** |
| | | * 农户ID |
| | | */ |
| | | private Long clientId; |
| | | |
| | | /** |
| | | * 农户姓名 |
| | | */ |
| | | private String clientName; |
| | | |
| | | /** |
| | | * 上报内容 |
| | | */ |
| | | private String content; |
| | | |
| | | /** |
| | | * 查询开始时间 |
| | | */ |
| | | private String timeStart; |
| | | |
| | | /** |
| | | * 查询结束时间 |
| | | */ |
| | | private String timeStop; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | } |