定时任务

    <!-- 8.待支付订单(订单状态为已提交)隔天 中午12点发条崔单短信 -->
    <bean id="jobtask8"
          class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
        <!-- 调用的类 -->
        <property name="targetObject">
            <ref bean="taskServiceByTcMsg" />
        </property>
        <!-- 调用类中的方法 -->
        <property name="targetMethod">
            <value>selectUnTcPaidMobiles</value>
        </property>
        <!-- 是否允许任务并发执行。当值为false时,表示必须等到前一个线程处理完毕后才再启一个新的线程 -->
        <property name="concurrent" value="false" />
    </bean>
/**
     *处方药催单短信定时任务 
     **/
    public void selectUnTcPaidMobiles(){
        try {
//            ServiceMessage<List<String>> result=ecTcMessageService.selectUnTcPaidMobiles();
//             if(result.getStatus().equals(MsgStatus.NORMAL)){
//                   List<String> mobileList=result.getResult();
//                    if(mobileList!=null && mobileList.size()>0){
//                        for(String mobile1:mobileList){
//                            long time=new Date().getTime();
//                            String check=MD5.getMD5(time+"www.j1.com");
//                            String mobile=mobile1;
//                            String msg="亲爱的会员,您刚拍下的商品库存告急,即将售完,请抓紧时间,赶紧去支付吧。错过就没有这个优惠了";
//                            String param="t="+time+"&mobile="+mobile+"&msg="+msg+"&check="+check;
//                            String res=HttpSenderUtil.sendPost("http://adm.j1.com/ec-dec/page/sms/sendSmsForEach/notice",param);
//                            System.out.println(res);
//                        }
//                    }
//             }
            
             ServiceMessage<List<Map>> result=ecTcMessageService.selectUnTcPaidMobilesNew();
             if(result.getStatus().equals(MsgStatus.NORMAL)){
                   List<Map> mobileList=result.getResult();
                    if(mobileList!=null && mobileList.size()>0){
                        for(Map mobile1:mobileList){
                            long time=new Date().getTime();
                            String check=MD5.getMD5(time+"www.j1.com");
                            String orderId=mobile1.get("ORDERID").toString();
                            String mobile=mobile1.get("MOBILE").toString();
                            String msg="您好!您的订单"+orderId+"请尽快付款,下单后36小时不支付将自动取消订单,谢谢配合!如您已支付,请忽略本短信";
                            String param="t="+time+"&mobile="+mobile+"&msg="+msg+"&check="+check;
                            String res=HttpSenderUtil.sendPost("http://adm.j1.com/ec-dec/page/sms/sendSmsForEach/notice",param);
                            System.out.println(res);
                        }
                    }
            }
        } catch (Exception e) {
            logger.error("TaskServiceByTcMsg.selectUnTcPaidMobiles:"+e.getMessage());
        }
    }
  @Override
    public ServiceMessage<List<Map>> selectUnTcPaidMobilesNew() {
        try {
            List<Map> mobileMapList=ecTcMessageMapper.selectUnTcPaidMobilesNew();
            List<Map> mobileList=new ArrayList<Map>();
            if(mobileMapList!=null && mobileMapList.size()>0){
                for(Map map:mobileMapList){
                    String mobile=(String) map.get("MOBILE");
                    boolean flag = Pattern.compile("[0-9]*").matcher(mobile).matches();
                    if(flag && mobile.length()==11){
                        mobileList.add(map);
                    }
                }
            }
              return super.returnCorrectResult("调用成功!", mobileList);
         } catch (Exception e) {
              return super.returnException(e);
         }
    }
    
        <!-- 处方药催单SQL LYD -->
    <select id="selectUnTcPaidMobilesNew" parameterType="map" resultType="java.util.HashMap">
             select m.mobile as mobile,o.order_id as orderid
             from order_info o,member m 
             where o.member_id=m.member_id and m.mobile is not null and   o.payment_mode = 'KDFH'
             and o.is_paid != 'Y'
             and o.is_tc = 'Y'
             and o.order_state != (select code_id from sys_code
                                  where code_type_no = 'order_state'
                                    and code_no = 'cancel')
             and o.is_delete = 'N'
             and round(to_number(sysdate -to_date(o.commit_time, 'YYYY-MM-DD hh24:mi:ss')) * 24) &gt;= 12
             and round(to_number(sysdate -to_date(o.commit_time, 'YYYY-MM-DD hh24:mi:ss')) * 24) &lt;36
    </select>

 

taskServiceByTcMsg.syncTcMessage.cronTrigger=0 40 16 * * ?
taskServiceByTcMsg.selectUnTcPaidMobiles.cronTrigger=0 0 17 * * ?(隔天中午十二点执行)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值