Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | String ds = DataSourceContext.get(); |
| | | System.out.println(ds); |
| | | |
| | | HttpServletRequest httpRequest = (HttpServletRequest) servletRequest; |
| | | String wxDataSourceName = httpRequest.getHeader("tag"); |
| | | if(wxDataSourceName != null && wxDataSourceName.trim().length() > 0){ |
| | |
| | | DataSourceContext.set(wxDataSourceName); |
| | | } else { |
| | | log.info("用户未选择数据源"); |
| | | DataSourceContext.set("ym"); |
| | | } |
| | | |
| | | filterChain.doFilter(servletRequest, servletResponse); |
| | |
| | | // 构造命令 |
| | | Command com = command(comId, commandCode, rtuAddr, protocol, rtuResultSendWebUrl, param); |
| | | |
| | | // 创建命令日志对象并添加到数据库中 |
| | | RmCommandHistory rmCommandHistory = getComHistory(comId, commandCode, commandName, intakeId, rtuAddr, protocol, param, operator); |
| | | rmCommandHistoryMapper.insert(rmCommandHistory); |
| | | comId = rmCommandHistory.getComId(); |
| | | |
| | | // 发送命令 |
| | | JSONObject response_SendCom= (JSONObject) JSON.toJSON(sendCom2Mw(com)); |
| | | if(response_SendCom != null && response_SendCom.getString("code").equals("0001")) { |
| | | // 请求成功, 处理回调 |
| | | BaseResponse response_CallBack = dealWithCallBack(comId); |
| | | |
| | | // 创建命令日志对象并添加到数据库中 |
| | | RmCommandHistory rmCommandHistory = getComHistory(comId, commandCode, commandName, intakeId, rtuAddr, protocol, param, operator); |
| | | rmCommandHistoryMapper.insert(rmCommandHistory); |
| | | comId = rmCommandHistory.getComId(); |
| | | |
| | | // 回调异常 |
| | | if(!response_CallBack.getCode().equals("0001")) { |
| | |
| | | |
| | | // 回调成功,再判断执行是否成功 |
| | | 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) { |
| | | /** |
| | |
| | | rmCommandHistory.setComId(comId); |
| | | rmCommandHistory.setResult((byte)0); |
| | | rmCommandHistory.setResultTime(new Date()); |
| | | rmCommandHistory.setResultText((JSONObject)JSON.toJSON(response_CallBack.getContent())); |
| | | //rmCommandHistory.setResultText((JSONObject)JSON.toJSON(response_CallBack.getContent())); |
| | | rmCommandHistory.setResultText(response_CallBack.getContent().toString()); |
| | | rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory); |
| | | return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString()); |
| | | } |
| | |
| | | Data myData = (Data)response_CallBack.getContent(); |
| | | |
| | | // 更新命令日志:执行结果、返回结果时间、结果内容 |
| | | rmCommandHistory = new RmCommandHistory(); |
| | | rmCommandHistory.setComId(comId); |
| | | rmCommandHistory.setResult((byte)1); |
| | | rmCommandHistory.setResultTime(new Date()); |
| | | rmCommandHistory.setResultText((JSONObject)JSON.toJSON(myData)); |
| | | rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory); |
| | | //rmCommandHistory = new RmCommandHistory(); |
| | | //rmCommandHistory.setComId(comId); |
| | | //rmCommandHistory.setResult((byte)1); |
| | | //rmCommandHistory.setResultTime(new Date()); |
| | | //rmCommandHistory.setResultText((JSONObject)JSON.toJSON(myData)); |
| | | //rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory); |
| | | |
| | | return BaseResponseUtils.buildSuccess(myData) ; |
| | | } else { |
| | |
| | | List<Map<String, Object>> getNoBindingIntakes(); |
| | | |
| | | /** |
| | | * 获取取水口数量(在线和不在线)废弃 |
| | | * 获取取水口数量(在线和不在线) |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getOnLineIntakesCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 获取取水口列表(在线和不在线)废弃 |
| | | * 获取取水口列表(在线和不在线) |
| | | * @param params |
| | | * @return |
| | | */ |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; |
| | | import com.dy.pipIrrGlobal.voRm.VoCommand; |
| | | import com.dy.pipIrrGlobal.voRm.VoUnclosedParam; |
| | | import com.dy.pipIrrGlobal.voRm.VoUnclosedValve; |
| | | import com.dy.pipIrrGlobal.voRm.VoCommand; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-05-24 10:46 |
| | | * @LastEditTime 2024-05-24 10:46 |
| | | * @date 2024-07-17 10:31 |
| | | * @LastEditTime 2024-07-17 10:31 |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface RmCommandHistoryMapper extends BaseMapper<RmCommandHistory> { |
| | | int deleteByPrimaryKey(Long id); |
| | | int deleteByPrimaryKey(Long comId); |
| | | |
| | | int insert(RmCommandHistory record); |
| | | |
| | | int insertSelective(RmCommandHistory record); |
| | | |
| | | RmCommandHistory selectByPrimaryKey(Long id); |
| | | RmCommandHistory selectByPrimaryKey(Long comId); |
| | | |
| | | int updateByPrimaryKeySelective(RmCommandHistory record); |
| | | |
| | |
| | | package com.dy.pipIrrGlobal.pojoRm; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-05-24 10:46 |
| | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 命令日志表 |
| | | */ |
| | | * 命令日志表 |
| | | */ |
| | | @TableName(value = "rm_command_history", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | |
| | | /** |
| | | * 命令结果内容 |
| | | */ |
| | | @TableField(typeHandler = JacksonTypeHandler.class) |
| | | private JSONObject resultText; |
| | | private String resultText; |
| | | |
| | | } |
| | |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | # url: jdbc:mysql://192.168.40.166: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 |
| | | # url: jdbc:mysql://8.140.179.55: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 |
| | | url: jdbc:mysql://8.140.179.55:3306/pipIrr_pj?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | username: root |
| | | password: dysql,;.abc!@# |
| | | druid: |
| | |
| | | #name: sp |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | # url: jdbc:mysql://192.168.40.166:3306/pipIrr_sp?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | url: jdbc:mysql://127.0.0.1:3306/pipIrr_sp?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | url: jdbc:mysql://192.168.40.166:3306/pipIrr_sp?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | # url: jdbc:mysql://127.0.0.1:3306/pipIrr_sp?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | # url: jdbc:mysql://8.140.179.55:3306/pipIrr_sp?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | username: root |
| | | password: dysql,;.abc!@# |
| | |
| | | #name: ym |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | # url: jdbc:mysql://192.168.40.166: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 |
| | | url: jdbc:mysql://192.168.40.166: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 |
| | | # url: jdbc:mysql://8.140.179.55:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | username: root |
| | | password: dysql,;.abc!@# |
| | |
| | | WHERE id NOT IN(SELECT intakeId FROM pr_controller) AND deleted = 0 |
| | | </select> |
| | | |
| | | <!--获取取水口数量(在线和不在先) 废弃--> |
| | | <!--获取取水口数量(在线和不在先)--> |
| | | <select id="getOnLineIntakesCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM pr_controller con |
| | | INNER JOIN pr_intake inta ON con.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 |
| | | <!--'[{"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} |
| | | </if> |
| | | <if test="intakeNum != null and intakeNum != ''"> |
| | | AND inta.name LIKE CONCAT('%', #{intakeNum}, '%') |
| | | AND inta.name = #{intakeNum} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--获取取水口列表(在线和不在先) 废弃--> |
| | | <!--获取取水口列表(在线和不在先)--> |
| | | <select id="getOnLineIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake"> |
| | | SELECT |
| | | con.intakeId, |
| | |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="result" jdbcType="TINYINT" property="result" /> |
| | | <result column="result_time" jdbcType="TIMESTAMP" property="resultTime" /> |
| | | <result column="result_text" property="resultText" jdbcType="JAVA_OBJECT" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" /> |
| | | <result column="result_text" jdbcType="LONGVARCHAR" property="resultText" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | com_id, command_code, command_name, intake_id, rtu_addr, protocol, param, send_time, `operator`, |
| | | `result`, result_time, result_text |
| | | com_id, command_code, command_name, intake_id, rtu_addr, protocol, param, send_time, |
| | | `operator`, `result`, result_time, result_text |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from rm_command_history |
| | | where com_id = #{id,jdbcType=BIGINT} |
| | | where com_id = #{comId,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from rm_command_history |
| | | where com_id = #{id,jdbcType=BIGINT} |
| | | where com_id = #{comId,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory"> |
| | | <!--@mbg.generated--> |
| | | insert into rm_command_history (com_id, command_code, command_name, |
| | | intake_id, rtu_addr, protocol, param, |
| | | send_time, `operator`, `result`, |
| | | result_time, result_text) |
| | | values (#{comId,jdbcType=BIGINT}, #{commandCode,jdbcType=VARCHAR}, #{commandName,jdbcType=VARCHAR}, #{intakeId,jdbcType=BIGINT}, |
| | | #{rtuAddr,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | #{sendTime,jdbcType=TIMESTAMP}, #{operator,jdbcType=BIGINT}, #{result,jdbcType=TINYINT}, |
| | | #{resultTime,jdbcType=TIMESTAMP}, #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}) |
| | | insert into rm_command_history (com_id, command_code, command_name, |
| | | intake_id, rtu_addr, protocol, |
| | | param, send_time, `operator`, |
| | | `result`, result_time, result_text |
| | | ) |
| | | values (#{comId,jdbcType=BIGINT}, #{commandCode,jdbcType=VARCHAR}, #{commandName,jdbcType=VARCHAR}, |
| | | #{intakeId,jdbcType=BIGINT}, #{rtuAddr,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, |
| | | #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, #{sendTime,jdbcType=TIMESTAMP}, #{operator,jdbcType=BIGINT}, |
| | | #{result,jdbcType=TINYINT}, #{resultTime,jdbcType=TIMESTAMP}, #{resultText,jdbcType=LONGVARCHAR} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory"> |
| | | <!--@mbg.generated--> |
| | |
| | | #{resultTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="resultText != null"> |
| | | #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | #{resultText,jdbcType=LONGVARCHAR}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | |
| | | result_time = #{resultTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="resultText != null"> |
| | | result_text = #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | result_text = #{resultText,jdbcType=LONGVARCHAR}, |
| | | </if> |
| | | </set> |
| | | where com_id = #{comId,jdbcType=BIGINT} |
| | |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | `result` = #{result,jdbcType=TINYINT}, |
| | | result_time = #{resultTime,jdbcType=TIMESTAMP}, |
| | | result_text = #{resultText,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler} |
| | | result_text = #{resultText,jdbcType=LONGVARCHAR} |
| | | where com_id = #{comId,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | |
| | | <!--根据取水口ID获取该取水口未关阀参数--> |
| | | <select id="getUncloseParam" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedParam"> |
| | | SELECT |
| | | com.rtu_addr AS rtuAddr, |
| | | com.param ->>'$.orderNo' AS orderNo, |
| | | com.param ->>'$.icCardNo' AS vcNum |
| | | com.rtu_addr AS rtuAddr, |
| | | com.param ->>'$.orderNo' AS orderNo, |
| | | com.param ->>'$.icCardNo' AS vcNum |
| | | FROM rm_command_history com |
| | | INNER JOIN pr_controller con ON com.rtu_addr = con.rtuAddr |
| | | INNER JOIN pr_intake inta ON con.intakeId = inta.id |
| | | INNER JOIN JSON_TABLE( |
| | | <!-- '[{"rtuAddr":"620201000029","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',--> |
| | | #{onLineMap}, |
| | | '$[*]' COLUMNS( |
| | | rtuAddr VARCHAR(20) PATH '$.rtuAddr', |
| | | isOnLine BOOLEAN PATH '$.isOnLine' |
| | | ) |
| | | ) rtus ON com.rtu_addr = rtus.rtuAddr |
| | | INNER JOIN pr_controller con ON com.rtu_addr = con.rtuAddr |
| | | INNER JOIN pr_intake inta ON con.intakeId = inta.id |
| | | INNER JOIN JSON_TABLE( |
| | | <!-- '[{"rtuAddr":"620201000029","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',--> |
| | | #{onLineMap}, |
| | | '$[*]' COLUMNS( |
| | | rtuAddr VARCHAR(20) PATH '$.rtuAddr', |
| | | isOnLine BOOLEAN PATH '$.isOnLine' |
| | | ) |
| | | ) rtus ON com.rtu_addr = rtus.rtuAddr |
| | | WHERE (com.command_code = '92' OR com.command_code = 'A2' OR com.command_code = '97') AND con.intakeId = #{intakeId} |
| | | AND NOT EXISTS ( |
| | | SELECT * |
| | | FROM rm_command_history |
| | | WHERE (result IS NULL OR result = 1 ) |
| | | AND (command_code = '93' OR command_code = 'A3' OR command_code = '98') |
| | | AND param ->>'$.orderNo' = com.param ->>'$.orderNo' |
| | | ) |
| | | AND NOT EXISTS ( |
| | | SELECT * |
| | | FROM rm_command_history |
| | | WHERE (result IS NULL OR result = 1 ) |
| | | AND (command_code = '93' OR command_code = 'A3' OR command_code = '98') |
| | | AND param ->>'$.orderNo' = com.param ->>'$.orderNo' |
| | | ) |
| | | ORDER BY com.send_time DESC |
| | | LIMIT 0,1 |
| | | LIMIT 0,1 |
| | | </select> |
| | | |
| | | <!--根据指定条件获取命令日志历史记录总数--> |
| | | <select id="getCommandHistoriesCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | COUNT(*) AS recordCount |
| | | FROM rm_command_history his |
| | | INNER JOIN pr_intake inta ON inta.id = his.intake_id |
| | | LEFT JOIN se_client cli ON cli.id = his.operator |
| | |
| | | <!--根据指定条件获取命令日志历史记录--> |
| | | <select id="getCommandHistories" resultType="com.dy.pipIrrGlobal.voRm.VoCommand"> |
| | | SELECT |
| | | his.com_id AS comId, |
| | | his.command_name AS commandName, |
| | | inta.name AS intakeName, |
| | | his.rtu_addr AS rtuAddr, |
| | | his.protocol, |
| | | his.send_time AS sendTime, |
| | | his.result_time AS resultTime, |
| | | (CASE |
| | | WHEN his.result = 1 THEN "成功" |
| | | ELSE "失败" |
| | | his.com_id AS comId, |
| | | his.command_name AS commandName, |
| | | inta.name AS intakeName, |
| | | his.rtu_addr AS rtuAddr, |
| | | his.protocol, |
| | | his.send_time AS sendTime, |
| | | his.result_time AS resultTime, |
| | | (CASE |
| | | WHEN his.result = 1 THEN "成功" |
| | | ELSE "失败" |
| | | END) AS result, |
| | | his.result_text, |
| | | IFNULL(cli.name, user.name) AS userName |
| | | his.result_text, |
| | | IFNULL(cli.name, user.name) AS userName |
| | | FROM rm_command_history his |
| | | INNER JOIN pr_intake inta ON inta.id = his.intake_id |
| | | LEFT JOIN se_client cli ON cli.id = his.operator |
| | | LEFT JOIN ba_user user ON user.id = his.operator |
| | | INNER JOIN pr_intake inta ON inta.id = his.intake_id |
| | | LEFT JOIN se_client cli ON cli.id = his.operator |
| | | LEFT JOIN ba_user user ON user.id = his.operator |
| | | <where> |
| | | <if test = "commandName != null and commandName !=''"> |
| | | AND his.command_name LIKE CONCAT('%',#{commandName},'%') |
| | |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | package com.dy.rtuMw.server.rtuData.p206V1_0_0; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.*; |
| | | import com.dy.common.mw.protocol.Data; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.DataV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCd92Vo; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCd93Vo; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCd97Vo; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCd98Vo; |
| | | import com.dy.common.util.DateTime; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrController; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; |
| | | import com.dy.rtuMw.server.rtuData.TaskSurpport; |
| | | import com.dy.common.mw.protocol.Data; |
| | | import com.dy.rtuMw.server.rtuData.dbSv.DbSv; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | |
| | | DataCd97Vo vo = (DataCd97Vo)obj ; |
| | | po.setResult((byte)1); |
| | | po.setResultTime(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt)) ; |
| | | po.setResultText((JSONObject) JSON.toJSON(vo)); |
| | | //po.setResultText((JSONObject) JSON.toJSON(vo)); |
| | | po.setResultText(vo.toString()); |
| | | }else if(obj instanceof DataCd98Vo){ |
| | | DataCd98Vo vo = (DataCd98Vo)obj ; |
| | | po.setResult((byte)1); |
| | | po.setResultTime(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt)); |
| | | po.setResultText((JSONObject) JSON.toJSON(vo)); |
| | | //po.setResultText((JSONObject) JSON.toJSON(vo)); |
| | | po.setResultText(vo.toString()); |
| | | }else if(obj instanceof DataCd92Vo){ |
| | | DataCd92Vo vo = (DataCd92Vo)obj ; |
| | | po.setResult((byte)1); |
| | | po.setResultTime(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt)) ; |
| | | po.setResultText((JSONObject) JSON.toJSON(vo)); |
| | | //po.setResultText((JSONObject) JSON.toJSON(vo)); |
| | | po.setResultText(vo.toString()); |
| | | }else if(obj instanceof DataCd93Vo){ |
| | | DataCd93Vo vo = (DataCd93Vo)obj ; |
| | | po.setResult((byte)1); |
| | | po.setResultTime(DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt)) ; |
| | | po.setResultText((JSONObject) JSON.toJSON(vo)); |
| | | //po.setResultText((JSONObject) JSON.toJSON(vo)); |
| | | po.setResultText(vo.toString()); |
| | | } |
| | | return po ; |
| | | } |
| | |
| | | datasource: #配置数据源 |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | # url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | url: jdbc:mysql://192.168.40.166: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: |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "open_wx", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | //@Transactional(rollbackFor = Exception.class) |
| | | public BaseResponse<Boolean> open(@RequestBody @Valid ValveOpen valve, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "close_wx", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | //@Transactional(rollbackFor = Exception.class) |
| | | public BaseResponse<Boolean> close(@RequestBody @Valid ValveClose valve, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | private final IntakeSv intakeSv; |
| | | |
| | | /** |
| | | * 获取取水口(在线和不在线) |
| | | * 根据取水口编号获取取水口对象 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | //@GetMapping(path = "one_intake") |
| | | @GetMapping(path = "all_intakes") |
| | | public BaseResponse<QueryResultVo<VoOnLineIntake>> getAllIntakes(OnLineIntakesQO qo) { |
| | | public BaseResponse<QueryResultVo<VoOnLineIntake>> getOneIntake(OnLineIntakesQO qo) { |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(intakeSv.selectOnLineIntakes(qo)); |
| | | return BaseResponseUtils.buildSuccess(intakeSv.selectOneIntake(qo)); |
| | | } catch (Exception e) { |
| | | log.error("查询取水口异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取取水口列表(在线和不在线) |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "all_intakes2") |
| | | public BaseResponse<QueryResultVo<List<VoOnLineIntake>>> getAllIntakes(OnLineIntakesQO qo) { |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(intakeSv.selectAllIntakes(qo)); |
| | | } catch (Exception e) { |
| | | log.error("查询取水口异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | |
| | | import com.dy.common.multiDataSource.DataSourceContext; |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper; |
| | | import com.dy.pipIrrGlobal.voPr.VoOnLineIntake; |
| | | import com.dy.pipIrrWechat.intake.qo.OnLineIntakesQO; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取取水口 |
| | | * 根据取水口编号获取取水口对象 |
| | | * @return |
| | | */ |
| | | public VoOnLineIntake selectOnLineIntakes(OnLineIntakesQO qo) { |
| | | public VoOnLineIntake selectOneIntake(OnLineIntakesQO qo) { |
| | | Command com = new Command() ; |
| | | com.id = Command.defaultId; |
| | | com.code = "LCD0001"; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取取水口列表(在线和不在线) |
| | | * @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); |
| | | |
| | | 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()); |
| | | // 如果 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; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据操作员获取常用取水口 |
| | | * @param operator |
| | | * @return |
| | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.multiDataSource.DataSourceContext; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | |
| | | job_body.put("mchid", mchid); |
| | | job_body.put("description", description); |
| | | job_body.put("out_trade_no", orderNumber); |
| | | job_body.put("attach", DataSourceContext.get()); |
| | | job_body.put("notify_url", notifyUrl); |
| | | |
| | | //订单金额 |
| | |
| | | JSONObject job_resource = JSONObject.parseObject(resource); |
| | | |
| | | // 解密后取出:商户订单号、微信支付订单号、交易状态、支付完成时间 |
| | | String attach = job_resource.getString("attach"); |
| | | DataSourceContext.set(attach); |
| | | String out_trade_no = job_resource.getString("out_trade_no"); |
| | | String transaction_id = job_resource.getString("transaction_id"); |
| | | String trade_state = job_resource.getString("trade_state"); |