diff --git a/src/main/java/cn/com/tenlion/systemtask/controller/api/receiveruser/ReceiverUserController.java b/src/main/java/cn/com/tenlion/systemtask/controller/api/receiveruser/ReceiverUserController.java index 1de87f9..6d818f2 100644 --- a/src/main/java/cn/com/tenlion/systemtask/controller/api/receiveruser/ReceiverUserController.java +++ b/src/main/java/cn/com/tenlion/systemtask/controller/api/receiveruser/ReceiverUserController.java @@ -171,8 +171,8 @@ public class ReceiverUserController extends DefaultBaseController { * 任务执行状态监测 * 通过获取任务下派时设置的下派超时限制与当前时间做计算来判断是否超时(是否即将超时) */ - @Scheduled(cron = "0 0/5 * * * ?") - // @Scheduled(cron = "0/5 * * * * ?") + // @Scheduled(cron = "0 0/5 * * * ?") + @Scheduled(cron = "0/5 * * * * ?") @Async public void executeStatusTasks() throws ParseException { System.err.println("----------任务执行状态监测开始----------"); diff --git a/src/main/java/cn/com/tenlion/systemtask/service/distributesub/impl/DistributeSubServiceImpl.java b/src/main/java/cn/com/tenlion/systemtask/service/distributesub/impl/DistributeSubServiceImpl.java index a3b58b3..1d88180 100644 --- a/src/main/java/cn/com/tenlion/systemtask/service/distributesub/impl/DistributeSubServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemtask/service/distributesub/impl/DistributeSubServiceImpl.java @@ -16,6 +16,8 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Service; import java.util.*; @@ -53,8 +55,9 @@ public class DistributeSubServiceImpl extends DefaultBaseService implements IDis String distributeSubId = UUIDUtil.getUUID(); Map params = HashMapUtil.beanToMap(distributeSubVO); params.put("distributeSubId", distributeSubId); + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); try { - if (null == securityComponent) { + if (null != authentication) { if (StringUtils.isBlank(token)) { setSaveInfo(params); } else { diff --git a/src/main/java/cn/com/tenlion/systemtask/service/receiveruser/impl/ReceiverUserServiceImpl.java b/src/main/java/cn/com/tenlion/systemtask/service/receiveruser/impl/ReceiverUserServiceImpl.java index 0eba7fc..93ef661 100644 --- a/src/main/java/cn/com/tenlion/systemtask/service/receiveruser/impl/ReceiverUserServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemtask/service/receiveruser/impl/ReceiverUserServiceImpl.java @@ -27,6 +27,8 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Service; import java.text.ParseException; @@ -77,8 +79,9 @@ public class ReceiverUserServiceImpl extends DefaultBaseService implements IRece String receiverUserId = UUIDUtil.getUUID(); Map params = HashMapUtil.beanToMap(receiverUserVO); params.put("receiverUserId", receiverUserId); + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); try { - if (null == securityComponent) { + if (null != authentication) { if (StringUtils.isBlank(token)) { setSaveInfo(params); } else { diff --git a/src/main/java/cn/com/tenlion/systemtask/service/urge/impl/UrgeServiceImpl.java b/src/main/java/cn/com/tenlion/systemtask/service/urge/impl/UrgeServiceImpl.java index 007c396..53349d4 100644 --- a/src/main/java/cn/com/tenlion/systemtask/service/urge/impl/UrgeServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemtask/service/urge/impl/UrgeServiceImpl.java @@ -17,6 +17,8 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Service; import java.util.*; @@ -54,8 +56,9 @@ public class UrgeServiceImpl extends DefaultBaseService implements IUrgeService String urgeId = UUIDUtil.getUUID(); Map params = HashMapUtil.beanToMap(urgeVO); params.put("urgeId", urgeId); + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); try { - if (null == securityComponent) { + if (null != authentication) { if (StringUtils.isBlank(token)) { setSaveInfo(params); } else {