bug修复
This commit is contained in:
parent
956b934144
commit
bff0d84786
@ -808,7 +808,14 @@
|
||||
|
||||
<select id="queryAlarmsByTime"
|
||||
resultType="com.zhgd.xmgl.modules.bigdevice.entity.TowerAlarm">
|
||||
select ta.* from tower_alarm ta where ta.add_time >= #{queryStartTime} and ta.add_time <![CDATA[<=]]>
|
||||
select ta.* from tower_alarm ta
|
||||
where ta.add_time >= #{queryStartTime} and ta.add_time <![CDATA[<=]]>
|
||||
concat(#{queryEndTime},' 23:59:59') and ta.alarm_type=1
|
||||
<if test="projectSn != null and projectSn != ''">
|
||||
and ta.project_sn=#{projectSn}
|
||||
</if>
|
||||
<if test="devSn != null and devSn != ''">
|
||||
and ta.dev_sn = #{devSn}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -1,26 +1,32 @@
|
||||
package com.zhgd.xmgl.modules.xz.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import java.util.HashMap;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.modules.xz.entity.FlowExceptionLog;
|
||||
import com.zhgd.xmgl.modules.xz.service.IFlowExceptionLogService;
|
||||
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
@ -35,11 +41,19 @@ import org.springframework.web.bind.annotation.*;
|
||||
@Slf4j
|
||||
@Api(tags = "工作流异常日志相关Api")
|
||||
public class FlowExceptionLogController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IFlowExceptionLogService flowExceptionLogService;
|
||||
IFlowExceptionLogService flowExceptionLogService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
RuntimeService runtimeService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ISystemUserService systemUserService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "工作流异常日志管理", operType = "分页查询", operDesc = "分页列表查询工作流异常日志信息")
|
||||
@ -55,6 +69,7 @@ public class FlowExceptionLogController {
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "工作流异常日志管理", operType = "列表查询", operDesc = "列表查询工作流异常日志信息")
|
||||
@ -66,6 +81,7 @@ public class FlowExceptionLogController {
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param flowExceptionLog
|
||||
* @return
|
||||
*/
|
||||
@ -77,8 +93,36 @@ public class FlowExceptionLogController {
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@OperLog(operModul = "工作流异常日志管理", operType = "添加", operDesc = "从工作流添加工作流异常日志信息")
|
||||
@ApiOperation(value = "从工作流添加工作流异常日志信息", notes = "从工作流添加工作流异常日志信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/flow/add")
|
||||
public Result addFromFlow(@RequestBody @Validate Map<String, Object> param) {
|
||||
log.info("从工作流添加工作流异常日志信息:{}", JSON.toJSONString(param));
|
||||
String instanceId = MapUtils.getString(param, "instanceId");
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(instanceId).singleResult();
|
||||
Date startTime = processInstance.getStartTime();
|
||||
String processDefinitionName = processInstance.getProcessDefinitionName();
|
||||
String startUserId = processInstance.getStartUserId();
|
||||
String projectSn = processInstance.getTenantId();
|
||||
FlowExceptionLog log = new FlowExceptionLog();
|
||||
log.setApprovalNumber(instanceId);
|
||||
log.setApprovalType(processDefinitionName);
|
||||
log.setProjectSn(projectSn);
|
||||
log.setLaunchTime(startTime);
|
||||
HashMap<String, Object> map = new HashMap<>(16);
|
||||
map.put("userId", startUserId);
|
||||
map.put("projectSn", projectSn);
|
||||
List<SystemUser> userList = systemUserService.getProjectChildernSystemUserList(map);
|
||||
log.setLauncherName(CollUtil.isNotEmpty(userList) ? userList.get(0).getRealName() : null);
|
||||
log.setLaunchEnterpriseName(CollUtil.isNotEmpty(userList) ? userList.get(0).getEnterpriseName() : null);
|
||||
log.setExceptionDetail("网络超时");
|
||||
flowExceptionLogService.add(log);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param flowExceptionLog
|
||||
* @return
|
||||
*/
|
||||
@ -92,6 +136,7 @@ public class FlowExceptionLogController {
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "工作流异常日志管理", operType = "删除", operDesc = "删除工作流异常日志信息")
|
||||
@ -105,6 +150,7 @@ public class FlowExceptionLogController {
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
||||
@ -3,11 +3,9 @@ package com.zhgd.xmgl.util;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.xmgl.base.EmailService;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.service.impl.EnterpriseInfoServiceImpl;
|
||||
import com.zhgd.xmgl.modules.worker.service.impl.WorkerInfoServiceImpl;
|
||||
import com.zhgd.xmgl.modules.xz.entity.FlowExceptionLog;
|
||||
@ -33,7 +31,6 @@ import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 发送邮件工具类 MailUtil
|
||||
@ -49,6 +46,9 @@ public class EmailUtils implements EmailService {
|
||||
@Lazy
|
||||
@Autowired
|
||||
RuntimeService runtimeService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
IFlowExceptionLogService flowExceptionLogService;
|
||||
/**
|
||||
* Spring Boot 提供了一个发送邮件的简单抽象,使用的是下面这个接口,这里直接注入即可使用
|
||||
*/
|
||||
@ -60,6 +60,15 @@ public class EmailUtils implements EmailService {
|
||||
*/
|
||||
@Value("${spring.mail.from}")
|
||||
private String from;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ISystemUserService systemUserService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private WorkerInfoServiceImpl workerInfoService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private EnterpriseInfoServiceImpl enterpriseInfoService;
|
||||
|
||||
public static void main(String[] args) {
|
||||
EmailUtils mailService = new EmailUtils();
|
||||
@ -157,20 +166,9 @@ public class EmailUtils implements EmailService {
|
||||
}
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
IFlowExceptionLogService flowExceptionLogService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ISystemUserService systemUserService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private WorkerInfoServiceImpl workerInfoService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private EnterpriseInfoServiceImpl enterpriseInfoService;
|
||||
/**
|
||||
* 保存异常并发送工作流异常邮件
|
||||
*
|
||||
* @param paramStr
|
||||
* @param e
|
||||
* @param subject
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user