Administrator
2024-06-06 400af57e240a4c0d74c81ffc8b3417226b51345a
2024-06-06 朱宝民 生产环境版本
26个文件已修改
5个文件已添加
1229 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/pom.xml 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/dto/Param.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeClient.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/Org.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoClientWechat.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-database-pj.yml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-demo/src/main/java/com/dy/pipIrrDemo/demo/DemoCtrl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/qo/OnLineIntakesQO.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/enums/LastOperateENUM.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java 197 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java 91 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientSv.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/DtoClient.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/enums/LastOperateENUM.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pom.xml 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/pom.xml
@@ -144,19 +144,19 @@
    <build>
        <plugins>
            <plugin>
                <!-- spring boot提供的maven打包插件 -->
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
<!--            <plugin>-->
<!--                &lt;!&ndash; spring boot提供的maven打包插件 &ndash;&gt;-->
<!--                <groupId>org.springframework.boot</groupId>-->
<!--                <artifactId>spring-boot-maven-plugin</artifactId>-->
<!--                <configuration>-->
<!--                    <excludes>-->
<!--                        <exclude>-->
<!--                            <groupId>org.projectlombok</groupId>-->
<!--                            <artifactId>lombok</artifactId>-->
<!--                        </exclude>-->
<!--                    </excludes>-->
<!--                </configuration>-->
<!--            </plugin>-->
            <plugin>
                <!-- maven里执行测试用例的插件 -->
                <groupId>org.apache.maven.plugins</groupId>
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java
@@ -5,21 +5,22 @@
import com.dy.common.mw.protocol.Command;
import com.dy.common.mw.protocol.CommandType;
import com.dy.common.mw.protocol.Data;
import com.dy.common.mw.protocol.p206V202404.CodeV202404;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pipIrrGlobal.command.dto.Param;
import com.dy.pipIrrGlobal.command.result.CommandResultCode;
import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper;
import com.dy.pipIrrGlobal.daoPr.PrControllerMapper;
import com.dy.pipIrrGlobal.daoRm.RmCommandHistoryMapper;
import com.dy.pipIrrGlobal.pojoPr.PrController;
import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.DependsOn;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
@@ -41,8 +42,8 @@
 * @Description 命令支撑类
 */
@Component
@DependsOn({"baSettingsMapper", "prControllerMapper"})
//@Component
//@DependsOn({"baSettingsMapper", "prControllerMapper"})
public class ComSupport {
    protected static String mwUrlSendCom = "http://127.0.0.1:8070/rtuMw/com/send" ;
@@ -59,8 +60,16 @@
    @Autowired
    private BaSettingsMapper baSettingsMapper;
    @Autowired
    private PrControllerMapper prControllerMapper;
    //@Autowired
    //private CommandSv commandSv;
    @Autowired
    private RmCommandHistoryMapper rmCommandHistoryMapper;
    public static ComSupport comSupport;
    /**
@@ -214,4 +223,71 @@
        }
        return response.getBody();
    }
    /**
     * 发送命令并处理请求结果及执行结果
     * @param po
     * @return
     */
    protected BaseResponse dealWithCommandResult(Param po) {
        Long comId = po.getComId();
        String commandCode = po.getCommandCode();
        Long intakeId = po.getIntakeId();
        String rtuAddr = po.getRtuAddr();
        String protocol = po.getProtocol();
        Object param = po.getParam();
        String rtuResultSendWebUrl = po.getRtuResultSendWebUrl();
        Long operator = po.getOperator();
        // 构造命令
        Command com = command(comId, commandCode, rtuAddr, protocol, rtuResultSendWebUrl, param);
        // 发送命令
        JSONObject response_SendCom= (JSONObject) JSON.toJSON(sendCom2Mw(com));
        if(response_SendCom != null && response_SendCom.getString("code").equals("0001")) {
            //if(1 > 0) {
            // 请求成功
            // 创建命令日志对象并添加到数据库中
            String commandName = CodeV202404.getCodeName(commandCode);
            RmCommandHistory rmCommandHistory = getComHistory(comId, commandCode, commandName, intakeId, rtuAddr, protocol, param, operator);
            //commandSv.insert(rmCommandHistory);
            rmCommandHistoryMapper.insert(rmCommandHistory);
            // 处理回调
            BaseResponse response_CallBack = dealWithCallBack(comId);
            // 回调失败
            if(!response_CallBack.getCode().equals("0001")) {
                // 命令日志执行结果改为失败
                rmCommandHistory = new RmCommandHistory();
                rmCommandHistory.setId(comId);
                rmCommandHistory.setResult((byte)0);
                //commandSv.updateCommandResult(rmCommandHistory);
                rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory);
                return BaseResponseUtils.buildFail(response_CallBack.getMsg());
                //return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
            }
            // 回调成功,再判断执行是否成功
            JSONObject job_content = (JSONObject)JSON.toJSON(response_CallBack.getContent());
            System.out.println(job_content);
            JSONObject job_subData = (JSONObject) job_content.getJSONObject("subData").getJSONObject("subData");
            System.out.println(job_subData);
            Boolean dealResult = job_subData.getBoolean("success");
            if(!dealResult) {
                return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
            }
            /**
             * 执行成功,返回回调内容
             */
            Data myData = (Data)response_CallBack.getContent();
            return BaseResponseUtils.buildSuccess(myData) ;
        } else {
            // 请求失败
            JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param");
            return BaseResponseUtils.buildFail(job_param.getString("message"));
        }
    }
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/dto/Param.java
New file
@@ -0,0 +1,32 @@
package com.dy.pipIrrGlobal.command.dto;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2024-06-04 11:25
 * @LastEditTime 2024-06-04 11:25
 * @Description
 */
@Data
public class Param {
    public static final long serialVersionUID = 202406041126001L;
    private Long comId;
    private String commandCode;
    private Long intakeId;
    private String rtuAddr;
    private String protocol;
    private Object param;
    private String rtuResultSendWebUrl;
    private Long operator;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientMapper.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoSe.SeClient;
import com.dy.pipIrrGlobal.voSe.VoClient;
import com.dy.pipIrrGlobal.voSe.VoClientWechat;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -105,4 +106,10 @@
     */
    List<Map<String, Object>> getWaterTypes();
    /**
     * 获取农户基本信息,小程序首页使用
     * @param sessionId
     * @return
     */
    VoClientWechat getSimpleClientInfo(@Param("sessionId") Long sessionId, @Param("openId") String openId);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeClient.java
@@ -45,7 +45,6 @@
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @Schema(description = "所在县ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "所在县不能为空")
    private Long countyid;
    /**
@@ -53,7 +52,6 @@
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @Schema(description = "所在镇ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "所在镇不能为空") //不能为空也不能为null
    private Long townid;
    /**
@@ -61,7 +59,6 @@
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @Schema(description = "所在村ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "所在村不能为空") //不能为空也不能为null
    private Long villageid;
    /**
@@ -69,7 +66,6 @@
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @Schema(description = "所在片区ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "所在片区不能为空") //不能为空也不能为null
    private Long blockid;
    /**
@@ -77,7 +73,6 @@
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @Schema(description = "所在分水房ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "所在分水房不能为空") //不能为空也不能为null
    private Long divideid;
    /**
@@ -92,7 +87,6 @@
     * 虚拟卡号;10位,从1000000000开始
     */
    @Schema(description = "虚拟卡号", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "虚拟卡号不能为空")
    private Long virtualid;
    /**
@@ -100,7 +94,6 @@
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @Schema(description = "农户编号", requiredMode = Schema.RequiredMode.REQUIRED)
    //@NotBlank(message = "农户编号不能为空")
    private String clientnum;
    /**
@@ -108,14 +101,12 @@
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @Schema(description = "区划编码串", requiredMode = Schema.RequiredMode.REQUIRED)
    //@NotNull(message = "区划编码串不能为空")
    private Long districtnum;
    /**
     * 区划名称串;县名+镇名+村名,用于归属地
     */
    @Schema(description = "区划名称串", requiredMode = Schema.RequiredMode.REQUIRED)
    //@NotBlank(message = "区划名称串")
    private String districttitle;
    /**
@@ -131,7 +122,7 @@
     */
    @Schema(description = "农户身份证号", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "农户身份证号不能为空") //不能为空也不能为null
    @Length(message = "农户身份证号必须{max}位数据", min = 18, max = 18)
    //@Length(message = "农户身份证号必须{max}位数据", min = 18, max = 18)
    private String idcard;
    /**
@@ -150,14 +141,14 @@
     * 街道及门牌号
     */
    @Schema(description = "街道+门牌号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Length(message = "地址不大于{max}字,不小于{min}字", min = 1, max = 50)
    @Length(message = "地址不大于{max}字,不小于{min}字", max = 50)
    private String address;
    /**
     * 备注信息
     */
    @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 200)
    @Length(message = "备注不大于{max}字,不小于{min}字", max = 200)
    private String remarks;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/Org.java
@@ -13,7 +13,8 @@
public enum Org {
    Ym("ym", "元谋"),
    Pj("pj", "片角镇") ;
    Pj("pj", "片角镇"),
    Jyg("ym", "嘉峪关");
    @EnumValue
    public String tag ;
@@ -44,7 +45,7 @@
    }
    public static Org get(String tag){
        if(tag.equals(Ym.tag)){
        if(tag.equals(Ym.tag) || tag.equals(Jyg.tag)){
            return Ym ;
        }else if(tag.equals(Pj.tag)){
            return Pj ;
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoClientWechat.java
New file
@@ -0,0 +1,26 @@
package com.dy.pipIrrGlobal.voSe;
import com.dy.common.po.BaseEntity;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2024-06-03 11:40
 * @LastEditTime 2024-06-03 11:40
 * @Description 农户视图对象,小程序使用
 */
@Data
public class VoClientWechat implements BaseEntity {
    private static final long serialVersionUID = 202406031142001L;
    private String sessionId;
    private String clientId;
    private String clientName;
    private String phone;
    private String blockId;
}
pipIrr-platform/pipIrr-global/src/main/resources/application-database-pj.yml
@@ -5,7 +5,8 @@
            #name: pj
            type: com.alibaba.druid.pool.DruidDataSource
            driverClassName: com.mysql.cj.jdbc.Driver
            url: jdbc:mysql://192.168.91.73:3306/pipIrr_pj?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
#            url: jdbc:mysql://192.168.91.73:3306/pipIrr_pj?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
            url: jdbc:mysql://127.0.0.1:3306/pipIrr_pj?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
            username: root
            password: dysql,;.abc!@#
            druid:
pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml
@@ -5,7 +5,8 @@
            #name: ym
            type: com.alibaba.druid.pool.DruidDataSource
            driverClassName: com.mysql.cj.jdbc.Driver
            url: jdbc:mysql://192.168.91.73:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
#            url: jdbc:mysql://192.168.91.73:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
            url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
            username: root
            password: dysql,;.abc!@#
            druid:
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml
@@ -168,10 +168,9 @@
    SELECT
        COUNT(*) AS recordCount
    FROM pr_controller con
        INNER JOIN pr_intake_controller ic ON ic.controllerId = con.id
        LEFT JOIN pr_intake_controller ic ON ic.controllerId = con.id
        INNER JOIN pr_intake inta ON con.intakeId = inta.id
    <where>
      AND ic.operateType = 1
      AND con.deleted = 0
      <if test = "id != null and id > 0">
@@ -198,10 +197,9 @@
        (SELECT COUNT(*) FROM pr_intake_controller WHERE controllerId = con.id AND intakeId = inta.id AND operateType = 1) AS bindNumber,
        con.findDt AS findDt
    FROM pr_controller con
        INNER JOIN pr_intake_controller ic ON ic.controllerId = con.id
        LEFT JOIN pr_intake_controller ic ON ic.controllerId = con.id
        INNER JOIN pr_intake inta ON con.intakeId = inta.id
    <where>
      AND ic.operateType = 1
      AND con.deleted = 0
      <if test = "id != null and id > 0">
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -421,7 +421,7 @@
               rtus.isOnLine
    FROM pr_controller con
           INNER JOIN pr_intake inta ON con.intakeId = inta.id
           INNER JOIN rm_command_history com ON con.rtuAddr = com.rtuAddr
           INNER JOIN rm_command_history com ON con.rtuAddr = com.rtu_addr
           INNER JOIN JSON_TABLE(
            <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
            #{onLineMap},
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml
@@ -436,4 +436,26 @@
    SELECT id, typeName from se_water_type
  </select>
  <!--获取农户基本信息,小程序首页使用-->
  <select id="getSimpleClientInfo" resultType="com.dy.pipIrrGlobal.voSe.VoClientWechat">
    SELECT
      CAST(ope.id AS char) AS sessionId,
      CAST(cli.id AS char)  AS clientId,
      cli.name AS clientName,
      cli.phone,
      CAST(cli.blockId AS char) AS blockId
    FROM se_open_id ope
           INNER JOIN se_client cli ON ope.client_id = cli.id
    <where>
      <if test = "sessionId != null">
        AND ope.id = #{sessionId}
      </if>
      <if test = "openId != null">
        AND ope.open_id = #{openId}
      </if>
    </where>
    LIMIT 0,1
  </select>
</mapper>
pipIrr-platform/pipIrr-web/pipIrr-web-demo/src/main/java/com/dy/pipIrrDemo/demo/DemoCtrl.java
@@ -116,7 +116,7 @@
    @GetMapping("test1")
    public BaseResponse<BaUser> test1(){
        BaUser po = new BaUser() ;
        po.userId = System.currentTimeMillis() ;
        po.id = System.currentTimeMillis() ;
        po.userName = "张三" ;
        po.phone = "13912345678" ;
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java
@@ -9,7 +9,9 @@
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoPr.PrIntake;
import com.dy.pipIrrGlobal.voPr.VoIntake;
import com.dy.pipIrrGlobal.voPr.VoOnLineIntake;
import com.dy.pipIrrGlobal.voSe.VoActiveCard;
import com.dy.pipIrrProject.intake.qo.OnLineIntakesQO;
import com.dy.pipIrrProject.result.ProjectResultCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@@ -276,4 +278,38 @@
        String fileName = URLEncoder.encode(rawFileName, "UTF-8").replaceAll("\\+", "%20");
        response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
    }
    /**
     * 获取取水口列表(在线和不在线)
     * @param qo
     * @return
     */
    @GetMapping(path = "all_intakes")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoOnLineIntake>>> getAllIntakes(OnLineIntakesQO qo) {
        try {
            QueryResultVo<List<VoOnLineIntake>> res = intakeSv.selectOnLineIntakes(qo);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("查询取水口异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 根据操作员获取常用取水口(在线和不在线)
     * @param operator
     * @return
     */
    @GetMapping(path = "used_intakes")
    @SsoAop()
    public BaseResponse<List<VoOnLineIntake>> getUsedIntakes(Long operator) {
        try {
            List<VoOnLineIntake> res = intakeSv.getUsedIntakes(operator);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("查询取水口异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java
@@ -1,19 +1,30 @@
package com.dy.pipIrrProject.intake;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.dy.common.mw.protocol.Command;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoPr.PrDivideMapper;
import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper;
import com.dy.pipIrrGlobal.pojoPr.PrIntake;
import com.dy.pipIrrGlobal.voPr.VoIntake;
import com.dy.pipIrrGlobal.voPr.VoOnLineIntake;
import com.dy.pipIrrProject.intake.qo.OnLineIntakesQO;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
/**
 * @author wuzeyu
@@ -27,8 +38,15 @@
public class IntakeSv {
    @Autowired
    private PrIntakeMapper prIntakeMapper;
    @Autowired
    private PrDivideMapper prDivideMapper;
    @Autowired
    private RestTemplate restTemplate;
    protected static String mwUrlSendCom = "http://127.0.0.1:8070/rtuMw/com/send" ;
    /**
     * 添加取水口
@@ -179,4 +197,93 @@
    public int getLevelByRegionId(long regionId) {
        return prIntakeMapper.getLevelByRegionId(regionId);
    }
    /**
     * 获取取水口列表
     * @return
     */
    public QueryResultVo<List<VoOnLineIntake>> selectOnLineIntakes(OnLineIntakesQO qo) {
        Command com = new Command() ;
        com.id = Command.defaultId;
        com.code = "LCD0001";
        com.type = "innerCommand";
        JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
        if(response != null && response.getString("code").equals("0001")) {
            JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap");
            HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class);
            JSONArray jsonArray = new JSONArray();
            for (Map.Entry<String, Boolean> entry : onLineMap.entrySet()) {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("rtuAddr", entry.getKey());
                jsonObject.put("isOnLine", entry.getValue());
                jsonArray.add(jsonObject);
            }
            qo.setOnLineMap(jsonArray.toJSONString());
            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;
        }
    }
    /**
     * 根据操作员获取常用取水口
     * @param operator
     * @return
     */
    public List<VoOnLineIntake> getUsedIntakes(Long operator) {
        Command com = new Command() ;
        com.id = Command.defaultId;
        com.code = "LCD0001";
        com.type = "innerCommand";
        JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
        if(response != null && response.getString("code").equals("0001")) {
            JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap");
            HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class);
            JSONArray jsonArray = new JSONArray();
            for (Map.Entry<String, Boolean> entry : onLineMap.entrySet()) {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("rtuAddr", entry.getKey());
                jsonObject.put("isOnLine", entry.getValue());
                jsonArray.add(jsonObject);
            }
            return prIntakeMapper.getUsedIntakes(jsonArray.toJSONString(), operator);
        } else {
            return new ArrayList<>();
        }
    }
    /**
     * 发送命令
     * @return
     */
    protected BaseResponse sendCom2Mw(Command com){
        String url = UriComponentsBuilder.fromUriString(mwUrlSendCom)
                .build()
                .toUriString();
        HttpHeaders headers = new HttpHeaders();
        HttpEntity<Command> httpEntity = new HttpEntity<>(com, headers);
        ResponseEntity<BaseResponse> response = null;
        try {
            // 通过Post方式调用接口
            response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, BaseResponse.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response.getBody();
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/qo/OnLineIntakesQO.java
New file
@@ -0,0 +1,33 @@
package com.dy.pipIrrProject.intake.qo;
import com.dy.common.webUtil.QueryConditionVo;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2024-05-27 20:32
 * @LastEditTime 2024-05-27 20:32
 * @Description
 */
@Data
public class OnLineIntakesQO extends QueryConditionVo {
    /**
     * 中间件返回的RTU在线情况对象数组
     */
    private String onLineMap;
    /**
     * 取水口编号
     */
    private String intakeNum;
    /**
     * 是否在线
     */
    @Max(value = 1,message = "是否在线仅允许为真或假")
    @Min(value = 0,message = "是否在线仅允许为真或假")
    private Boolean isOnLine;
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
@@ -15,10 +15,8 @@
import com.dy.pipIrrGlobal.voPr.VoOnLineIntake;
import com.dy.pipIrrGlobal.voRm.VoUnclosedValve;
import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
import com.dy.pipIrrRemote.common.qo.OnLineIntakesQO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@@ -77,75 +75,6 @@
     */
    public Integer update(RmCommandHistory po) {
        return rmCommandHistoryMapper.updateByPrimaryKeySelective(po);
    }
    /**
     * 获取取水口列表
     * @return
     */
    public QueryResultVo<List<VoOnLineIntake>> selectOnLineIntakes(OnLineIntakesQO qo) {
        Command com = new Command() ;
        com.id = Command.defaultId;
        com.code = "LCD0001";
        com.type = "innerCommand";
        JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
        if(response != null && response.getString("code").equals("0001")) {
            JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap");
            HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class);
            JSONArray jsonArray = new JSONArray();
            for (Map.Entry<String, Boolean> entry : onLineMap.entrySet()) {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("rtuAddr", entry.getKey());
                jsonObject.put("isOnLine", entry.getValue());
                jsonArray.add(jsonObject);
            }
            qo.setOnLineMap(jsonArray.toJSONString());
            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;
        }
    }
    /**
     * 根据操作员获取常用取水口
     * @param operator
     * @return
     */
    public List<VoOnLineIntake> getUsedIntakes(Long operator) {
        Command com = new Command() ;
        com.id = Command.defaultId;
        com.code = "LCD0001";
        com.type = "innerCommand";
        JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
        if(response != null && response.getString("code").equals("0001")) {
            JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap");
            HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class);
            JSONArray jsonArray = new JSONArray();
            for (Map.Entry<String, Boolean> entry : onLineMap.entrySet()) {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("rtuAddr", entry.getKey());
                jsonObject.put("isOnLine", entry.getValue());
                jsonArray.add(jsonObject);
            }
            return prIntakeMapper.getUsedIntakes(jsonArray.toJSONString(), operator);
        } else {
            return new ArrayList<>();
        }
    }
    /**
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/enums/LastOperateENUM.java
New file
@@ -0,0 +1,27 @@
package com.dy.pipIrrRemote.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
 * @author ZhuBaoMin
 * @date 2024-03-06 9:21
 * @LastEditTime 2024-03-06 9:21
 * @Description
 */
@Getter
@AllArgsConstructor
public enum LastOperateENUM {
    OPEN_ACCOUNT((byte)1, "开户"),
    RECHARGE((byte)2, "充值"),
    CONSUME((byte)3, "消费"),
    APPLY_REFUND((byte)4, "申请退款"),
    AUDIT_REFUND((byte)5, "退款审核"),
    REFUND((byte)6, "退款"),
    OPEN_VALVE((byte)7, "开阀"),
    CLOSE_VALVE((byte)8, "关阀");
    private final Byte code;
    private final String message;
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java
@@ -5,20 +5,21 @@
import com.dy.common.aop.SsoAop;
import com.dy.common.mw.protocol.Command;
import com.dy.common.mw.protocol.Data;
import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1;
import com.dy.common.mw.protocol.p206V1_0_0.downVos.Com97Vo;
import com.dy.common.mw.protocol.p206V202404.CodeV202404;
import com.dy.common.mw.protocol.p206V202404.downVos.ComCd10Vo;
import com.dy.common.mw.protocol.p206V202404.downVos.ComCdXyVo;
import com.dy.common.util.IDLongGenerator;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.command.ComSupport;
import com.dy.pipIrrGlobal.command.dto.Param;
import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory;
import com.dy.pipIrrGlobal.voPr.VoOnLineIntake;
import com.dy.pipIrrRemote.common.CommandSv;
import com.dy.pipIrrRemote.common.dto.Addr;
import com.dy.pipIrrRemote.common.dto.DtoBase;
import com.dy.pipIrrRemote.common.qo.OnLineIntakesQO;
import com.dy.pipIrrRemote.result.RemoteResultCode;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -27,12 +28,7 @@
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
 * @author ZhuBaoMin
@@ -50,58 +46,7 @@
    protected static String controllerType = "57";
    private final IDLongGenerator idLongGenerator;
    /**
     * 查询所有RTU在线情况(仅测试用)
     * @return
     */
    @GetMapping(path = "get_online")
    @SsoAop()
    public BaseResponse<Boolean> get_online() {
        Command com = new Command() ;
        com.id = Command.defaultId;
        com.code = "LCD0001";
        com.type = "innerCommand";
        JSONObject response = (JSONObject)JSON.toJSON(sendCom2Mw(com));
        JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment");
        return BaseResponseUtils.buildSuccess(attachment) ;
    }
    /**
     * 获取取水口列表(在线和不在线)
     * @param qo
     * @return
     */
    @GetMapping(path = "get_online_intakes")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoOnLineIntake>>> getOnLineIntakes(OnLineIntakesQO qo) {
        try {
            QueryResultVo<List<VoOnLineIntake>> res = commandSv.selectOnLineIntakes(qo);
            return BaseResponseUtils.buildSuccess(res);
            } catch (Exception e) {
            log.error("查询取水口异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 根据操作员获取常用取水口
     * @param operator
     * @return
     */
    @GetMapping(path = "used_intakes")
    @SsoAop()
    public BaseResponse<List<VoOnLineIntake>> getUsedIntakes(Long operator) {
        try {
            List<VoOnLineIntake> res = commandSv.getUsedIntakes(operator);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("查询取水口异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    private String rtuResultSendWebUrl = "http://127.0.0.1:8081/remote/comRes/receive" ;
    /**
     * 设置设备终端地址
@@ -120,55 +65,101 @@
        Long intakeId = addr.getIntakeId();
        String newRtuAddr = addr.getNewRtuAddr();
        Long operator = addr.getOperator();
        String commandCode = CodeV202404.cd_10;
        Long comId = idLongGenerator.generate();
        // 取水口ID换阀控器地址及通讯协议
        //PrController prController = commandSv.getControllerByIntakeId(intakeId);
        //if(prController == null) {
        //    return BaseResponseUtils.buildError(RemoteResultCode.RTU_NOT_EXIST.getMessage());
        //}
        //String rtuAddr = prController.getRtuAddr();
        //String protocol = prController.getProtocol();
        // 创建视图
        ComCd10Vo param = new ComCd10Vo() ;
        param.controllerType = controllerType;
        param.projectNo =projectNo;
        param.rtuNewAddr = newRtuAddr;
        // 创建命令日志对象并添加到数据库中
        //RmCommandHistory rmCommandHistory = getComHistory(comId, commandCode, intakeId, rtuAddr, protocol, param, operator);
        //comId = commandSv.insert(rmCommandHistory);
        //System.out.println(comId);
        // 构造命令
        //Command com = command(comId, commandCode, rtuAddr, protocol, param);
        //sendCom2Mw(com);
        CompletableFuture<Data> featureObject = new CompletableFuture<>();
        features.put(comId, featureObject);
        try {
            CompletableFuture<Data> feature = (CompletableFuture<Data>) features.get(comId);
            Data resultData = feature.get(30, TimeUnit.SECONDS);
            features.remove(comId);
            String commandId = resultData.getCommandId();
            if(commandId.equals(comId)) {
                //futureValue = new CompletableFuture<>();
                return BaseResponseUtils.buildSuccess((JSONObject)JSON.toJSON(resultData.subData));
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        } catch (TimeoutException e) {
            return BaseResponseUtils.buildFail("1分钟后去查看结果");
        // 获取系统参数
        if(!setuped) {
            setUp();
        }
        // 取水口ID换阀控器地址及通讯协议
        JSONObject job_rtu = getRtu(intakeId, null);
        if(job_rtu == null) {
            return BaseResponseUtils.buildError(RemoteResultCode.RTU_NOT_EXIST.getMessage());
        }
        String rtuAddr = job_rtu.getString("rtuAddr");
        String protocol = job_rtu.getString("protocol");
        //return BaseResponseUtils.buildSuccess(resultData.toJson());
        String commandCode = null;
        if(protocol.equals("p206V202404")) {
            // 获取功能码
            commandCode = CodeV202404.cd_10;
        return BaseResponseUtils.buildSuccess() ;
            // 创建视图
            ComCd10Vo param = new ComCd10Vo() ;
            param.controllerType = controllerType;
            param.projectNo =projectNo;
            param.rtuNewAddr = newRtuAddr;
            // 发送命令并处理请求结果及执行结果
            Param po = new Param();
            po.setComId(comId);
            po.setCommandCode(commandCode);
            po.setIntakeId(intakeId);
            po.setRtuAddr(rtuAddr);
            po.setProtocol(protocol);
            po.setParam(param);
            po.setRtuResultSendWebUrl(rtuResultSendWebUrl);
            po.setOperator(operator);
            return dealWithCommandResult(po);
        } else if(protocol.equals("p206V1_0_1")) {
            // 获取功能码
            commandCode = CodeV1_0_1.cd_10;
            // 创建视图
            Com97Vo param = new Com97Vo() ;
            // 构造命令
            Command com = command(comId, commandCode, rtuAddr, protocol, rtuResultSendWebUrl, param);
            // 发送命令
            JSONObject response_SendCom= (JSONObject) JSON.toJSON(sendCom2Mw(com));
            if(response_SendCom != null && response_SendCom.getString("code").equals("0001")) {
                //if(1 > 0) {
                // 请求成功
                // 创建命令日志对象并添加到数据库中
                String commandName = CodeV1_0_1.getCodeName(commandCode);
                RmCommandHistory rmCommandHistory = getComHistory(comId, commandCode, commandName, intakeId, rtuAddr, protocol, param, operator);
                commandSv.insert(rmCommandHistory);
                // 处理回调
                BaseResponse response_CallBack = dealWithCallBack(comId);
                //回调失败
                if(!response_CallBack.getCode().equals("0001")) {
                    // 命令日志执行结果改为失败
                    rmCommandHistory = new RmCommandHistory();
                    rmCommandHistory.setId(comId);
                    rmCommandHistory.setResult((byte)0);
                    commandSv.updateCommandResult(rmCommandHistory);
                    return BaseResponseUtils.buildFail(response_CallBack.getMsg());
                    //return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
                }
                // 回调成功,再判断执行是否成功
                JSONObject job_content = (JSONObject)JSON.toJSON(response_CallBack.getContent());
                System.out.println(job_content);
                JSONObject job_subData = (JSONObject) job_content.getJSONObject("subData").getJSONObject("subData");
                System.out.println(job_subData);
                Boolean dealResult = job_subData.getBoolean("success");
                if(!dealResult) {
                    return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
                }
                /**
                 * 执行成功,返回回调内容
                 */
                Data myData = (Data)response_CallBack.getContent();
                return BaseResponseUtils.buildSuccess(myData) ;
            } else {
                // 请求失败
                JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param");
                return BaseResponseUtils.buildFail(job_param.getString("message"));
            }
        } else {
            return BaseResponseUtils.buildFail("系统暂不支持该协议");
        }
    }
    /**
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java
@@ -17,14 +17,12 @@
import com.dy.pipIrrGlobal.command.ComSupport;
import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper;
import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory;
import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
import com.dy.pipIrrGlobal.voRm.VoUnclosedValve;
import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
import com.dy.pipIrrRemote.common.CommandSv;
import com.dy.pipIrrRemote.common.dto.ValveClose;
import com.dy.pipIrrRemote.common.dto.ValveOpen;
import com.dy.pipIrrRemote.result.RemoteResultCode;
import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
@@ -35,7 +33,6 @@
import org.springframework.web.bind.annotation.*;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@@ -58,7 +55,7 @@
    private String rtuResultSendWebUrl = "http://127.0.0.1:8081/remote/comRes/receive" ;
    /**
     * 小程序远程开阀
     * 平台远程开阀
     * @param valve
     * @param bindingResult
     * @return
@@ -155,10 +152,10 @@
                // 回调失败
                if(!response_CallBack.getCode().equals("0001")) {
                    // 命令日志执行结果改为失败
                    rmCommandHistory = new RmCommandHistory();
                    rmCommandHistory.setId(comId);
                    rmCommandHistory.setResult((byte)0);
                    commandSv.updateCommandResult(rmCommandHistory);
                    //rmCommandHistory = new RmCommandHistory();
                    //rmCommandHistory.setId(comId);
                    //rmCommandHistory.setResult((byte)0);
                    //commandSv.updateCommandResult(rmCommandHistory);
                    return BaseResponseUtils.buildFail(response_CallBack.getMsg());
                    //return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
                }
@@ -177,12 +174,12 @@
                 * 执行成功
                 * 更改虚拟卡状态:是否使用中、最后操作、最后操作时间
                 */
                SeVirtualCard virtualCard = new SeVirtualCard();
                virtualCard.setId(vcId);
                virtualCard.setInUse((byte) 1);
                virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                virtualCard.setLastOperateTime(new Date());
                seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                //SeVirtualCard virtualCard = new SeVirtualCard();
                //virtualCard.setId(vcId);
                //virtualCard.setInUse((byte) 1);
                //virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                //virtualCard.setLastOperateTime(new Date());
                //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                // 回调返回的内容
                Data myData = (Data)response_CallBack.getContent();
@@ -223,10 +220,10 @@
                //回调失败
                if(!response_CallBack.getCode().equals("0001")) {
                    // 命令日志执行结果改为失败
                    rmCommandHistory = new RmCommandHistory();
                    rmCommandHistory.setId(comId);
                    rmCommandHistory.setResult((byte)0);
                    commandSv.updateCommandResult(rmCommandHistory);
                    //rmCommandHistory = new RmCommandHistory();
                    //rmCommandHistory.setId(comId);
                    //rmCommandHistory.setResult((byte)0);
                    //commandSv.updateCommandResult(rmCommandHistory);
                    return BaseResponseUtils.buildFail(response_CallBack.getMsg());
                    //return BaseResponseUtils.buildFail(response_CallBack.getContent().toString());
                }
@@ -245,12 +242,12 @@
                 * 执行成功
                 * 更改虚拟卡状态:是否使用中、最后操作、最后操作时间
                 */
                SeVirtualCard virtualCard = new SeVirtualCard();
                virtualCard.setId(vcId);
                virtualCard.setInUse((byte) 1);
                virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                virtualCard.setLastOperateTime(new Date());
                seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                //SeVirtualCard virtualCard = new SeVirtualCard();
                //virtualCard.setId(vcId);
                //virtualCard.setInUse((byte) 1);
                //virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                //virtualCard.setLastOperateTime(new Date());
                //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                // 回调返回的内容
                Data myData = (Data)response_CallBack.getContent();
@@ -266,7 +263,7 @@
    }
    /**
     * 小程序远程关阀
     * 平台远程关阀
     * @param valve
     * @param bindingResult
     * @return
@@ -330,10 +327,10 @@
                // 回调失败
                if(!response_CallBack.getCode().equals("0001")) {
                    // 命令日志执行结果改为失败
                    rmCommandHistory = new RmCommandHistory();
                    rmCommandHistory.setId(comId);
                    rmCommandHistory.setResult((byte)0);
                    commandSv.updateCommandResult(rmCommandHistory);
                    //rmCommandHistory = new RmCommandHistory();
                    //rmCommandHistory.setId(comId);
                    //rmCommandHistory.setResult((byte)0);
                    //commandSv.updateCommandResult(rmCommandHistory);
                    return BaseResponseUtils.buildFail(response_CallBack.getMsg());
                    //return BaseResponseUtils.buildError(WechatResultCode.GET_RESULT_ERROR.getMessage());
                }
@@ -352,13 +349,13 @@
                 * 执行成功
                 * 更改虚拟卡状态:是否使用中、最后操作、最后操作时间
                 */
                Long vcId = seVirtualCardMapper.getVcIdByNum(vcNum);
                SeVirtualCard virtualCard = new SeVirtualCard();
                virtualCard.setId(vcId);
                virtualCard.setInUse((byte) 0);
                virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                virtualCard.setLastOperateTime(new Date());
                seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                //Long vcId = seVirtualCardMapper.getVcIdByNum(vcNum);
                //SeVirtualCard virtualCard = new SeVirtualCard();
                //virtualCard.setId(vcId);
                //virtualCard.setInUse((byte) 0);
                //virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                //virtualCard.setLastOperateTime(new Date());
                //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                // 回调返回的内容
                Data myData = (Data)response_CallBack.getContent();
@@ -397,10 +394,10 @@
                // 回调失败
                if(!response_CallBack.getCode().equals("0001")) {
                    // 命令日志执行结果改为失败
                    rmCommandHistory = new RmCommandHistory();
                    rmCommandHistory.setId(comId);
                    rmCommandHistory.setResult((byte)0);
                    commandSv.updateCommandResult(rmCommandHistory);
                    //rmCommandHistory = new RmCommandHistory();
                    //rmCommandHistory.setId(comId);
                    //rmCommandHistory.setResult((byte)0);
                    //commandSv.updateCommandResult(rmCommandHistory);
                    return BaseResponseUtils.buildFail(response_CallBack.getMsg());
                    //return BaseResponseUtils.buildError(WechatResultCode.GET_RESULT_ERROR.getMessage());
                }
@@ -419,13 +416,13 @@
                 * 执行成功
                 * 更改虚拟卡状态:是否使用中、最后操作、最后操作时间
                 */
                Long vcId = seVirtualCardMapper.getVcIdByNum(vcNum);
                SeVirtualCard virtualCard = new SeVirtualCard();
                virtualCard.setId(vcId);
                virtualCard.setInUse((byte) 0);
                virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                virtualCard.setLastOperateTime(new Date());
                seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                //Long vcId = seVirtualCardMapper.getVcIdByNum(vcNum);
                //SeVirtualCard virtualCard = new SeVirtualCard();
                //virtualCard.setId(vcId);
                //virtualCard.setInUse((byte) 0);
                //virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                //virtualCard.setLastOperateTime(new Date());
                //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                // 回调返回的内容
                Data myData = (Data)response_CallBack.getContent();
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java
@@ -13,6 +13,7 @@
import com.dy.pipIrrGlobal.pojoSe.SeCodeVerify;
import com.dy.pipIrrGlobal.pojoSe.SeOpenId;
import com.dy.pipIrrGlobal.voSe.VoClient;
import com.dy.pipIrrGlobal.voSe.VoClientWechat;
import com.dy.pipIrrSell.client.dto.CodeVerifyDTO;
import com.dy.pipIrrSell.result.SellResultCode;
import com.dy.pipIrrSell.sms.AliyunSmsSv;
@@ -353,6 +354,55 @@
    }
    /**
     * 根据村ID获取12位行政区划
     * @param villageId
     * @return
     */
    @Operation(summary = "根据村ID获取12位行政区划", description = "根据村ID获取12位行政区划")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @GetMapping(path = "district")
    @SsoAop()
    public BaseResponse<Boolean> getDistrictNum(@RequestParam("villageId") @NotNull(message = "村编号不能为空") Long villageId){
        /**
         * 获取5级行政区划信息
         */
        Map map_districts = Optional.ofNullable(clientSv.getDistrictsByVillageId(villageId)).orElse(new HashMap());
        if(map_districts.size() <= 0) {
            return BaseResponseUtils.buildFail("区划信息有误");
        }
        String provinceNum = map_districts.get("provinceNum").toString();
        String cityNum = map_districts.get("cityNum").toString();
        String countyNum = map_districts.get("countyNum").toString();
        String townNum = map_districts.get("townNum").toString();
        String villageNum = map_districts.get("villageNum").toString();
        // 生成12位5级行政区划编码串及名称串
        Long districtNum = Long.parseLong(provinceNum + cityNum + countyNum + townNum + villageNum);
        //获取项目编码
        String projectNo = clientSv.getItemValue("projectNo");
        //转为int
        Integer projectNo1 = Integer.valueOf(projectNo);
        //转为16进制
//        String projectNo2 = Integer.toHexString(projectNo1);
//        log.info(projectNo2);
        String projectNo3 = String.format("%02x", projectNo1);
        log.info(projectNo3);
        Map map = new HashMap();
        map.put("districtNum", districtNum);
        map.put("projectNo",projectNo3);
        return BaseResponseUtils.buildSuccess(map);
    }
    /**
     * 发送验证码
     * @param phoneNumber
     * @return
@@ -479,51 +529,53 @@
    }
    /**
     * 根据村ID获取12位行政区划
     * @param villageId
     * 获取农户基本信息,小程序首页使用
     * @param sessionId
     * @return
     */
    @Operation(summary = "根据村ID获取12位行政区划", description = "根据村ID获取12位行政区划")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @GetMapping(path = "district")
    @GetMapping(path = "/simple_info")
    @SsoAop()
    public BaseResponse<Boolean> getDistrictNum(@RequestParam("villageId") @NotNull(message = "村编号不能为空") Long villageId){
        /**
         * 获取5级行政区划信息
         */
        Map map_districts = Optional.ofNullable(clientSv.getDistrictsByVillageId(villageId)).orElse(new HashMap());
        if(map_districts.size() <= 0) {
            return BaseResponseUtils.buildFail("区划信息有误");
    public BaseResponse<VoClientWechat> getSimpleClientInfo(@RequestParam Long sessionId){
        try {
            VoClientWechat res = clientSv.getSimpleClientInfo(sessionId, null);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("查询农户异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 登录凭证登录
     * @param code 临时登录凭证
     * @return
     */
    @GetMapping(path = "/code_login")
    @SsoAop()
    public BaseResponse<VoClientWechat> codeLogin(@RequestParam String code) throws IOException {
        // 登录凭证校验
        Map<String, Object> queryParams = new HashMap<>();
        queryParams.put("appid", appid);
        queryParams.put("secret", secret);
        queryParams.put("js_code", code);
        queryParams.put("grant_type", grantType);
        Map<String, String> headerParams = new HashMap<>();
        JSONObject job = restTemplateUtil.get(loginUrl, queryParams, headerParams);
        String openId = job.getString("openid");
        if(openId == null) {
            return BaseResponseUtils.buildFail(SellResultCode.LOGIN_FAIL.getMessage());
        }
        String provinceNum = map_districts.get("provinceNum").toString();
        String cityNum = map_districts.get("cityNum").toString();
        String countyNum = map_districts.get("countyNum").toString();
        String townNum = map_districts.get("townNum").toString();
        String villageNum = map_districts.get("villageNum").toString();
        // 生成12位5级行政区划编码串及名称串
        Long districtNum = Long.parseLong(provinceNum + cityNum + countyNum + townNum + villageNum);
        //获取项目编码
        String projectNo = clientSv.getItemValue("projectNo");
        //转为int
        Integer projectNo1 = Integer.valueOf(projectNo);
        //转为16进制
//        String projectNo2 = Integer.toHexString(projectNo1);
//        log.info(projectNo2);
        String projectNo3 = String.format("%02x", projectNo1);
        log.info(projectNo3);
        Map map = new HashMap();
        map.put("districtNum", districtNum);
        map.put("projectNo",projectNo3);
        return BaseResponseUtils.buildSuccess(map);
        try {
            VoClientWechat res = clientSv.getSimpleClientInfo(null, openId);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("查询农户异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientSv.java
@@ -10,6 +10,7 @@
import com.dy.pipIrrGlobal.pojoSe.SeCodeVerify;
import com.dy.pipIrrGlobal.pojoSe.SeOpenId;
import com.dy.pipIrrGlobal.voSe.VoClient;
import com.dy.pipIrrGlobal.voSe.VoClientWechat;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -184,4 +185,13 @@
    public String getItemValue(String itemName) {
        return baSettingsMapper.getItemValue(itemName);
    }
    /**
     * 获取农户基本信息,小程序首页使用
     * @param sessionId
     * @return
     */
    public VoClientWechat getSimpleClientInfo(Long sessionId, String openId) {
        return seClientMapper.getSimpleClientInfo(sessionId, openId);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/DtoClient.java
@@ -31,21 +31,21 @@
     * 村ID
     */
    @Schema(description = "所在村ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "所在村不能为空")
    //@NotNull(message = "所在村不能为空")
    private Long villageId;
    /**
     * 片区ID
     */
    @Schema(description = "所在片区ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "所在片区不能为空")
    //@NotNull(message = "所在片区不能为空")
    private Long blockId;
    /**
     * 分水房ID
     */
    @Schema(description = "所在分水房ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "所在分水房不能为空")
    //@NotNull(message = "所在分水房不能为空")
    private Long divideId;
    /**
@@ -68,8 +68,8 @@
     * 身份证号
     */
    @Schema(description = "农户身份证号", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "农户身份证号不能为空") //不能为空也不能为null
    @Length(message = "农户身份证号必须{max}位数据", min = 18, max = 18)
    //@NotBlank(message = "农户身份证号不能为空") //不能为空也不能为null
    //@Length(message = "农户身份证号必须{max}位数据", min = 18, max = 18)
    private String idCard;
    /**
@@ -88,14 +88,14 @@
     * 街道及门牌号
     */
    @Schema(description = "街道+门牌号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Length(message = "地址不大于{max}字,不小于{min}字", min = 1, max = 50)
    @Length(message = "地址不大于{max}字,不小于{min}字", max = 50)
    private String address;
    /**
     * 备注信息
     */
    @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 200)
    @Length(message = "备注不大于{max}字,不小于{min}字", max = 200)
    private String remarks;
    /**
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java
@@ -135,7 +135,12 @@
    NO_SECURITY_CODE_FOR_PHONE(20002, "该手机号未发送验证码"),
    SECURITY_CODE_ERROR(20003, "验证码错误"),
    VALIDATION_TIMEOUT(20004, "验证超时"),
    PHONE_NUMBER_IS_ERROR(20004, "手机号错误,非注册农户");
    PHONE_NUMBER_IS_ERROR(20004, "手机号错误,非注册农户"),
    /**
     * 小程序
     */
    LOGIN_FAIL(20004, "登录失败");
    private final Integer code;
    private final String message;
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java
@@ -5,10 +5,7 @@
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoSe.SeVcRefund;
import com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem;
import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState;
import com.dy.pipIrrGlobal.pojoSe.*;
import com.dy.pipIrrGlobal.voSe.VoClient;
import com.dy.pipIrrSell.client.ClientSv;
import com.dy.pipIrrSell.result.SellResultCode;
@@ -123,22 +120,6 @@
        String openid = job.getString("openid");
        String sessionKey = job.getString("session_key");
        // 检验登录态
        //JSONObject checkSessionKey = payHelper.checkSessionKey(appid, secret, openid, sessionKey);
        //if(checkSessionKey != null) {
        //    Integer errcode = checkSessionKey.getInteger("errcode");
        //    String errmsg = checkSessionKey.getString("errmsg");
        //}
        // 重置登录态
        //JSONObject resetUserSessionKey = payHelper.resetUserSessionKey(appid, secret, openid, sessionKey);
        //if(resetUserSessionKey != null) {
        //    Integer errcode = checkSessionKey.getInteger("errcode");
        //    String errmsg = checkSessionKey.getString("errmsg");
        //    String openid_New = checkSessionKey.getString("openid");
        //    String sessionKey_New = checkSessionKey.getString("session_key");
        //}
        // 添加登录态记录
        SeWebchatLogonState po = new SeWebchatLogonState();
        po.setOpenId(openid);
@@ -223,12 +204,15 @@
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        // 接收参数:登录态ID、农户ID、虚拟卡ID、充值金额
        String sessionId = order.getSessionId();
        Long sessionId = order.getSessionId();
        Long virtualId = order.getVirtualId();
        Integer rechargeAmount = order.getRechargeAmount();
        String prepayId = "";
        SeWebchatLogonState po = paymentSv.selectOne(Long.parseLong(sessionId));
        //SeWebchatLogonState po = paymentSv.selectOne(Long.parseLong(sessionId));
        //String openid = po.getOpenId();
        SeOpenId po = paymentSv.selectOne(sessionId);
        String openid = po.getOpenId();
        SeVirtualCard seVirtualCard = virtualCardSv.selectVirtuCardById(virtualId);
@@ -286,11 +270,11 @@
        headers.put("Content-Type", "application/json");
        // 暂时注释掉,认证通过后再放开
        //JSONObject job_result = restTemplateUtil.post(PayInfo.orderUrl, body, headers);
        //if(job_result != null) {
        //    System.out.println(job_result.toString());
        //    prepayId = job_result.getString("prepay_id");
        //}
        JSONObject job_result = restTemplateUtil.post(PayInfo.orderUrl, body, headers);
        if(job_result != null) {
            System.out.println(job_result.toString());
            prepayId = job_result.getString("prepay_id");
        }
        return BaseResponseUtils.buildSuccess(prepayId) ;
    }
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java
@@ -1,7 +1,9 @@
package com.dy.pipIrrSell.wechatpay;
import com.dy.pipIrrGlobal.daoSe.SeOpenIdMapper;
import com.dy.pipIrrGlobal.daoSe.SeVcRechargeMapper;
import com.dy.pipIrrGlobal.daoSe.SeWebchatLogonStateMapper;
import com.dy.pipIrrGlobal.pojoSe.SeOpenId;
import com.dy.pipIrrGlobal.pojoSe.SeVcRecharge;
import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState;
import lombok.extern.slf4j.Slf4j;
@@ -24,6 +26,9 @@
    @Autowired
    private SeVcRechargeMapper seVcRechargeMapper;
    @Autowired
    private SeOpenIdMapper seOpenIdMapper;
    /**
     * 添加登录态状态记录
     * @param po
@@ -39,10 +44,14 @@
     * @param id
     * @return
     */
    SeWebchatLogonState selectOne(Long id) {
    SeWebchatLogonState selectOne2(Long id) {
        return seWebchatLogonStateMapper.selectByPrimaryKey(id);
    }
    SeOpenId selectOne(Long sessionId) {
        return seOpenIdMapper.selectByPrimaryKey(sessionId);
    }
    /**
     * 添加虚拟卡充值记录
     * @param po
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java
@@ -1,7 +1,6 @@
package com.dy.pipIrrSell.wechatpay.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@@ -21,8 +20,8 @@
     * 登录态ID,用来获取openID
     */
    @Schema(description = "登录态ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotBlank(message = "登录态ID不能为空")
    private String sessionId;
    @NotNull(message = "登录态ID不能为空")
    private Long sessionId;
    /**
     * 虚拟卡编号,外键,用来获取虚拟卡余额
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java
@@ -15,10 +15,8 @@
import com.dy.pipIrrGlobal.voPr.VoOnLineIntake;
import com.dy.pipIrrGlobal.voRm.VoUnclosedValve;
import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
import com.dy.pipIrrWechat.command.qo.OnLineIntakesQO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@@ -77,75 +75,6 @@
     */
    public Integer update(RmCommandHistory po) {
        return rmCommandHistoryMapper.updateByPrimaryKeySelective(po);
    }
    /**
     * 获取取水口列表
     * @return
     */
    public QueryResultVo<List<VoOnLineIntake>> selectOnLineIntakes(OnLineIntakesQO qo) {
        Command com = new Command() ;
        com.id = Command.defaultId;
        com.code = "LCD0001";
        com.type = "innerCommand";
        JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
        if(response != null && response.getString("code").equals("0001")) {
            JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap");
            HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class);
            JSONArray jsonArray = new JSONArray();
            for (Map.Entry<String, Boolean> entry : onLineMap.entrySet()) {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("rtuAddr", entry.getKey());
                jsonObject.put("isOnLine", entry.getValue());
                jsonArray.add(jsonObject);
            }
            qo.setOnLineMap(jsonArray.toJSONString());
            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;
        }
    }
    /**
     * 根据操作员获取常用取水口
     * @param operator
     * @return
     */
    public List<VoOnLineIntake> getUsedIntakes(Long operator) {
        Command com = new Command() ;
        com.id = Command.defaultId;
        com.code = "LCD0001";
        com.type = "innerCommand";
        JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
        if(response != null && response.getString("code").equals("0001")) {
            JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap");
            HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class);
            JSONArray jsonArray = new JSONArray();
            for (Map.Entry<String, Boolean> entry : onLineMap.entrySet()) {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("rtuAddr", entry.getKey());
                jsonObject.put("isOnLine", entry.getValue());
                jsonArray.add(jsonObject);
            }
            return prIntakeMapper.getUsedIntakes(jsonArray.toJSONString(), operator);
        } else {
            return new ArrayList<>();
        }
    }
    /**
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java
@@ -17,10 +17,8 @@
import com.dy.pipIrrGlobal.command.ComSupport;
import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper;
import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory;
import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
import com.dy.pipIrrGlobal.voRm.VoUnclosedValve;
import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM;
import com.dy.pipIrrWechat.command.dto.ValveClose;
import com.dy.pipIrrWechat.command.dto.ValveOpen;
import com.dy.pipIrrWechat.result.WechatResultCode;
@@ -34,7 +32,6 @@
import org.springframework.web.bind.annotation.*;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@@ -171,12 +168,12 @@
                 * 执行成功
                 * 更改虚拟卡状态:是否使用中、最后操作、最后操作时间
                 */
                SeVirtualCard virtualCard = new SeVirtualCard();
                virtualCard.setId(vcId);
                virtualCard.setInUse((byte) 1);
                virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                virtualCard.setLastOperateTime(new Date());
                seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                //SeVirtualCard virtualCard = new SeVirtualCard();
                //virtualCard.setId(vcId);
                //virtualCard.setInUse((byte) 1);
                //virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                //virtualCard.setLastOperateTime(new Date());
                //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                // 回调返回的内容
                Data myData = (Data)response_CallBack.getContent();
@@ -234,12 +231,12 @@
                 * 执行成功
                 * 更改虚拟卡状态:是否使用中、最后操作、最后操作时间
                 */
                SeVirtualCard virtualCard = new SeVirtualCard();
                virtualCard.setId(vcId);
                virtualCard.setInUse((byte) 1);
                virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                virtualCard.setLastOperateTime(new Date());
                seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                //SeVirtualCard virtualCard = new SeVirtualCard();
                //virtualCard.setId(vcId);
                //virtualCard.setInUse((byte) 1);
                //virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                //virtualCard.setLastOperateTime(new Date());
                //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                // 回调返回的内容
                Data myData = (Data)response_CallBack.getContent();
@@ -336,13 +333,13 @@
                 * 执行成功
                 * 更改虚拟卡状态:是否使用中、最后操作、最后操作时间
                 */
                Long vcId = seVirtualCardMapper.getVcIdByNum(vcNum);
                SeVirtualCard virtualCard = new SeVirtualCard();
                virtualCard.setId(vcId);
                virtualCard.setInUse((byte) 0);
                virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                virtualCard.setLastOperateTime(new Date());
                seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                //Long vcId = seVirtualCardMapper.getVcIdByNum(vcNum);
                //SeVirtualCard virtualCard = new SeVirtualCard();
                //virtualCard.setId(vcId);
                //virtualCard.setInUse((byte) 0);
                //virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                //virtualCard.setLastOperateTime(new Date());
                //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                // 回调返回的内容
                Data myData = (Data)response_CallBack.getContent();
@@ -398,13 +395,13 @@
                 * 执行成功
                 * 更改虚拟卡状态:是否使用中、最后操作、最后操作时间
                 */
                Long vcId = seVirtualCardMapper.getVcIdByNum(vcNum);
                SeVirtualCard virtualCard = new SeVirtualCard();
                virtualCard.setId(vcId);
                virtualCard.setInUse((byte) 0);
                virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                virtualCard.setLastOperateTime(new Date());
                seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                //Long vcId = seVirtualCardMapper.getVcIdByNum(vcNum);
                //SeVirtualCard virtualCard = new SeVirtualCard();
                //virtualCard.setId(vcId);
                //virtualCard.setInUse((byte) 0);
                //virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode());
                //virtualCard.setLastOperateTime(new Date());
                //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard);
                // 回调返回的内容
                Data myData = (Data)response_CallBack.getContent();
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/enums/LastOperateENUM.java
New file
@@ -0,0 +1,27 @@
package com.dy.pipIrrWechat.command.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
 * @author ZhuBaoMin
 * @date 2024-03-06 9:21
 * @LastEditTime 2024-03-06 9:21
 * @Description
 */
@Getter
@AllArgsConstructor
public enum LastOperateENUM {
    OPEN_ACCOUNT((byte)1, "开户"),
    RECHARGE((byte)2, "充值"),
    CONSUME((byte)3, "消费"),
    APPLY_REFUND((byte)4, "申请退款"),
    AUDIT_REFUND((byte)5, "退款审核"),
    REFUND((byte)6, "退款"),
    OPEN_VALVE((byte)7, "开阀"),
    CLOSE_VALVE((byte)8, "关阀");
    private final Byte code;
    private final String message;
}
pipIrr-platform/pipIrr-web/pom.xml
@@ -180,34 +180,34 @@
            <artifactId>dubbo</artifactId>
            <version>3.2.7</version>
            <exclusions>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-all</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.yaml</groupId>
                    <artifactId>snakeyaml</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-context</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.alibaba.spring</groupId>
                    <artifactId>spring-context-support</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.alibaba.fastjson2</groupId>
                    <artifactId>fastjson2</artifactId>
                </exclusion>
               <exclusion>
                   <groupId>com.alibaba</groupId>
                   <artifactId>hessian-lite</artifactId>
                </exclusion>
               <exclusion>
                   <groupId>org.javassist</groupId>
                   <artifactId>javassist</artifactId>
                </exclusion>
<!--                <exclusion>-->
<!--                    <groupId>io.netty</groupId>-->
<!--                    <artifactId>netty-all</artifactId>-->
<!--                </exclusion>-->
<!--                <exclusion>-->
<!--                    <groupId>org.yaml</groupId>-->
<!--                    <artifactId>snakeyaml</artifactId>-->
<!--                </exclusion>-->
<!--                <exclusion>-->
<!--                    <groupId>org.springframework</groupId>-->
<!--                    <artifactId>spring-context</artifactId>-->
<!--                </exclusion>-->
<!--                <exclusion>-->
<!--                    <groupId>com.alibaba.spring</groupId>-->
<!--                    <artifactId>spring-context-support</artifactId>-->
<!--                </exclusion>-->
<!--                <exclusion>-->
<!--                    <groupId>com.alibaba.fastjson2</groupId>-->
<!--                    <artifactId>fastjson2</artifactId>-->
<!--                </exclusion>-->
<!--               <exclusion>-->
<!--                   <groupId>com.alibaba</groupId>-->
<!--                   <artifactId>hessian-lite</artifactId>-->
<!--                </exclusion>-->
<!--               <exclusion>-->
<!--                   <groupId>org.javassist</groupId>-->
<!--                   <artifactId>javassist</artifactId>-->
<!--                </exclusion>-->
            </exclusions>
        </dependency>