| @@ -17,9 +17,11 @@ import com.simple.utils.HttpUtil; | |||||
| import com.simple.utils.RsaUtil; | import com.simple.utils.RsaUtil; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.web.multipart.MultipartFile; | |||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.concurrent.Executors; | |||||
| import java.util.concurrent.ScheduledExecutorService; | |||||
| import java.util.concurrent.TimeUnit; | |||||
| @Service | @Service | ||||
| public class WxMsgServiceImpl implements WxMsgService { | public class WxMsgServiceImpl implements WxMsgService { | ||||
| @@ -54,7 +56,7 @@ public class WxMsgServiceImpl implements WxMsgService { | |||||
| } | } | ||||
| //是否立即发送 | //是否立即发送 | ||||
| if (wxMsg.getIsright() == 0) { | |||||
| if (wxMsg.getIsright() == 1) { | |||||
| wxMsg.setStatus(1); | wxMsg.setStatus(1); | ||||
| sendmsg(wxMsg); | sendmsg(wxMsg); | ||||
| } else { | } else { | ||||
| @@ -73,7 +75,7 @@ public class WxMsgServiceImpl implements WxMsgService { | |||||
| } | } | ||||
| //是否立即发送 | //是否立即发送 | ||||
| if (wxMsg.getIsright() == 0) { | |||||
| if (wxMsg.getIsright() == 1) { | |||||
| wxMsg.setStatus(1); | wxMsg.setStatus(1); | ||||
| sendmsg(wxMsg); | sendmsg(wxMsg); | ||||
| } else { | } else { | ||||
| @@ -81,6 +83,8 @@ public class WxMsgServiceImpl implements WxMsgService { | |||||
| wxMsg.setStatus(0); | wxMsg.setStatus(0); | ||||
| wxMsgMapper.updateByPrimaryKeySelective(wxMsg); | wxMsgMapper.updateByPrimaryKeySelective(wxMsg); | ||||
| return new ResultData(Result.SUCCESS, "短信会在预设时间发送"); | return new ResultData(Result.SUCCESS, "短信会在预设时间发送"); | ||||
| } | } | ||||
| } | } | ||||
| @@ -170,4 +174,14 @@ public class WxMsgServiceImpl implements WxMsgService { | |||||
| } | } | ||||
| public static void main(String args[]){ | |||||
| ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); | |||||
| service.scheduleAtFixedRate(()->System.out.println("task ScheduledExecutorService "+new Date()), 0, 1, TimeUnit.SECONDS); | |||||
| } | |||||
| } | } | ||||