bill Order Check Task

master
wangning 7 years ago
parent 82707c9d85
commit 7c0b958fee

@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.sun.tracing.dtrace.ProviderAttributes;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
@ -33,7 +34,11 @@ public interface BillOrderMapper {
@AutoSql(type = SqlType.SELECT)
List<JSONObject> findByBillId(@Param("bill_id") String bill_id);
List<String> findOrderIdByStatus(@Param("order_status")String order_status);
PageList<JSONObject> query(@Param("bill_id") String bill_id, @Param("param") JSONObject jsonObject, PageBounds pageBounds);
JSONObject analysis(@Param("bill_id")String bill_id,@Param("param")JSONObject jsonObject);
int updateStatusByOrderId(@Param("order_id")String order_id, @Param("order_status")String order_status);
}

@ -0,0 +1,38 @@
package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.mappers.bill.BillOrderMapper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import com.alibaba.fastjson.JSONObject;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
import javax.annotation.Resource;
/**
* Created by wangning on 2018/1/2.
*/
@Component
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
public class BillOrderCheckTask {
@Resource
private BillOrderMapper billOrderMapper;
@Resource
private OrderMapper orderMapper;
@Scheduled(cron = "0 0/3 * * * ?")
public void checkGreenChannel() {
List<String> orderIds = billOrderMapper.findOrderIdByStatus("0");
orderIds.forEach((p) -> {
JSONObject order = orderMapper.find(p);
if(order.getIntValue("status")==3||order.getIntValue("status")==1){
billOrderMapper.updateStatusByOrderId(p,"2");
}
});
}
}

@ -30,4 +30,14 @@
and order_status = #{param.status}
</if>
</select>
<select id="findOrderIdByStatus" resultType="java.lang.String">
select order_id from pmt_bill_order
where order_status = #{order_status}
</select>
<update id="updateStatusByOrderId">
update pmt_bill_order
set order_status = #{order_status}
where order_id = #{order_id}
</update>
</mapper>
Loading…
Cancel
Save