From bf580699fbe3fe2996712d90f09325e870991435 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期三, 04 六月 2025 09:33:45 +0800 Subject: [PATCH] 两次请求命令时保存第二次的ID,开阀时判断阀门开闭状态 --- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java | 8 ++ pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java | 3 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml | 5 + pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/enums/RechargeTypeENUM.java | 21 +++++ pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardSv.java | 123 ++++++++++++++++++++++++++++++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml | 2 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java | 44 ++++++++-- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeControllerMapper.java | 7 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml | 7 + pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/dto/DtoRecharge.java | 5 + pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java | 7 + 11 files changed, 221 insertions(+), 11 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java index c79dda6..e991aff 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java @@ -39,6 +39,14 @@ int updateByCommandId(@Param("commandId") Long commandId, @Param("commandResult") Byte commandResult, @Param("failureFactors") String failureFactors); /** + * 鏍规嵁涓婚敭淇敼鍛戒护ID + * @param commandId + * @param id + * @return + */ + int updateCommandId(@Param("commandId") Long commandId, @Param("id") Long id); + + /** * 鏍规嵁璁″垝ID鑾峰彇寰呯粓姝㈢殑鍙栨按鍙D锛堝凡鍙戝竷寮�鍙戝懡浠わ紝鏃犺鏄惁鎴愬姛锛� * @param planId * @return diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeControllerMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeControllerMapper.java index 09e26e5..d3a4f83 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeControllerMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeControllerMapper.java @@ -59,4 +59,11 @@ * @return */ int updateByIntakeSelective(PrIntakeController record); + + /** + * 鏍规嵁鍙栨按鍙D鑾峰彇鍙栨按鍙e悕绉� + * @param intakeId + * @return + */ + String getIntakeNameById(@Param("intakeId") Long intakeId); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml index cf9d2c9..6dc8edc 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml @@ -156,6 +156,13 @@ where command_id = #{commandId} </update> + <!--鏍规嵁涓婚敭淇敼鍛戒护ID--> + <update id="updateCommandId"> + update ir_intake_operate + set command_id = #{commandId} + where id = #{id} + </update> + <!--鏍规嵁璁″垝ID鑾峰彇寰呯粓姝㈢殑鍙栨按鍙D锛堝凡鍙戝竷寮�鍙戝懡浠わ紝鏃犺鏄惁鎴愬姛锛�--> <select id="getToTerminateIntakeIds" resultType="java.lang.Long"> SELECT diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml index 2837fc5..1545ca5 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml @@ -434,7 +434,7 @@ FROM ir_irrigate_schedule sche INNER JOIN ir_plan_schedule ps ON schedule_id = sche.id WHERE ps.plan_id = #{planId} - LIMIT 1 +<!-- LIMIT 1--> ) AS has_intersection </select> diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml index f025aee..6abdee5 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml @@ -210,4 +210,9 @@ </set> where intakeId = #{intakeid,jdbcType=BIGINT} </update> + + <!--鏍规嵁鍙栨按鍙D鑾峰彇鍙栨按鍙e悕绉�--> + <select id="getIntakeNameById" resultType="java.lang.String"> + SELECT name AS intakeName FROM pr_intake WHERE id = #{intakeId} + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardSv.java index e244ab3..8a8e2bc 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardSv.java @@ -1,18 +1,21 @@ package com.dy.pipIrrTerminal.card; import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; import com.dy.pipIrrGlobal.daoPr.PrWaterPriceMapper; import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper; import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; import com.dy.pipIrrGlobal.daoSe.SeClientMapper; import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; import com.dy.pipIrrGlobal.pojoSe.SeClientCard; +import com.dy.pipIrrGlobal.pojoSe.SeRechargeHistory; import com.dy.pipIrrGlobal.voSe.VoTermRecharge; import com.dy.pipIrrTerminal.card.dto.ActiveCard; import com.dy.pipIrrTerminal.card.dto.DtoRecharge; import com.dy.pipIrrTerminal.card.enums.CardStateENUM; import com.dy.pipIrrTerminal.card.enums.LastOperateENUM; import com.dy.pipIrrTerminal.card.enums.OperateTypeENUM; +import com.dy.pipIrrTerminal.card.enums.RechargeTypeENUM; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -264,4 +267,124 @@ return map; } + public Map canRecharge(DtoRecharge po) { + Map map = new HashMap<>(); + map.put("success", false); + map.put("content", null); + + String stateName = Optional.ofNullable(seClientCardMapper.getCardStateByCardNum(po.getCardNum())).orElse(""); + // 鍗曠嫭鍏呭�兼椂鍗$墖蹇呴』涓烘甯� + if((po.getRechargeType() == RechargeTypeENUM.RECHARGE.getCode()) && !stateName.equals("姝e父")) { + map.put("msg", stateName + ", " + "姘村崱鐘舵�佷笉鏀寔褰撳墠鎿嶄綔"); + return map; + } + + map.put("success", true); + return map; + } + + public Map addRecharge(DtoRecharge po) { + Map map = new HashMap<>(); + map.put("success", false); + map.put("content", null); + + /** + * cardId 姘村崱缂栧彿锛堜緷鎹按鍗$紪鍙疯幏鍙栵級 + * clientId 鍐滄埛缂栧彿锛堜緷鎹按鍗$紪鍙疯幏鍙栵級 + * cardNum 姘村崱缂栧彿 + * money 鍗$墖浣欓 + * amount 鍏呭�奸噾棰� + * gift 璧犻�侀噾棰� + * afterRecharge 鍏呭�煎悗浣欓 + * paymentId 鏀粯鏂瑰紡缂栧彿 + * price 姘翠环 + * remarks 澶囨敞 + * operator 鎿嶄綔浜虹紪鍙� + * rechargeTime 鍏呭�兼椂闂� + */ + + //Long cardId = 0L; + //Long clientId = 0L; + //Long cardNum = po.getCardNum(); + //Float money = po.getMoney(); + //Float amount = po.getAmount(); + //Float gift = po.getGift(); + //Float afterRecharge = money + amount + gift; + //Long paymentId = po.getPaymentId(); + //Float price = po.getPrice(); + //String remarks = po.getRemarks(); + //Long operator = po.getOperator(); + //Date rechargeTime = new Date(); + + Map map_canRecharge = canRecharge(po); + if(map_canRecharge.get("success").equals(false)) { + map.put("msg", map_canRecharge.get("msg").toString()); + return map; + } + + /** + * 渚濇嵁姘村崱缂栧彿鑾峰彇姘村崱琛ㄤ富閿強鍐滄埛缂栧彿 + */ + Map map_cardAndClient = seClientCardMapper.getCardIdAndClientNum(po.getCardNum()); + if (map_cardAndClient == null || map_cardAndClient.size() <= 0) { + map.put("msg", "鍗″彿閿欒锛岃鍗′笉瀛樺湪"); + return map; + } + Long cardId = Long.parseLong(map_cardAndClient.get("cardId").toString()); + Long clientId = Long.parseLong(map_cardAndClient.get("clientId").toString()); + + /** + * 娣诲姞姘村崱鍏呭�兼搷浣滆褰� + */ + SeCardOperate seCardOperate = new SeCardOperate(); + seCardOperate.setCardId(cardId); + seCardOperate.setClientId(clientId); + seCardOperate.setMoney(po.getMoney()); + seCardOperate.setTradeAmount(po.getAmount()); + seCardOperate.setGift(po.getGift()); + seCardOperate.setOperateType(OperateTypeENUM.RECHARGE.getCode()); + seCardOperate.setPaymentId(po.getPaymentId()); + seCardOperate.setPrice(po.getPrice()); + seCardOperate.setRemarks(po.getRemarks()); + seCardOperate.setOperator(po.getOperator()); + seCardOperate.setOperateDt(new Date()); + seCardOperate.setOperateValid((byte) 1); + seCardOperateMapper.insert(seCardOperate); + Long rec = Optional.ofNullable(seCardOperate.getId()).orElse(0L); + if (rec == 0) { + //return BaseResponseUtils.buildErrorMsg("鍏呭�煎け璐�-鍏呭�艰褰曞啓鍏ュ紓甯�"); + } + + /** + * 娣诲姞鍏呭�煎巻鍙茶褰� + */ + SeRechargeHistory seRechargeHistory = new SeRechargeHistory(); + seRechargeHistory.setCardid(cardId); + seRechargeHistory.setClientid(clientId); + seRechargeHistory.setMoney(po.getMoney()); + seRechargeHistory.setAmount(po.getAmount()); + seRechargeHistory.setGift(po.getGift()); + Float afterRecharge = po.getMoney() + po.getAmount() + po.getGift(); + seRechargeHistory.setAfterrecharge(afterRecharge); + seRechargeHistory.setPaymentid(po.getPaymentId()); + seRechargeHistory.setPrice(po.getPrice()); + seRechargeHistory.setRemarks(po.getRemarks()); + seRechargeHistory.setOperator(po.getOperator()); + seRechargeHistory.setOperatedt(new Date()); + seRechargeHistory.setOperateValid((byte) 1); + //seRechargeHistoryMapper.insert(seRechargeHistory); + Long rec_seRechargeHistory = Optional.ofNullable(seRechargeHistory.getId()).orElse(0L); + //if (rec_seRechargeHistory == 0) { + // return BaseResponseUtils.buildErrorMsg("鍏呭�煎け璐�-鍏呭�煎巻鍙茶褰曞啓鍏ュ紓甯�"); + //} + + //Map map_response = new HashMap(); + //map_response.put("projectNo", String.format("%02x", projectNo)); + //map_response.put("orderNumber", rec); + //map_response.put("cardNum", cardNum); + //return BaseResponseUtils.buildSuccess(map_response); + + return map; + } + } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/dto/DtoRecharge.java b/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/dto/DtoRecharge.java index 0497da6..0605f3a 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/dto/DtoRecharge.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/dto/DtoRecharge.java @@ -70,4 +70,9 @@ */ @Positive(message = "鎿嶄綔浜虹紪鍙峰繀椤讳负澶т簬0鐨勬暣鏁�") private Long operator; + + /** + * 鍏呭�肩被鍨嬶細1-寮�鍗″悓姝ュ厖鍊硷紝2-鍏呭�� + */ + private Byte rechargeType; } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/enums/RechargeTypeENUM.java b/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/enums/RechargeTypeENUM.java new file mode 100644 index 0000000..45642e6 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/enums/RechargeTypeENUM.java @@ -0,0 +1,21 @@ +package com.dy.pipIrrTerminal.card.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author ZhuBaoMin + * @date 2025-05-09 20:12 + * @LastEditTime 2025-05-09 20:12 + * @Description + */ + +@Getter +@AllArgsConstructor +public enum RechargeTypeENUM { + PLUS((byte)1, "寮�鍗″悓姝ュ厖鍊�"), + RECHARGE((byte)2, "鍏呭��"); + + private final Byte code; + private final String message; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java index 6bbaac0..8e2a50c 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java @@ -22,6 +22,7 @@ import com.dy.pipIrrGlobal.command.ComSupport; import com.dy.pipIrrGlobal.command.dto.Param; import com.dy.pipIrrGlobal.daoIr.IrIntakeOperateMapper; +import com.dy.pipIrrGlobal.daoPr.PrIntakeControllerMapper; import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper; import com.dy.pipIrrGlobal.daoPr.PrIntakeVcMapper; import com.dy.pipIrrGlobal.daoPr.PrWaterPriceMapper; @@ -40,6 +41,8 @@ import com.dy.pipIrrWechat.command.dto.AutomaticClose; import com.dy.pipIrrWechat.command.dto.ValveClose; import com.dy.pipIrrWechat.command.dto.ValveOpen; +import com.dy.pipIrrWechat.irrigatePlan.IrrigatePlanSv; +import com.dy.pipIrrWechat.irrigation.IrrigationSv; import com.dy.pipIrrWechat.result.WechatResultCode; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -72,6 +75,8 @@ private final RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper; //private final PrCommonIntakesMapper prCommonIntakesMapper; private final IrIntakeOperateMapper irIntakeOperateMapper; + private final IrrigationSv irrigationSv; + private final PrIntakeControllerMapper prIntakeControllerMapper; @Value("${mw.rtuCallbackUrl_wx}") private String rtuCallbackUrl_wx; @@ -85,7 +90,7 @@ private String pro_mw = "mw"; private String key_mw = "comSendUrl"; @Autowired - public CommandSv(RmCommandHistoryMapper rmCommandHistoryMapper,RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper, SeVirtualCardMapper seVirtualCardMapper, PrIntakeMapper prIntakeMapper, PrWaterPriceMapper prWaterPriceMapper, PrIntakeVcMapper prIntakeVcMapper, SeClientCardMapper seClientCardMapper, RmIrrigateProfileMapper rmIrrigateProfileMapper, Environment env, IrIntakeOperateMapper irIntakeOperateMapper) { + public CommandSv(RmCommandHistoryMapper rmCommandHistoryMapper,RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper, SeVirtualCardMapper seVirtualCardMapper, PrIntakeMapper prIntakeMapper, PrWaterPriceMapper prWaterPriceMapper, PrIntakeVcMapper prIntakeVcMapper, SeClientCardMapper seClientCardMapper, RmIrrigateProfileMapper rmIrrigateProfileMapper, Environment env, IrIntakeOperateMapper irIntakeOperateMapper, IrrigationSv irrigationSv, PrIntakeControllerMapper prIntakeControllerMapper) { this.rmCommandHistoryMapper = rmCommandHistoryMapper; this.rmOpenCloseValveLastMapper = rmOpenCloseValveLastMapper; //this.prCommonIntakesMapper = prCommonIntakesMapper; @@ -97,6 +102,8 @@ this.rmIrrigateProfileMapper = rmIrrigateProfileMapper; this.env = env; this.irIntakeOperateMapper = irIntakeOperateMapper; + this.irrigationSv = irrigationSv; + this.prIntakeControllerMapper = prIntakeControllerMapper; } /** * 铏氭嫙鍗D鎹㈣櫄鎷熷崱瀵硅薄 @@ -127,6 +134,7 @@ com.type = "innerCommand"; comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com)); + String aa = response.toJSONString(); JSONArray jsonArray = new JSONArray(); if(response != null && response.getString("code").equals("0001")) { @@ -268,8 +276,10 @@ Long operator = automaticClose.getOperator(); Byte openType = automaticClose.getOpenType(); Long comId = new IDLongGenerator().generate(); + String intakeName = Optional.ofNullable(prIntakeControllerMapper.getIntakeNameById(intakeId)).orElse(""); // 濡傛灉鏄疆鐏� + Long operateId = null; if(openType != null && openType == 1) { IrIntakeOperate irIntakeOperate = new IrIntakeOperate(); irIntakeOperate.setPlanId(planId); @@ -279,8 +289,8 @@ irIntakeOperate.setStartTime(startTime); irIntakeOperate.setDuration(duration); - Long id = addIntakeOperate(irIntakeOperate); - if(id == null) { + operateId = addIntakeOperate(irIntakeOperate); + if(operateId == null) { Map map = new HashMap<>(); map.put("success", false); map.put("msg", "娣诲姞鍙栨按鍙f搷浣滆褰曞け璐�"); @@ -307,7 +317,7 @@ Map map = new HashMap<>(); map.put("success", false); - map.put("msg", WechatResultCode.PLEASE_SELECT_A_VC.getMessage() + "(" + intakeId + ")"); + map.put("msg", WechatResultCode.PLEASE_SELECT_A_VC.getMessage() + "(" + intakeName + ")"); map.put("content", null); return map; } @@ -320,14 +330,14 @@ Map map = new HashMap<>(); map.put("success", false); - map.put("msg", WechatResultCode.PLEASE_SELECT_A_VC.getMessage() + "(" + intakeId + ")"); + map.put("msg", WechatResultCode.PLEASE_SELECT_A_VC.getMessage() + "(" + intakeName + ")"); map.put("content", null); return map; } String vcNum = vc.getVcNum().toString(); Double moneyRemain = vc.getMoney(); if(moneyRemain < 100) { - irIntakeOperateMapper.updateByCommandId(comId, (byte)2, "铏氭嫙鍗′綑棰濅笉瓒筹紝璇峰厖鍊�" + "(" + intakeId + ")"); + irIntakeOperateMapper.updateByCommandId(comId, (byte)2, "铏氭嫙鍗′綑棰濅笉瓒筹紝璇峰厖鍊�" + "(" + intakeName + ")"); Map map = new HashMap<>(); map.put("success", false); map.put("msg", "铏氭嫙鍗′綑棰濅笉瓒筹紝璇峰厖鍊�"); @@ -338,6 +348,7 @@ // 鑾峰彇姘翠环 Double waterPrice = getPrice(); if(waterPrice == null) { + irIntakeOperateMapper.updateByCommandId(comId, (byte)2, WechatResultCode.NO_WATER_PRICE.getMessage() + "(" + intakeName + ")"); Map map = new HashMap<>(); map.put("success", false); map.put("msg", WechatResultCode.NO_WATER_PRICE.getMessage()); @@ -348,7 +359,7 @@ // 鍙栨按鍙D鎹㈤榾鎺у櫒鍦板潃鍙婇�氳鍗忚 JSONObject job_rtu = getRtu(intakeId, null); if(job_rtu == null) { - irIntakeOperateMapper.updateByCommandId(comId, (byte)2, WechatResultCode.RTU_NOT_EXIST.getMessage() + "(" + intakeId + ")"); + irIntakeOperateMapper.updateByCommandId(comId, (byte)2, WechatResultCode.RTU_NOT_EXIST.getMessage() + "(" + intakeName + ")"); Map map = new HashMap<>(); map.put("success", false); @@ -364,11 +375,22 @@ // 鐢熸垚璁㈠崟鍙� String orderNo = generateOrderNo(); if(orderNo == null) { - irIntakeOperateMapper.updateByCommandId(comId, (byte)2, WechatResultCode.NO_ORDER_NUMBER.getMessage() + "(" + intakeId + ")"); + irIntakeOperateMapper.updateByCommandId(comId, (byte)2, WechatResultCode.NO_ORDER_NUMBER.getMessage() + "(" + intakeName + ")"); Map map = new HashMap<>(); map.put("success", false); map.put("msg", WechatResultCode.NO_ORDER_NUMBER.getMessage()); + map.put("content", null); + return map; + } + + // 鍒ゆ柇闃�鎺у櫒鏄惁宸茬粡寮�闃� + Boolean isOpen = irrigationSv.getOpenCloseStatus(rtuAddr); + if(isOpen) { + irIntakeOperateMapper.updateByCommandId(comId, (byte)2, intakeName + " 闃�闂ㄤ负鎵撳紑鐘舵��"); + Map map = new HashMap<>(); + map.put("success", false); + map.put("msg", intakeName + " 闃�闂ㄤ负鎵撳紑鐘舵��"); map.put("content", null); return map; } @@ -419,8 +441,12 @@ BaseResponse<Boolean> result = dealWithCommandResult(myParam); // 濡傛灉鍛戒护鎵ц澶辫触锛屽垯鍐嶆鎵ц鍛戒护 if(!result.isSuccess()) { - myParam.setComId(new IDLongGenerator().generate()); + Long newComId = new IDLongGenerator().generate(); + myParam.setComId(newComId); result = dealWithCommandResult(myParam); + + // 鏍规嵁operateId淇敼鍙栨按鍙f搷浣滆褰曚腑鐨刢ommandId + irIntakeOperateMapper.updateCommandId(newComId, operateId); } Map map = new HashMap<>(); diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java index a0bd00b..86c013c 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java @@ -285,6 +285,13 @@ for (VoIrrigateSchedule schedule : schedules) { Long groupId = schedule.getGroupId(); List<Long> intakeIds = getIntakeIdsByGroupId(groupId); + if(intakeIds == null || intakeIds.size() <= 0) { + Map map = new HashMap<>(); + map.put("success", false); + map.put("msg", "褰撳墠杞亴缁勫唴娌℃湁鏈夋晥鐨勫彇姘村彛"); + map.put("content", null); + return map; + } for (Long intakeId : intakeIds) { if (schedule.getDuration() > 0) { // 浠婂彂甯冪亴婧夋椂闀垮ぇ浜�0鐨� diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java index b853e64..f5d7255 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationSv.java @@ -191,7 +191,8 @@ return false; } - if(response.getJSONObject("content").getJSONObject("attachment").get("valveOpenTrueCloseFalse").equals("true")) { + // if(response.getJSONObject("content").getJSONObject("attachment").get("valveOpenTrueCloseFalse").equals("true")) { + if(response.getJSONObject("content").getJSONObject("attachment").getBoolean("valveOpenTrueCloseFalse")) { return true; } else { -- Gitblit v1.8.0