diff --git a/hxhq-api/hxhq-api-system/src/main/java/com/hxhq/system/api/RemoteUserService.java b/hxhq-api/hxhq-api-system/src/main/java/com/hxhq/system/api/RemoteUserService.java index 59f3179..82bfd2b 100644 --- a/hxhq-api/hxhq-api-system/src/main/java/com/hxhq/system/api/RemoteUserService.java +++ b/hxhq-api/hxhq-api-system/src/main/java/com/hxhq/system/api/RemoteUserService.java @@ -51,4 +51,16 @@ public interface RemoteUserService */ @PutMapping("/user/recordlogin") public R recordUserLogin(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); + + /** + * 测试Feign跨服务调用 + */ + @PostMapping("/business/study/testFeign") + public void testFeign(); + + /** + * 自动归还试验 + */ + @PostMapping("/business/study/autoGh") + public void autoGhStudy(); } diff --git a/hxhq-api/hxhq-api-system/src/main/java/com/hxhq/system/api/factory/RemoteUserFallbackFactory.java b/hxhq-api/hxhq-api-system/src/main/java/com/hxhq/system/api/factory/RemoteUserFallbackFactory.java index 3c75c25..2ed6494 100644 --- a/hxhq-api/hxhq-api-system/src/main/java/com/hxhq/system/api/factory/RemoteUserFallbackFactory.java +++ b/hxhq-api/hxhq-api-system/src/main/java/com/hxhq/system/api/factory/RemoteUserFallbackFactory.java @@ -42,6 +42,14 @@ public class RemoteUserFallbackFactory implements FallbackFactorycom.hxhq hxhq-common-swagger - - com.hxhq - hxhq-modules-system - 3.6.6 - compile - diff --git a/hxhq-modules/hxhq-job/src/main/java/com/hxhq/job/task/RyTask.java b/hxhq-modules/hxhq-job/src/main/java/com/hxhq/job/task/RyTask.java index 935c99a..d664539 100644 --- a/hxhq-modules/hxhq-job/src/main/java/com/hxhq/job/task/RyTask.java +++ b/hxhq-modules/hxhq-job/src/main/java/com/hxhq/job/task/RyTask.java @@ -1,35 +1,24 @@ package com.hxhq.job.task; -import com.hxhq.business.service.IGyzjFfjlService; -import com.hxhq.business.service.IGyzjService; -import com.hxhq.business.service.IMjyFfjlService; -import com.hxhq.business.service.IMjyService; +import com.hxhq.system.api.RemoteUserService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.hxhq.common.core.utils.StringUtils; -import java.util.Date; - /** * 定时任务调度测试 - * + * * @author hxhq */ @Component("ryTask") public class RyTask { protected Logger logger = LoggerFactory.getLogger(getClass()); - - @Autowired - private IGyzjService gyzjService; @Autowired - private IGyzjFfjlService gyzjFfjlService; - @Autowired - private IMjyService mjyService; - @Autowired - private IMjyFfjlService mjyFfjlService; + private RemoteUserService remoteUserService; + public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) { @@ -46,44 +35,17 @@ public class RyTask System.out.println("执行无参方法"); } - - //region 麻精药 - - /** - * 麻精药借阅到期自动归还 - */ - public void autoJyExpireReturnMjy() + public void testJob() { - mjyService.autoJyExpireReturn(); + System.out.println("testJob"); + remoteUserService.testFeign(); } /** - * 麻精药发放记录借阅到期自动归还 + * 到期自动归还试验 */ - public void autoJyExpireReturnMjyFfjl() + public void autoGhStudy() { - mjyFfjlService.autoJyExpireReturn(); + remoteUserService.autoGhStudy(); } - - //endregion - - //region 给药制剂 - - /** - * 给药制剂借阅到期自动归还 - */ - public void autoJyExpireReturnGyzj() - { - gyzjService.autoJyExpireReturn(); - } - - /** - * 给药制剂发放记录借阅到期自动归还 - */ - public void autoJyExpireReturnGyzjFfjl() - { - gyzjFfjlService.autoJyExpireReturn(); - } - - //endregion } diff --git a/hxhq-modules/hxhq-job/src/main/resources/bootstrap.yml b/hxhq-modules/hxhq-job/src/main/resources/bootstrap.yml index 24f3a05..5a02a8f 100644 --- a/hxhq-modules/hxhq-job/src/main/resources/bootstrap.yml +++ b/hxhq-modules/hxhq-job/src/main/resources/bootstrap.yml @@ -25,3 +25,7 @@ spring: # 共享配置 shared-configs: - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} +# token配置 +token: + # 是否允许账户多终端同时登录(true允许 false不允许) + soloLogin: false \ No newline at end of file diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java index aa9d6a6..d5ad051 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java @@ -392,5 +392,23 @@ public class StudyController extends BaseController return AjaxResult.success(); } + /** + * 测试Feign + */ + @PostMapping("/testFeign") + public void testFeign() + { + logger.info("testFeign进来"); + } + + /** + * 自动归还到期试验 + */ + @PostMapping("/autoGh") + public void autoGh() + { + studyService.autoGh(); + } + //endregion } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java index 1934bad..de196d4 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java @@ -148,6 +148,11 @@ public interface IStudyService extends IService */ void gh(StudySaveForm form); + /** + * 到期自动归还 + */ + void autoGh(); + // endregion } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java index 9b267a6..edd4c32 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java @@ -532,7 +532,7 @@ public class StudyServiceImpl extends ServiceImpl implements archiveLogService.saveInfo(ArchiveLogTypeEnum.sy,StudyTypeEnum.getEnumByValue(info.getType()),info.getId(),info.getName(),info.getSn(),info.getLeaderName(),study.getStatus().equals(StudyStatusEnum.ysd.getValue())?"拒绝归档":"同意归档"); String title = StudyTypeEnum.getEnumByValue(info.getType()).getText()+"【"+info.getName()+"("+info.getSn()+")】提交的申请归档已"+sign.getQmyy()+(study.getStatus().equals(StudyStatusEnum.ysd.getValue())?(",原因:"+sign.getRemark()):""); - noticeService.save(title,study.getLeader(),getNoticeUrl(info)); + noticeService.save(title,info.getLeader(),getNoticeUrl(info)); } private String getNoticeUrl(Study study){ @@ -562,7 +562,7 @@ public class StudyServiceImpl extends ServiceImpl implements archiveLogService.saveInfo(ArchiveLogTypeEnum.sy,StudyTypeEnum.getEnumByValue(info.getType()),info.getId(),info.getName(),info.getSn(),info.getLeaderName(),study.getStatus().equals(StudyStatusEnum.gd.getValue())?"拒绝解档":"同意解档"); String title = StudyTypeEnum.getEnumByValue(info.getType()).getText()+"【"+info.getName()+"("+info.getSn()+")】提交的申请解档已"+sign.getQmyy()+(study.getStatus().equals(StudyStatusEnum.gd.getValue())?(",原因:"+sign.getRemark()):""); - noticeService.save(title,study.getLeader(),getNoticeUrl(info)); + noticeService.save(title,info.getLeader(),getNoticeUrl(info)); } @Override @@ -589,7 +589,7 @@ public class StudyServiceImpl extends ServiceImpl implements archiveLogService.saveInfo(ArchiveLogTypeEnum.sy,StudyTypeEnum.getEnumByValue(info.getType()),info.getId(),info.getName(),info.getSn(),info.getLeaderName(),study.getBorrowStatus().equals(StudyBorrowStatusEnum.wjy.getValue())?"拒绝借阅":"同意借阅"); String title = StudyTypeEnum.getEnumByValue(info.getType()).getText()+"【"+info.getName()+"("+info.getSn()+")】提交的申请借阅已"+sign.getQmyy()+(study.getBorrowStatus().equals(StudyBorrowStatusEnum.wjy.getValue())?(",原因:"+sign.getRemark()):""); - noticeService.save(title,study.getLeader(),getNoticeUrl(info)); + noticeService.save(title,info.getLeader(),getNoticeUrl(info)); } @Override @@ -615,7 +615,33 @@ public class StudyServiceImpl extends ServiceImpl implements archiveLogService.saveInfo(ArchiveLogTypeEnum.sy,StudyTypeEnum.getEnumByValue(info.getType()),info.getId(),info.getName(),info.getSn(),info.getLeaderName(),"确认归还"); String title = StudyTypeEnum.getEnumByValue(info.getType()).getText()+"【"+info.getName()+"("+info.getSn()+")】提交的申请借阅已确认归还"; - noticeService.save(title,study.getLeader(),getNoticeUrl(info)); + noticeService.save(title,info.getLeader(),getNoticeUrl(info)); + } + + @Override + @Transactional + public void autoGh() { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("status",StudyStatusEnum.gd.getValue()); + queryWrapper.eq("borrow_status",StudyBorrowStatusEnum.jyz.getValue()); + queryWrapper.lt("borrow_end_date",DateUtils.getDate()); + List studyList = list(queryWrapper); + for(Study info : studyList){ + try{ + info.setBorrowStatus(StudyBorrowStatusEnum.wjy.getValue()); + updateById(info); + + SignForm sign = new SignForm(); + sign.setQmyy("到期自动归还"); + sign.setQmyyEn("Check-out End on Time"); + studyJcgjService.saveInfo(info.getId(), JcgjlxEnum.lc, JcmcysEnum.blue,null,null,sign); + + String title = StudyTypeEnum.getEnumByValue(info.getType()).getText()+"【"+info.getName()+"("+info.getSn()+")】提交的申请借阅已到期自动归还"; + noticeService.save(title,info.getLeader(),getNoticeUrl(info)); + }catch (Exception e){ + log.error("自动归还试验出错",e); + } + } } //endregion