1、微信小程序后端轮灌迟延时长改为可配置的;
2、微信小程序查询取水口接口实现修改,改为后端模糊查询;
6个文件已修改
108 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeCtrl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeSv.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/resources/application-self.yml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java
@@ -205,4 +205,20 @@
     * @return
     */
    List<VoIntakeSimple> getNotLinkVcIntakes();
    /**
     * 为wechat,根据指定取水口名称模糊(后端)查询水口记录数
     * @param params
     * @return
     */
    Long getSomeIntakesCount4Wx(Map<?, ?> params);
    /**
     * 为wechat,根据指定取水口名称模糊(后端)查询水口
     * @param params
     * @return
     */
    List<VoOnLineIntake> getSomeIntakes4Wx(Map<?, ?> params);
}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -765,4 +765,37 @@
                WHERE iv.intake_id = inta.id
            ) AND inta.deleted = 0
    </select>
    <!-- 为wechat,根据指定取水口名称模糊(后端)查询水口记录数 -->
    <select id="getSomeIntakesCount4Wx" parameterType="java.util.Map" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM pr_intake tb
        <where>
            tb.deleted = 0
            <if test="intakeName != null and intakeName != ''">
                AND tb.name LIKE CONCAT('%', #{intakeName})
            </if>
        </where>
    </select>
    <!-- 为wechat,根据指定取水口名称模糊(后端)查询水口记录 -->
    <select id="getSomeIntakes4Wx" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake">
        SELECT
        inta.id AS intakeId,
        con.rtuAddr,
        inta.name AS intakeNum
        FROM pr_intake inta
        INNER JOIN pr_controller con ON con.intakeId = inta.id
        <where>
            inta.deleted = 0
            <if test="intakeName != null and intakeName != ''">
                AND inta.name LIKE CONCAT('%', #{intakeName})
            </if>
        </where>
        ORDER BY inta.id DESC
    </select>
</mapper>
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeCtrl.java
@@ -40,6 +40,22 @@
     * @return
     */
    @GetMapping(path = "all_intakes")
    public BaseResponse<QueryResultVo<List<VoOnLineIntake>>> getSomeIntakes(OnLineIntakesQO qo) {
        try {
            return BaseResponseUtils.buildSuccess(intakeSv.selectSomeIntakes(qo));
        } catch (Exception e) {
            log.error("查询取水口异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 根据取水口编号获取取水口对象
     * @param qo
     * @return
     */
    @GetMapping(path = "all_intakes1")
    public BaseResponse<QueryResultVo<VoOnLineIntake>> getOneIntake(OnLineIntakesQO qo) {
        try {
            return BaseResponseUtils.buildSuccess(intakeSv.selectOneIntake(qo));
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/intake/IntakeSv.java
@@ -65,6 +65,30 @@
        this.env = env;
    }
    /**
     * 获取取水口列表
     * @return
     */
    public QueryResultVo<List<VoOnLineIntake>> selectSomeIntakes(OnLineIntakesQO qo) {
        // 如果 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.getSomeIntakesCount4Wx(params);
        QueryResultVo<List<VoOnLineIntake>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = qo.pageSize ;
        rsVo.pageCurr = qo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = prIntakeMapper.getSomeIntakes4Wx(params);
        return rsVo;
    }
    /**
     * 根据取水口编号获取取水口对象
     * @return
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java
@@ -18,6 +18,7 @@
import org.apache.dubbo.common.utils.PojoUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -67,6 +68,11 @@
    @Autowired
    private CommandSv commandSv;
    @Value("${webchat.irr.plan.delay}")
    private Integer irrPlanDelay ;//轮灌中计划开阀的延迟时长
    private static final Integer irrPlanDelayDefault = 5 ;//轮灌中计划开阀的默认延迟时长
    /**
     * 添加灌溉计划
@@ -179,8 +185,12 @@
        LocalDateTime startTime = planStartTime.toInstant().atZone(ZoneId.systemDefault()) .toLocalDateTime();
        if(startupMode == 1){
            // 测试阶段延后2分钟,正式发布为5分钟
            startTime = startTime.plusMinutes(2);
            //startTime = startTime.plusMinutes(2);
            //startTime = startTime.plusMinutes(5);
            if(irrPlanDelay == null || irrPlanDelay <= 0) {
                irrPlanDelay = irrPlanDelayDefault ;
            }
            startTime = startTime.plusMinutes(irrPlanDelay);
        }
        planStartTime = Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant());
        LocalDateTime stopTime = startTime.plusMinutes(duration);
@@ -527,7 +537,7 @@
    }
    @Transactional(rollbackFor = Exception.class)
    private Integer updatePlanTimes(Date planStartTime, Date planEndTime,  Long planId){
    Integer updatePlanTimes(Date planStartTime, Date planEndTime, Long planId){
        return irrigatePlanMapper.updatePlanTimes(planStartTime, planEndTime, planId);
    }
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/resources/application-self.yml
@@ -12,6 +12,11 @@
        context-parameters:
            #GenerateIdSetSuffixListener中应用,取值范围是0-99
            idSuffix: ${pipIrr.wechat.idSuffix}
webchat:
    irr:
        plan:
            delay: 5 #轮灌中计划开阀的延迟时长
#阿里短信服务
aliyun: