记录工作流异常日志
This commit is contained in:
parent
0476848dfb
commit
291f55c14b
@ -199,5 +199,8 @@ public class SystemUser implements Serializable {
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "默认1,通过邮箱验证,0则不通过邮箱验证")
|
||||
private java.lang.Integer isCheckCode;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "企业名称")
|
||||
private java.lang.String enterpriseName;
|
||||
|
||||
}
|
||||
|
||||
@ -47,7 +47,8 @@
|
||||
b.role_id,
|
||||
po.dept_name as projectOrgName,
|
||||
d.enterprise_id,
|
||||
d.person_mail
|
||||
d.person_mail,
|
||||
ei.enterprise_name
|
||||
from system_user t
|
||||
LEFT JOIN base_role_user b ON t.user_id = b.user_id
|
||||
LEFT JOIN base_role c ON c.role_id = b.role_id
|
||||
|
||||
@ -255,7 +255,7 @@ public class CarInfoController {
|
||||
carInfoService.addCarInfo(carInfo);
|
||||
} catch (Exception e) {
|
||||
log.error("添加车辆黑白名单管理信息", e);
|
||||
emailUtils.sendFlowEmail(paramStr, e, "添加车辆", "/xmgl/carInfo/save");
|
||||
emailUtils.saveExceptionAndSendFlowEmail(paramStr, e, "添加车辆", "/xmgl/carInfo/save", MapUtils.getString(map, "instanceId"));
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ -201,11 +201,10 @@ public class DangerousEngineeringRecordController {
|
||||
dangerousEngineeringRecord.setSpecialConstructionSchemeFile(JSON.toJSONString(spFile));
|
||||
dangerousEngineeringRecord.setResponsibilityCompany(enterpriseInfo.getEnterpriseName());
|
||||
dangerousEngineeringRecord.setPersonLiable(workerInfo.getWorkerName());
|
||||
System.out.println(dangerousEngineeringRecord);
|
||||
dangerousEngineeringRecordService.saveDangerousEngineeringRecord(dangerousEngineeringRecord);
|
||||
} catch (Exception e) {
|
||||
log.error("添加现场危大工程信息", e);
|
||||
emailUtils.sendFlowEmail(paramStr, e, "添加现场危大工程信息", "/xmgl/dangerousEngineeringRecord/save");
|
||||
emailUtils.saveExceptionAndSendFlowEmail(paramStr, e, "添加现场危大工程信息", "/xmgl/dangerousEngineeringRecord/save", MapUtils.getString(map, "instanceId"));
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ -0,0 +1,119 @@
|
||||
package com.zhgd.xmgl.modules.xz.controller;
|
||||
|
||||
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.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 lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 工作流异常日志
|
||||
* @author: pds
|
||||
* @date: 2024-07-23
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/flowExceptionLog")
|
||||
@Slf4j
|
||||
@Api(tags = "工作流异常日志相关Api")
|
||||
public class FlowExceptionLogController {
|
||||
@Autowired
|
||||
private IFlowExceptionLogService flowExceptionLogService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "工作流异常日志管理", operType = "分页查询", operDesc = "分页列表查询工作流异常日志信息")
|
||||
@ApiOperation(value = "分页列表查询工作流异常日志信息", notes = "分页列表查询工作流异常日志信息", httpMethod="GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<FlowExceptionLog>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(flowExceptionLogService.queryPageList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "工作流异常日志管理", operType = "列表查询", operDesc = "列表查询工作流异常日志信息")
|
||||
@ApiOperation(value = "列表查询工作流异常日志信息", notes = "列表查询工作流异常日志信息", httpMethod="GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<FlowExceptionLog>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(flowExceptionLogService.queryList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param flowExceptionLog
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "工作流异常日志管理", operType = "添加", operDesc = "添加工作流异常日志信息")
|
||||
@ApiOperation(value = "添加工作流异常日志信息", notes = "添加工作流异常日志信息" , httpMethod="POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<FlowExceptionLog> add(@RequestBody @Validate FlowExceptionLog flowExceptionLog) {
|
||||
flowExceptionLogService.add(flowExceptionLog);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param flowExceptionLog
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "工作流异常日志管理", operType = "编辑", operDesc = "编辑工作流异常日志信息")
|
||||
@ApiOperation(value = "编辑工作流异常日志信息", notes = "编辑工作流异常日志信息" , httpMethod="POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<FlowExceptionLog> edit(@RequestBody FlowExceptionLog flowExceptionLog) {
|
||||
flowExceptionLogService.edit(flowExceptionLog);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "工作流异常日志管理", operType = "删除", operDesc = "删除工作流异常日志信息")
|
||||
@ApiOperation(value = "删除工作流异常日志信息", notes = "删除工作流异常日志信息" , httpMethod="POST")
|
||||
@ApiImplicitParam(name = "id", value = "工作流异常日志ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<FlowExceptionLog> delete(@ApiIgnore @RequestBody HashMap<String ,Object> map) {
|
||||
flowExceptionLogService.delete(MapUtils.getString(map, "id"));
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "工作流异常日志管理", operType = "通过id查询", operDesc = "通过id查询工作流异常日志信息")
|
||||
@ApiOperation(value = "通过id查询工作流异常日志信息", notes = "通过id查询工作流异常日志信息" , httpMethod="GET")
|
||||
@ApiImplicitParam(name = "id", value = "工作流异常日志ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<FlowExceptionLog> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
return Result.success(flowExceptionLogService.queryById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@ -217,7 +217,7 @@ public class XzMaterialController {
|
||||
xzMaterialService.saveInfo(xzMaterial);
|
||||
} catch (Exception e) {
|
||||
log.error(interfaceName + e);
|
||||
emailUtils.sendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzMaterial/save");
|
||||
emailUtils.saveExceptionAndSendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzMaterial/save", MapUtils.getString(obj, "instanceId"));
|
||||
}
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ public class XzVisitorManageRecordController {
|
||||
xzVisitorManageRecordService.save(xzVisitorManageRecord);
|
||||
} catch (Exception e) {
|
||||
log.error("添加访客信息", e);
|
||||
emailUtils.sendFlowEmail(paramStr, e, "添加访客信息", "/xmgl/xzVisitorManageRecord/save");
|
||||
emailUtils.saveExceptionAndSendFlowEmail(paramStr, e, "添加访客信息", "/xmgl/xzVisitorManageRecord/save", MapUtils.getString(map, "instanceId"));
|
||||
}
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
|
||||
@ -372,7 +372,7 @@ public class XzWorkerInfoAuditRecordController {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("劳务人员审核通过", e);
|
||||
emailUtils.sendFlowEmail(paramStr, e, "劳务人员审核通过", "/xmgl/xzWorkerInfoAuditRecord/adoptWorkerInfo");
|
||||
emailUtils.saveExceptionAndSendFlowEmail(paramStr, e, "劳务人员审核通过", "/xmgl/xzWorkerInfoAuditRecord/adoptWorkerInfo", MapUtils.getString(paramMap, "instanceId"));
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ -0,0 +1,70 @@
|
||||
package com.zhgd.xmgl.modules.xz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
/**
|
||||
* @Description: 工作流异常日志
|
||||
* @author: pds
|
||||
* @date: 2024-07-23
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("flow_exception_log")
|
||||
@ApiModel(value="FlowExceptionLog实体类",description="FlowExceptionLog")
|
||||
public class FlowExceptionLog implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value="id")
|
||||
private java.lang.Long id ;
|
||||
/**审批单编号*/
|
||||
@Excel(name = "审批单编号", width = 15)
|
||||
@ApiModelProperty(value="审批单编号")
|
||||
private java.lang.String approvalNumber ;
|
||||
/**审批类型*/
|
||||
@Excel(name = "审批类型", width = 15)
|
||||
@ApiModelProperty(value="审批类型")
|
||||
private java.lang.String approvalType ;
|
||||
/**所属项目SN*/
|
||||
@Excel(name = "所属项目SN", width = 15)
|
||||
@ApiModelProperty(value="所属项目SN")
|
||||
private java.lang.String projectSn ;
|
||||
/**提交时间*/
|
||||
@Excel(name = "提交时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value="提交时间")
|
||||
private java.util.Date launchTime ;
|
||||
/**发起人企业*/
|
||||
@Excel(name = "发起人企业", width = 15)
|
||||
@ApiModelProperty(value="发起人企业")
|
||||
private java.lang.String launchEnterpriseName ;
|
||||
/**发起人名称*/
|
||||
@Excel(name = "发起人名称", width = 15)
|
||||
@ApiModelProperty(value="发起人名称")
|
||||
private java.lang.String launcherName ;
|
||||
/**异常详细*/
|
||||
@Excel(name = "异常详细", width = 15)
|
||||
@ApiModelProperty(value="异常详细")
|
||||
private java.lang.String exceptionDetail ;
|
||||
/**创建时间*/
|
||||
@ApiModelProperty(value="创建时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createDate ;
|
||||
/**更新时间*/
|
||||
@ApiModelProperty(value="更新时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateDate ;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.zhgd.xmgl.modules.xz.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.zhgd.xmgl.modules.xz.entity.FlowExceptionLog;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 工作流异常日志
|
||||
* @author: pds
|
||||
* @date: 2024-07-23
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface FlowExceptionLogMapper extends BaseMapper<FlowExceptionLog> {
|
||||
|
||||
}
|
||||
@ -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.zhgd.xmgl.modules.xz.mapper.FlowExceptionLogMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,54 @@
|
||||
package com.zhgd.xmgl.modules.xz.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.xz.entity.FlowExceptionLog;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 工作流异常日志
|
||||
* @author: pds
|
||||
* @date: 2024-07-23
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IFlowExceptionLogService extends IService<FlowExceptionLog> {
|
||||
/**
|
||||
* 分页列表查询工作流异常日志信息
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
IPage<FlowExceptionLog> queryPageList(HashMap<String, Object> param);
|
||||
/**
|
||||
* 列表查询工作流异常日志信息
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
List<FlowExceptionLog> queryList(HashMap<String, Object> param);
|
||||
/**
|
||||
* 添加工作流异常日志信息
|
||||
* @param flowExceptionLog 工作流异常日志
|
||||
* @return
|
||||
*/
|
||||
void add(FlowExceptionLog flowExceptionLog);
|
||||
/**
|
||||
* 编辑工作流异常日志信息
|
||||
* @param flowExceptionLog 工作流异常日志
|
||||
* @return
|
||||
*/
|
||||
void edit(FlowExceptionLog flowExceptionLog);
|
||||
/**
|
||||
* 根据id删除工作流异常日志信息
|
||||
* @param id 工作流异常日志的id
|
||||
* @return
|
||||
*/
|
||||
void delete(String id);
|
||||
/**
|
||||
* 根据id查询工作流异常日志信息
|
||||
* @param id 工作流异常日志的id
|
||||
* @return
|
||||
*/
|
||||
FlowExceptionLog queryById(String id);
|
||||
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.zhgd.xmgl.modules.xz.service.impl;
|
||||
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.xz.entity.FlowExceptionLog;
|
||||
import com.zhgd.xmgl.modules.xz.mapper.FlowExceptionLogMapper;
|
||||
import com.zhgd.xmgl.modules.xz.service.IFlowExceptionLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: 工作流异常日志
|
||||
* @author: pds
|
||||
* @date: 2024-07-23
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class FlowExceptionLogServiceImpl extends ServiceImpl<FlowExceptionLogMapper, FlowExceptionLog> implements IFlowExceptionLogService {
|
||||
@Autowired
|
||||
private FlowExceptionLogMapper flowExceptionLogMapper;
|
||||
@Override
|
||||
public IPage<FlowExceptionLog> queryPageList(HashMap<String, Object> param) {
|
||||
QueryWrapper<FlowExceptionLog> queryWrapper = this.getQueryWrapper(param);
|
||||
Page<FlowExceptionLog> page = PageUtil.getPage(param);
|
||||
IPage<FlowExceptionLog> pageList = this.page(page, queryWrapper);
|
||||
pageList.setRecords(this.dealList(pageList.getRecords()));
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowExceptionLog> queryList(HashMap<String, Object> param) {
|
||||
QueryWrapper<FlowExceptionLog> queryWrapper = getQueryWrapper(param);
|
||||
return dealList(this.list(queryWrapper));
|
||||
}
|
||||
|
||||
private QueryWrapper<FlowExceptionLog> getQueryWrapper(HashMap<String, Object> param) {
|
||||
String alias = "";
|
||||
QueryWrapper<FlowExceptionLog> queryWrapper = QueryGenerator.initPageQueryWrapper(FlowExceptionLog.class, param, alias);
|
||||
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(FlowExceptionLog::getId));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
private List<FlowExceptionLog> dealList(List<FlowExceptionLog> list) {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(FlowExceptionLog flowExceptionLog) {
|
||||
flowExceptionLog.setId(null);
|
||||
baseMapper.insert(flowExceptionLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(FlowExceptionLog flowExceptionLog) {
|
||||
FlowExceptionLog oldFlowExceptionLog = baseMapper.selectById(flowExceptionLog.getId());
|
||||
if(oldFlowExceptionLog==null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.updateById(flowExceptionLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
FlowExceptionLog flowExceptionLog = baseMapper.selectById(id);
|
||||
if(flowExceptionLog==null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowExceptionLog queryById(String id) {
|
||||
FlowExceptionLog entity = getById(id);
|
||||
if (entity == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
@ -242,7 +242,7 @@ public class XzBlindPlatePlugSafeController {
|
||||
xzBlindPlatePlugSafeService.add(xzBlindPlatePlugSafe);
|
||||
} catch (Exception e) {
|
||||
log.error(interfaceName + e);
|
||||
emailUtils.sendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzBlindPlatePlugSafe/save");
|
||||
emailUtils.saveExceptionAndSendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzBlindPlatePlugSafe/save", MapUtils.getString(paramMap, "instanceId"));
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ public class XzGroundSafetController {
|
||||
xzGroundSafetService.add(xzGroundSafet);
|
||||
} catch (Exception e) {
|
||||
log.error(interfaceName + e);
|
||||
emailUtils.sendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzGroundSafet/save");
|
||||
emailUtils.saveExceptionAndSendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzGroundSafet/save", MapUtils.getString(paramMap, "instanceId"));
|
||||
|
||||
}
|
||||
return Result.ok();
|
||||
|
||||
@ -197,7 +197,7 @@ public class XzHighJobSafeController {
|
||||
xzHighJobSafeService.add(xzHighJobSafe);
|
||||
} catch (Exception e) {
|
||||
log.error(interfaceName + e);
|
||||
emailUtils.sendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzHighJobSafe/save");
|
||||
emailUtils.saveExceptionAndSendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzHighJobSafe/save", MapUtils.getString(paramMap, "instanceId"));
|
||||
|
||||
}
|
||||
return Result.ok();
|
||||
|
||||
@ -189,7 +189,7 @@ public class XzHoistSafetyWorkController {
|
||||
xzHoistSafetyWorkService.add(xzHoistSafetyWork);
|
||||
} catch (Exception e) {
|
||||
log.error(interfaceName + e);
|
||||
emailUtils.sendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzHoistSafetyWork/save");
|
||||
emailUtils.saveExceptionAndSendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzHoistSafetyWork/save", MapUtils.getString(paramMap, "instanceId"));
|
||||
|
||||
}
|
||||
return Result.ok();
|
||||
|
||||
@ -247,7 +247,7 @@ public class XzLimitSpaceSafeController {
|
||||
xzLimitSpaceSafeService.add(JSONObject.parseObject(JSON.toJSONString(paramMap), XzLimitSpaceSafe.class));
|
||||
} catch (Exception e) {
|
||||
log.error(interfaceName + e);
|
||||
emailUtils.sendFlowEmail(paramStr, e, interfaceName, "xmgl/xzLimitSpaceSafe/save");
|
||||
emailUtils.saveExceptionAndSendFlowEmail(paramStr, e, interfaceName, "xmgl/xzLimitSpaceSafe/save", MapUtils.getString(paramMap, "instanceId"));
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ public class XzOpenCircuitSafeController {
|
||||
xzOpenCircuitSafeService.add(xzOpenCircuitSafe);
|
||||
} catch (Exception e) {
|
||||
log.error(interfaceName + e);
|
||||
emailUtils.sendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzOpenCircuitSafe/save");
|
||||
emailUtils.saveExceptionAndSendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzOpenCircuitSafe/save", MapUtils.getString(paramMap, "instanceId"));
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ public class XzSpecialOperationFireSafetyController {
|
||||
xzSpecialOperationFireSafetyService.add(xzSpecialOperationFireSafety);
|
||||
} catch (Exception e) {
|
||||
log.error(interfaceName + e);
|
||||
emailUtils.sendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzSpecialOperationFireSafety/save");
|
||||
emailUtils.saveExceptionAndSendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzSpecialOperationFireSafety/save", MapUtils.getString(paramMap, "instanceId"));
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ public class XzTemporaryElectricitySafeController {
|
||||
xzTemporaryElectricitySafeService.add(xzTemporaryElectricitySafe);
|
||||
} catch (Exception e) {
|
||||
log.error(interfaceName + e);
|
||||
emailUtils.sendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzTemporaryElectricitySafe/save");
|
||||
emailUtils.saveExceptionAndSendFlowEmail(paramStr, e, interfaceName, "/xmgl/xzTemporaryElectricitySafe/save", MapUtils.getString(paramMap, "instanceId"));
|
||||
|
||||
}
|
||||
return Result.ok();
|
||||
|
||||
@ -1,13 +1,25 @@
|
||||
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;
|
||||
import com.zhgd.xmgl.modules.xz.service.IFlowExceptionLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.mail.MailException;
|
||||
import org.springframework.mail.SimpleMailMessage;
|
||||
@ -18,6 +30,10 @@ import org.springframework.stereotype.Service;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 发送邮件工具类 MailUtil
|
||||
@ -30,12 +46,18 @@ import java.io.File;
|
||||
@Slf4j
|
||||
public class EmailUtils implements EmailService {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
//Spring Boot 提供了一个发送邮件的简单抽象,使用的是下面这个接口,这里直接注入即可使用
|
||||
@Lazy
|
||||
@Autowired
|
||||
RuntimeService runtimeService;
|
||||
/**
|
||||
* Spring Boot 提供了一个发送邮件的简单抽象,使用的是下面这个接口,这里直接注入即可使用
|
||||
*/
|
||||
@Lazy
|
||||
@Autowired
|
||||
private JavaMailSender mailSender;
|
||||
|
||||
// 配置文件中我的qq邮箱
|
||||
/**
|
||||
* 配置文件中我的qq邮箱
|
||||
*/
|
||||
@Value("${spring.mail.from}")
|
||||
private String from;
|
||||
|
||||
@ -135,15 +157,27 @@ 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
|
||||
* @param url
|
||||
* @param instanceId
|
||||
*/
|
||||
public void sendFlowEmail(String paramStr, Exception e, String subject, String url) {
|
||||
public void saveExceptionAndSendFlowEmail(String paramStr, Exception e, String subject, String url, String instanceId) {
|
||||
String envName;
|
||||
if (EnvironmentUtil.isXingZongProd()) {
|
||||
envName = "星纵生产环境";
|
||||
@ -152,8 +186,28 @@ public class EmailUtils implements EmailService {
|
||||
} else {
|
||||
envName = "本地环境";
|
||||
}
|
||||
String detail = StrUtil.format("调用接口:" + url + ",参数:{},异常详情:{}", paramStr, ExceptionUtil.stacktraceToString(e));
|
||||
String detail = StrUtil.format("调用接口:" + url + ",参数:{},审批单编号:{},异常详情:{}", paramStr, instanceId, ExceptionUtil.stacktraceToString(e));
|
||||
String sub = envName + "工作流【" + subject + "】出现异常";
|
||||
if (instanceId != null) {
|
||||
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(detail);
|
||||
flowExceptionLogService.add(log);
|
||||
}
|
||||
this.sendSimpleMail("ak47_vce@163.com", sub, detail);
|
||||
this.sendSimpleMail("du.haipeng@szjxj.com", sub, detail);
|
||||
this.sendSimpleMail("2634687239@qq.com", sub, detail);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user