yang_shj
1 year ago
86 changed files with 2170 additions and 6 deletions
@ -0,0 +1,12 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface ContentMapper extends BaseMapper<ContentEntity>{ |
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.obj.entity.ObjectEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface ObjectMapper extends BaseMapper<ObjectEntity> { |
||||
|
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface ObjectUserMapper extends BaseMapper<ObjectUserEntity>{ |
||||
|
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface PlanMapper extends UserDataScopeBaseMapper<PlanEntity> { |
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanObjectTemplateEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface PlanObjectTemplateMapper extends BaseMapper<PlanObjectTemplateEntity> { |
||||
|
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanOrgEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface PlanOrgMapper extends BaseMapper<PlanOrgEntity> { |
||||
|
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanPositionEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface PlanPositionMapper extends BaseMapper<PlanPositionEntity> { |
||||
|
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanUserEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface PlanUserMapper extends BaseMapper<PlanUserEntity> { |
||||
|
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface ProjectContentMapper extends BaseMapper<ProjectContentEntity>{ |
||||
|
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface ProjectMapper extends BaseMapper<ProjectEntity>{ |
||||
|
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface TaskObjectMapper extends BaseMapper<TaskObjectEntity> { |
||||
|
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectContentEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface TaskObjectProjectContentMapper extends BaseMapper<TaskObjectProjectContentEntity> { |
||||
|
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectEntity; |
||||
import com.hnac.hzinfo.inspect.task.vo.TaskObjectProjectOfflineVO; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface TaskObjectProjectMapper extends BaseMapper<TaskObjectProjectEntity> { |
||||
|
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.task.entity.TaskResultEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface TaskResultMapper extends BaseMapper<TaskResultEntity> { |
||||
|
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface TaskUserMapper extends BaseMapper<TaskUserEntity> { |
||||
|
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.obj.entity.TemplateEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface TemplateMapper extends BaseMapper<TemplateEntity> { |
||||
|
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.scheduled.mapper.inspect; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzinfo.inspect.obj.entity.TemplateProjectEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Mapper |
||||
public interface TemplateProjectMapper extends BaseMapper<TemplateProjectEntity>{ |
||||
|
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.hnac.hzims.scheduled.mapper.operation; |
||||
|
||||
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; |
||||
import com.hnac.hzims.operational.duty.vo.*; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.springblade.core.datascope.annotation.UserDataAuth; |
||||
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface DutyMainMapper extends UserDataScopeBaseMapper<ImsDutyMainEntity> { |
||||
|
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.hnac.hzims.scheduled.scheduled; |
||||
|
||||
import com.hnac.hzims.scheduled.service.inspect.TaskService; |
||||
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.utils.DateUtil; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Component; |
||||
import java.util.Date; |
||||
|
||||
import static com.hnac.hzinfo.inspect.task.TaskContants.INSPECT_TASK_DISTRIBUTE; |
||||
|
||||
|
||||
/** |
||||
* 业务模块定时任务 |
||||
* @author ysj |
||||
*/ |
||||
@Slf4j |
||||
@Component |
||||
public class BusinessScheduledTask { |
||||
|
||||
@Autowired |
||||
private TaskService service; |
||||
|
||||
/** |
||||
* 首页-指标数据加载 |
||||
*/ |
||||
@XxlJob(INSPECT_TASK_DISTRIBUTE) |
||||
//@Scheduled(cron = "0/40 * * * * ? ")
|
||||
public ReturnT<String> inspectTaskDistribute(String param) { |
||||
if (Func.isBlank(param)) { |
||||
param = DateUtil.format(new Date(), "yyyy-MM"); |
||||
} |
||||
service.inspectTaskDistribute(param); |
||||
return new ReturnT<>("SUCCESS"); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface ContentService extends BaseService<ContentEntity> { |
||||
|
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.obj.entity.ObjectEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface ObjectService extends BaseService<ObjectEntity> { |
||||
|
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface ObjectUserService extends BaseService<ObjectUserEntity> { |
||||
|
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanObjectTemplateEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface PlanObjectTemplateService extends BaseService<PlanObjectTemplateEntity> { |
||||
|
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanOrgEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface PlanOrgService extends BaseService<PlanOrgEntity> { |
||||
|
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanPositionEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface PlanPositionService extends BaseService<PlanPositionEntity> { |
||||
|
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface PlanService extends BaseService<PlanEntity> { |
||||
|
||||
|
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanUserEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* 巡检计划用户模板服务类 |
||||
* |
||||
* @author Chill |
||||
*/ |
||||
public interface PlanUserService extends BaseService<PlanUserEntity> { |
||||
|
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
|
||||
import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface ProjectContentService extends BaseService<ProjectContentEntity>{ |
||||
|
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
|
||||
import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface ProjectService extends BaseService<ProjectEntity>{ |
||||
|
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectContentEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface TaskObjectProjectContentService extends BaseService<TaskObjectProjectContentEntity> { |
||||
|
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface TaskObjectProjectService extends BaseService<TaskObjectProjectEntity> { |
||||
|
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity; |
||||
import com.hnac.hzinfo.inspect.task.vo.TaskObjectOfflineVO; |
||||
import com.hnac.hzinfo.inspect.task.vo.TaskObjectVO; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface TaskObjectService extends BaseService<TaskObjectEntity> { |
||||
|
||||
} |
@ -0,0 +1,296 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.alibaba.fastjson.JSON; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.hnac.hzinfo.core.push.enums.PushAudienceType; |
||||
import com.hnac.hzinfo.core.push.model.PushAudience; |
||||
import com.hnac.hzinfo.core.push.model.PushInfo; |
||||
import com.hnac.hzinfo.core.push.model.PushPlatform; |
||||
import com.hnac.hzinfo.inspect.task.TaskContants; |
||||
import com.hnac.hzinfo.inspect.task.entity.TaskEntity; |
||||
import com.hnac.hzinfo.inspect.task.job.HzThreadPool; |
||||
import com.xxl.job.core.log.XxlJobLogger; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.sms.model.SmsResponse; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.CollectionUtil; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.resource.feign.IPushClient; |
||||
import org.springblade.resource.feign.ISmsClient; |
||||
import org.springblade.resource.vo.PushInfoVO; |
||||
import org.springblade.system.user.cache.UserCache; |
||||
import org.springblade.system.user.entity.User; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.beans.factory.annotation.Value; |
||||
import org.springframework.data.redis.core.DefaultTypedTuple; |
||||
import org.springframework.data.redis.core.RedisTemplate; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.time.LocalDate; |
||||
import java.time.LocalDateTime; |
||||
import java.time.ZoneOffset; |
||||
import java.time.format.DateTimeFormatter; |
||||
import java.util.*; |
||||
import java.util.concurrent.*; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* 巡检任务通知、短信提醒管理器 |
||||
* 提醒列表使用redis缓存 |
||||
* |
||||
* @author py |
||||
*/ |
||||
@Slf4j |
||||
@Component |
||||
public class TaskRemindManager { |
||||
|
||||
/** |
||||
* 巡检任务开始前发送短信信息阿里云模板 |
||||
**/ |
||||
@Value("${hzims.inspect.task.templateCode.taskBegin}") |
||||
private String taskBeginTemplateCode; |
||||
|
||||
/** |
||||
* 巡检任务结束前发送短信信息阿里云模板 |
||||
**/ |
||||
@Value("${hzims.inspect.task.templateCode.taskEnd}") |
||||
private String taskEndTemplateCode; |
||||
|
||||
/** |
||||
* 巡检消息推送模板 - 极光 |
||||
**/ |
||||
@Value("${hzims.inspect.task.jgPushCode}") |
||||
private String jgPushCode; |
||||
|
||||
@Autowired |
||||
private TaskService taskService; |
||||
@Autowired |
||||
private RedisTemplate redisTemplate; |
||||
@Autowired |
||||
private ISmsClient smsClient; |
||||
@Autowired |
||||
private IPushClient pushClient; |
||||
|
||||
|
||||
/** |
||||
* 开始前提醒任务列表 |
||||
*/ |
||||
final static String REMIND_TASK_BEGIN_LIST = "hzinfo:remind:begin:tasks"; |
||||
/** |
||||
* 结束前提醒任务列表 |
||||
*/ |
||||
final static String REMIND_TASK_END_LIST = "hzinfo:remind:end:tasks"; |
||||
|
||||
/** |
||||
* 开始 |
||||
* 重置redis开始提醒缓存列表 |
||||
* 按照时间排序 : 正序 |
||||
*/ |
||||
public void replaceBeginTaskCacheList(List<TaskEntity> taskBegin){ |
||||
//先删除
|
||||
redisTemplate.opsForZSet().removeRange(REMIND_TASK_BEGIN_LIST,0, -1); |
||||
setTaskBeginList(taskBegin); |
||||
} |
||||
|
||||
/** |
||||
* 结束 |
||||
* 重置redis结束提醒缓存列表 |
||||
* 按照时间排序 : 正序 |
||||
*/ |
||||
public void replaceEndTaskCacheList(List<TaskEntity> taskEnd){ |
||||
//先删除
|
||||
redisTemplate.opsForZSet().removeRange(REMIND_TASK_END_LIST,0, -1); |
||||
setTaskEndList(taskEnd); |
||||
} |
||||
|
||||
/** |
||||
* 开始 |
||||
* 任务批量加入redis提醒缓存列表中 |
||||
* |
||||
*/ |
||||
public void setTaskBeginList(List<TaskEntity> tasks){ |
||||
HashSet set = new HashSet(); |
||||
|
||||
for (TaskEntity task : tasks) { |
||||
DefaultTypedTuple<TaskEntity> tuple = new DefaultTypedTuple<>(task, (double) task.getStartRemindTime().toEpochSecond(ZoneOffset.of("+8"))); |
||||
set.add(tuple); |
||||
} |
||||
if(Func.isNotEmpty(set)){ |
||||
redisTemplate.opsForZSet().add(REMIND_TASK_BEGIN_LIST, set); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 结束 |
||||
* 任务批量加入redis提醒缓存列表中 |
||||
*/ |
||||
public void setTaskEndList(List<TaskEntity> tasks){ |
||||
HashSet set = new HashSet(); |
||||
for (TaskEntity task : tasks) { |
||||
DefaultTypedTuple<TaskEntity> tuple = new DefaultTypedTuple<>(task, (double) task.getEndRemindTime().toEpochSecond(ZoneOffset.of("+8"))); |
||||
set.add(tuple); |
||||
} |
||||
if(Func.isNotEmpty(set)){ |
||||
redisTemplate.opsForZSet().add(REMIND_TASK_END_LIST, set); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 把任务加入redis提醒缓存列表中 |
||||
* 加入的时候 按照时间排序 : 正序 |
||||
*/ |
||||
public void addTaskToCacheList(TaskEntity task){ |
||||
DateTimeFormatter dfShort = DateTimeFormatter.ofPattern("yyyy-MM-dd "); |
||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
||||
|
||||
redisTemplate.expire(REMIND_TASK_BEGIN_LIST,365,TimeUnit.DAYS); |
||||
if(task.getStartRemindTime().isAfter(LocalDateTime.parse(dfShort.format(LocalDate.now()) + "00:00:00", df))){ |
||||
redisTemplate.opsForZSet().add(REMIND_TASK_BEGIN_LIST, task, task.getStartRemindTime().toEpochSecond(ZoneOffset.of("+8"))); |
||||
log.info("--------------- key = hzinfo:remind:begin:tasks ---- size = " + redisTemplate.opsForZSet().size(REMIND_TASK_BEGIN_LIST)); |
||||
} |
||||
|
||||
if(task.getEndRemindTime().isAfter(LocalDateTime.parse(dfShort.format(LocalDate.now()) + "00:00:00", df))){ |
||||
redisTemplate.opsForZSet().add(REMIND_TASK_END_LIST, task, task.getEndRemindTime().toEpochSecond(ZoneOffset.of("+8"))); |
||||
log.info("--------------- key = hzinfo:remind:end:tasks ---- size = " + redisTemplate.opsForZSet().size(REMIND_TASK_END_LIST)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 任务开始前 |
||||
*/ |
||||
static final int BEGIN_SEND_FLAG = 1; |
||||
/** |
||||
* 任务结束前 |
||||
*/ |
||||
static final int END_SEND_FLAG = 2; |
||||
|
||||
/** |
||||
* 任务开始、结束前提醒 |
||||
*/ |
||||
public void taskRemind(){ |
||||
sendMsg(BEGIN_SEND_FLAG); |
||||
sendMsg(END_SEND_FLAG); |
||||
} |
||||
|
||||
/** |
||||
* 任务开始、结束前提醒 |
||||
*/ |
||||
public void cleanCache(){ |
||||
long currentTime = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")); |
||||
String key = REMIND_TASK_BEGIN_LIST; |
||||
for (int i = 0; i < 2; i++) { |
||||
if(i == 1 ){ |
||||
key = REMIND_TASK_END_LIST; |
||||
} |
||||
Set<TaskEntity> tasks = redisTemplate.opsForZSet().rangeByScore(key,0, currentTime); |
||||
if(Func.isNotEmpty(tasks)){ |
||||
for (TaskEntity task : tasks) { |
||||
//用户id为空,删除数据
|
||||
redisTemplate.opsForZSet().remove(key, task); |
||||
} |
||||
} |
||||
log.info(key + " 清空cache后 ---- size = " + redisTemplate.opsForZSet().size(key)); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 任务开始/结束前 |
||||
* 推送消息、发送短信 |
||||
* @param sendFlag 发送标识:任务开始前提醒 1;任务结束前提醒 2; |
||||
*/ |
||||
private void sendMsg(int sendFlag){ |
||||
//redis key; 消息推送标题; 短信模板code
|
||||
String key = "", title = "", templateCode = ""; |
||||
|
||||
switch (sendFlag){ |
||||
case BEGIN_SEND_FLAG: |
||||
key = REMIND_TASK_BEGIN_LIST; |
||||
title = "任务开始前提醒"; |
||||
templateCode = taskBeginTemplateCode; |
||||
break; |
||||
case END_SEND_FLAG: |
||||
key = REMIND_TASK_END_LIST; |
||||
title = "任务结束前提醒"; |
||||
templateCode = taskEndTemplateCode; |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
|
||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
||||
long currentTime = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")); |
||||
Set<TaskEntity> tasks = redisTemplate.opsForZSet().rangeByScore(key,0, currentTime); |
||||
if(Func.isNotEmpty(tasks)){ |
||||
//若该任务已完成 则无需再进行短信推送
|
||||
List<Long> taskIds = tasks.stream().map(TaskEntity::getId).collect(Collectors.toList()); |
||||
List<TaskEntity> undoneTaskList = taskService.list(Wrappers.<TaskEntity>lambdaQuery() |
||||
.ne(TaskEntity::getStatus, TaskContants.TaskStatusEnum.FINISH_STATUS.getStatus()) |
||||
.in(TaskEntity::getId, taskIds) |
||||
); |
||||
if(CollectionUtil.isEmpty(undoneTaskList)) { |
||||
XxlJobLogger.log("巡检短信通知列表为空;redis内取出数据为:" + JSON.toJSONString(taskIds)); |
||||
return; |
||||
} |
||||
List<Long> undoneTaskIds = undoneTaskList.stream().map(TaskEntity::getId).collect(Collectors.toList()); |
||||
for (TaskEntity task : tasks) { |
||||
if(!undoneTaskIds.contains(task.getId())) { |
||||
XxlJobLogger.log(task.getId()+"巡检任务已完成,无需推送短信"); |
||||
return; |
||||
} |
||||
XxlJobLogger.log(task.getId()+"开始推送消息!"); |
||||
// 移动端消息推送 : 使用 用户id做TAG,前端注册用户id为TAG
|
||||
PushInfoVO pushInfoVO = new PushInfoVO(); |
||||
pushInfoVO.setTenantId(task.getTenantId()); |
||||
PushPlatform platform = PushPlatform.all(); |
||||
Map<PushAudienceType, List<String>> audienceMap = new HashMap<>(); |
||||
audienceMap.put(PushAudienceType.TAG, Collections.singletonList(task.getUserId().toString())); |
||||
PushAudience audience = new PushAudience(false, audienceMap); |
||||
PushInfo pushInfo = new PushInfo(jgPushCode |
||||
, title |
||||
, "任务“"+ task.getPlanName() + "”的计划执行时间是:" + df.format(task.getPlanStartTime())+ " —— " + df.format(task.getPlanEndTime()) |
||||
, "" |
||||
, null |
||||
, platform |
||||
, audience); |
||||
pushInfoVO.setPushInfo(pushInfo); |
||||
|
||||
Map<String, String> smsMap = new HashMap<>(3); |
||||
smsMap.put("one", task.getPlanName()); |
||||
if(sendFlag == BEGIN_SEND_FLAG){ |
||||
smsMap.put("two", df.format(task.getPlanStartTime())); |
||||
} else if(sendFlag == END_SEND_FLAG){ |
||||
smsMap.put("two", df.format(task.getPlanEndTime())); |
||||
} //smsMap.put("three", df.format(task.getPlanEndTime()));
|
||||
|
||||
|
||||
String jsonParam = JSON.toJSONString(smsMap); |
||||
|
||||
User user = UserCache.getUser(task.getUserId()); |
||||
String userPhone = Func.isNotEmpty(user) ? user.getPhone() : null; |
||||
log.info("------------ 发送短信 用户手机号 = " + userPhone); |
||||
|
||||
String finalTemplateCode = templateCode; |
||||
XxlJobLogger.log(task.getId()+"开始推送短信!"); |
||||
ThreadFactory threadFactory = Executors.defaultThreadFactory(); |
||||
ThreadPoolExecutor pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingDeque(), threadFactory); |
||||
pool.execute(() -> { |
||||
if(Func.isNotEmpty(userPhone)){ |
||||
// 发送短信
|
||||
R<SmsResponse> success = smsClient.sendMessage(task.getTenantId(), finalTemplateCode, jsonParam, userPhone); |
||||
log.info("msg -- 用户手机号:" + userPhone + " ; 短信内容:" + jsonParam + " ; TenantId:" + task.getTenantId() + " ; finalTemplateCode:" + finalTemplateCode + ";返回信息 = " + (Func.isNotEmpty(success)?success.toString(): "返回为空")); |
||||
} |
||||
//推送消息给移动端
|
||||
pushClient.tenantPush(pushInfoVO); |
||||
log.info("msg -- 推送信息完成" ); |
||||
}); |
||||
|
||||
//把已发送的数据移除
|
||||
// redisTemplate.opsForZSet().remove(key, task);
|
||||
log.info("已推送、发送短信后 --------------- key = " + key + " ---- size = " + redisTemplate.opsForZSet().size(key)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.task.entity.TaskResultEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface TaskResultService extends BaseService<TaskResultEntity> { |
||||
|
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface TaskUserService extends BaseService<TaskUserEntity> { |
||||
|
||||
} |
@ -0,0 +1,98 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.ai.dto.VideoReturnDTO; |
||||
import com.hnac.hzinfo.inspect.plan.PlanContants; |
||||
import com.hnac.hzinfo.inspect.task.entity.TaskEntity; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.data.redis.core.RedisTemplate; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.time.LocalDateTime; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
|
||||
/** |
||||
* 视频巡检任务 |
||||
* 提醒列表使用redis缓存 |
||||
* @Author: py |
||||
*/ |
||||
@Component |
||||
public class TaskVideoManager { |
||||
|
||||
/** |
||||
* 视频巡检任务列表 |
||||
*/ |
||||
final static String VIDEO_TASK_LIST = "hzinfo:video:tasks"; |
||||
|
||||
/** |
||||
* 视频巡检 AI识别结果列表 |
||||
*/ |
||||
final static String VIDEO_TASK_AI_RESULT= "hzinfo:video:ai:results"; |
||||
|
||||
@Autowired |
||||
private RedisTemplate redisTemplate; |
||||
|
||||
/** |
||||
* 把AI识别结果加入redis缓存中 |
||||
*/ |
||||
public void addAiResultToMap(VideoReturnDTO returnDTO){ |
||||
redisTemplate.opsForHash().put(VIDEO_TASK_AI_RESULT, returnDTO.getVideo(), returnDTO); |
||||
} |
||||
|
||||
/** |
||||
* 从redis缓存中取出AI识别结果 |
||||
*/ |
||||
public VideoReturnDTO getAiResultFromMap(String video){ |
||||
if(redisTemplate.opsForHash().hasKey(VIDEO_TASK_AI_RESULT, video)){ |
||||
return (VideoReturnDTO)redisTemplate.opsForHash().get(VIDEO_TASK_AI_RESULT, video); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 把任务加入redis提醒缓存列表中 |
||||
*/ |
||||
public void addTaskToVideoCacheList(TaskEntity task){ |
||||
if(task.getAutoVideo().equals(PlanContants.InspectTypeEnum.VIDEO.getVal())){ |
||||
redisTemplate.opsForHash().put(VIDEO_TASK_LIST, task.getId(), task); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 把任务加入redis提醒缓存列表中 |
||||
*/ |
||||
public void deleteTaskFromCacheList(TaskEntity task){ |
||||
redisTemplate.opsForHash().delete(VIDEO_TASK_LIST, task.getId()); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
public void deleteTaskFromCacheList(String taskId){ |
||||
redisTemplate.opsForHash().delete(VIDEO_TASK_LIST, taskId); |
||||
} |
||||
|
||||
/** |
||||
* 从缓存中取出当前时间加一分钟之前的所有数据 |
||||
*/ |
||||
public List<TaskEntity> getTasksFromCacheList(){ |
||||
List<TaskEntity> tasks = new ArrayList<>(); |
||||
HashMap<String, TaskEntity> map = (HashMap<String, TaskEntity>) redisTemplate.opsForHash().entries(VIDEO_TASK_LIST); |
||||
map.forEach((id, task) ->{ |
||||
if(task.getPlanStartTime().isBefore(LocalDateTime.now().plusMinutes(1L))){ |
||||
tasks.add(task); |
||||
deleteTaskFromCacheList(id); |
||||
} |
||||
}); |
||||
return tasks; |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
|
||||
import com.hnac.hzinfo.inspect.obj.entity.TemplateProjectEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface TemplateProjectService extends BaseService<TemplateProjectEntity>{ |
||||
|
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect; |
||||
|
||||
import com.hnac.hzinfo.inspect.obj.entity.TemplateEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface TemplateService extends BaseService<TemplateEntity> { |
||||
|
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.service.inspect.ContentService; |
||||
import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; |
||||
import com.hnac.hzinfo.inspect.obj.mapper.ContentMapper; |
||||
import com.hnac.hzinfo.inspect.obj.services.DatabaseCopyHandler; |
||||
import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.log.exception.ServiceException; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.tool.utils.CollectionUtil; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Collection; |
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class ContentServiceImpl extends BaseServiceImpl<ContentMapper, ContentEntity> implements ContentService { |
||||
|
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.mapper.inspect.ObjectMapper; |
||||
import com.hnac.hzims.scheduled.service.inspect.ObjectService; |
||||
import com.hnac.hzinfo.inspect.obj.entity.ObjectEntity; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
|
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class ObjectServiceImpl extends BaseServiceImpl<ObjectMapper, ObjectEntity> implements ObjectService { |
||||
|
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.service.inspect.ObjectUserService; |
||||
import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity; |
||||
import com.hnac.hzinfo.inspect.obj.mapper.ObjectUserMapper; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class ObjectUserServiceImpl extends BaseServiceImpl<ObjectUserMapper, ObjectUserEntity> implements ObjectUserService { |
||||
|
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.service.inspect.PlanObjectTemplateService; |
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanObjectTemplateEntity; |
||||
import com.hnac.hzinfo.inspect.plan.mapper.PlanObjectTemplateMapper; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class PlanObjectTemplateServiceImpl extends BaseServiceImpl<PlanObjectTemplateMapper, PlanObjectTemplateEntity> implements PlanObjectTemplateService { |
||||
|
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.hnac.hzims.scheduled.service.inspect.PlanOrgService; |
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanOrgEntity; |
||||
import com.hnac.hzinfo.inspect.plan.mapper.PlanOrgMapper; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
public class PlanOrgServiceImpl extends BaseServiceImpl<PlanOrgMapper, PlanOrgEntity> implements PlanOrgService { |
||||
|
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanPositionEntity; |
||||
import com.hnac.hzinfo.inspect.plan.mapper.PlanPositionMapper; |
||||
import com.hnac.hzinfo.inspect.plan.service.IPlanPositionService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class PlanPositionServiceImpl extends BaseServiceImpl<PlanPositionMapper, PlanPositionEntity> implements IPlanPositionService { |
||||
|
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.mapper.inspect.PlanMapper; |
||||
import com.hnac.hzims.scheduled.service.inspect.PlanService; |
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> implements PlanService { |
||||
|
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.service.inspect.PlanUserService; |
||||
import com.hnac.hzinfo.inspect.plan.entity.PlanUserEntity; |
||||
import com.hnac.hzinfo.inspect.plan.mapper.PlanUserMapper; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class PlanUserServiceImpl extends BaseServiceImpl<PlanUserMapper, PlanUserEntity> implements PlanUserService { |
||||
|
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.service.inspect.ProjectContentService; |
||||
import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity; |
||||
import com.hnac.hzinfo.inspect.obj.mapper.ProjectContentMapper; |
||||
import com.hnac.hzinfo.inspect.obj.services.DatabaseCopyHandler; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class ProjectContentServiceImpl extends BaseServiceImpl<ProjectContentMapper, ProjectContentEntity> implements ProjectContentService { |
||||
|
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.service.inspect.ProjectService; |
||||
import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; |
||||
import com.hnac.hzinfo.inspect.obj.mapper.ProjectMapper; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class ProjectServiceImpl extends BaseServiceImpl<ProjectMapper, ProjectEntity> implements ProjectService { |
||||
|
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.service.inspect.TaskObjectProjectContentService; |
||||
import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectContentEntity; |
||||
import com.hnac.hzinfo.inspect.task.mapper.TaskObjectProjectContentMapper; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class TaskObjectProjectContentServiceImpl extends BaseServiceImpl<TaskObjectProjectContentMapper, TaskObjectProjectContentEntity> implements TaskObjectProjectContentService { |
||||
|
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.service.inspect.TaskObjectProjectService; |
||||
import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectEntity; |
||||
import com.hnac.hzinfo.inspect.task.mapper.TaskObjectProjectMapper; |
||||
import com.hnac.hzinfo.inspect.task.vo.TaskObjectProjectOfflineVO; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class TaskObjectProjectServiceImpl extends BaseServiceImpl<TaskObjectProjectMapper, TaskObjectProjectEntity> implements TaskObjectProjectService { |
||||
|
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.service.inspect.TaskObjectService; |
||||
import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity; |
||||
import com.hnac.hzinfo.inspect.task.mapper.TaskObjectMapper; |
||||
import com.hnac.hzinfo.inspect.task.vo.TaskObjectOfflineVO; |
||||
import com.hnac.hzinfo.inspect.task.vo.TaskObjectVO; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class TaskObjectServiceImpl extends BaseServiceImpl<TaskObjectMapper, TaskObjectEntity> implements TaskObjectService { |
||||
|
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.service.inspect.TaskResultService; |
||||
import com.hnac.hzinfo.inspect.task.entity.TaskResultEntity; |
||||
import com.hnac.hzinfo.inspect.task.mapper.TaskResultMapper; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class TaskResultServiceImpl extends BaseServiceImpl<TaskResultMapper, TaskResultEntity> implements TaskResultService { |
||||
|
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.service.inspect.TaskUserService; |
||||
import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity; |
||||
import com.hnac.hzinfo.inspect.task.mapper.TaskUserMapper; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class TaskUserServiceImpl extends BaseServiceImpl<TaskUserMapper, TaskUserEntity> implements TaskUserService { |
||||
|
||||
} |
@ -0,0 +1,34 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.hnac.hzims.scheduled.service.inspect.TemplateProjectService; |
||||
import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; |
||||
import com.hnac.hzinfo.inspect.obj.entity.TemplateEntity; |
||||
import com.hnac.hzinfo.inspect.obj.entity.TemplateProjectEntity; |
||||
import com.hnac.hzinfo.inspect.obj.mapper.TemplateProjectMapper; |
||||
import com.hnac.hzinfo.inspect.obj.services.DatabaseCopyHandler; |
||||
import com.hnac.hzinfo.inspect.obj.services.TemplateService; |
||||
import com.hnac.hzinfo.inspect.obj.services.impl.ProjectContentServiceImpl; |
||||
import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; |
||||
import com.hnac.hzinfo.inspect.obj.vo.ProjectContentDto; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class TemplateProjectServiceImpl extends BaseServiceImpl<TemplateProjectMapper, TemplateProjectEntity> implements TemplateProjectService { |
||||
|
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.hnac.hzims.scheduled.service.inspect.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.hnac.hzims.scheduled.service.inspect.TemplateService; |
||||
import com.hnac.hzinfo.inspect.obj.entity.TemplateEntity; |
||||
import com.hnac.hzinfo.inspect.obj.mapper.TemplateMapper; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("inspect") |
||||
public class TemplateServiceImpl extends BaseServiceImpl<TemplateMapper, TemplateEntity> implements TemplateService { |
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
|
||||
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; |
||||
import com.hnac.hzims.operational.duty.vo.ImsDutyMainFeignVO; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface DutyMainService extends BaseService<ImsDutyMainEntity> { |
||||
ImsDutyMainFeignVO mainPerson(Long classId, String date); |
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; |
||||
import com.hnac.hzims.operational.duty.vo.ImsDutyMainFeignVO; |
||||
import com.hnac.hzims.scheduled.mapper.operation.DutyMainMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.DutyMainService; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.tool.utils.ObjectUtil; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* 服务实现类 |
||||
* |
||||
* @author Chill |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
public class DutyMainServiceImpl extends BaseServiceImpl<DutyMainMapper, ImsDutyMainEntity> implements DutyMainService { |
||||
|
||||
|
||||
@Override |
||||
public ImsDutyMainFeignVO mainPerson(Long classId, String date) { |
||||
ImsDutyMainEntity entity = this.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ |
||||
eq(ImsDutyMainEntity::getDutyDate, date); |
||||
eq(ImsDutyMainEntity::getClassId, classId); |
||||
}}); |
||||
if(ObjectUtil.isEmpty(entity)){ |
||||
return new ImsDutyMainFeignVO(); |
||||
} |
||||
ImsDutyMainFeignVO main = new ImsDutyMainFeignVO(); |
||||
main.setMainId(entity.getId()); |
||||
String[] persons = entity.getDutyPersonIds().split("\\^"); |
||||
//string 转为 long
|
||||
List<Long> personList = Arrays.stream(persons).map(person -> Long.parseLong(person.trim())).collect(Collectors.toList()); |
||||
main.setPersons(personList); |
||||
return main; |
||||
} |
||||
} |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.ContentMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.operation.DutyMainMapper"> |
||||
<resultMap id="BaseResultMap" type="com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity"> |
||||
<id column="ID" property="id" jdbcType="BIGINT"/> |
||||
<result column="TENANT_ID" property="tenantId" jdbcType="VARCHAR"/> |
||||
<result column="DUTY_PERSON_IDS" property="dutyPersonIds" jdbcType="LONGVARCHAR"/> |
||||
<result column="DUTY_DATE" property="dutyDate" jdbcType="DATE"/> |
||||
<result column="CLASS_ID" property="classId" jdbcType="BIGINT"/> |
||||
<result column="DUTY_GROUP_ID" property="dutyGroupId" jdbcType="BIGINT"/> |
||||
<result column="CLASS_NAME" property="className" jdbcType="VARCHAR"/> |
||||
<result column="STATUS" property="status" jdbcType="TINYINT"/> |
||||
<result column="REMARK" property="remark" jdbcType="LONGVARCHAR"/> |
||||
<result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP"/> |
||||
<result column="UPDATE_TIME" property="updateTime" jdbcType="TIMESTAMP"/> |
||||
<result column="CREATE_USER" property="createUser" jdbcType="BIGINT"/> |
||||
<result column="UPDATE_USER" property="updateUser" jdbcType="BIGINT"/> |
||||
<result column="IS_DELETED" property="isDeleted" jdbcType="TINYINT"/> |
||||
<result column="CREATE_DEPT" property="createDept" jdbcType="BIGINT"/> |
||||
</resultMap> |
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.ObjectMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.ObjectUserMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.PlanMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.PlanObjectTemplateMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.PlanOrgMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.PlanPositionMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.PlanUserMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.ProjectContentMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.ProjectMapper"> |
||||
|
||||
</mapper> |
@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.TaskMapper"> |
||||
</mapper> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.TaskObjectMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.TaskObjectProjectContentMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.TaskObjectProjectMapper"> |
||||
|
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.TaskResultMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.TaskUserMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.TemplateMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.TemplateProjectMapper"> |
||||
|
||||
</mapper> |
Loading…
Reference in new issue