From f8b9a8cec961040962f35a16b00580ca3adacf29 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 3 Jan 2024 16:35:53 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=EF=BC=9A=E8=AF=81=E4=B9=A6=E5=88=B0=E6=9C=9F?= =?UTF-8?q?=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduled/mapper/basic/CertificatetMapper.xml | 6 - .../mapper/basic/CertificatetNoticeMapper.xml | 6 - .../mapper/basic/PersonManagemetMapper.xml | 97 -------------- .../scheduled/scheduled/BasicScheduledTask.java | 148 +++++++++++++++++++++ .../scheduled/scheduled/basicScheduledTask.java | 141 -------------------- .../service/basic/IImsPresonManagementService.java | 21 +++ .../basic/impl/CertificatetNoticeServiceImpl.java | 2 + .../basic/impl/CertificatetServiceImpl.java | 2 + .../basic/impl/PresonManagementServiceImpl.java | 27 ++++ .../resources/mapper/basic/CertificatetMapper.xml | 6 + .../mapper/basic/CertificatetNoticeMapper.xml | 6 + .../mapper/basic/PersonManagemetMapper.xml | 97 ++++++++++++++ 12 files changed, 309 insertions(+), 250 deletions(-) delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetMapper.xml delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetNoticeMapper.xml delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/PersonManagemetMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/basicScheduledTask.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/IImsPresonManagementService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/PresonManagementServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/basic/CertificatetMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/basic/CertificatetNoticeMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/basic/PersonManagemetMapper.xml diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetMapper.xml deleted file mode 100644 index 6941d55..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetMapper.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetNoticeMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetNoticeMapper.xml deleted file mode 100644 index c951079..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/CertificatetNoticeMapper.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/PersonManagemetMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/PersonManagemetMapper.xml deleted file mode 100644 index 409cbfb..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/basic/PersonManagemetMapper.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java new file mode 100644 index 0000000..843c270 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java @@ -0,0 +1,148 @@ +package com.hnac.hzims.scheduled.scheduled; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.basic.entity.CertificatetEntity; +import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; +import com.hnac.hzims.basic.entity.PersonManagemetEntity; +import com.hnac.hzims.message.MessageConstants; +import com.hnac.hzims.message.dto.BusinessMessageDTO; +import com.hnac.hzims.message.entity.config.SmsConfigEntity; +import com.hnac.hzims.message.fegin.IMessageClient; +import com.hnac.hzims.message.fegin.IMessageConfigClient; +import com.hnac.hzims.scheduled.mapper.basic.PersonManagemetMapper; +import com.hnac.hzims.scheduled.service.basic.IImsCertificatetNoticeService; +import com.hnac.hzims.scheduled.service.basic.IImsCertificatetService; +import com.hnac.hzims.scheduled.service.basic.IImsPresonManagementService; +import com.xxl.job.core.biz.model.ReturnT; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.junit.jupiter.api.Test; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + + +/** + * 排班到期定时任务通知 + * + * @author ty + */ +@Slf4j +@Component +public class BasicScheduledTask { + + @Autowired + private IImsCertificatetService iImsCertificatetService; + @Autowired + private IImsCertificatetNoticeService iImsCertificatetNoticeService; + @Autowired + private ISysClient sysClient; + @Autowired + private IUserClient userClient; + @Autowired + private IMessageClient messageClient; + @Autowired + private IImsPresonManagementService presonManagementService; + @Autowired + private IMessageConfigClient messageConfigClient; + + /** + * realId刷新 + */ +// @XxlJob(CERTIFICATET_DEAD_LINE_NOTICE) + @Scheduled(cron = "0/40 * * * * ? ") +// public ReturnT certificatetDeadLineNotice(String param) throws ParseException { + public ReturnT certificatetDeadLineNotice() throws ParseException { + Date endTime = new Date(); + String param=""; + if (StringUtils.isNotBlank(param)) { + endTime = new SimpleDateFormat("yyyy-MM-dd").parse(param); + } + CertificatetNoticeEntity noticeEntity = iImsCertificatetNoticeService.getOne(Wrappers.lambdaQuery() + .eq(CertificatetNoticeEntity::getIsDeleted, 0) + .last("limit 1;")); + //用户档案过期截止时间 + Date date = DateUtil.plusDays(endTime, noticeEntity.getSafeTime()); + List list = iImsCertificatetService.list(Wrappers.lambdaQuery() + .le(CertificatetEntity::getDeadTime, date)); + String noticeUsers = noticeEntity.getNoticeUsers(); + List userList = Arrays.asList(noticeUsers.split(",")); + if (CollectionUtil.isNotEmpty(userList) && CollectionUtil.isNotEmpty(list)) { + List personIds = list.stream().map(CertificatetEntity::getPersonId).collect(Collectors.toList()); + List personManagemetEntities = presonManagementService.list(Wrappers.query().lambda().in(PersonManagemetEntity::getId, personIds)); + String personNotice=""; + if (CollectionUtil.isNotEmpty(personManagemetEntities)) { + personNotice = personManagemetEntities.stream().map(PersonManagemetEntity::getName).collect(Collectors.joining(",")); + } + if ("1".equals(noticeEntity.getSendType())) { + sendSmsByUserList(userList, date,personNotice); + } + sendMessage(list.get(0), noticeEntity.getSafeTime(), noticeEntity.getNoticeUsers(),personNotice); + } + return new ReturnT<>("SUCCESS"); + } + + @Test + public void getVideoMonitor() throws ParseException { + ReturnT stringReturnT = this.certificatetDeadLineNotice(); + } + + private void sendSmsByUserList(List userList, Date date,String personNotice) { + //区分用户 + for (String s : userList) { + User user = UserCache.getUser(Long.valueOf(s)); + String phone = ""; + if (ObjectUtil.isNotEmpty(user)) { + phone = user.getPhone(); + } + //短信推送 + String code = "certificatetNotice"; + SmsConfigEntity smsConfigEntity = messageConfigClient.getSmsConfigByBusinessKey(code); + Map contentParams = new HashMap<>(2); + contentParams.put("one", personNotice); + String deadLine = DateUtil.format(date, "yyyy-MM-dd"); + contentParams.put("two", deadLine); + smsConfigEntity.setTemplateParam(JSONObject.toJSONString(contentParams)); + smsConfigEntity.setPhones(phone); + messageConfigClient.pushSmsMessageByConfig(smsConfigEntity); + } + } + + private void sendMessage(CertificatetEntity certificatetEntity, Integer date, String users,String personNotice) { +// //注意:通知人是创建人所在机构 + BusinessMessageDTO message = new BusinessMessageDTO(); + message.setBusinessClassify("system"); + message.setBusinessKey(MessageConstants.BusinessClassifyEnum.CERTIFICATETNOTICE.getKey()); + message.setSubject(MessageConstants.BusinessClassifyEnum.CERTIFICATETNOTICE.getDescription()); + message.setTaskId(System.currentTimeMillis()); + message.setTenantId("200000"); + String countent = + personNotice + "的证书即将到期,请提交新的证书资料"; + message.setContent(countent); + message.setDeptId(certificatetEntity.getCreateDept()); + R deptName = sysClient.getDeptName(certificatetEntity.getCreateDept()); + if (deptName.isSuccess()) { + message.setDeptName(deptName.getData()); + } + message.setUserIds(users); + User admin = userClient.userByAccount("200000", "admin").getData(); + message.setCreateUser(admin.getId()); + messageClient.sendAppAndWsMsgByUsers(message); + } + + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/basicScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/basicScheduledTask.java deleted file mode 100644 index 9b72730..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/basicScheduledTask.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.hnac.hzims.scheduled.scheduled; - -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hnac.hzims.basic.entity.CertificatetEntity; -import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; -import com.hnac.hzims.basic.entity.PersonManagemetEntity; -import com.hnac.hzims.message.MessageConstants; -import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.entity.config.SmsConfigEntity; -import com.hnac.hzims.message.fegin.IMessageClient; -import com.hnac.hzims.message.fegin.IMessageConfigClient; -import com.hnac.hzims.scheduled.mapper.basic.PersonManagemetMapper; -import com.hnac.hzims.scheduled.service.basic.IImsCertificatetNoticeService; -import com.hnac.hzims.scheduled.service.basic.IImsCertificatetService; -import com.xxl.job.core.biz.model.ReturnT; -import com.xxl.job.core.handler.annotation.XxlJob; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.DateUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.system.feign.ISysClient; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; -import org.springblade.system.user.feign.IUserClient; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; - -import static com.hnac.hzims.operational.main.constant.MainConstants.*; - - -/** - * 排班到期定时任务通知 - * - * @author ty - */ -@Slf4j -@Component -public class basicScheduledTask { - - @Autowired - private IImsCertificatetService iImsCertificatetService; - @Autowired - private IImsCertificatetNoticeService iImsCertificatetNoticeService; - @Autowired - private ISysClient sysClient; - @Autowired - private IUserClient userClient; - @Autowired - private IMessageClient messageClient; - @Autowired - private PersonManagemetMapper personManagemetMapper; - @Autowired - private IMessageConfigClient messageConfigClient; - - /** - * realId刷新 - */ - @XxlJob(CERTIFICATET_DEAD_LINE_NOTICE) -// @Scheduled(cron = "0 */1 * * * ? ") - public ReturnT certificatetDeadLineNotice(String param) throws ParseException { - Date endTime = new Date(); - if (Func.isBlank(param)) { - endTime = new SimpleDateFormat("yyyy-MM-dd").parse(param); - } - CertificatetNoticeEntity noticeEntity = iImsCertificatetNoticeService.getOne(Wrappers.lambdaQuery() - .eq(CertificatetNoticeEntity::getIsDeleted, 0) - .last("limit 1;")); - //用户档案过期截止时间 - Date date = DateUtil.plusDays(endTime, noticeEntity.getSafeTime()); - List list = iImsCertificatetService.list(Wrappers.lambdaQuery() - .le(CertificatetEntity::getDeadTime, date)); - String noticeUsers = noticeEntity.getNoticeUsers(); - List userList = Arrays.asList(noticeUsers.split(",")); - if (CollectionUtil.isNotEmpty(userList) && CollectionUtil.isNotEmpty(list)) { - List personIds = list.stream().map(CertificatetEntity::getPersonId).collect(Collectors.toList()); - List personManagemetEntities = personManagemetMapper.selectList(Wrappers.query().lambda().in(PersonManagemetEntity::getId, personIds)); - String personNotice=""; - if (CollectionUtil.isNotEmpty(personManagemetEntities)) { - personNotice = personManagemetEntities.stream().map(PersonManagemetEntity::getName).collect(Collectors.joining(",")); - } - if ("1".equals(noticeEntity.getSendType())) { - sendSmsByUserList(userList, date,personNotice); - } - sendMessage(list.get(0), noticeEntity.getSafeTime(), noticeEntity.getNoticeUsers(),personNotice); - } - return new ReturnT<>("SUCCESS"); - } - - private void sendSmsByUserList(List userList, Date date,String personNotice) { - //区分用户 - for (String s : userList) { - User user = UserCache.getUser(Long.valueOf(s)); - String phone = ""; - if (ObjectUtil.isNotEmpty(user)) { - phone = user.getPhone(); - } - //短信推送 - String code = "certificatetNotice"; - SmsConfigEntity smsConfigEntity = messageConfigClient.getSmsConfigByBusinessKey(code); - Map contentParams = new HashMap<>(2); - contentParams.put("one", personNotice); - String deadLine = DateUtil.format(date, "yyyy-MM-dd"); - contentParams.put("two", deadLine); - smsConfigEntity.setTemplateParam(JSONObject.toJSONString(contentParams)); - smsConfigEntity.setPhones(phone); - messageConfigClient.pushSmsMessageByConfig(smsConfigEntity); - } - } - - private void sendMessage(CertificatetEntity certificatetEntity, Integer date, String users,String personNotice) { -// //注意:通知人是创建人所在机构 - BusinessMessageDTO message = new BusinessMessageDTO(); - message.setBusinessClassify("system"); - message.setBusinessKey(MessageConstants.BusinessClassifyEnum.CERTIFICATETNOTICE.getKey()); - message.setSubject(MessageConstants.BusinessClassifyEnum.CERTIFICATETNOTICE.getDescription()); - message.setTaskId(System.currentTimeMillis()); - message.setTenantId("200000"); - String countent = - personNotice + "的证书即将到期,请提交新的证书资料"; - message.setContent(countent); - message.setDeptId(certificatetEntity.getCreateDept()); - R deptName = sysClient.getDeptName(certificatetEntity.getCreateDept()); - if (deptName.isSuccess()) { - message.setDeptName(deptName.getData()); - } - message.setUserIds(users); - User admin = userClient.userByAccount("200000", "admin").getData(); - message.setCreateUser(admin.getId()); - messageClient.sendAppAndWsMsgByUsers(message); - } - - -} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/IImsPresonManagementService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/IImsPresonManagementService.java new file mode 100644 index 0000000..bc00a78 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/IImsPresonManagementService.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.scheduled.service.basic; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.basic.entity.PersonManagemetEntity; +import com.hnac.hzims.basic.vo.PersonManagemetExportVo; +import com.hnac.hzims.basic.vo.PersonManagemetVo; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; + +import java.util.List; + +/** + * 服务类 + * + * @author Chill + */ +public interface IImsPresonManagementService extends IService { + + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetNoticeServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetNoticeServiceImpl.java index b4e956d..f1b2210 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetNoticeServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetNoticeServiceImpl.java @@ -1,5 +1,6 @@ package com.hnac.hzims.scheduled.service.basic.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; import com.hnac.hzims.scheduled.mapper.basic.CertificatetNoticeMapper; import com.hnac.hzims.scheduled.service.basic.IImsCertificatetNoticeService; @@ -17,5 +18,6 @@ import org.springframework.stereotype.Service; @Service @Slf4j @RequiredArgsConstructor +@DS("basic") public class CertificatetNoticeServiceImpl extends BaseServiceImpl implements IImsCertificatetNoticeService { } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetServiceImpl.java index 8849e80..79b890c 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/CertificatetServiceImpl.java @@ -1,5 +1,6 @@ package com.hnac.hzims.scheduled.service.basic.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import com.hnac.hzims.basic.entity.CertificatetEntity; import com.hnac.hzims.scheduled.mapper.basic.CertificatetMapper; import com.hnac.hzims.scheduled.service.basic.IImsCertificatetService; @@ -17,5 +18,6 @@ import org.springframework.stereotype.Service; @Service @Slf4j @RequiredArgsConstructor +@DS("basic") public class CertificatetServiceImpl extends BaseServiceImpl implements IImsCertificatetService { } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/PresonManagementServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/PresonManagementServiceImpl.java new file mode 100644 index 0000000..04b2f84 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/basic/impl/PresonManagementServiceImpl.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.scheduled.service.basic.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.basic.entity.PersonManagemetEntity; +import com.hnac.hzims.scheduled.mapper.basic.PersonManagemetMapper; +import com.hnac.hzims.scheduled.service.basic.IImsPresonManagementService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + + + +/** + * 人员信息实现类 + * + * @author ty + */ +@Service +@Slf4j +@RequiredArgsConstructor +@DS("basic") +public class PresonManagementServiceImpl extends BaseServiceImpl implements IImsPresonManagementService { + + + +} diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/basic/CertificatetMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/basic/CertificatetMapper.xml new file mode 100644 index 0000000..6941d55 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/basic/CertificatetMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/basic/CertificatetNoticeMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/basic/CertificatetNoticeMapper.xml new file mode 100644 index 0000000..c951079 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/basic/CertificatetNoticeMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/basic/PersonManagemetMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/basic/PersonManagemetMapper.xml new file mode 100644 index 0000000..409cbfb --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/basic/PersonManagemetMapper.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From e7f4d3d54184ee0f6fd27eed97312306c132770c Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 3 Jan 2024 16:36:33 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=EF=BC=9A=E8=AF=81=E4=B9=A6=E5=88=B0=E6=9C=9F?= =?UTF-8?q?=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/scheduled/scheduled/BasicScheduledTask.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java index 843c270..8af696a 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java @@ -15,6 +15,7 @@ import com.hnac.hzims.scheduled.service.basic.IImsCertificatetNoticeService; import com.hnac.hzims.scheduled.service.basic.IImsCertificatetService; import com.hnac.hzims.scheduled.service.basic.IImsPresonManagementService; import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.junit.jupiter.api.Test; @@ -35,6 +36,8 @@ import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; +import static com.hnac.hzims.operational.main.constant.MainConstants.CERTIFICATET_DEAD_LINE_NOTICE; + /** * 排班到期定时任务通知 @@ -63,12 +66,12 @@ public class BasicScheduledTask { /** * realId刷新 */ -// @XxlJob(CERTIFICATET_DEAD_LINE_NOTICE) - @Scheduled(cron = "0/40 * * * * ? ") -// public ReturnT certificatetDeadLineNotice(String param) throws ParseException { - public ReturnT certificatetDeadLineNotice() throws ParseException { + @XxlJob(CERTIFICATET_DEAD_LINE_NOTICE) +// @Scheduled(cron = "0/40 * * * * ? ") + public ReturnT certificatetDeadLineNotice(String param) throws ParseException { +// public ReturnT certificatetDeadLineNotice() throws ParseException { +// String param=""; Date endTime = new Date(); - String param=""; if (StringUtils.isNotBlank(param)) { endTime = new SimpleDateFormat("yyyy-MM-dd").parse(param); } From af60bd7626f6494e954b8976ed5e9ca26d9fae80 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 3 Jan 2024 16:36:54 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=EF=BC=9A=E8=AF=81=E4=B9=A6=E5=88=B0=E6=9C=9F?= =?UTF-8?q?=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java index 8af696a..9d6940b 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BasicScheduledTask.java @@ -98,12 +98,6 @@ public class BasicScheduledTask { } return new ReturnT<>("SUCCESS"); } - - @Test - public void getVideoMonitor() throws ParseException { - ReturnT stringReturnT = this.certificatetDeadLineNotice(); - } - private void sendSmsByUserList(List userList, Date date,String personNotice) { //区分用户 for (String s : userList) { From f8dc2ca2496a5c4b8b5ccb64bfc643b4108009e1 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 3 Jan 2024 19:26:19 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java | 2 +- .../com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java b/hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java index adbf9b0..4b96c6a 100644 --- a/hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java +++ b/hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java @@ -37,6 +37,6 @@ public class VoteChartVo { @ExcelIgnore private List finishIds; @ApiModelProperty(value = "完成率") - @ExcelProperty(value = "完成率", index = 3) + @ExcelProperty(value = "完成率", index = 4) private Double finishRate; } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java index 455e33f..064ce83 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java @@ -1166,8 +1166,8 @@ public class TaskServiceImpl extends BaseServiceImpl imp if (CollectionUtil.isEmpty(list)||CollectionUtil.isEmpty(undoneIds)){ voteChartVo.setFinishRate(0.00d); }else { - BigDecimal divide = new BigDecimal(list.size()).divide(new BigDecimal(list.size()),2,BigDecimal.ROUND_UP); - voteChartVo.setFinishRate( divide.doubleValue()); + BigDecimal divide = new BigDecimal(finishIds.size()).divide(new BigDecimal(list.size()),2,BigDecimal.ROUND_UP); + voteChartVo.setFinishRate(divide.doubleValue()); } return voteChartVo; } From 0b30fb7114de97519ebba43991764c17324d592b Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 4 Jan 2024 09:39:33 +0800 Subject: [PATCH 5/5] =?UTF-8?q?#=E5=B7=A5=E4=BD=9C=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../process/constant/TicketProcessConstant.java | 5 + .../hzims/ticket/repair/entity/WorkTaskEntity.java | 118 +++++++++++++++++++++ .../hzims/ticket/repair/fegin/IWorkTaskClient.java | 26 +++++ .../repair/fegin/WorkTaskClientFallback.java | 17 +++ .../strategy/serviceimpl/WorkTaskServiceImpl.java | 44 ++++++++ .../hzims/ticket/repair/fegin/WorkTaskClient.java | 26 +++++ .../hzims/ticket/repair/mapper/WorkTaskMapper.java | 11 ++ .../ticket/repair/mapper/xml/WorkTaskMapper.xml | 6 ++ .../ticket/repair/service/IWorkTaskService.java | 13 +++ .../repair/service/impl/WorkTaskServiceImpl.java | 27 +++++ 10 files changed, 293 insertions(+) create mode 100644 hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java create mode 100644 hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IWorkTaskClient.java create mode 100644 hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClientFallback.java create mode 100644 hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/WorkTaskServiceImpl.java create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClient.java create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/WorkTaskMapper.java create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/xml/WorkTaskMapper.xml create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/IWorkTaskService.java create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java diff --git a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java index 5a7d5d3..d4098d5 100644 --- a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java +++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java @@ -45,6 +45,11 @@ public class TicketProcessConstant { * 检修任务 */ public static final String OVERHAUL_TASK = "overhaul_task"; + + /** + * 工作任务 + */ + public static final String WORK_TASK = "work_task"; // public static final String DEFECT_KEY = "defectCheck"; diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java new file mode 100644 index 0000000..3c26a42 --- /dev/null +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java @@ -0,0 +1,118 @@ +package com.hnac.hzims.ticket.repair.entity; + + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.NullSerializer; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tenant.mp.TenantEntity; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @author ysj + */ +@Data +@TableName("hzims_work_task") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "工作任务表", description = "工作任务表") +public class WorkTaskEntity extends TenantEntity { + + private static final long serialVersionUID = -3122149146340663132L; + + @ApiModelProperty(value = "设备code") + private String emCode; + + @ApiModelProperty(value = "编号") + private String number; + + @ApiModelProperty(value = "单位") + private String company; + + @ApiModelProperty(value = "处理状态") + private Integer handleStatus; + + @ApiModelProperty(value = "应急抢修发起人") + private Long originator; + + @ApiModelProperty(value = "应急抢修负责人") + private Long charge; + + @ApiModelProperty(value = "应急抢修班组") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Long repairTeam; + + @ApiModelProperty(value = "应急抢修人员") + private String repairPersonnel; + + @ApiModelProperty(value = "应急抢修任务描述") + private String repairTask; + + @ApiModelProperty(value = "安全措施") + private String safetyMeasures; + + @ApiModelProperty(value = "注意事项") + private String pointsAttention; + + @ApiModelProperty(value = "现场保留安全措施") + private String reserveMeasures; + + @ApiModelProperty(value = "许可人") + private Long licensor; + + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @ApiModelProperty(value = "许可时间") + private Date licensorTime; + + @ApiModelProperty(value = "许可人安全措施") + private String licensorMeasures; + + @ApiModelProperty(value = "许可人描述") + private String licensorMemo; + + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @ApiModelProperty(value = "许可完成确认时间") + private Date licensorCompleteTime; + + @ApiModelProperty(value = "抢修工时") + private String implementHours; + + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @ApiModelProperty(value = "抢修开始时间") + private Date implementStartTime; + + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @ApiModelProperty(value = "抢修结束时间") + private Date implementEndTime; + + @ApiModelProperty(value = "抢修描述") + private String implementDesc; + + @ApiModelProperty(value = "流程实例ID") + private String processInstanceId; +} diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IWorkTaskClient.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IWorkTaskClient.java new file mode 100644 index 0000000..f36fab3 --- /dev/null +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IWorkTaskClient.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.ticket.repair.fegin; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.ticket.constants.TicketConstants; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * @author ysj + */ +@FeignClient( + value = TicketConstants.APP_NAME, + fallback = RepairClientFallback.class +) +public interface IWorkTaskClient { + + String API_PREFIX = "/feign/workTask"; + + String WORK_TASK_PROCESS_LISTENER = API_PREFIX + "/listener"; + + @PostMapping(WORK_TASK_PROCESS_LISTENER) + R listener(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse); +} + diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClientFallback.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClientFallback.java new file mode 100644 index 0000000..98bbd47 --- /dev/null +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClientFallback.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.ticket.repair.fegin; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import org.springblade.core.tool.api.R; +import org.springframework.stereotype.Component; + +/** + * @author ysj + */ +@Component +public class WorkTaskClientFallback implements IWorkTaskClient { + + @Override + public R listener(ProcessWorkFlowResponse processWorkFlowResponse) { + return R.status(false); + } +} diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/WorkTaskServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/WorkTaskServiceImpl.java new file mode 100644 index 0000000..e9f5d72 --- /dev/null +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/WorkTaskServiceImpl.java @@ -0,0 +1,44 @@ +package com.hnac.hzims.middle.processflow.strategy.serviceimpl; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.processflow.service.ProcessDictService; +import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService; +import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.WORK_TASK; + +/** + * @author ysj + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class WorkTaskServiceImpl extends ProcessAbstractService { + + private final ProcessDictService processDictService; + + /** + * 消息确认-工作任务单 + * @param flowQueue + * @return + */ + @Override + public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { + String dictValue = processDictService.selectDictValueByKey(WORK_TASK); + return dictValue.equals(flowQueue.getProcessDefinitionKey()); + } + + /** + * 调用工作任务流程监听 + * @param response + */ + @Override + public void calculate(ProcessWorkFlowResponse response) { + + /*if (!defect.isSuccess()) { + throw new ServiceException("检修任务业务执行异常!"); + }*/ + } +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClient.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClient.java new file mode 100644 index 0000000..0b9f97f --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/fegin/WorkTaskClient.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.ticket.repair.fegin; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.ticket.repair.service.IWorkTaskService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author ysj + */ +@RestController +@Slf4j +@AllArgsConstructor +public class WorkTaskClient implements IWorkTaskClient { + + private final IWorkTaskService workTaskService; + + @Override + @PostMapping(WORK_TASK_PROCESS_LISTENER) + public R listener(ProcessWorkFlowResponse processWorkFlowResponse) { + return R.status(workTaskService.listener(processWorkFlowResponse)); + } +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/WorkTaskMapper.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/WorkTaskMapper.java new file mode 100644 index 0000000..5776107 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/WorkTaskMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.ticket.repair.mapper; + +import com.hnac.hzims.ticket.repair.entity.WorkTaskEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface WorkTaskMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/xml/WorkTaskMapper.xml b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/xml/WorkTaskMapper.xml new file mode 100644 index 0000000..a190f1a --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/mapper/xml/WorkTaskMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/IWorkTaskService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/IWorkTaskService.java new file mode 100644 index 0000000..9d7b25f --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/IWorkTaskService.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.ticket.repair.service; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.ticket.repair.entity.WorkTaskEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface IWorkTaskService extends BaseService { + + boolean listener(ProcessWorkFlowResponse processWorkFlowResponse); +} \ No newline at end of file diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java new file mode 100644 index 0000000..eef3891 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.ticket.repair.service.impl; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.ticket.repair.entity.WorkTaskEntity; +import com.hnac.hzims.ticket.repair.mapper.WorkTaskMapper; +import com.hnac.hzims.ticket.repair.service.IWorkTaskService; +import lombok.RequiredArgsConstructor; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@RequiredArgsConstructor +public class WorkTaskServiceImpl extends BaseServiceImpl implements IWorkTaskService { + + /** + * 工作任务流程监听 :业务处理 + * @param processWorkFlowResponse + * @return + */ + @Override + public boolean listener(ProcessWorkFlowResponse processWorkFlowResponse) { + return false; + } +} \ No newline at end of file