微信发送消息数据优化
需求:用户体验慢,需要实现先返回后执行代码功能
线程创建和运行
ThreadUtil threadUtil = new ThreadUtil(systemService,userid,openid); threadUtil.start();
这里是线程创建得run方法实现
package com.jeecg.pai.extend.util; import com.jeecg.offical.util.GlobalConfig; import org.jeecgframework.web.system.service.SystemService; import java.io.IOException; public class ThreadUtil extends Thread { private String userid; private SystemService systemService; private String openid; public ThreadUtil(SystemService systemService,String userid,String openid){ this.userid=userid; this.systemService=systemService; this.openid=openid; } public ThreadUtil() { } public ThreadUtil(String thread1) { } public void run() { try { System.out.println("openid =进入了子线程 " + openid); GlobalConfig.noticeManagerAuditAd(systemService, userid, openid, 2); } catch (IOException e) { e.printStackTrace(); } } }
另启一个线程发送即可