Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveLast; |
| | | import com.dy.pipIrrGlobal.voRm.VoOpenCloseValve; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @return |
| | | */ |
| | | Integer getCountByCloseType(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 为指定(阀控器地址、水卡编号、无关阀记录)开关阀最新记录添加关阀时间,使之不在未关阀记录中显示 |
| | | * @param rtuAddr |
| | | * @param icCardNo |
| | | * @return |
| | | */ |
| | | Integer addCloseTime(@Param("rtuAddr") String rtuAddr, @Param("icCardNo")String icCardNo); |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoClientWechat; |
| | | import com.dy.pipIrrGlobal.voSt.VoCardUsage; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | VoClientWechat getSimpleClientInfo(@Param("sessionId") Long sessionId, @Param("openId") String openId); |
| | | |
| | | /** |
| | | * 获取指定时间段农户:充值合计、消费合计、余额 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getClientUsagesCount(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 获取指定时间段农户:充值合计、消费合计、余额 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoCardUsage> getClientUsages(Map<String, Object> params); |
| | | } |
| | |
| | | <where> |
| | | AND com.operator = #{operator} |
| | | AND (com.protocol = 'p206V1_0_1' AND (com.command_code = '92' OR com.command_code = '97' OR com.command_code = '99' OR com.command_code = 'A0' OR com.command_code = 'A1' OR com.command_code = 'A2')) |
| | | AND NOT EXISTS( |
| | | SELECT * FROM rm_command_history |
| | | WHERE (result IS NULL OR result = 1) |
| | | AND (com.protocol = 'p206V1_0_1' AND (command_code = '93' OR command_code = '98' OR command_code = '00')) |
| | | AND param ->> '$.orderNo' = com.param ->> '$.orderNo' |
| | | ) |
| | | AND ( |
| | | SELECT cl_dt FROM rm_open_close_valve_last |
| | | WHERE rtu_addr = com.rtu_addr AND op_ic_card_no = com.param ->> '$.icCardNo' |
| | | ORDER BY op_dt DESC |
| | | LIMIT 1 |
| | | ) IS NULL |
| | | </where> |
| | | GROUP BY inta.name, rtus.isOnLine, com.rtu_addr, com.param ->> '$.icCardNo', com.command_code, com.send_time |
| | | ORDER BY com.send_time DESC |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--为指定(阀控器地址、水卡编号、无关阀记录)开关阀最新记录添加关阀时间,使之不在未关阀记录中显示--> |
| | | <update id="addCloseTime"> |
| | | UPDATE rm_open_close_valve_last |
| | | SET cl_dt = NOW() |
| | | WHERE rtu_addr = #{rtuAddr} AND op_ic_card_no = #{icCardNo} AND cl_dt IS NULL |
| | | </update> |
| | | </mapper> |
| | |
| | | </where> |
| | | LIMIT 0,1 |
| | | </select> |
| | | |
| | | <!--获取指定时间段农户:充值合计、消费合计、余额--> |
| | | <select id="getClientUsagesCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | count(*) |
| | | FROM se_client cli |
| | | <where> |
| | | <if test="clientName != null and clientName != ''"> |
| | | AND cli.name like CONCAT('%', #{clientName}, '%') |
| | | </if> |
| | | <if test="clientNum != null and clientNum != ''"> |
| | | AND cli.clientNum like CONCAT('%', #{clientNum}, '%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <!--获取指定时间段农户:充值合计、消费合计、余额--> |
| | | <select id="getClientUsages" resultType="com.dy.pipIrrGlobal.voSt.VoCardUsage"> |
| | | SELECT |
| | | cli.name AS clientName, |
| | | (SELECT ROUND(SUM(rch.amount),2) FROM se_recharge_history rch WHERE rch.clientId = cli.id AND rch.operateDt BETWEEN #{timeStart} AND #{timeStop}) AS totalRecharge, |
| | | (SELECT ROUND(SUM(his.cl_this_money),2) FROM rm_open_close_valve_history his WHERE his.client_id = cli.id AND his.cl_dt BETWEEN #{timeStart} AND #{timeStop}) AS totalConsumption, |
| | | (SELECT ROUND(SUM(card.money),2) FROM se_client_card card WHERE card.clientId = cli.id) AS balance |
| | | FROM se_client cli |
| | | <where> |
| | | <if test="clientName != null and clientName != ''"> |
| | | AND cli.name like CONCAT('%', #{clientName}, '%') |
| | | </if> |
| | | <if test="clientNum != null and clientNum != ''"> |
| | | AND cli.clientNum like CONCAT('%', #{clientNum}, '%') |
| | | </if> |
| | | </where> |
| | | ORDER BY totalConsumption DESC, totalRecharge DESC |
| | | <trim prefix="limit "> |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.dy.pipIrrGlobal.daoPr.PrIntakeVcMapper; |
| | | import com.dy.pipIrrGlobal.daoPr.PrWaterPriceMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmCommandHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveLastMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; |
| | |
| | | private final PrWaterPriceMapper prWaterPriceMapper; |
| | | private final PrIntakeVcMapper prIntakeVcMapper; |
| | | private final SeClientCardMapper seClientCardMapper; |
| | | private RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper; |
| | | |
| | | /** |
| | | * pro_mw:属性 |
| | |
| | | private String pro_mw = "mw"; |
| | | private String key_mw = "comSendUrl"; |
| | | @Autowired |
| | | public CommandSv(RmCommandHistoryMapper rmCommandHistoryMapper, SeVirtualCardMapper seVirtualCardMapper, PrIntakeMapper prIntakeMapper, PrWaterPriceMapper prWaterPriceMapper, PrIntakeVcMapper prIntakeVcMapper, SeClientCardMapper seClientCardMapper, Environment env) { |
| | | public CommandSv(RmCommandHistoryMapper rmCommandHistoryMapper,RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper, SeVirtualCardMapper seVirtualCardMapper, PrIntakeMapper prIntakeMapper, PrWaterPriceMapper prWaterPriceMapper, PrIntakeVcMapper prIntakeVcMapper, SeClientCardMapper seClientCardMapper, Environment env) { |
| | | this.rmCommandHistoryMapper = rmCommandHistoryMapper; |
| | | this.rmOpenCloseValveLastMapper = rmOpenCloseValveLastMapper; |
| | | this.seVirtualCardMapper = seVirtualCardMapper; |
| | | this.prIntakeMapper = prIntakeMapper; |
| | | this.prWaterPriceMapper = prWaterPriceMapper; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 为指定(阀控器地址、水卡编号、无关阀记录)开关阀最新记录添加关阀时间,使之不在未关阀记录中显示 |
| | | * @param rtuAddr |
| | | * @param icCardNo |
| | | * @return |
| | | */ |
| | | public Integer addClostTime(String rtuAddr, String icCardNo) { |
| | | return rmOpenCloseValveLastMapper.addCloseTime(rtuAddr, icCardNo); |
| | | } |
| | | |
| | | /** |
| | | * 修改命令日志记录,回调报错时将命令记录的执行结果改为失败 |
| | | * @param po |
| | | * @return |
| | |
| | | import com.dy.pipIrrRemote.common.CommandSv; |
| | | import com.dy.pipIrrRemote.common.dto.*; |
| | | import com.dy.pipIrrRemote.result.RemoteResultCode; |
| | | import com.dy.pipIrrRemote.valve.dto.deleteUnclosedParam; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.validation.Valid; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 强制因此未关阀记录:为指定(阀控器地址、水卡编号、无关阀记录)开关阀最新记录添加关阀时间,使之不在未关阀记录中显示 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "deleteUnclosed", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> deleteUnclosed(@RequestBody @Valid deleteUnclosedParam po, BindingResult bindingResult) { |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | commandSv.addClostTime(po.getRtuAddr(), po.getVcNum()); |
| | | return BaseResponseUtils.buildSuccess(); |
| | | } |
| | | |
| | | /** |
| | | * 平台远程充值 |
| | | * @param po |
| | | * @param bindingResult |
New file |
| | |
| | | package com.dy.pipIrrRemote.valve.dto; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-10-19 10:48 |
| | | * @LastEditTime 2024-10-19 10:48 |
| | | * @Description 删除未关阀记录传入参数 |
| | | */ |
| | | |
| | | @Data |
| | | public class deleteUnclosedParam { |
| | | public static final long serialVersionUID = 202410191049001L; |
| | | |
| | | /** |
| | | * 阀控器地址 |
| | | */ |
| | | @NotBlank(message = "阀控器地址不能为空") |
| | | private String rtuAddr; |
| | | |
| | | /** |
| | | * 虚拟卡编号 |
| | | */ |
| | | @NotBlank(message = "虚拟卡编号不能为空") |
| | | private String vcNum; |
| | | } |
| | |
| | | if (timeStart != null && timeStart != ""){ |
| | | timeStart = timeStart + " 00:00:00"; |
| | | }else { |
| | | timeStart = LocalDate.now() + " 00:00:00"; |
| | | timeStart = LocalDateTime.now().minusYears(1).toString(); |
| | | } |
| | | if (timeStop != null && timeStop != ""){ |
| | | timeStop = timeStop + " 23:59:59"; |
| | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.voSt.*; |
| | | import com.dy.pipIrrStatistics.card.IcCardqo.CommonQO; |
| | | import com.dy.pipIrrStatistics.card.qo.CardUsageQO; |
| | | import com.dy.pipIrrStatistics.client.qo.*; |
| | | import com.dy.pipIrrStatistics.intake.qo.ClientAmountQO; |
| | | import com.dy.pipIrrStatistics.result.StatisticlResultCode; |
| | |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取指定时间段农户:充值合计、消费合计、余额 |
| | | * @param qo |
| | | //* @param bindingResult |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "/client_usage") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoCardUsage>>> getClientUsages(@Valid CardUsageQO qo, BindingResult bindingResult) { |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(clientSv.getClientUsages(qo)); |
| | | } catch (Exception e) { |
| | | log.error("获取开卡记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.daoRm.RmClientAmountDayLastMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeClientMapper; |
| | | import com.dy.pipIrrGlobal.voSt.*; |
| | | import com.dy.pipIrrStatistics.card.IcCardqo.CommonQO; |
| | | import com.dy.pipIrrStatistics.card.qo.CardUsageQO; |
| | | import com.dy.pipIrrStatistics.client.qo.*; |
| | | import com.dy.pipIrrStatistics.intake.qo.ClientAmountQO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper; |
| | | @Autowired |
| | | private SeCardOperateMapper seCardOperateMapper; |
| | | |
| | | @Autowired |
| | | private RmClientAmountDayLastMapper rmClientAmountDayLastMapper; |
| | | @Autowired |
| | | private SeClientMapper seClientMapper; |
| | | |
| | | /** |
| | | * 获取指定时间段内开阀次数超过指定值的农户 |
| | |
| | | rsVo.obj = rmClientAmountDayLastMapper.getNotRechargeLastClients(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 获取指定时间段农户:充值合计、消费合计、余额 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoCardUsage>> getClientUsages(CardUsageQO qo) { |
| | | |
| | | String timeStart = qo.getTimeStart(); |
| | | String timeStop = qo.getTimeStop(); |
| | | |
| | | if (timeStart != null && timeStart != ""){ |
| | | timeStart = timeStart + " 00:00:00"; |
| | | }else { |
| | | timeStart = LocalDateTime.now().minusYears(1).toString(); |
| | | } |
| | | if (timeStop != null && timeStop != ""){ |
| | | timeStop = timeStop + " 23:59:59"; |
| | | }else { |
| | | timeStop = LocalDateTime.now().toString(); |
| | | } |
| | | qo.setTimeStart(timeStart); |
| | | qo.setTimeStop(timeStop); |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = Optional.ofNullable(seClientMapper.getClientUsagesCount(params)).orElse(0L); |
| | | |
| | | QueryResultVo<List<VoCardUsage>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | rsVo.pageSize = qo.pageSize ; |
| | | rsVo.pageCurr = qo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seClientMapper.getClientUsages(params); |
| | | return rsVo ; |
| | | } |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.daoPr.PrWaterPriceMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmCommandHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmIrrigateProfileMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveLastMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; |
| | |
| | | private final PrIntakeVcMapper prIntakeVcMapper; |
| | | private final SeClientCardMapper seClientCardMapper; |
| | | private final RmIrrigateProfileMapper rmIrrigateProfileMapper; |
| | | private RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper; |
| | | |
| | | /** |
| | | * pro_mw:属性 |
| | |
| | | private String pro_mw = "mw"; |
| | | private String key_mw = "comSendUrl"; |
| | | @Autowired |
| | | public CommandSv(RmCommandHistoryMapper rmCommandHistoryMapper, SeVirtualCardMapper seVirtualCardMapper, PrIntakeMapper prIntakeMapper, PrWaterPriceMapper prWaterPriceMapper, PrIntakeVcMapper prIntakeVcMapper, SeClientCardMapper seClientCardMapper, RmIrrigateProfileMapper rmIrrigateProfileMapper, Environment env) { |
| | | public CommandSv(RmCommandHistoryMapper rmCommandHistoryMapper,RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper, SeVirtualCardMapper seVirtualCardMapper, PrIntakeMapper prIntakeMapper, PrWaterPriceMapper prWaterPriceMapper, PrIntakeVcMapper prIntakeVcMapper, SeClientCardMapper seClientCardMapper, RmIrrigateProfileMapper rmIrrigateProfileMapper, Environment env) { |
| | | this.rmCommandHistoryMapper = rmCommandHistoryMapper; |
| | | this.rmOpenCloseValveLastMapper = rmOpenCloseValveLastMapper; |
| | | this.seVirtualCardMapper = seVirtualCardMapper; |
| | | this.prIntakeMapper = prIntakeMapper; |
| | | this.prWaterPriceMapper = prWaterPriceMapper; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 为指定(阀控器地址、水卡编号、无关阀记录)开关阀最新记录添加关阀时间,使之不在未关阀记录中显示 |
| | | * @param rtuAddr |
| | | * @param icCardNo |
| | | * @return |
| | | */ |
| | | public Integer addClostTime(String rtuAddr, String icCardNo) { |
| | | return rmOpenCloseValveLastMapper.addCloseTime(rtuAddr, icCardNo); |
| | | } |
| | | |
| | | /** |
| | | * 根据取水口ID获取与之绑定虚拟卡ID |
| | | * @param intakeId |
| | | * @return |
| | |
| | | import com.dy.pipIrrGlobal.voRm.VoIrrigaterProfile; |
| | | import com.dy.pipIrrGlobal.voRm.VoUnclosedValve; |
| | | import com.dy.pipIrrGlobal.voSe.VoVirtualCard; |
| | | import com.dy.pipIrrWechat.command.dto.AutomaticClose; |
| | | import com.dy.pipIrrWechat.command.dto.Recharge; |
| | | import com.dy.pipIrrWechat.command.dto.ValveClose; |
| | | import com.dy.pipIrrWechat.command.dto.ValveOpen; |
| | | import com.dy.pipIrrWechat.command.dto.*; |
| | | import com.dy.pipIrrWechat.result.WechatResultCode; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.validation.Valid; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 强制因此未关阀记录:为指定(阀控器地址、水卡编号、无关阀记录)开关阀最新记录添加关阀时间,使之不在未关阀记录中显示 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "deleteUnclosed", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | public BaseResponse<Boolean> deleteUnclosed(@RequestBody @Valid deleteUnclosedParam po, BindingResult bindingResult) { |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | commandSv.addClostTime(po.getRtuAddr(), po.getVcNum()); |
| | | return BaseResponseUtils.buildSuccess(); |
| | | } |
| | | |
| | | /** |
| | | * 小程序远程充值 |
| | | * @param po |
| | | * @param bindingResult |
New file |
| | |
| | | package com.dy.pipIrrWechat.command.dto; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-10-19 11:07 |
| | | * @LastEditTime 2024-10-19 11:07 |
| | | * @Description 删除未关阀记录传入参数 |
| | | */ |
| | | @Data |
| | | public class deleteUnclosedParam { |
| | | public static final long serialVersionUID = 202410191108001L; |
| | | |
| | | /** |
| | | * 阀控器地址 |
| | | */ |
| | | @NotBlank(message = "阀控器地址不能为空") |
| | | private String rtuAddr; |
| | | |
| | | /** |
| | | * 虚拟卡编号 |
| | | */ |
| | | @NotBlank(message = "虚拟卡编号不能为空") |
| | | private String vcNum; |
| | | } |