Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
zhongwei
yang_shj 2 years ago
parent
commit
77c7a77bfe
  1. 6
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/plan/entity/PlanEntity.java
  2. 5
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskEntity.java
  3. 3
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/MessagePushRecordDto.java
  4. 7
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/PlanMsgRecordDto.java
  5. 3
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MessagePushRecordEntity.java
  6. 2
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/SafeEquipmentTrialFeignClient.java
  7. 2
      hzims-service/hzims-middle/src/main/resources/application.yml
  8. 7
      hzims-service/inspect/pom.xml
  9. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java
  10. 126
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java
  11. 5
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/job/service/TaskJobService.java
  12. 4
      hzims-service/inspect/src/main/resources/db/1.0.0.sql
  13. 2
      hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java
  14. 11
      hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
  15. 9
      hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java
  16. 1
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java
  17. 2
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/SmsMessageServiceImpl.java
  18. 2
      hzims-service/message/src/main/resources/db/1.0.0.sql
  19. 2
      hzims-service/message/src/main/resources/db/1.0.1.sql
  20. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/scheduled/DutyRecCreateTask.java
  21. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyMainPersonService.java
  22. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java
  23. 33
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyGroupServiceImpl.java
  24. 58
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainPersonServiceImpl.java
  25. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
  26. 255
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java
  27. 22
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java
  28. 23
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainStatisticsServiceImpl.java
  29. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java
  30. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
  31. 6
      hzims-service/operational/src/main/resources/db/1.0.1.sql
  32. 10
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java
  33. 1
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java
  34. 18
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

6
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/plan/entity/PlanEntity.java

@ -3,6 +3,8 @@ package com.hnac.hzinfo.inspect.plan.entity;
import com.baomidou.mybatisplus.annotation.TableField;
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 jdk.nashorn.internal.ir.annotations.Ignore;
@ -195,4 +197,8 @@ public class PlanEntity extends TenantEntity {
@ApiModelProperty(value = "值班id")
private Long dutyId;
@ApiModelProperty(value = "消息模板ID")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long messageTemplateId;
}

5
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskEntity.java

@ -3,6 +3,8 @@ package com.hnac.hzinfo.inspect.task.entity;
import com.baomidou.mybatisplus.annotation.TableField;
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;
@ -165,5 +167,8 @@ public class TaskEntity extends TenantEntity {
@ApiModelProperty(value = "值班id")
private Long dutyId;
@ApiModelProperty(value = "消息模板ID")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long messageTemplateId;
}

3
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/MessagePushRecordDto.java

@ -22,4 +22,7 @@ public class MessagePushRecordDto extends MessagePushRecordEntity implements Ser
@NotNull
private List<String> types;
@ApiModelProperty("创建人")
private Long createUser;
}

7
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/PlanMsgRecordDto.java

@ -52,13 +52,20 @@ public class PlanMsgRecordDto implements Serializable {
@NotNull
private LocalDateTime planTime;
@ApiModelProperty("短信推送资源编码")
private String resourceCode;
@ApiModelProperty("消息创建人")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long createUser;
@ApiModelProperty("阿里云短信模板参数")
private String smsParam;
@ApiModelProperty("消息推送耳机")
@NotNull
private String content;
@ApiModelProperty("租户ID")
private String tenantId;

3
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MessagePushRecordEntity.java

@ -68,6 +68,9 @@ public class MessagePushRecordEntity extends MessageTemplateEntity {
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty("阿里云短信模板参数")
private String smsParam;
@ApiModelProperty(value = "计划推送时间")
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)

2
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/SafeEquipmentTrialFeignClient.java

@ -26,7 +26,7 @@ public interface SafeEquipmentTrialFeignClient {
/**
* 分页
*/
@GetMapping("/list")
@GetMapping("/safeEquimentTrial/list")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:createDept,fileName,startTime,endTime")
public R<BladePage<SafeEquipmentTrialVO>> list(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query) ;

2
hzims-service/hzims-middle/src/main/resources/application.yml

@ -20,6 +20,8 @@ mybatis-plus:
mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.hnac.hzims.**.entity
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#swagger扫描路径配置
swagger:

7
hzims-service/inspect/pom.xml

@ -13,6 +13,7 @@
<groupId>com.hnac.hzinfo.inspect</groupId>
<artifactId>hzinfo-inspect</artifactId>
<version>4.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
@ -134,7 +135,11 @@
<artifactId>blade-starter-oss-minio</artifactId>
<version>${bladex.project.version}</version>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>message-api</artifactId>
<version>${hzims.project.version}</version>
</dependency>
<!--短信发送平台 Start 引用后有druid版本冲突-->
<!--<dependency>-->

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java

@ -137,7 +137,7 @@ public class PlanController extends BladeController {
@ApiImplicitParam(name="status",value="0:待审核-->1:已审核-->2:派发中-->3:暂停-->4:结束-->5审核不通过-->6待提交")
})
public R<Boolean> modifyPlanStatus(@RequestParam(value = "id") @ApiParam(value = "主键ID",required = true) Long id,
@RequestParam @DictInvalid(dictKey = PlanContants.PLAN_STATUS) Integer status) {
@RequestParam Integer status) {
return R.status(planService.modifyPlanStatus(id, status));
}

126
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java

@ -0,0 +1,126 @@
package com.hnac.hzinfo.inspect.task.aspect;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hnac.hzims.message.dto.PlanMsgRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzinfo.inspect.plan.entity.PlanEntity;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity;
import com.hnac.hzinfo.inspect.task.job.service.TaskRemindManager;
import com.hnac.hzinfo.inspect.task.service.ITaskService;
import com.hnac.hzinfo.inspect.task.service.ITaskUserService;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName TaskGenerateAspect
* @description: 消息生成后业务操作
* @author: hx
* @create: 2023-04-17 11:21
* @Version 4.0
**/
@Aspect
@Component
@RequiredArgsConstructor
@Slf4j
public class TaskGenerateAspect {
private final IMessageClient messageClient;
private final ITaskService taskService;
private final ITaskUserService taskUserService;
/**
* 巡检任务开始前发送短信信息阿里云模板
**/
@Value("${hzims.inspect.task.templateCode.taskBegin}")
private String taskBeginTemplateCode;
/**
* 巡检任务结束前发送短信信息阿里云模板
**/
@Value("${hzims.inspect.task.templateCode.taskEnd}")
private String taskEndTemplateCode;
@Pointcut("execution(* com.hnac.hzinfo.inspect.task.job.service.ITaskJobService.sendTask(..))")
public void taskSaveCut() {
}
@AfterReturning(value = "taskSaveCut()")
private void saveTask(JoinPoint joinPoint) {
Object[] args = joinPoint.getArgs();
new Thread(() -> {
if(ObjectUtil.isNotEmpty(args[0]) && args[0] instanceof PlanEntity) {
PlanEntity plan = (PlanEntity) args[0];
List<TaskEntity> list = taskService.list(
Wrappers.<TaskEntity>lambdaQuery().eq(TaskEntity::getPlanId,plan.getId())
);
if(CollectionUtil.isNotEmpty(list)) {
list.forEach(this::pushMessageByTask);
}
TaskEntity task = JSONObject.parseObject(JSON.toJSONString(args[0]),TaskEntity.class);
this.pushMessageByTask(task);
}
},"巡检任务消息推送").start();
}
/**
* 根据巡检任务生成消息推送记录
* @param taskEntity 巡检任务
*/
private void pushMessageByTask(TaskEntity taskEntity) {
PlanMsgRecordDto recordDto = new PlanMsgRecordDto();
recordDto.setDeptId(taskEntity.getCreateDept());
recordDto.setTemplateId(taskEntity.getMessageTemplateId());
recordDto.setTaskId(taskEntity.getId());
if(Func.isEmpty(AuthUtil.getUserId())) {
recordDto.setTenantId(taskEntity.getTenantId());
}
// 获取巡检任务的消息推送人
LambdaQueryWrapper<TaskUserEntity> eq = Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId, taskEntity.getId());
List<TaskUserEntity> taskUserList = taskUserService.list(eq);
if(CollectionUtil.isNotEmpty(taskUserList)) {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
taskUserList.stream().map(TaskUserEntity::getUserId).filter(Func::isNotEmpty).forEach(userId -> {
recordDto.setReceiver(userId);
recordDto.setCreateUser(userId);
Map<String,String> smsMap = new HashMap<>(2);
// 消息开始前提醒
recordDto.setResourceCode(taskBeginTemplateCode);
smsMap.put("one",taskEntity.getPlanName());
smsMap.put("two",df.format(taskEntity.getPlanStartTime()));
recordDto.setPlanTime(taskEntity.getPlanStartTime());
recordDto.setSmsParam(JSON.toJSONString(smsMap));
recordDto.setContent("任务“"+ taskEntity.getPlanName() + "”的计划执行时间是:" + df.format(taskEntity.getPlanStartTime())+ " —— " + df.format(taskEntity.getPlanEndTime()));
messageClient.planSendMessage(recordDto);
// 消息结束前提醒
/* smsMap.put("two",df.format(taskEntity.getPlanEndTime()));
recordDto.setPlanTime(taskEntity.getPlanEndTime());
recordDto.setSmsParam(JSON.toJSONString(smsMap));
messageClient.planSendMessage(recordDto);*/
});
}
}
}

5
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/job/service/TaskJobService.java

@ -18,6 +18,7 @@ import com.hnac.hzinfo.inspect.plan.entity.*;
import com.hnac.hzinfo.inspect.plan.service.*;
import com.hnac.hzinfo.inspect.task.TaskContants;
import com.hnac.hzinfo.inspect.task.TaskContants.ClaimStatusEnum;
import com.hnac.hzinfo.inspect.task.aspect.TaskGenerateAspect;
import com.hnac.hzinfo.inspect.task.entity.*;
import com.hnac.hzinfo.inspect.task.service.ITaskObjectProjectContentService;
import com.hnac.hzinfo.inspect.task.service.ITaskObjectProjectService;
@ -89,6 +90,9 @@ public class TaskJobService {
@Autowired
private IDutyMainClient dutyMainClient;
@Autowired
private TaskGenerateAspect taskGenerateAspect;
private final String dateSplit = "_";
/**
@ -401,6 +405,7 @@ public class TaskJobService {
task.setCreateUser(plan.getCreateUser());
task.setCreateDept(plan.getCreateDept());
task.setAutoVideo(plan.getAutoVideo());
task.setMessageTemplateId(plan.getMessageTemplateId());
task.setMethod(plan.getMethod());
task.setEndRemindFlag(true);
task.setStartRemindFlag(true);

4
hzims-service/inspect/src/main/resources/db/1.0.0.sql

@ -0,0 +1,4 @@
-- 巡检计划添加消息模板字段
alter table `hz_st_re_plan` add column `message_template_id` bigint(20) comment '消息模板ID';
-- 巡检任务添加消息模板字段
alter table `hz_st_ex_task` add column `message_template_id` bigint(20) comment '消息模板ID';

2
hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java

@ -70,7 +70,7 @@ public class MessagePushRecordController extends BladeController {
@ApiOperationSupport(order = 6)
public R<Boolean> readMessage(@PathVariable @ApiParam("消息记录ID") String id) {
MessagePushRecordEntity record = messagePushRecordService.getById(id);
if(!record.getPusher().equals(AuthUtil.getUserId())) {
if(!(Long.parseLong(record.getPusher()) == AuthUtil.getUserId())) {
return R.fail("当前登录人不是消息推送人,修改状态失败");
}
LambdaUpdateWrapper<MessagePushRecordEntity> eq = Wrappers.<MessagePushRecordEntity>lambdaUpdate()

11
hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java

@ -18,12 +18,14 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
@ -31,6 +33,7 @@ import javax.validation.Valid;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.Optional;
/**
* @author hx
@ -58,6 +61,10 @@ public class MessageClient extends BladeController implements IMessageClient{
request.getTypes().forEach(type -> {
MessagePushRecordEntity entity = BeanUtil.copy(request,MessagePushRecordEntity.class);
entity.setType(type);
if(Func.isEmpty(AuthUtil.getUserId())) {
entity.setCreateUser(request.getCreateUser());
entity.setCreateDept(request.getCreateDept());
}
entity.setMessageId(messageId);
recordService.saveAndSend(entity);
});
@ -88,13 +95,15 @@ public class MessageClient extends BladeController implements IMessageClient{
entity.setTemplateId(request.getTemplateId());
entity.setDeptId(request.getDeptId());
entity.setCreateUser(request.getCreateUser());
entity.setResourceCode(request.getResourceCode());
entity.setCreateDept(request.getDeptId());
entity.setPlanTime(request.getPlanTime());
entity.setPushType(MessageConstants.PLAN);
entity.setPusher(request.getReceiver().toString());
entity.setPusherName(UserCache.getUser(request.getReceiver()).getName());
entity.setPusherName(Optional.ofNullable(UserCache.getUser(request.getReceiver())).map(User::getName).orElse(""));
entity.setAccount(request.getReceiver().toString());
entity.setContent(request.getContent());
entity.setSmsParam(request.getSmsParam());
if(Func.isNotEmpty(request.getTenantId())) {
entity.setTenantId(request.getTenantId());
}

9
hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java

@ -84,6 +84,9 @@ public class MessagePushSchedule {
MessagePushRecordEntity request = records.get(0);
// 完善推送内容
request.setContent(this.getPushContent(type,records));
if(MessageConstants.SMS_PUSH.equals(type)) {
request.setSmsParam(request.getContent());
}
request.setMessageId(IdWorker.getId());
Boolean flag = service.send(request);
if(!flag) {
@ -111,9 +114,9 @@ public class MessagePushSchedule {
}
else if(MessageConstants.SMS_PUSH.equals(type)) {
Map<String,String> params = new HashMap<>();
list.stream().map(MessagePushRecordEntity::getContent).forEachOrdered(record -> {
JSONObject param = JSONObject.parseObject(record);
param.forEach((k,v) -> {
list.stream().map(MessagePushRecordEntity::getSmsParam).forEachOrdered(param -> {
JSONObject paramJson = JSONObject.parseObject(param);
paramJson.forEach((k,v) -> {
params.put(k, params.containsKey(k) && Func.isNotEmpty(params.get(k)) ? params.get(k) + "," + v : (String) v);
});
});

1
hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java

@ -97,6 +97,7 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
if (MessageConstants.IMMEDIATELY.equals(request.getPushType())) {
request.setPlanTime(now);
request.setPushTime(now);
request.setStatus(MessageConstants.NOT_PUSH);
// 立即推送消息
if (this.save(request) && Func.isNotEmpty(request.getId())) {
return this.send(request.getId());

2
hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/SmsMessageServiceImpl.java

@ -51,7 +51,7 @@ public class SmsMessageServiceImpl implements IMessageService {
R<SmsResponse> response = smsClient.sendMessage(
Func.isNotEmpty(AuthUtil.getTenantId()) ? AuthUtil.getTenantId() : request.getTenantId(),
request.getResourceCode(),
request.getContent(),
request.getSmsParam(),
this.getAccountByPusher(Long.parseLong(request.getPusher()),request.getType())
);
Assert.isTrue(response.isSuccess(),() -> {

2
hzims-service/message/src/main/resources/db/1.0.0.sql

@ -25,7 +25,7 @@ SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE IF NOT EXISTS `hzims_message_push_record` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`TASK_ID` bigint(20) NOT NULL COMMENT '消息类型',
`TEMPLATE_ID` bigint(20) NOT NULL COMMENT '消息模板ID',
`TEMPLATE_ID` bigint(20) COMMENT '消息模板ID',
`PUSHER` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '推送人',
`PUSHER_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '推送人名称',
`CONTENT` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '内容',

2
hzims-service/message/src/main/resources/db/1.0.1.sql

@ -2,3 +2,5 @@
alter table hzims_message_push_record add COLUMN `MESSAGE_ID` bigint(20) DEFAULT NULL comment '消息ID';
-- 添加消息推送类型
alter table hzims_message_push_record add COLUMN `PUSH_TYPE` VARCHAR(2) DEFAULT NULL comment '推送类型,0:即时推送,1:计划推送';
-- 添加短信推送参数
alter table `hzims_message_push_record` add COLUMN `SMS_PARAM` VARCHAR(255) COMMENT '阿里云短信模板参数';

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/scheduled/DutyRecCreateTask.java

@ -5,8 +5,6 @@ import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import static com.hnac.hzims.operational.duty.constant.DutyScheduledConstant.TASK_VALUE_MESSAGE_REMINDING_CREATE;
@ -24,13 +22,17 @@ public class DutyRecCreateTask {
* @return
* @throws Exception
*/
// @XxlJob(TASK_VALUE_MESSAGE_REMINDING_CREATE)
// public ReturnT<String> messageRemonding(String param) throws Exception {
// recService.messageRemonding();
// return new ReturnT<>("SUCCESS");
// }
@XxlJob(TASK_VALUE_MESSAGE_REMINDING_CREATE)
public ReturnT<String> messageRemonding(String param) throws Exception {
recService.messageRemonding();
public ReturnT<String> messageRemondingV2(String param) throws Exception {
recService.messageRemondingV2();
return new ReturnT<>("SUCCESS");
}
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyMainPersonService.java

@ -14,4 +14,7 @@ public interface IImsDutyMainPersonService extends BaseService<ImsDutyMainPerson
void doSaveBasch(List<ImsDutyMainPersonEntity> list);
List<ImsDutyMainPersonEntity> selectByMainIds(List<Long> dutyMainIds);
List<ImsDutyMainPersonEntity> selectByMainId(Long dutyMainId);
}

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java

@ -6,10 +6,8 @@ import com.hnac.hzims.operational.duty.dto.ChangeShiftsRspDTO;
import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity;
import com.hnac.hzims.operational.duty.vo.ImsDutyQrCodeVo;
import com.hnac.hzims.operational.duty.vo.ImsDutyRecVO;
import com.hnac.hzims.operational.duty.vo.ImsRecVo;
import com.hnac.hzims.operational.duty.vo.ImsSchedulingVo;
import com.hnac.hzinfo.inspect.plan.vo.PlanVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
@ -62,9 +60,15 @@ public interface IImsDutyRecService extends BaseService<ImsDutyRecEntity> {
String getQRCode();
/**
* 消息提醒 20230414之后已弃用
* 根据黄兴的消息中心模板更新为新的V2的接口
*/
// void messageRemonding();
/**
* 消息提醒
*/
void messageRemonding();
void messageRemondingV2();
/**
* 消息提醒测试

33
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyGroupServiceImpl.java

@ -3,12 +3,10 @@ package com.hnac.hzims.operational.duty.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.duty.entity.ImsDutyGroupEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyGroupPEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity;
import com.hnac.hzims.operational.duty.entity.*;
import com.hnac.hzims.operational.duty.mapper.ImsDutyGroupMapper;
import com.hnac.hzims.operational.duty.mapper.ImsDutyGroupPMapper;
import com.hnac.hzims.operational.duty.mapper.ImsDutyMainPersonMapper;
import com.hnac.hzims.operational.duty.service.IImsDutyGroupPService;
import com.hnac.hzims.operational.duty.service.IImsDutyGroupService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
@ -48,7 +46,8 @@ public class ImsDutyGroupServiceImpl extends BaseServiceImpl<ImsDutyGroupMapper,
@Autowired
private ImsDutyGroupPMapper imsDutyGroupPMapper;
@Autowired
private ImsDutyMainPersonMapper imsDutyMainPersonMapper;
@Autowired
private IUserClient userClient;
@ -292,17 +291,33 @@ public class ImsDutyGroupServiceImpl extends BaseServiceImpl<ImsDutyGroupMapper,
if (CollectionUtil.isNotEmpty(list1)) {
ImsDutyMainEntity imsDutyMainEntity = list1.get(0);
ImsDutyGroupEntity groupEntity = this.baseMapper.selectById(imsDutyMainEntity.getDutyGroupId());
String userName = "";
Long managerId = null;
String groupName = "";
if (imsDutyMainEntity.getDutyGroupId()!=null) {
ImsDutyGroupEntity groupEntity = this.baseMapper.selectById(imsDutyMainEntity.getDutyGroupId());
if (null != groupEntity.getManagerId()){
R<User> userR = userClient.userInfoById(groupEntity.getManagerId());
managerId=groupEntity.getManagerId();
}
groupName=groupEntity.getGroupName();
}else {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, imsDutyMainEntity.getId());
last(" limit 1");
}});
managerId=imsDutyMainPersonEntity.getDutyChargePerson();
groupName="灵活排班";
}
if (managerId!=null) {
R<User> userR = userClient.userInfoById(managerId);
if (userR.isSuccess() && ObjectUtil.isNotEmpty(userR.getData())) {
userName = userR.getData().getName();
}
}
return R.fail(groupEntity.getGroupName() + userName +
"是负责人,且存在排班不能直接删除,请先更换" + groupEntity.getGroupName() + "负责人,再进行删除操作!");
return R.fail(groupName +"-"+ userName +
"是负责人,且存在排班不能直接删除,请先更换" + groupName + "负责人,再进行删除操作!");
}
}
imsDutyGroupPService.deleteBatch(ids);

58
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainPersonServiceImpl.java

@ -1,47 +1,19 @@
package com.hnac.hzims.operational.duty.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.hnac.hzims.monitor.utils.DateUtils;
import com.hnac.hzims.operational.defect.constants.DefectConstant;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.mapper.OperPhenomenonMapper;
import com.hnac.hzims.operational.duty.entity.*;
import com.hnac.hzims.operational.duty.enume.DutyRecStatus;
import com.hnac.hzims.operational.duty.enume.JoinStatus;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainPersonEntity;
import com.hnac.hzims.operational.duty.mapper.*;
import com.hnac.hzims.operational.duty.scheduled.ThreadTask;
import com.hnac.hzims.operational.duty.service.IImsDutyGroupPService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainPersonService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainTemplateService;
import com.hnac.hzims.operational.duty.vo.*;
import com.hnac.hzims.operational.main.vo.DutyPersonalReportVO;
import com.hnac.hzims.operational.report.vo.DutyReportVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.sql.Time;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import java.util.List;
/**
* 服务实现类
@ -71,4 +43,28 @@ public class ImsDutyMainPersonServiceImpl extends BaseServiceImpl<ImsDutyMainPer
public void doSaveBasch(List<ImsDutyMainPersonEntity> list) {
this.saveBatch(list);
}
@Override
public List<ImsDutyMainPersonEntity> selectByMainIds(List<Long> dutyMainIds) {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = this.baseMapper.selectList(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
in(ImsDutyMainPersonEntity::getDutyMainId, dutyMainIds);
}});
if (CollectionUtils.isNotEmpty(imsDutyMainPersonEntities)){
return imsDutyMainPersonEntities;
}
return null;
}
@Override
public List<ImsDutyMainPersonEntity> selectByMainId(Long dutyMainId) {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = this.baseMapper.selectList(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainId);
}});
if (CollectionUtils.isNotEmpty(imsDutyMainPersonEntities)){
return imsDutyMainPersonEntities;
}
return null;
}
}

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java

@ -160,6 +160,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
imsSchedulingVo.setGroupName("临时班组");
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, id);
last(" limit 1");
}});
imsSchedulingVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson());
} else {
@ -927,10 +928,13 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
if (1 == vo.getPersonType()) {
String dutyOrderIds = JSONObject.toJSONString(vo.getDutyOrderIds(), SerializerFeature.WriteMapNullValue);
entity.setDutyOrderIds(dutyOrderIds);
entity.setFlexible(null);
entity.setType(1);
} else {
String flexible = JSONObject.toJSONString(vo.getFlexible(), SerializerFeature.WriteMapNullValue);
entity.setFlexible(flexible);
String dutyOrderIds = JSONObject.toJSONString(vo.getDutyOrderIds(), SerializerFeature.WriteMapNullValue);
entity.setDutyOrderIds(dutyOrderIds);
entity.setType(2);
}
String dutyArrIds = JSONObject.toJSONString(vo.getDutyArrIds(), SerializerFeature.WriteMapNullValue);
@ -1110,7 +1114,6 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
eq(DutyGroupGeneratingCapacityEntity::getEndTime, dutyMainInfoVo.getEndTime());
eq(DutyGroupGeneratingCapacityEntity::getDutyDept, dutyMainInfoVo.getCreateDept());
eq(DutyGroupGeneratingCapacityEntity::getDateTime, DateUtil.format(dutyMainInfoVo.getDutyDate(), DateUtil.PATTERN_DATE));
//eq(DutyGroupGeneratingCapacityEntity::getGroupId, dutyMainInfoVo.getDutyGroupId());
}});
if (CollectionUtil.isNotEmpty(generatingCapacityList)) {
double generatingCapacity = generatingCapacityList.stream().mapToDouble(DutyGroupGeneratingCapacityEntity::getGeneratingCapacity).sum();
@ -1310,6 +1313,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
List<String> personIdlist = new ArrayList<>(Arrays.asList(dutyMainPersonIds));
if (1 == changeDutyMainVo.getType()) {
personIdlist.addAll(personId);
} else {
personIdlist.removeAll(personId);
}
String resIds = StringUtils.join(personIdlist, "^");
@ -1375,7 +1379,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
*/
private NextDutyInfoVo getUpDutyInfo(DutyInfoVo item) {
DutyMainInfoVo dutyMainInfoVo = this.baseMapper.queryDutyInfoV2(item.getPreDutyId());
if (null == dutyMainInfoVo.getGroupName()) {
if (null == dutyMainInfoVo.getDutyGroupId()) {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainInfoVo.getId());
}});
@ -1633,7 +1637,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
public List<DutyMainInfoVo> getDutyDataV2(Long deptId) {
List<DutyMainInfoVo> dutyMainInfoVos = this.baseMapper.selectDutyMainInfoVoV2(deptId);
dutyMainInfoVos = dutyMainInfoVos.stream().map(s -> {
if (null == s.getGroupName()) {
if (null == s.getDutyGroupId()) {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, s.getId());
}});
@ -1657,7 +1661,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
@Override
public DutyMainInfoVo getNextDutyDataV2(Long parentId) {
DutyMainInfoVo dutyMainInfoVo = this.baseMapper.selectDutyMainInfoSignV2(parentId);
if (null == dutyMainInfoVo.getGroupName()) {
if (null == dutyMainInfoVo.getDutyGroupId()) {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainInfoVo.getId());
}});

255
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java

@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.message.fegin.IMessagePushClient;
import com.hnac.hzims.message.req.PushExtrasReq;
import com.hnac.hzims.monitor.utils.DateUtils;
@ -46,6 +49,7 @@ import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
@ -79,6 +83,8 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
@Autowired
private IMessagePushClient messagePushClient;
@Autowired
private IMessageClient messageClient;
@Autowired
private IUserClient userClient;
@Autowired
private IFlowClient flowClient;
@ -113,23 +119,39 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
if (ObjectUtil.isEmpty(dutyMainEntity)) {
return R.fail("当前时间没有接班人!");
}
//获取交班人班组
Long handGroupManagerId;
if (handDutyMainEntity.getDutyGroupId() != null) {
//获取交班人班
ImsDutyGroupEntity handGroupEntity = imsDutyGroupService.getById(handDutyMainEntity.getDutyGroupId());
handGroupManagerId = handGroupEntity.getManagerId();
} else {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = imsDutyMainPersonService.selectByMainId(handDutyMainEntity.getId());
handGroupManagerId = imsDutyMainPersonEntities.get(0).getDutyChargePerson();
}
Long groupEntityManagerId;
//获取接班人班组
if (dutyMainEntity.getDutyGroupId() != null) {
ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(dutyMainEntity.getDutyGroupId());
//判断班组长是否存在
R<User> userR = userClient.userInfoById(groupEntity.getManagerId());
groupEntityManagerId = groupEntity.getManagerId();
ImsDutyGroupPEntity groupPEntity = imsDutyGroupPService.getOne(new LambdaQueryWrapper<ImsDutyGroupPEntity>() {{
eq(ImsDutyGroupPEntity::getGroupId, groupEntity.getId());
eq(ImsDutyGroupPEntity::getPersonId, groupEntity.getManagerId()).last(" LIMIT 1");
eq(ImsDutyGroupPEntity::getPersonId, groupEntityManagerId).last(" LIMIT 1");
}});
if (ObjectUtil.isEmpty(groupPEntity)) {
return R.fail("接班班组长不存在,请指定班组长后进行交班!");
}
} else {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities2 = imsDutyMainPersonService.selectByMainId(dutyMainEntity.getId());
groupEntityManagerId = imsDutyMainPersonEntities2.get(0).getDutyChargePerson();
if (!userR.isSuccess() || ObjectUtil.isEmpty(userR.getData()) || ObjectUtil.isEmpty(groupPEntity)) {
}
//判断班组长是否存在
R<User> userR = userClient.userInfoById(groupEntityManagerId);
if (!userR.isSuccess() || ObjectUtil.isEmpty(userR.getData())) {
return R.fail("接班班组长不存在,请指定班组长后进行交班!");
}
Long inspectTaskId = getInspectTaskId(vo, groupEntity.getManagerId());//新增巡检任务
Long inspectTaskId = getInspectTaskId(vo, groupEntityManagerId);//新增巡检任务
if (null == inspectTaskId) {
return R.fail("创建巡检计划失败");
}
@ -137,19 +159,19 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
// 保存
save(recEntity);
}
log.info("groupEntity-------------------------:" + groupEntity + "----- inspectTaskId-------------------------:" + inspectTaskId);
log.info("groupEntityManagerId-------------------------:" + groupEntityManagerId + "----- inspectTaskId-------------------------:" + inspectTaskId);
R<BladeFlow> result = flowClient.startProcessInstanceByKey(DutyRecProcessConstant.
DUTY_REC_FLOW_KEY, StringUtil.format("{}:{}",
DutyRecProcessConstant.DUTY_REC_PROCESS_TABLE, recEntity.getId()), new HashMap<String, Object>() {{
put("taskId", recEntity.getId());
put(DutyRecProcessConstant.TASK_VARIABLE_CARRY_USER, TaskUtil.getTaskUser(groupEntity.getManagerId().toString()));
put(DutyRecProcessConstant.TASK_VARIABLE_CARRY_USER, TaskUtil.getTaskUser(groupEntityManagerId.toString()));
//put(DutyRecProcessConstant.TASK_VARIABLE_CARRY_USER, Arrays.stream(dutyMainEntity.getDutyPersonIds().split("\\^")).map(o -> TaskUtil.getTaskUser(o)).collect(Collectors.joining(",")));
}});
log.info("result-------------------------:" + result);
if (result.isSuccess()) {
Date date = new Date();
//消息提醒
handMessageRemind(handGroupEntity, groupEntity, date);
handMessageRemind(handGroupManagerId, groupEntityManagerId, date);
//判断是否延时交班
judgeDelayedHand(handDutyMainEntity, recEntity);//判断交班是否延时
@ -177,22 +199,22 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
imsDutyMainMapper.updateById(imsDutyMainEntity);
}
void handMessageRemind(ImsDutyGroupEntity handGroupEntity, ImsDutyGroupEntity groupEntity, Date date) {
void handMessageRemind(Long handGroupManagerId, Long groupEntityManagerId, Date date) {
//消息提醒
R<User> userR = userClient.userInfoById(handGroupEntity.getManagerId());
R<User> userR = userClient.userInfoById(handGroupManagerId);
if (userR.isSuccess()) {
String userName = "";
PushExtrasReq req = new PushExtrasReq();
log.info("--------------------------req:" + req, groupEntity.getManagerId(), userName, date);
log.info("--------------------------req:" + req, groupEntityManagerId, userName, date);
if (ObjectUtil.isNotEmpty(userR.getData()) && StringUtil.isNotBlank(userR.getData().getName())) {
userName = userR.getData().getName();
log.info("--------------------------req2:" + req, groupEntity.getManagerId(), userName, date);
log.info("--------------------------req2:" + req, groupEntityManagerId, userName, date);
}
String format = DateUtil.format(date, DateUtil.PATTERN_DATETIME);
/*remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(),
groupEntity.getManagerId(), userName, null,
format, groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());*/
log.info("--------------------------req3:" + req, groupEntity.getManagerId(), userName, date);
log.info("--------------------------req3:" + req, groupEntityManagerId, userName, date);
}
}
@ -252,6 +274,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
/**
* 详情
*
* @param vo
* @return
*/
@ -331,20 +354,24 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
return R.success("您当前未值班");
}
if (entity.getDutyGroupId() != null) {
ImsDutyGroupEntity groupEntity = imsDutyGroupService.getOne(new LambdaQueryWrapper<ImsDutyGroupEntity>() {{
eq(ImsDutyGroupEntity::getId, entity.getDutyGroupId());
eq(ImsDutyGroupEntity::getManagerId, AuthUtil.getUserId());
}});
if (ObjectUtils.isEmpty(groupEntity)) {
return R.success("您不是该班组负责人,不可交班!");
}
} else {
ImsDutyMainPersonEntity personEntity = imsDutyMainPersonService.getOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, entity.getId());
eq(ImsDutyMainPersonEntity::getDutyChargePerson, AuthUtil.getUserId());
last(" limit 1");
}});
if (ObjectUtil.isEmpty(groupEntity)&&ObjectUtil.isEmpty(personEntity)) {
if ( ObjectUtil.isEmpty(personEntity)) {
return R.success("您不是该班组负责人,不可交班!");
}
}
ImsDutyRecEntity recEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<ImsDutyRecEntity>() {{
eq(ImsDutyRecEntity::getDutyId, entity.getId());
}});
@ -421,6 +448,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
// vo.setCarryDutyMainVo(imsSchedulingVo1);
// return R.data(vo);
// }
/**
* 获取签到二维码
*
@ -503,19 +531,82 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
/**
* 消息提醒
*/
//20230414已弃用,改用V2
// @Override
// public void messageRemonding() {
// List<ImsDutyMainEntity> list = imsDutyMainService.list(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
// eq(ImsDutyMainEntity::getStatus, JoinStatus.DUTY_ING.getStatus());
// }});
// if (CollectionUtil.isNotEmpty(list)) {
// for (ImsDutyMainEntity entity : list) {
// ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(entity.getDutyGroupId());
// ImsDutyClassEntity classEntity = imsDutyClassService.getById(entity.getClassId());
// if (ObjectUtil.isNotEmpty(groupEntity) && ObjectUtil.isNotEmpty(classEntity)) {
// String userName = "";
// if (null != groupEntity.getManagerId()) {
// userName = userClient.userInfoById(groupEntity.getManagerId()).getData().getName();
// }
// PushExtrasReq req = new PushExtrasReq();
// if (null != entity.getPreDutyId()) {
// ImsDutyRecEntity one = this.getOne(new LambdaQueryWrapper<ImsDutyRecEntity>() {{
// eq(ImsDutyRecEntity::getDutyId, entity.getId());
// }});
// ImsDutyMainEntity carryMainentity = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
// eq(ImsDutyMainEntity::getPreDutyId, entity.getPreDutyId());
// }});
// ImsDutyGroupEntity carryGroupEntity = imsDutyGroupService.getById(carryMainentity.getDutyGroupId());
// if (ObjectUtil.isEmpty(one)) {//未发起交班流程 判断是否提醒交班
// Long differMinute = DateUtils.getDifferMinute(calculateDate(entity, classEntity, OperationalConstants.DutyRecTypeEnum.HAND_REC.getVal()));
// if (differMinute == -OperationalConstants.MessageRecTypeEnum.HAND_REC_MESSAGE.getVal()) { // 提醒交班
// remondingHead(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(), groupEntity.getManagerId(), groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());
// } else if (differMinute == OperationalConstants.MessageRecTypeEnum.DELAYED_HAND_REC_MESSAGE.getVal()) {//延时交班提醒
// //提醒站长 接班人 交班人
// User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData();
// remondingStation(req, admin, userName, classEntity);//提醒站长
// remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), carryGroupEntity.getManagerId(), userName, classEntity, null, carryGroupEntity.getTenantId(), carryGroupEntity.getCreateDept(), carryGroupEntity.getCreateUser());//提醒接班人
// remondingHead(req, OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), groupEntity.getManagerId(), groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());//提醒交班人
// }
// } else {//已发起接班流程 判断是否提醒接班
// ImsDutyClassEntity carryClassEntity = imsDutyClassService.getById(carryMainentity.getClassId());
// Long differMinute = DateUtils.getDifferMinute(calculateDate(carryMainentity, carryClassEntity, OperationalConstants.DutyRecTypeEnum.CARRY_REC.getVal()));
// if (differMinute > 0 && one.getDelayStatus() == 0) {
// ImsDutyGroupEntity groupEntity1 = imsDutyGroupService.getById(carryMainentity.getDutyGroupId());
// //提醒站长 接班人 交班人
// User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData();
// remondingStation(req, admin, groupEntity1.getManagerId().toString(), classEntity);//提醒站长
// remondingCarry(req, 2, carryGroupEntity.getManagerId(), groupEntity1.getManagerId().toString(), classEntity, null, groupEntity1.getTenantId(), groupEntity1.getCreateDept(), groupEntity1.getCreateUser());//提醒接班人
// }
// }
// }
// }
// }
// }
// }
/**
* 消息提醒
* 相较于上一个版本大体逻辑没变只改了推送消息的方式调用黄兴接口
*/
@Override
public void messageRemonding() {
public void messageRemondingV2() {
List<ImsDutyMainEntity> list = imsDutyMainService.list(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
eq(ImsDutyMainEntity::getStatus, JoinStatus.DUTY_ING.getStatus());
}});
if (CollectionUtil.isNotEmpty(list)) {
for (ImsDutyMainEntity entity : list) {
Long groupEntityManagerId;
if (entity.getDutyGroupId() != null) {
ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(entity.getDutyGroupId());
groupEntityManagerId = groupEntity.getManagerId();
} else {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = imsDutyMainPersonService.selectByMainId(entity.getId());
groupEntityManagerId = imsDutyMainPersonEntities.get(0).getDutyChargePerson();
}
ImsDutyClassEntity classEntity = imsDutyClassService.getById(entity.getClassId());
if (ObjectUtil.isNotEmpty(groupEntity) && ObjectUtil.isNotEmpty(classEntity)) {
if (ObjectUtil.isNotEmpty(groupEntityManagerId) && ObjectUtil.isNotEmpty(classEntity)) {
String userName = "";
if (null != groupEntity.getManagerId()) {
userName = userClient.userInfoById(groupEntity.getManagerId()).getData().getName();
if (null != groupEntityManagerId) {
userName = userClient.userInfoById(groupEntityManagerId).getData().getName();
}
PushExtrasReq req = new PushExtrasReq();
if (null != entity.getPreDutyId()) {
@ -525,27 +616,40 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
ImsDutyMainEntity carryMainentity = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
eq(ImsDutyMainEntity::getPreDutyId, entity.getPreDutyId());
}});
Long carryManagerId;
String carryTenantId;
Long carryCreateDept;
if (carryMainentity.getDutyGroupId() == null) {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = imsDutyMainPersonService.selectByMainId(carryMainentity.getId());
carryManagerId = imsDutyMainPersonEntities.get(0).getDutyChargePerson();
carryTenantId = imsDutyMainPersonEntities.get(0).getTenantId();
carryCreateDept = imsDutyMainPersonEntities.get(0).getCreateDept();
} else {
ImsDutyGroupEntity carryGroupEntity = imsDutyGroupService.getById(carryMainentity.getDutyGroupId());
carryManagerId = carryGroupEntity.getManagerId();
carryTenantId = carryGroupEntity.getTenantId();
carryCreateDept = carryGroupEntity.getCreateDept();
}
R<User> user = userClient.userInfoById(carryManagerId);
if (ObjectUtil.isEmpty(one)) {//未发起交班流程 判断是否提醒交班
Long differMinute = DateUtils.getDifferMinute(calculateDate(entity, classEntity, OperationalConstants.DutyRecTypeEnum.HAND_REC.getVal()));
if (differMinute == -OperationalConstants.MessageRecTypeEnum.HAND_REC_MESSAGE.getVal()) { // 提醒交班
remondingHead(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(), groupEntity.getManagerId(), groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());
remondingHeadV2(OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(), groupEntityManagerId, userName, entity.getTenantId(), entity.getCreateDept(), entity.getId(), entity.getCreateUser());
} else if (differMinute == OperationalConstants.MessageRecTypeEnum.DELAYED_HAND_REC_MESSAGE.getVal()) {//延时交班提醒
//提醒站长 接班人 交班人
User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData();
remondingStation(req, admin, userName, classEntity);//提醒站长
remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), carryGroupEntity.getManagerId(), userName, classEntity, null, carryGroupEntity.getTenantId(), carryGroupEntity.getCreateDept(), carryGroupEntity.getCreateUser());//提醒接班人
remondingHead(req, OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), groupEntity.getManagerId(), groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());//提醒交班人
remondingStationV2(admin, userName, classEntity, carryMainentity.getTenantId(), carryMainentity.getId(), carryMainentity.getCreateDept(), carryMainentity.getCreateUser());//提醒站长
remondingCarryV2(OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), carryManagerId, userName, classEntity, null, carryTenantId, carryCreateDept, carryMainentity.getId(), carryMainentity.getCreateUser());//提醒接班人
remondingHeadV2(OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), groupEntityManagerId, userName, entity.getTenantId(), entity.getCreateDept(), entity.getId(), entity.getCreateUser());//提醒交班人
}
} else {//已发起接班流程 判断是否提醒接班
ImsDutyClassEntity carryClassEntity = imsDutyClassService.getById(carryMainentity.getClassId());
Long differMinute = DateUtils.getDifferMinute(calculateDate(carryMainentity, carryClassEntity, OperationalConstants.DutyRecTypeEnum.CARRY_REC.getVal()));
if (differMinute > 0 && one.getDelayStatus() == 0) {
ImsDutyGroupEntity groupEntity1 = imsDutyGroupService.getById(carryMainentity.getDutyGroupId());
//提醒站长 接班人 交班人
User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData();
remondingStation(req, admin, groupEntity1.getManagerId().toString(), classEntity);//提醒站长
remondingCarry(req, 2, carryGroupEntity.getManagerId(), groupEntity1.getManagerId().toString(), classEntity, null, groupEntity1.getTenantId(), groupEntity1.getCreateDept(), groupEntity1.getCreateUser());//提醒接班人
remondingStationV2(admin, admin.getName(), classEntity, carryMainentity.getTenantId(), carryMainentity.getId(), carryMainentity.getCreateDept(), carryMainentity.getCreateUser());//提醒站长
remondingCarryV2(2, carryManagerId, user.getData().getName(), classEntity, null, carryTenantId, carryCreateDept, carryMainentity.getId(), carryMainentity.getCreateUser());//提醒接班人
}
}
}
@ -587,7 +691,6 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
}});
List<Long> idList = new ArrayList<>();
boolean bool = true;
ImsDutyMainEntity dutyMainEntity = new ImsDutyMainEntity();
@ -850,6 +953,35 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
}
/**
* 消息提醒站长
*/
private void remondingStationV2(User admin, String userName, ImsDutyClassEntity
classEntity, String tenantId, Long taskId, Long createDept, Long createUser) {
MessagePushRecordDto messagePushRecordDto = new MessagePushRecordDto();
messagePushRecordDto.setBusinessClassify("dailyRemind");
messagePushRecordDto.setBusinessKey(MessageConstants.BusinessClassifyEnum.DUTY.getKey());
messagePushRecordDto.setSubject(MessageConstants.BusinessClassifyEnum.DUTY.getDescription());
messagePushRecordDto.setTaskId(taskId);
messagePushRecordDto.setTenantId(tenantId);
messagePushRecordDto.setPusher(admin.getId().toString());
messagePushRecordDto.setPusherName(userName);
messagePushRecordDto.setAccount(admin.getId().toString());
messagePushRecordDto.setContent(userName + " 负责人 值班日期为:(" + classEntity.getStartTime()
+ "-" + classEntity.getEndTime() + ") 目前已交班延迟,请尽快联系该负责人进行交班工作");
messagePushRecordDto.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
messagePushRecordDto.setPushType(MessageConstants.IMMEDIATELY);
messagePushRecordDto.setDeptId(Long.valueOf(admin.getDeptId()));
R<String> deptName = sysClient.getDeptName(Long.valueOf(admin.getDeptId()));
if (deptName.isSuccess()) {
messagePushRecordDto.setDeptName(deptName.getData());
}
messagePushRecordDto.setCreateDept(createDept);
messagePushRecordDto.setCreateUser(createUser);
R<Boolean> booleanR = messageClient.sendMessage(messagePushRecordDto);
System.out.println(booleanR.toString());
}
/**
* 消息提醒交班人
*/
private void remondingHead(PushExtrasReq req, int type, Long managerId, String tenantId, Long createDept, Long createUser) {
@ -866,7 +998,35 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
}
/**
* 消息提醒接班人
* 消息提醒交班人
*/
private void remondingHeadV2(int type, Long managerId, String userName, String tenantId, Long createDept, Long taskId, Long createUser) {
MessagePushRecordDto messagePushRecordDto = new MessagePushRecordDto();
messagePushRecordDto.setBusinessClassify("dailyRemind");
messagePushRecordDto.setBusinessKey(MessageConstants.BusinessClassifyEnum.DUTY.getKey());
messagePushRecordDto.setSubject(MessageConstants.BusinessClassifyEnum.DUTY.getDescription());
messagePushRecordDto.setTaskId(taskId);
messagePushRecordDto.setTenantId(tenantId);
messagePushRecordDto.setPusher(managerId.toString());
messagePushRecordDto.setPusherName(userName);
messagePushRecordDto.setAccount(managerId.toString());
if (type == OperationalConstants.RecTypeEnum.HAND_REMIND.getVal()) {
messagePushRecordDto.setContent("您距离本次值班结束时间只剩 15 分钟,请尽快进行交班工作");
} else if (type == OperationalConstants.RecTypeEnum.HAND_DELAY.getVal()) {
messagePushRecordDto.setContent("您已交班延迟,请尽快进行交班工作");
}
messagePushRecordDto.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
messagePushRecordDto.setDeptId(createDept);
messagePushRecordDto.setPushType(MessageConstants.IMMEDIATELY);
R<String> deptName = sysClient.getDeptName(createDept);
messagePushRecordDto.setDeptName(deptName.getData());
messagePushRecordDto.setCreateDept(createDept);
messagePushRecordDto.setCreateUser(createUser);
messageClient.sendMessage(messagePushRecordDto);
}
/**
* 消息提醒接班人 启用
*/
private void remondingCarry(PushExtrasReq req, int type, Long managerId, String userName, ImsDutyClassEntity
classEntity, String date, String tenantId, Long createDept, Long createUser) {
@ -883,6 +1043,38 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
messagePushClient.sendMessage(managerId.toString(), req, tenantId, createDept, createUser);
}
/**
* 消息提醒接班人
*/
private void remondingCarryV2(int type, Long managerId, String userName, ImsDutyClassEntity
classEntity, String date, String tenantId, Long createDept, Long taskId, Long createUser) {
MessagePushRecordDto messagePushRecordDto = new MessagePushRecordDto();
messagePushRecordDto.setBusinessClassify("dailyRemind");
messagePushRecordDto.setBusinessKey(MessageConstants.BusinessClassifyEnum.DUTY.getKey());
messagePushRecordDto.setSubject(MessageConstants.BusinessClassifyEnum.DUTY.getDescription());
messagePushRecordDto.setTaskId(taskId);
messagePushRecordDto.setTenantId(tenantId);
messagePushRecordDto.setPusher(managerId.toString());
messagePushRecordDto.setPusherName(userName);
messagePushRecordDto.setAccount(managerId.toString());
if (type == OperationalConstants.RecTypeEnum.HAND_REMIND.getVal()) {
messagePushRecordDto.setContent(userName + " 于 " + date + " 时已提交交班工作");
} else if (type == OperationalConstants.RecTypeEnum.HAND_DELAY.getVal()) {
messagePushRecordDto.setContent(userName + " 值班日期为(" + classEntity.getStartTime() + " - " + classEntity.getEndTime() + "),目前已延迟交班");
} else if (type == OperationalConstants.RecTypeEnum.REMIND_HAND_PERSON.getVal()) {
messagePushRecordDto.setContent("您已交班延迟,请尽快进行交班工作");
}
messagePushRecordDto.setPushType(MessageConstants.IMMEDIATELY);
messagePushRecordDto.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
messagePushRecordDto.setDeptId(createDept);
R<String> deptName = sysClient.getDeptName(createDept);
messagePushRecordDto.setDeptName(deptName.getData());
messagePushRecordDto.setCreateDept(createDept);
messagePushRecordDto.setCreateUser(createUser);
R<Boolean> booleanR = messageClient.sendMessage(messagePushRecordDto);
System.out.println(booleanR.toString());
}
//新增巡检计划 获取巡检任务ID
public Long getInspectTaskId(PlanVO vo, Long princId) {
vo.setName(DateUtil.format(new Date(), "yyyy-MM-dd HH") + "-交接班巡视");
@ -973,6 +1165,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
/**
* 交接班统计
*
* @param param
* @return
*/

22
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java

@ -1,8 +1,6 @@
package com.hnac.hzims.operational.main.controller.web;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
@ -33,9 +31,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.SpringQueryMap;
@ -132,10 +128,10 @@ public class AreaMonthlyDetailsController {
/**
* 根据区域和月份分页查询日维护列表
* 根据区域和月份分页查询日维护列表
*/
@ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域和月份分页查询日维护列表")
@ApiOperation(value = "根据区域和月份分页查询日维护列表")
@GetMapping("/queryLogMaintenancePageList/{page}/{size}")
public R<IPage<MaintenanceTaskVo>> queryLogMaintenancePageList(
@ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ -148,11 +144,11 @@ public class AreaMonthlyDetailsController {
/**
* 根据区域和月份分页查询日维护 根据id获取详情
* 根据区域和月份分页查询日维护 根据id获取详情
*/
@GetMapping("/queryLogMaintenancePageList/detail/{id}")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "根据区域和月份分页查询日维护 根据id获取详情")
@ApiOperation(value = "根据区域和月份分页查询日维护 根据id获取详情")
public R<OperMaintenanceTaskEntity> detail(@PathVariable Long id) {
return taskService.detail(id);
}
@ -163,8 +159,14 @@ public class AreaMonthlyDetailsController {
*/
@ApiOperationSupport(order = 50)
@ApiOperation(value = "根据区域和月份分页查询巡检任务")
@GetMapping("/queryCheckTaskPageList")
public R<BladePage<TaskVo>> queryCheckTaskPageList(TaskListQuery task, Query query) {
@GetMapping("/queryCheckTaskPageList/{page}/{size}")
public R<BladePage<TaskVo>> queryCheckTaskPageList(
@ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
TaskListQuery task) {
Query query = new Query();
query.setCurrent(page.intValue());
query.setSize(size.intValue());
BladePage<TaskVo> taskVoIPage = areaMonthlyDetailsService.queryCheckTaskPageList(task, query);
return R.data(taskVoIPage);
}

23
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainStatisticsServiceImpl.java

@ -16,10 +16,8 @@ import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyGroupEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.service.IImsDutyClassService;
import com.hnac.hzims.operational.duty.service.IImsDutyGroupService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.duty.service.IImsDutyRecService;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainPersonEntity;
import com.hnac.hzims.operational.duty.service.*;
import com.hnac.hzims.operational.main.service.IMainStatisticsService;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant;
@ -30,21 +28,15 @@ import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import com.hnac.hzinfo.inspect.task.feign.IInspectTaskReportClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springblade.system.cache.DictCache;
import org.springblade.system.entity.Dict;
import org.springblade.system.feign.IDictClient;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -64,6 +56,7 @@ public class MainStatisticsServiceImpl implements IMainStatisticsService {
private final IOperDefectStatisticsService operDefectStatisticsService;
private final IImsDutyClassService iImsDutyClassService;
private final IDictClient dictClient;
private final IImsDutyMainPersonService imsDutyMainPersonService;
@Override
@ -85,14 +78,22 @@ public class MainStatisticsServiceImpl implements IMainStatisticsService {
DutyStatisticsVO dutyStatisticsVo = new DutyStatisticsVO();
if(imsDutyMainEntity != null){
dutyStatisticsVo = BeanUtil.copy(imsDutyMainEntity, DutyStatisticsVO.class);
if (dutyStatisticsVo.getDutyGroupId()!=null) {
//完善负责人信息
ImsDutyGroupEntity imsDutyGroupEntity = imsDutyGroupService.getById(dutyStatisticsVo.getDutyGroupId());
if (imsDutyGroupEntity != null) {
dutyStatisticsVo.setGroupName(imsDutyGroupEntity.getGroupName());
User managerUser = UserCache.getUser(imsDutyGroupEntity.getManagerId());
dutyStatisticsVo.setManager(managerUser);
}
}else {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = imsDutyMainPersonService.selectByMainId(dutyStatisticsVo.getId());
dutyStatisticsVo.setGroupName("灵活排班");
if (CollectionUtil.isNotEmpty(imsDutyMainPersonEntities)) {
User managerUser = UserCache.getUser(imsDutyMainPersonEntities.get(0).getDutyChargePerson());
dutyStatisticsVo.setManager(managerUser);
}
}
String dutyPersonIds = dutyStatisticsVo.getDutyPersonIds();
int num = 0;
int completeNum = 0;

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java

@ -162,6 +162,7 @@ public class MaintenanceTaskCreateTask {
return;
}
}
BeanUtil.copyProperties(planEntity, taskEntity);
taskService.save(taskEntity);
//生成工作流实例
String processInstanceId = this.startProcessInstance(planEntity.getProcDefId(), taskEntity);
@ -169,6 +170,9 @@ public class MaintenanceTaskCreateTask {
taskService.updateById(taskEntity);
planEntity.setCreateTaskTime(DateUtil.now());
planMapper.updateById(planEntity);
taskEntity = taskService.getById(taskEntity.getId());
//taskEntity.setMessageTemplateId(1646694238095732738L);
this.pushTaskMessage(taskEntity);
}
@ -207,7 +211,7 @@ public class MaintenanceTaskCreateTask {
XxlJobLogger.log("开始保存{}的日常维护消息推送记录",taskEntity.getDisposer());
R<MessageTemplateEntity> templateR = messageClient.getMsgTemplateById(taskEntity.getMessageTemplateId());
if(templateR.isSuccess() && ObjectUtil.isNotEmpty(templateR.getData())) {
Func.toLongList("",taskEntity.getDisposer()).forEach(userId -> {
Func.toLongList(",",taskEntity.getDisposer()).forEach(userId -> {
// MessagePushRecordDto recordDto = BeanUtil.copy(templateR.getData(),MessagePushRecordDto.class);
// recordDto.setTypes(Arrays.asList(Func.split(recordDto.getType(),",")));
// recordDto.setDeptId(taskEntity.getCreateDept());

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

@ -341,7 +341,8 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
* @return
*/
@Override
public IPage<MaintenanceTaskVo> queryLogMaintenancePageList(Page<OperMaintenanceTaskEntity> pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo) {
public IPage<MaintenanceTaskVo>
queryLogMaintenancePageList(Page<OperMaintenanceTaskEntity> pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo) {
//1.根据区域查询
QueryWrapper<OperMaintenanceTaskEntity> queryWrapper = new QueryWrapper<>();
//维护内容

6
hzims-service/operational/src/main/resources/db/1.0.1.sql

@ -4,3 +4,9 @@ alter table hzims_oper_maintenance_library add COLUMN `MESSAGE_TEMPLATE_ID` bigi
alter table hzims_oper_maintenance_plan add COLUMN `MESSAGE_TEMPLATE_ID` bigint(20) comment '消息推送模板ID';
-- 日常维护任务添加消息模板ID
alter table hzims_oper_maintenance_task add COLUMN `MESSAGE_TEMPLATE_ID` bigint(20) comment '消息推送模板ID';
-- 日常维护库设备库编码长度修改
alter table hzims_oper_maintenance_library MODIFY COLUMN `em_code` VARCHAR(50) comment '设备编码';
-- 日常维护库设备计划编码长度修改
alter table hzims_oper_maintenance_plan MODIFY COLUMN `em_code` VARCHAR(50) comment '设备编码';
-- 日常维护库设备任务编码长度修改
alter table hzims_oper_maintenance_task MODIFY COLUMN `em_code` VARCHAR(50) comment '设备编码';

10
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java

@ -5,6 +5,8 @@ import com.hnac.hzims.message.dto.PlanMsgRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.safeproduct.template.abstracts.TemplateAbstractService;
import com.qiniu.util.Json;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.stereotype.Service;
@ -16,6 +18,7 @@ import java.util.Optional;
/**
* 日常维护计划
*
* @Author WL
* @Version v1.0
* @Serial 1.0
@ -25,7 +28,6 @@ import java.util.Optional;
public class MaintenanceTempleServiceImpl extends TemplateAbstractService {
/**
* 执行具体的业务场景,推送消息
*
@ -34,15 +36,16 @@ public class MaintenanceTempleServiceImpl extends TemplateAbstractService {
@Override
public PlanMsgRecordDto executeTemplateMessage(PlanMsgRecordDto planMsgRecord) {
Map<String, Object> map = new HashMap<>();
map.put("one",
Optional.ofNullable(UserCache.getUser(planMsgRecord.getReceiver())).map(User::getName).orElse(""));
map.put("one", Optional.ofNullable(UserCache.getUser(planMsgRecord.getReceiver())).map(User::getName).orElse(""));
map.put("two", planMsgRecord.getPlanTime());
planMsgRecord.setContent(JSON.toJSONString(map));
planMsgRecord.setResourceCode("aliyun-safeTool-push");
return planMsgRecord;
}
/**
* 模板状态
*
* @param status
*/
@Override
@ -51,5 +54,4 @@ public class MaintenanceTempleServiceImpl extends TemplateAbstractService {
}
}

1
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java

@ -123,6 +123,7 @@ public class StandardTicketInfoController extends BladeController {
@SpringQueryMap StandardTicketWithAreaVo areaMonthlyVo) {
Page<StandardTicketInfoEntity> searchPage = new Page<>(page, size);
BladePage<StandardTicketVo> standardTicketInfoEntity =
standardTicketInfoService.areaMonthlyWithOperation(areaMonthlyVo, searchPage);
return R.data(standardTicketInfoEntity);

18
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

@ -56,7 +56,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
Map<String,Object> params = new HashMap<String, Object>(2) {{
put("taskId", "1644624168666353665");
put("signUserIds", AuthUtil.getUserId());
put("signUserIds", "1377143375838359553");
}};
flowClient.startProcessInstanceContainNameByKey(
@ -64,12 +64,16 @@ public class TicketProcessServiceImpl implements TicketProcessService {
"开启工作的任务",
params);
R<List<TaskList>> listR = flowClient.todoList(processDefinitionKey);
listR.getData().forEach(taskList -> {
System.out.println("任务名称:"+taskList);
System.out.println(taskList.getTaskName());
System.out.println(taskList.getStatus());
});
// R<List<TaskList>> listR = flowClient.todoList(processDefinitionKey);
// listR.getData().forEach(taskList -> {
// System.out.println("任务名称:"+taskList);
// System.out.println(taskList.getTaskName());
// System.out.println(taskList.getStatus());
// });
// flowClient.completeTask()
}
}

Loading…
Cancel
Save