zhubaomin
2024-11-09 c8ffc5ed851f85808aa735a575402ebae4b00da9
获取全部取水口接口取消在线情况判断
4个文件已修改
130 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeCtrl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeSv.java 89 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/qo/OnLineIntakesQO.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -603,31 +603,14 @@
        </trim>
    </select>
    <!--根据取水口编号获取取水口对象-->
    <select id="getIntakeByName" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake">
        SELECT con.intakeId,
        con.rtuAddr,
        inta.name AS intakeNum,
        rtus.isOnLine
        SELECT
            con.intakeId,
            con.rtuAddr,
            inta.name AS intakeNum
        FROM pr_controller con
        INNER JOIN pr_intake inta ON con.intakeId = inta.id
        left JOIN JSON_TABLE(
        #{onLineMap},
        '$[*]' COLUMNS (
        rtuAddr VARCHAR(20) PATH '$.rtuAddr',
        isOnLine BOOLEAN PATH '$.isOnLine'
        )
        ) rtus ON con.rtuAddr = rtus.rtuAddr
            INNER JOIN pr_intake inta ON con.intakeId = inta.id
        <where>
            <if test="intakeNum != null and intakeNum != ''">
                AND LOWER(inta.name) = #{intakeNum}
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeCtrl.java
@@ -36,7 +36,6 @@
     * @param qo
     * @return
     */
    //@GetMapping(path = "one_intake")
    @GetMapping(path = "all_intakes")
    public BaseResponse<QueryResultVo<VoOnLineIntake>> getOneIntake(OnLineIntakesQO qo) {
        try {
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeSv.java
@@ -68,30 +68,28 @@
     * @return
     */
    public VoOnLineIntake selectOneIntake(OnLineIntakesQO qo) {
        Command com = new Command() ;
        com.id = Command.defaultId;
        com.code = "LCD0001";
        com.type = "innerCommand";
        comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw);
        //Command com = new Command() ;
        //com.id = Command.defaultId;
        //com.code = "LCD0001";
        //com.type = "innerCommand";
        //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");
        //    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());
        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");
            if(attachment != null) {
                attachment.forEach((key, value) -> {
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("rtuAddr", key);
                    jsonObject.put("isOnLine", value);
                    jsonArray.add(jsonObject);
                });
            }
        //} else {
        //    return new VoOnLineIntake();
        }
        qo.setOnLineMap(jsonArray.toJSONString());
        // 如果 intakeNum 不为空,则转为小写再写入qo对象
        String intakeNum = qo.getIntakeNum();
        if(intakeNum != null) {
@@ -107,31 +105,28 @@
     * @return
     */
    public QueryResultVo<List<VoOnLineIntake>> selectAllIntakes(OnLineIntakesQO qo) {
        Command com = new Command() ;
        com.id = Command.defaultId;
        com.code = "LCD0001";
        com.type = "innerCommand";
        comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw);
        //Command com = new Command() ;
        //com.id = Command.defaultId;
        //com.code = "LCD0001";
        //com.type = "innerCommand";
        //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");
        //    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());
        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");
            if(attachment != null) {
                attachment.forEach((key, value) -> {
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("rtuAddr", key);
                    jsonObject.put("isOnLine", value);
                    jsonArray.add(jsonObject);
                });
            }
        //} else {
        //    QueryResultVo<List<VoOnLineIntake>> rsVo = new QueryResultVo<>();
        //    return rsVo;
        }
        qo.setOnLineMap(jsonArray.toJSONString());
        // 如果 intakeNum 不为空,则转为小写再写入qo对象
        String intakeNum = qo.getIntakeNum();
        if(intakeNum != null) {
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/qo/OnLineIntakesQO.java
@@ -1,8 +1,6 @@
package com.dy.pipIrrWechat.intake.qo;
import com.dy.common.webUtil.QueryConditionVo;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -17,19 +15,8 @@
@EqualsAndHashCode(callSuper = false)
public class OnLineIntakesQO extends QueryConditionVo {
    /**
     * 中间件返回的RTU在线情况对象数组
     */
    private String onLineMap;
    /**
     * 取水口编号
     */
    private String intakeNum;
    /**
     * 是否在线
     */
    @Max(value = 1,message = "是否在线仅允许为真或假")
    @Min(value = 0,message = "是否在线仅允许为真或假")
    private Boolean isOnLine;
}