Commit 38285704 authored by KeYong's avatar KeYong

Merge branch 'developer' of 172.16.10.76:moa/amos-boot-biz into developer

parents bb0b505b 2622642a
...@@ -31,8 +31,8 @@ public class DutyFirstAidExcleDto implements Serializable{ ...@@ -31,8 +31,8 @@ public class DutyFirstAidExcleDto implements Serializable{
@ExcelIgnore @ExcelIgnore
@ApiModelProperty(value = "用户id") @ApiModelProperty(value = "用户id")
private String userId; private String userId;
@ExcelProperty(value = "用户名称", index = 2) @ExcelProperty(value = "值班人员", index = 2)
@ApiModelProperty(value = "用户名称") @ApiModelProperty(value = "值班人员")
private String userName; private String userName;
@ExcelIgnore @ExcelIgnore
......
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 设备告警月统计
*
* @author system_generator
* @date 2022-01-16
*/
@Data
@Accessors(chain = true)
@TableName("wl_analysis_report_month")
public class AnalysisReportMonth {
private static final long serialVersionUID = 1L;
/**
* 系统id
*/
@TableField("system_id")
private Long systemId;
/**
* 总数量
*/
@TableField("num")
private Integer num;
/**
* 装备定义编码
*/
@TableField("equipment_code")
private String equipmentCode;
/**
*
*/
@TableField("equipment_name")
private String equipmentName;
/**
* 报告所在年月
*/
@TableField("report_month")
private String reportMonth;
/**
* 故障设备数量
*/
@TableField("fault_equip_num")
private Integer faultEquipNum;
/**
* 故障信息条数
*/
@TableField("fault_info_num")
private Integer faultInfoNum;
/**
* 告警设备数量
*/
@TableField("alarm_equip_num")
private Integer alarmEquipNum;
/**
* 告警信息条数
*/
@TableField("alarm_info_num")
private Integer alarmInfoNum;
/**
* 总信息数量
*/
@TableField("total_info_num")
private Integer totalInfoNum;
/**
* 创建时间
*/
@TableField("create_date")
private Date createDate;
}
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 总结报告
*
* @author system_generator
* @date 2022-01-16
*/
@Data
@Accessors(chain = true)
@TableName("wl_analysis_report_summary")
public class AnalysisReportSummary {
private static final long serialVersionUID = 1L;
/**
* 系统id
*/
@TableField("system_id")
private Long systemId;
/**
* 系统名称
*/
@TableField("system_name")
private String systemName;
/**
* 报告类型
*/
@TableField("report_type")
private String reportType;
/**
* 报告日期
*/
@TableField("report_date")
private Date reportDate;
/**
* 总结信息
*/
@TableField("summary_info")
private String summaryInfo;
/**
* 创建时间
*/
@TableField("create_date")
private Date createDate;
}
...@@ -122,4 +122,7 @@ public class FireFightingSystemEntity { ...@@ -122,4 +122,7 @@ public class FireFightingSystemEntity {
@ApiModelProperty("系统类型编码") @ApiModelProperty("系统类型编码")
private String systemTypeCode; private String systemTypeCode;
@ApiModelProperty(value = "分析报告统计用参数(为空不统计) ")
private String analysisIndexKey;
} }
package com.yeejoin.amos.latentdanger.common.enums;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 计划类型枚举(机场单位、外部单位)
*/
public enum PlanTypeEnum {
OUTER("外部单位检查","1"),
INNER("机场单位检查","0");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
PlanTypeEnum(String name, String code){
this.name = name;
this.code = code;
}
public static PlanTypeEnum getEnum(String code) {
PlanTypeEnum auditEnum = null;
for(PlanTypeEnum type: PlanTypeEnum.values()) {
if (type.getCode().equals(code)) {
auditEnum = type;
break;
}
}
return auditEnum;
}
public static List<Map<String,String>> getEnumList() {
List<Map<String,String>> nameList = new ArrayList<>();
for (PlanTypeEnum c: PlanTypeEnum.values()) {
Map<String, String> map = new HashMap<String, String>();
map.put("name", c.getName());
map.put("code", c.getCode());
nameList.add(map);
}
return nameList;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
...@@ -124,27 +124,33 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID ...@@ -124,27 +124,33 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
List< Map<String, Object>> result = new ArrayList<Map<String, Object>>(); List< Map<String, Object>> result = new ArrayList<Map<String, Object>>();
List<String> userNameList= new ArrayList<String>(); List<String> userNameList= new ArrayList<String>();
List<String> firstAidSimpleList = new ArrayList<String>();
List<String> companyNameList = new ArrayList<String>();
String firstAidCompanyId = dutyPersonShiftMapper.getFirstAidCompanyId(); String firstAidCompanyId = dutyPersonShiftMapper.getFirstAidCompanyId();
if (firstAidCompanyId != "" && firstAidCompanyId != null){ if (firstAidCompanyId != "" && firstAidCompanyId != null){
ids.add(firstAidCompanyId); ids.add(firstAidCompanyId);
OrgUsr companyDetail = orgUsrServiceImpl.getDetailById(Long.parseLong(firstAidCompanyId));
String companyNameString = companyDetail.getBizOrgName()+ "@" +companyDetail.getSequenceNbr();
companyNameList.add(companyNameString);
} }
List<String> firstAidSimpleList = new ArrayList<String>();
List<String> companyNameList = new ArrayList<String>();
String typeString = "JJZ"; String typeString = "JJZ";
ids.stream().forEach(i->{ ids.stream().forEach(i->{
Map<String, Object> detailMap = new HashMap<String, Object>(); Map<String, Object> detailMap = new HashMap<String, Object>();
List<OrgUsr> personList = orgUsrServiceImpl.getPersonListByParentId(Long.parseLong(i)); if (!i.equals(firstAidCompanyId)){
List<OrgUsr> personList = orgUsrServiceImpl.getPersonListByParentId(Long.parseLong(i));
personList.stream().forEach(m -> {
String userNameString =m.getBizOrgName()+ "@" +m.getSequenceNbr();
userNameList.add(userNameString);
});
detailMap.put("userName", userNameList);
}
personList.stream().forEach(m -> { //单位默认为 消防救援保障部,不可编辑。
String userNameString =m.getBizOrgName()+ "@" +m.getSequenceNbr();
userNameList.add(userNameString);
});
detailMap.put("userName", userNameList);
OrgUsr companyDetail = orgUsrServiceImpl.getDetailById(Long.parseLong(i));
String companyNameString = companyDetail.getBizOrgName()+ "@" +companyDetail.getSequenceNbr();
companyNameList.add(companyNameString);
detailMap.put("companyName", companyNameList); detailMap.put("companyName", companyNameList);
List<DataDictionary> dataDicList= dataDictionaryService.getByType(typeString); List<DataDictionary> dataDicList= dataDictionaryService.getByType(typeString);
List<String> dataDicSimpleList = new ArrayList<String>(); List<String> dataDicSimpleList = new ArrayList<String>();
dataDicList.stream().forEach(l->{ dataDicList.stream().forEach(l->{
......
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.AnalysisReportMonth;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 设备告警月统计 Mapper 接口
*
* @author system_generator
* @date 2022-01-16
*/
public interface AnalysisReportMonthMapper extends BaseMapper<AnalysisReportMonth> {
/**
* 插入月分析列表数据
* @param suffix 指标信息
* @param beginDate 开始日期
* @param endDate 结束日期
* @param systemId 系统id
*/
void insertSystemMonthData(@Param("indexKeySuffix") List<String> suffix, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("systemId") Long systemId);
}
package com.yeejoin.equipmanage.mapper;
import com.yeejoin.equipmanage.common.entity.AnalysisReportSummary;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 总结报告 Mapper 接口
*
* @author system_generator
* @date 2022-01-16
*/
public interface AnalysisReportSummaryMapper extends BaseMapper<AnalysisReportSummary> {
/**
* 插入月总结信息
* @param suffix 指标参数
* @param beginDate 开始日期
* @param endDate 结束日期
* @param systemId 系统id
*/
void insertSystemMonthSummaryData(@Param("indexKeySuffix") List<String> suffix, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("systemId") Long systemId);
}
...@@ -50,6 +50,6 @@ public class AnalysisReportSchedulerJob { ...@@ -50,6 +50,6 @@ public class AnalysisReportSchedulerJob {
Date yestDay = DateUtils.dateAdd(new Date(),-1,false); Date yestDay = DateUtils.dateAdd(new Date(),-1,false);
Date beginDate = DateUtils.getFirstDayOfMonth(yestDay); Date beginDate = DateUtils.getFirstDayOfMonth(yestDay);
Date endDate = DateUtils.getLastDayOfMonth(yestDay); Date endDate = DateUtils.getLastDayOfMonth(yestDay);
iAnalysisReportLogService.generateReport(AnalysisReportEnum.MONTH_REPORT,beginDate,endDate); iAnalysisReportLogService.generateMonthReport(AnalysisReportEnum.MONTH_REPORT,beginDate,endDate);
} }
} }
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.AnalysisReportLog; import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum; import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
import java.text.ParseException;
import java.util.Date; import java.util.Date;
/** /**
...@@ -27,4 +28,11 @@ public interface IAnalysisReportLogService extends IService<AnalysisReportLog> { ...@@ -27,4 +28,11 @@ public interface IAnalysisReportLogService extends IService<AnalysisReportLog> {
* @param endDate 结束日期 * @param endDate 结束日期
*/ */
void generateReport(AnalysisReportEnum reportEnum, Date beginDate, Date endDate); void generateReport(AnalysisReportEnum reportEnum, Date beginDate, Date endDate);
/** 月报表生成
* @param monthReport 报告类型
* @param beginDate 开始日期
* @param endDate 结束日期
*/
void generateMonthReport(AnalysisReportEnum monthReport, Date beginDate, Date endDate) throws ParseException;
} }
...@@ -5,14 +5,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -5,14 +5,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.AnalysisReportLog; import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity; import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum; import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.mapper.AnalysisReportLogMapper; import com.yeejoin.equipmanage.mapper.AnalysisReportLogMapper;
import com.yeejoin.equipmanage.mapper.AnalysisReportMonthMapper;
import com.yeejoin.equipmanage.mapper.AnalysisReportSummaryMapper;
import com.yeejoin.equipmanage.service.IAnalysisReportLogService; import com.yeejoin.equipmanage.service.IAnalysisReportLogService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Calendar; import java.text.ParseException;
import java.util.Date; import java.util.*;
/** /**
* 报告流水表 服务实现类 * 报告流水表 服务实现类
...@@ -23,6 +30,16 @@ import java.util.Date; ...@@ -23,6 +30,16 @@ import java.util.Date;
@Service @Service
public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogMapper, AnalysisReportLog> implements IAnalysisReportLogService { public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogMapper, AnalysisReportLog> implements IAnalysisReportLogService {
@Autowired
IFireFightingSystemService fireFightingSystemService;
@Autowired
AnalysisReportMonthMapper analysisReportMonthMapper;
@Autowired
AnalysisReportSummaryMapper analysisReportSummaryMapper;
@Override @Override
public IPage<AnalysisReportLog> listPage(Page page, AnalysisReportLog analysisReportLog) { public IPage<AnalysisReportLog> listPage(Page page, AnalysisReportLog analysisReportLog) {
...@@ -39,12 +56,35 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM ...@@ -39,12 +56,35 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
@Override @Override
public void generateReport(AnalysisReportEnum reportEnum, Date beginDate, Date endDate) { public void generateReport(AnalysisReportEnum reportEnum, Date beginDate, Date endDate) {
this.saveAnalysisReportLog(reportEnum, beginDate, endDate);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void generateMonthReport(AnalysisReportEnum reportEnum, Date beginDate, Date endDate) throws ParseException {
// 0.保存日志
this.saveAnalysisReportLog(reportEnum, beginDate, endDate);
// 创建月分析统计报告数据
// 1、 查询消防系统表,捞出所有系统,新增字段,存放自定义用的告警指标模糊查询指标key,逗号分隔
List<FireFightingSystemEntity> fightingSystemEntityList = fireFightingSystemService.getBaseMapper().selectList(
new LambdaQueryWrapper<FireFightingSystemEntity>()
.isNotNull(FireFightingSystemEntity::getAnalysisIndexKey));
// 2、循环插入 wl_analysis_report_month、wl_analysis_report_summary
String beginDateStr = DateUtils.dateFormat(beginDate,DateUtils.DATE_PATTERN);
String endDateStr = DateUtils.dateFormat(endDate,DateUtils.DATE_PATTERN);
fightingSystemEntityList.forEach(f -> {
analysisReportMonthMapper.insertSystemMonthData(new ArrayList<>(Arrays.asList(f.getAnalysisIndexKey().split(","))), beginDateStr, endDateStr, f.getId());
analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(Arrays.asList(f.getAnalysisIndexKey().split(","))), beginDateStr, endDateStr, f.getId());
});
}
private void saveAnalysisReportLog(AnalysisReportEnum reportEnum, Date beginDate, Date endDate) {
AnalysisReportLog reportLog = new AnalysisReportLog(); AnalysisReportLog reportLog = new AnalysisReportLog();
reportLog.setName(reportEnum.getName()); reportLog.setName(reportEnum.getName());
reportLog.setReportType(reportEnum.getType()); reportLog.setReportType(reportEnum.getType());
reportLog.setStartDate(beginDate); reportLog.setStartDate(beginDate);
reportLog.setEndDate(endDate); reportLog.setEndDate(endDate);
reportLog.setReportDateDesc(buildReportDateDesc(reportEnum,beginDate,endDate)); reportLog.setReportDateDesc(buildReportDateDesc(reportEnum, beginDate, endDate));
this.save(reportLog); this.save(reportLog);
} }
...@@ -52,7 +92,7 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM ...@@ -52,7 +92,7 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
StringBuilder desc = new StringBuilder(); StringBuilder desc = new StringBuilder();
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(beginDate); calendar.setTime(beginDate);
switch (reportEnum){ switch (reportEnum) {
case DAY_REPORT: case DAY_REPORT:
desc.append(calendar.get(Calendar.YEAR)); desc.append(calendar.get(Calendar.YEAR));
desc.append("年"); desc.append("年");
......
...@@ -205,6 +205,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -205,6 +205,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Value("${systemctl.amos.switch}") @Value("${systemctl.amos.switch}")
private Boolean amosSwitch; private Boolean amosSwitch;
@Value("${isSendApp}")
private Boolean isSendApp;
private static final String A = "A"; private static final String A = "A";
private final static Map staticMap = new HashMap(); private final static Map staticMap = new HashMap();
...@@ -762,15 +765,20 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -762,15 +765,20 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
DateUtils.date2LongStr(equipmentSpecificAlarmLog.getCreateDate())); DateUtils.date2LongStr(equipmentSpecificAlarmLog.getCreateDate()));
model.setBody(body); model.setBody(body);
model.setMsgType("iotMonitor"); model.setMsgType("iotMonitor");
model.setIsSendApp(true); if (isSendApp){
model.setIsSendApp(true);
model.setTerminal("APP/WEB");
} else {
model.setIsSendApp(false);
model.setTerminal("WEB");
}
model.setIsSendWeb(true); model.setIsSendWeb(true);
model.setTerminal("APP/WEB");
model.setCategory(1); model.setCategory(1);
model.setRelationId(String.valueOf(equipmentSpecificAlarmLog.getId())); model.setRelationId(String.valueOf(equipmentSpecificAlarmLog.getId()));
Token token = remoteSecurityService.getServerToken(); Token token = remoteSecurityService.getServerToken();
systemctlFeign.create(token.getAppKey(), token.getProduct(), token.getToke(), model); systemctlFeign.create(token.getAppKey(), token.getProduct(), token.getToke(), model);
log.info(String.format("调用平台消息服务成功:%s", JSON.toJSONString(model))); log.info(String.format("调用平台消息服务成功:%s", JSON.toJSONString(model)));
} catch (InnerInvokException e) { } catch (Exception e) {
// e.printStackTrace(); // e.printStackTrace();
log.error("告警消息同步平台失败:syncSystemctlMsg,===>>>" + e.getMessage()); log.error("告警消息同步平台失败:syncSystemctlMsg,===>>>" + e.getMessage());
} }
......
...@@ -40,6 +40,6 @@ public interface JcsFeignClient { ...@@ -40,6 +40,6 @@ public interface JcsFeignClient {
/** /**
* 根据id获取单位人员列表 * 根据id获取单位人员列表
*/ */
@GetMapping(value = "/company/{ids}/person") @GetMapping(value = "/org-usr/company/{ids}/person")
FeignClientResult<List<CompanyPerson>> selectCompanyPerson(@PathVariable List<Long> ids); FeignClientResult<List<CompanyPerson>> selectCompanyPerson(@PathVariable List<Long> ids);
} }
...@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo; ...@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo; import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum; import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.boot.biz.common.enums.WorkFlowEnum;
import com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
...@@ -69,6 +70,7 @@ import com.yeejoin.amos.latentdanger.common.enums.LatentDangerState; ...@@ -69,6 +70,7 @@ import com.yeejoin.amos.latentdanger.common.enums.LatentDangerState;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerStateEnum; import com.yeejoin.amos.latentdanger.common.enums.LatentDangerStateEnum;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerTypeEnum; import com.yeejoin.amos.latentdanger.common.enums.LatentDangerTypeEnum;
import com.yeejoin.amos.latentdanger.common.enums.OwerEnum; import com.yeejoin.amos.latentdanger.common.enums.OwerEnum;
import com.yeejoin.amos.latentdanger.common.enums.PlanTypeEnum;
import com.yeejoin.amos.latentdanger.common.remote.RemoteSpcService; import com.yeejoin.amos.latentdanger.common.remote.RemoteSpcService;
import com.yeejoin.amos.latentdanger.common.remote.RemoteWebSocketServer; import com.yeejoin.amos.latentdanger.common.remote.RemoteWebSocketServer;
import com.yeejoin.amos.latentdanger.common.remote.RemoteWorkFlowService; import com.yeejoin.amos.latentdanger.common.remote.RemoteWorkFlowService;
...@@ -162,6 +164,10 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -162,6 +164,10 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
@Value("${onSite.confirm.roleName}") @Value("${onSite.confirm.roleName}")
private String onSiteConfirmRole; private String onSiteConfirmRole;
// 有启动后执行外部单位隐患审核的角色名称
@Value("${sodFireProtection.confirm.roleName}")
private String sodFireProtectionConfirmRole;
// 等级、状态枚举权限和隐患列表的一致 // 等级、状态枚举权限和隐患列表的一致
private String dangerDataAuthInterfacePath = "latent/danger/page/list"; private String dangerDataAuthInterfacePath = "latent/danger/page/list";
...@@ -1182,15 +1188,30 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -1182,15 +1188,30 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}); });
}); });
} }
if (!roleNameSet.contains(onSiteConfirmRole)) { String startCondition = PlanTypeEnum.INNER.getCode();
executeSubmitDto.setIsOk(false); if (PlanTypeEnum.OUTER.getCode().equals(bizInfo.getString("isOuter"))) {
executeSubmitDto.setMsg("没有执行权限"); if (!roleNameSet.contains(sodFireProtectionConfirmRole)) {// 安全运行部门消防业务 角色
return executeSubmitDto; executeSubmitDto.setIsOk(false);
executeSubmitDto.setMsg("没有执行权限");
return executeSubmitDto;
}
startCondition = "outer";
} else {
if (!roleNameSet.contains(onSiteConfirmRole)) {// 单位防火监督检查负责人 角色
executeSubmitDto.setIsOk(false);
executeSubmitDto.setMsg("没有执行权限");
return executeSubmitDto;
}
} }
// 2、开启工作流 // 2、开启工作流
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.put("businessKey", latentDanger.getBusinessKey()); body.put("businessKey", latentDanger.getBusinessKey());
body.put("processDefinitionKey", workflowProcessDefinitionKey); body.put("processDefinitionKey", workflowProcessDefinitionKey);
/* 修改现场确认的工作流流程的节点执行条件分支------strat by chenhao 2022-01-18*/
HashMap<String, Object> conditionMap = new HashMap<>();
conditionMap.put(WorkFlowEnum.CONDITION.getCode(), startCondition);
body.put("variables", conditionMap);
/* 修改现场确认的工作流流程的节点执行条件分支------end by chenhao 2022-01-18*/
JSONObject result = workflowFeignService.startByVariable(body); JSONObject result = workflowFeignService.startByVariable(body);
if (result == null || ValidationUtil.isEmpty(result.get("data"))) { if (result == null || ValidationUtil.isEmpty(result.get("data"))) {
executeSubmitDto.setIsOk(false); executeSubmitDto.setIsOk(false);
...@@ -1200,39 +1221,48 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -1200,39 +1221,48 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
Map resultData = (Map) result.get("data"); Map resultData = (Map) result.get("data");
latentDanger.setInstanceId((String) resultData.get("id")); latentDanger.setInstanceId((String) resultData.get("id"));
latentDanger.setUpdateDate(new Date()); latentDanger.setUpdateDate(new Date());
latentDanger.setDangerState(LatentDangerState.SupervisionDangerStateEnum.现场确认.getCode()); if (PlanTypeEnum.OUTER.getCode().equals(bizInfo.getString("isOuter"))) { // 外部单位隐患直接到 安运部二次审核节点
latentDanger.setDangerStateName(LatentDangerState.SupervisionDangerStateEnum.现场确认.getName()); // 保存日志信息
executeResultMsg = latentDanger.getDangerStateName() + ExecuteTypeEnum.通过.getName();
record =
latentDangerFlowRecordService.getOne(new LambdaQueryWrapper<LatentDangerFlowRecord>().eq(LatentDangerFlowRecord::getDangerId, latentDanger.getId()));
latentDanger.setDangerState(LatentDangerState.SupervisionDangerStateEnum.隐患二次审核确认.getCode());
latentDanger.setDangerStateName(LatentDangerState.SupervisionDangerStateEnum.隐患二次审核确认.getName());
} else {
latentDanger.setDangerState(LatentDangerState.SupervisionDangerStateEnum.现场确认.getCode());
latentDanger.setDangerStateName(LatentDangerState.SupervisionDangerStateEnum.现场确认.getName());
// 3、执行一步现场确认 // 3、执行一步现场确认
boolean executeResult = workflowExecuteService.excuteTask(latentDanger.getInstanceId(), planType); boolean executeResult = workflowExecuteService.excuteTask(latentDanger.getInstanceId(), planType);
if (!executeResult) { if (!executeResult) {
this.updateById(latentDanger); this.updateById(latentDanger);
executeSubmitDto.setIsOk(false); executeSubmitDto.setIsOk(false);
executeSubmitDto.setMsg("任务执行失败"); executeSubmitDto.setMsg("任务执行失败");
return executeSubmitDto; return executeSubmitDto;
} }
// 4、在执行完节点后需要将检查组长id设置为下个节点执行人 // 4、在执行完节点后需要将检查组长id设置为下个节点执行人
Object resultObj = workflowExecuteService.setTaskAssign(latentDanger.getInstanceId(), checkLeaderId); Object resultObj = workflowExecuteService.setTaskAssign(latentDanger.getInstanceId(), checkLeaderId);
executeSubmitDto.setCheckLeaderId(userModel.getUserId()); executeSubmitDto.setCheckLeaderId(userModel.getUserId());
if (!(Boolean) resultObj) { if (!(Boolean) resultObj) {
executeSubmitDto.setIsOk(false); executeSubmitDto.setIsOk(false);
executeSubmitDto.setMsg("设置节点执行人失败"); executeSubmitDto.setMsg("设置节点执行人失败");
return executeSubmitDto; return executeSubmitDto;
}
// 5、保存日志信息
executeResultMsg = latentDanger.getDangerStateName() + ExecuteTypeEnum.通过.getName();
record = saveFlowRecord("", latentDanger.getDangerStateName(), userId, departmentId, latentDanger.getFlowJson(),
latentDanger.getId(), reginParams.getRole(), executeResultMsg, "", userRealName, departmentName,
latentDanger.getDangerState(), 0);
LatentDangerState.SupervisionDangerStateEnum curEnum =
LatentDangerState.SupervisionDangerStateEnum.getEnumByCode(latentDanger.getDangerState());
LatentDangerState.SupervisionDangerStateEnum nextEnum =
LatentDangerState.SupervisionDangerStateEnum.getEnumByCode(curEnum.getNext());
latentDanger.setDangerState(nextEnum.getCode());
latentDanger.setDangerStateName(nextEnum.getName());
} }
// 5、保存日志信息
executeResultMsg = latentDanger.getDangerStateName() + ExecuteTypeEnum.通过.getName();
record = saveFlowRecord("", latentDanger.getDangerStateName(), userId, departmentId, latentDanger.getFlowJson(),
latentDanger.getId(), reginParams.getRole(), executeResultMsg, "", userRealName, departmentName,
latentDanger.getDangerState(), 0);
LatentDangerState.SupervisionDangerStateEnum curEnum =
LatentDangerState.SupervisionDangerStateEnum.getEnumByCode(latentDanger.getDangerState());
LatentDangerState.SupervisionDangerStateEnum nextEnum =
LatentDangerState.SupervisionDangerStateEnum.getEnumByCode(curEnum.getNext());
latentDanger.setDangerState(nextEnum.getCode());
latentDanger.setDangerStateName(nextEnum.getName());
latentDanger.setCurrentFlowRecordId(record.getId()); latentDanger.setCurrentFlowRecordId(record.getId());
this.updateById(latentDanger); this.updateById(latentDanger);
......
...@@ -66,7 +66,7 @@ public class AsyncTask { ...@@ -66,7 +66,7 @@ public class AsyncTask {
private static final String TAB = "\r\n"; private static final String TAB = "\r\n";
/** /**
* 检查消息推送 * 检查消息推送
* @param checkId * @param checkId
...@@ -155,7 +155,6 @@ public class AsyncTask { ...@@ -155,7 +155,6 @@ public class AsyncTask {
if (pointName != null) { if (pointName != null) {
body += "关联检查点:" + pointName + TAB; body += "关联检查点:" + pointName + TAB;
} }
body = body.replaceAll(null, "").replaceAll("null", "");
saveAndSendMsg(orgCode, informerList, msgTypeEnum.getTitle(), body, msgTypeEnum.getMsgType(), latentDangerId, taskId, state,""); saveAndSendMsg(orgCode, informerList, msgTypeEnum.getTitle(), body, msgTypeEnum.getMsgType(), latentDangerId, taskId, state,"");
} }
...@@ -186,6 +185,8 @@ public class AsyncTask { ...@@ -186,6 +185,8 @@ public class AsyncTask {
String title, String body, String msgType, String title, String body, String msgType,
Long relationId, String taskId, Integer state, Long relationId, String taskId, Integer state,
String userRealName) { String userRealName) {
body = body.replaceAll("null", "");//过滤掉所有null
if(body.startsWith(TAB)) body =body.replaceFirst(TAB,"");//过滤掉以换行开头的换行符
JSONArray array = JSONArray.parseArray(informerList); JSONArray array = JSONArray.parseArray(informerList);
Set<String> sendUserIds = new HashSet<>(); Set<String> sendUserIds = new HashSet<>();
if (array.size()>0) { if (array.size()>0) {
......
...@@ -16,6 +16,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -16,6 +16,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Map;
@RestController @RestController
@RequestMapping(value = "/api/planAudit") @RequestMapping(value = "/api/planAudit")
@Api(tags = "计划审核api") @Api(tags = "计划审核api")
...@@ -45,4 +47,13 @@ public class PlanAuditController extends AbstractBaseController { ...@@ -45,4 +47,13 @@ public class PlanAuditController extends AbstractBaseController {
return ResponseHelper.buildResponse(planAuditService.listByPlanId(planId)); return ResponseHelper.buildResponse(planAuditService.listByPlanId(planId));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PersonIdentify
@ApiOperation(value = "查询登陆人有没有计划执行权限")
@GetMapping(value = "/checkTaskAuth")
public ResponseModel checkTaskAuth(@RequestParam("planId") Long planId) {
ReginParams reginParams = getSelectedOrgInfo();
return ResponseHelper.buildResponse(planAuditService.checkTaskAuth(planId, reginParams));
}
} }
package com.yeejoin.amos.supervision.business.feign; package com.yeejoin.amos.supervision.business.feign;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.supervision.business.dto.OrgUsrFormDto; import com.yeejoin.amos.supervision.business.dto.OrgUsrFormDto;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -64,4 +66,13 @@ public interface JCSFeignClient { ...@@ -64,4 +66,13 @@ public interface JCSFeignClient {
*/ */
@RequestMapping(value = "jcs/org-usr/{companyId}/person/list", method = RequestMethod.GET) @RequestMapping(value = "jcs/org-usr/{companyId}/person/list", method = RequestMethod.GET)
FeignClientResult<List<OrgUsrFormDto>> getPersonListByCompanyId(@PathVariable("companyId") String companyId); FeignClientResult<List<OrgUsrFormDto>> getPersonListByCompanyId(@PathVariable("companyId") String companyId);
/**
* 根据机场人员id获取amos平台人员id
*
* @param orgUserId 机场单位人员id
* @return AgencyUserModel 平台人员信息
**/
@RequestMapping(value = "jcs/org-usr/amos/{orgUserId}", method = RequestMethod.GET)
ResponseModel<AgencyUserModel> getAmosIdByUserId(@PathVariable String orgUserId);
} }
...@@ -300,6 +300,9 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService { ...@@ -300,6 +300,9 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
result.put("makerUserName", plan.getMakerUserName()); // 计划制定人名称 result.put("makerUserName", plan.getMakerUserName()); // 计划制定人名称
result.put("userId", plan.getUserId()); // 检查参与人id result.put("userId", plan.getUserId()); // 检查参与人id
result.put("userIdName", plan.getUserName()); // 检查参与人名称 result.put("userIdName", plan.getUserName()); // 检查参与人名称
// 放入标识隐患是外部导入还是非外部,1为外部导入
String isOuter = DangerCheckTypeLevelEnum.EXTERNAL.getCode().equals(plan.getCheckLevel()) ? "1" : "0";
result.put("isOuter", isOuter);
// 将机场单位bizOrgCode保存起来用于按机场单位数据过滤 // 将机场单位bizOrgCode保存起来用于按机场单位数据过滤
FeignClientResult<Map<String, Object>> companyResult = jcsFeignClient.getCompanyById(point.getOriginalId()); FeignClientResult<Map<String, Object>> companyResult = jcsFeignClient.getCompanyById(point.getOriginalId());
if (!ValidationUtil.isEmpty(companyResult)) { if (!ValidationUtil.isEmpty(companyResult)) {
......
...@@ -3,9 +3,11 @@ package com.yeejoin.amos.supervision.business.service.impl; ...@@ -3,9 +3,11 @@ package com.yeejoin.amos.supervision.business.service.impl;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService; import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService; import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.supervision.business.dao.repository.IPlanAuditDao; import com.yeejoin.amos.supervision.business.dao.repository.IPlanAuditDao;
import com.yeejoin.amos.supervision.business.dao.repository.IPlanAuditLogDao; import com.yeejoin.amos.supervision.business.dao.repository.IPlanAuditLogDao;
import com.yeejoin.amos.supervision.business.dao.repository.IPlanDao; import com.yeejoin.amos.supervision.business.dao.repository.IPlanDao;
import com.yeejoin.amos.supervision.business.feign.JCSFeignClient;
import com.yeejoin.amos.supervision.business.service.intfc.IPlanAuditService; import com.yeejoin.amos.supervision.business.service.intfc.IPlanAuditService;
import com.yeejoin.amos.supervision.common.enums.CheckTypeSuEnum; import com.yeejoin.amos.supervision.common.enums.CheckTypeSuEnum;
import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum; import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum;
...@@ -14,11 +16,13 @@ import com.yeejoin.amos.supervision.common.enums.WorkFlowBranchEnum; ...@@ -14,11 +16,13 @@ import com.yeejoin.amos.supervision.common.enums.WorkFlowBranchEnum;
import com.yeejoin.amos.supervision.dao.entity.Plan; import com.yeejoin.amos.supervision.dao.entity.Plan;
import com.yeejoin.amos.supervision.dao.entity.PlanAudit; import com.yeejoin.amos.supervision.dao.entity.PlanAudit;
import com.yeejoin.amos.supervision.dao.entity.PlanAuditLog; import com.yeejoin.amos.supervision.dao.entity.PlanAuditLog;
import com.yeejoin.amos.supervision.exception.YeeException;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -45,6 +49,9 @@ public class PlanAuditServiceImpl implements IPlanAuditService { ...@@ -45,6 +49,9 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
@Autowired @Autowired
private PlanServiceImpl planService; private PlanServiceImpl planService;
@Autowired
JCSFeignClient jcsFeignClient;
@Override @Override
@Transactional @Transactional
public Boolean auditWorkFlow(PlanAuditLog planAuditLog, Integer status, String condition, ReginParams reginParams) throws Exception { public Boolean auditWorkFlow(PlanAuditLog planAuditLog, Integer status, String condition, ReginParams reginParams) throws Exception {
...@@ -58,11 +65,13 @@ public class PlanAuditServiceImpl implements IPlanAuditService { ...@@ -58,11 +65,13 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
String taskId = taskAuthMap.get("taskId") == null ? null : taskAuthMap.get("taskId").toString(); String taskId = taskAuthMap.get("taskId") == null ? null : taskAuthMap.get("taskId").toString();
String name = taskAuthMap.get("name") == null ? null : taskAuthMap.get("name").toString(); String name = taskAuthMap.get("name") == null ? null : taskAuthMap.get("name").toString();
String roleName = reginParams.getRole().getRoleName(); String roleName = reginParams.getRole().getRoleName();
workflowExcuteService.CompleteTask(instanceId, condition, reginParams); // 获取审核最后一步所需条件
String conditionValue = getConditionValue(plan, condition);
workflowExcuteService.CompleteTask(instanceId, conditionValue, reginParams);
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity(); ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
String userId = reginParams.getUserModel().getUserId(); String userId = reginParams.getUserModel().getUserId();
// 更新计划状态,指定执行人 // 更新计划状态,指定执行人
updatePlanStatus(condition,plan,instanceId,userId); updatePlanStatus(condition,plan,instanceId, conditionValue);
// 更新流水表 // 更新流水表
planAuditLog.setPlanId(planAudit.getPlanId()); planAuditLog.setPlanId(planAudit.getPlanId());
planAuditLog.setPlanAuditId(planAudit.getId()); planAuditLog.setPlanAuditId(planAudit.getId());
...@@ -81,35 +90,89 @@ public class PlanAuditServiceImpl implements IPlanAuditService { ...@@ -81,35 +90,89 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
} }
/** /**
* 获取最后一步审核通过下一步条件
* @param plan 计划
* @param condition 前端传的是否通过
* @return 下一步条件
*/
private String getConditionValue(Plan plan, String condition) throws Exception {
String fail = "1";
String nextCondition = "outer";
// 前端传递为0表示通过,通过才区分下一步
if (!fail.equals(condition) && DangerCheckTypeLevelEnum.EXTERNAL.getCode().equals(plan.getCheckLevel())) {
String workFlowBranch = getWorkFlowBranch(plan);
if (workFlowBranch.equals(WorkFlowBranchEnum.DAILY.getWorkFlowBranch())) {
if (PlanStatusEnum.EXAMINE_THREE.getValue() == plan.getStatus()) {
return nextCondition;
}
} else {
if (PlanStatusEnum.EXAMINE_ONE.getValue() == plan.getStatus()) {
return nextCondition;
}
}
return fail;
}
return condition;
}
/**
* 更新计划id * 更新计划id
* @param condition 同意0 不同意1 * @param condition 同意0 不同意1
* @param plan 当前计划对象 * @param plan 当前计划对象
*/ */
private void updatePlanStatus (String condition, Plan plan, String instanceId, String userId) throws Exception { private void updatePlanStatus (String condition, Plan plan, String instanceId, String conditionValue) throws Exception {
String fail = "1"; String fail = "1";
String nextCondition = "outer";
if (fail.equals(condition)) { if (fail.equals(condition)) {
planDao.updatePlanStatus(PlanStatusEnum.DRAFT.getValue(), plan.getId()); planDao.updatePlanStatus(PlanStatusEnum.DRAFT.getValue(), plan.getId());
} else { } else {
//检查级别 // 获取检查组长
DangerCheckTypeLevelEnum dangerCheckTypeLevelEnum = DangerCheckTypeLevelEnum.getEumByCode(plan.getCheckLevel()); AgencyUserModel userModel = jcsFeignClient.getAmosIdByUserId(plan.getLeadPeopleIds()).getResult();
//检查类型 if (ValidationUtil.isEmpty(userModel)) {
CheckTypeSuEnum checkTypeSuEnum = CheckTypeSuEnum.getEumByCode(plan.getCheckTypeId()); throw new YeeException("业务信息错误");
String branch = PlanServiceImpl.workFlowExcuteBranch(dangerCheckTypeLevelEnum.getCondition(), checkTypeSuEnum.getCondition()); }
if (branch.equals(WorkFlowBranchEnum.DAILY.getWorkFlowBranch())) { // 工作流中使用平台用户名称,因此这里取userName
String checkLeaderId = userModel.getUserName();
String workFlowBranch = getWorkFlowBranch(plan);
PlanStatusEnum statusEnum = PlanStatusEnum.getEnum(plan.getStatus());
if (workFlowBranch.equals(WorkFlowBranchEnum.DAILY.getWorkFlowBranch())) {
if (PlanStatusEnum.EXAMINE_THREE.getValue() == plan.getStatus()) { if (PlanStatusEnum.EXAMINE_THREE.getValue() == plan.getStatus()) {
workflowExcuteService.setTaskAssign(instanceId, plan.getLeadPeopleIds()); workflowExcuteService.setTaskAssign(instanceId, checkLeaderId);
}
int status = statusEnum != null ? statusEnum.getNextStatus() : PlanStatusEnum.DRAFT.getValue();
if (nextCondition.equals(conditionValue) && PlanStatusEnum.EXAMINE_THREE.getValue() == status) {
status = PlanStatusEnum.IN_EXECUTION.getValue();
} }
PlanStatusEnum statusEnum = PlanStatusEnum.getEnum(plan.getStatus()); planDao.updatePlanStatus(status, plan.getId());
planDao.updatePlanStatus(statusEnum != null ? statusEnum.getNextStatus() : PlanStatusEnum.DRAFT.getValue(), plan.getId());
} else { } else {
int status = PlanStatusEnum.EXAMINE_FORMULATE.getValue();
if (PlanStatusEnum.EXAMINE_ONE.getValue() == plan.getStatus()) { if (PlanStatusEnum.EXAMINE_ONE.getValue() == plan.getStatus()) {
workflowExcuteService.setTaskAssign(instanceId, plan.getLeadPeopleIds()); workflowExcuteService.setTaskAssign(instanceId, checkLeaderId);
} else {
status = statusEnum != null ? statusEnum.getNextStatus() : PlanStatusEnum.DRAFT.getValue();
}
if (nextCondition.equals(conditionValue)) {
status = PlanStatusEnum.IN_EXECUTION.getValue();
} }
planDao.updatePlanStatus(PlanStatusEnum.EXAMINE_FORMULATE.getValue(), plan.getId()); planDao.updatePlanStatus(status, plan.getId());
} }
} }
} }
/**
* 获取当前流程分支
* @param plan 计划对象
* @return 流程分支
*/
private String getWorkFlowBranch(Plan plan) throws Exception {
//检查级别
DangerCheckTypeLevelEnum dangerCheckTypeLevelEnum = DangerCheckTypeLevelEnum.getEumByCode(plan.getCheckLevel());
//检查类型
CheckTypeSuEnum checkTypeSuEnum = CheckTypeSuEnum.getEumByCode(plan.getCheckTypeId());
return PlanServiceImpl.workFlowExcuteBranch(dangerCheckTypeLevelEnum.getCondition(), checkTypeSuEnum.getCondition());
}
@Override @Override
public List<PlanAuditLog> listByPlanId(Long planId) { public List<PlanAuditLog> listByPlanId(Long planId) {
Sort.Order idOrder = new Sort.Order(Sort.Direction.ASC, "createDate"); Sort.Order idOrder = new Sort.Order(Sort.Direction.ASC, "createDate");
...@@ -119,6 +182,17 @@ public class PlanAuditServiceImpl implements IPlanAuditService { ...@@ -119,6 +182,17 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
return planAuditLogDao.findAllByPlanId(planId, sort); return planAuditLogDao.findAllByPlanId(planId, sort);
} }
@Override
public Map<String, Object> checkTaskAuth(Long planId, ReginParams reginParams) {
PlanAudit planAudit = planAuditDao.findByPlanId(planId);
if (ObjectUtils.isNotEmpty(planAudit)) {
String instanceId = planAudit.getProcessInstanceId();
return workflowExcuteService.checkTaskAuthMap(instanceId, reginParams);
} else {
throw new YeeException("该计划暂无流程实例!");
}
}
// @Override // @Override
// @Transactional // @Transactional
// public Boolean auditWorkFlow(PlanAuditLog planAuditLog, String condition, ReginParams reginParams) { // public Boolean auditWorkFlow(PlanAuditLog planAuditLog, String condition, ReginParams reginParams) {
......
...@@ -4,6 +4,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams; ...@@ -4,6 +4,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.supervision.dao.entity.PlanAuditLog; import com.yeejoin.amos.supervision.dao.entity.PlanAuditLog;
import java.util.List; import java.util.List;
import java.util.Map;
public interface IPlanAuditService { public interface IPlanAuditService {
Boolean auditWorkFlow(PlanAuditLog planAuditLog, Integer status, String condition, ReginParams reginParams) throws Exception; Boolean auditWorkFlow(PlanAuditLog planAuditLog, Integer status, String condition, ReginParams reginParams) throws Exception;
...@@ -14,4 +15,12 @@ public interface IPlanAuditService { ...@@ -14,4 +15,12 @@ public interface IPlanAuditService {
* @return List<PlanAuditLog> * @return List<PlanAuditLog>
*/ */
List<PlanAuditLog> listByPlanId(Long planId); List<PlanAuditLog> listByPlanId(Long planId);
/**
* 登陆人是否有该计划执行权限
* @param planId 计划id
* @param reginParams 登陆人信息
* @return 权限标识
*/
Map<String, Object> checkTaskAuth(Long planId, ReginParams reginParams);
} }
...@@ -51,6 +51,7 @@ systemctl.sync.switch=false ...@@ -51,6 +51,7 @@ systemctl.sync.switch=false
systemctl.jcs.switch=false systemctl.jcs.switch=false
#平台数据开关 #平台数据开关
systemctl.amos.switch=false systemctl.amos.switch=false
isSendApp=false
#报表数据地址 #报表数据地址
equip.report.url=/fire-fighting-system/ureport/preview?_u=file: equip.report.url=/fire-fighting-system/ureport/preview?_u=file:
......
...@@ -51,6 +51,7 @@ systemctl.sync.switch=false ...@@ -51,6 +51,7 @@ systemctl.sync.switch=false
systemctl.jcs.switch=false systemctl.jcs.switch=false
#平台数据开关 #平台数据开关
systemctl.amos.switch=false systemctl.amos.switch=false
isSendApp=false
#报表数据地址 #报表数据地址
equip.report.url=/fire-fighting-system/ureport/preview?_u=file: equip.report.url=/fire-fighting-system/ureport/preview?_u=file:
......
...@@ -58,6 +58,7 @@ systemctl.sync.switch=false ...@@ -58,6 +58,7 @@ systemctl.sync.switch=false
systemctl.jcs.switch=true systemctl.jcs.switch=true
#平台数据开关 #平台数据开关
systemctl.amos.switch=true systemctl.amos.switch=true
isSendApp=true
#报表数据地址 #报表数据地址
equip.report.url=/fire-fighting-system/ureport/preview?_u=file: equip.report.url=/fire-fighting-system/ureport/preview?_u=file:
......
...@@ -2071,4 +2071,73 @@ ...@@ -2071,4 +2071,73 @@
ALTER TABLE wl_equipment ADD COLUMN clean_type varchar(50) DEFAULT NULL COMMENT '警情消除方式(0:收到复位信号自动消除;1:警情处理确认后消除)'; ALTER TABLE wl_equipment ADD COLUMN clean_type varchar(50) DEFAULT NULL COMMENT '警情消除方式(0:收到复位信号自动消除;1:警情处理确认后消除)';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1642465149617-1">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="wl_analysis_report_month"/>
</not>
</preConditions>
<comment>create table wl_analysis_report_month 分析报告用</comment>
<sql>
CREATE TABLE `wl_analysis_report_month` (
`system_id` bigint DEFAULT NULL COMMENT '系统id',
`num` int DEFAULT NULL COMMENT '总数量',
`equipment_code` varchar(255) DEFAULT NULL COMMENT '装备定义编码',
`equipment_name` varchar(255) DEFAULT NULL,
`report_month` varchar(255) DEFAULT NULL COMMENT '报告所在年月',
`fault_equip_num` int DEFAULT NULL COMMENT '故障设备数量',
`fault_info_num` int DEFAULT NULL COMMENT '故障信息条数',
`alarm_equip_num` int DEFAULT NULL COMMENT '告警设备数量',
`alarm_info_num` int DEFAULT NULL COMMENT '告警信息条数',
`total_info_num` int DEFAULT NULL COMMENT '总信息数量',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
UNIQUE KEY `uk_system_id_report_month_equipment_code` (`system_id`,`equipment_code`,`report_month`) USING BTREE,
KEY `idx_report_month` (`report_month`) USING BTREE
) ENGINE=InnoDB COMMENT='设备告警月统计';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1642465149617-2">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="wl_analysis_report_summary"/>
</not>
</preConditions>
<comment>create table wl_analysis_report_summary 分析报告用</comment>
<sql>
CREATE TABLE `wl_analysis_report_summary` (
`system_id` bigint DEFAULT NULL COMMENT '系统id',
`system_name` varchar(255) DEFAULT NULL COMMENT '系统名称',
`report_type` varchar(255) DEFAULT NULL COMMENT '报告类型',
`report_date` date DEFAULT NULL COMMENT '报告日期',
`summary_info` varchar(500) DEFAULT NULL COMMENT '总结信息',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
UNIQUE KEY `uk_system_id_report_type_report_date` (`system_id`,`report_type`,`report_date`),
KEY `idx_systemid_report_type` (`system_id`,`report_type`) USING BTREE
) ENGINE=InnoDB COMMENT='总结报告';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1642465149617-3">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_fire_fighting_system" columnName="analysis_index_key"/>
</not>
</preConditions>
<comment>f_fire_fighting_system add column analysis_index_key 分析报告用</comment>
<sql>
ALTER TABLE f_fire_fighting_system ADD COLUMN `analysis_index_key` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分析报告统计用参数(为空不统计)';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1642465149617-4">
<preConditions onFail="MARK_RAN">
<columnExists tableName="f_fire_fighting_system" columnName="analysis_index_key"/>
</preConditions>
<comment>f_fire_fighting_system 更新 analysis_index_key 分析报告统计用</comment>
<sql>
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='Fault,Open,OilLeak' WHERE (`code`='029026401813010000000030');
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='FireAlarm,Fault,Shield' WHERE (`code`='029026401813010000000016');
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='Fault,Alarm,Abnormal' WHERE (`code`='029026401813010000000023');
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='Fault,Shield,FireAlarm' WHERE (`code`='029026401813010000000047');
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='FireAlarm,Fault,Shield,State' WHERE (`code`='029026401813010000000054');
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
<?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.yeejoin.equipmanage.mapper.AnalysisReportMonthMapper">
<insert id="insertSystemMonthData">
insert into wl_analysis_report_month
(
system_id,
num,
equipment_name,
equipment_code,
fault_equip_num,
fault_info_num,
alarm_equip_num,
alarm_info_num,
total_info_num,
report_month
)
select
a1.*,
DATE_FORMAT(NOW(),'%Y-%m')
from
(SELECT
system_id,
num,
name,
code,
(SELECT
count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_true_num >0
and report.index_type LIKE CONCAT('%','Fault')
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as faultEquipNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_type LIKE CONCAT('%','Fault')
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as faultInfoNum,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_true_num >0
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as alarmEquipNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as alarmInfoNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as totalInfoNum
FROM(
SELECT
s.id as system_id,
equipment.code,
equipment.name,
count(1) AS num
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where spec.system_id <![CDATA[<>]]> '' and s.id = #{systemId}
GROUP BY equipment.code,s.id, equipment.name ORDER BY system_id, code
) a) as a1
</insert>
</mapper>
<?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.yeejoin.equipmanage.mapper.AnalysisReportSummaryMapper">
<insert id="insertSystemMonthSummaryData">
insert into
wl_analysis_report_summary (
system_id,
summary_info,
system_name,
report_type,
report_date
)
select
s.id,
CONCAT(s.name,',',#{beginDate},' - ',#{endDate} ,':',CHAR(10),
CONCAT('正常设备',IFNULL(f1.totalNormalEquipNum,0),'台,','正常率:',concat(IFNULL(f1.normalEquipNumPercent,0)*100,'%'),',',
'同比上月',IF(IFNULL(f1.totalNormalEquipNum,0)- IFNULL(f1.lastMonthTotalNormalEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalNormalEquipNum,0) = 0 ,'---',CONCAT(round(IFNULL(f1.totalNormalEquipNum,0)/f1.lastMonthTotalNormalEquipNum -1,2)* 100,'%')),',',CHAR(10)),
CONCAT('故障设备',IFNULL(f1.totalFaultEquipNum,0),'台,','故障率:',concat(ROUND(IFNULL(f1.faultEquipPercent,0),2)*100,'%'),',',
'同比上月',IF(IFNULL(f1.totalFaultEquipNum,0)- IFNULL(f1.lastMonthTotalFaultEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalFaultEquipNum,0) = 0 ,'---',CONCAT(round(IFNULL(f1.totalFaultEquipNum,0)/f1.lastMonthTotalFaultEquipNum -1,2)* 100,'%')),',',CHAR(10)),
CONCAT('告警设备',IFNULL(f1.totalAlarmEquipNum,0),'台,',
'同比上月',IF(IFNULL(f1.totalAlarmEquipNum,0)- IFNULL(f1.lastMonthTotalAlarmEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalAlarmEquipNum,0) = 0 ,'---',CONCAT(round(IFNULL(f1.totalAlarmEquipNum,0)/f1.lastMonthTotalAlarmEquipNum -1,2)* 100,'%')),',',CHAR(10)),
CONCAT('告警总数',IFNULL(f1.totalAlarmInfoNum,0),'条,',
'同比上月',IF(IFNULL(f1.totalAlarmInfoNum,0)- IFNULL(f1.lastMonthTotalAlarmInfoNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalAlarmInfoNum,0) = 0 ,'---', CONCAT(round(IFNULL(f1.totalAlarmInfoNum,0)/f1.lastMonthTotalAlarmInfoNum -1,2)* 100,'%'))
,'。')) as content,
s.`name`,
3 as report_type,
#{endDate} as report_date
from
f_fire_fighting_system s
LEFT JOIN
(select
s1.*,
IFNULL(s2.totalAlarmEquipNum,0) as lastMonthTotalAlarmEquipNum,
IFNULL(s2.totalAlarmInfoNum,0) as lastMonthTotalAlarmInfoNum,
IFNULL(s2.totalNormalEquipNum,0) as lastMonthTotalNormalEquipNum,
IFNULL(s2.totalEquipNum,0) as lastMonthTotalEquipNum,
IFNULL(s2.totalFaultEquipNum,0) as lastMonthTotalFaultEquipNum
from
(SELECT
u1.system_id,
IFNULL(sum(num),0) as totalEquipNum,
IFNULL(sum(normalEquipNum),0) as totalNormalEquipNum,
IFNULL(sum(faultEquipNum),0) as totalFaultEquipNum,
IFNULL(sum(alarmEquipNum),0) as totalAlarmEquipNum,
IFNULL(sum(alarmInfoNum),0) as totalAlarmInfoNum,
if(sum(num) > 0,ROUND(sum(normalEquipNum)/sum(num),2), '-') as normalEquipNumPercent,
if(sum(num) > 0,ROUND(sum(faultEquipNum)/sum(num),2), '-') as faultEquipPercent
from
(select
a1.*,
(a1.num - a1.alarmEquipNum) as normalEquipNum
from
(SELECT
system_id,
num,
name,
code,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_true_num >0
and report.index_type LIKE CONCAT('%','Fault')
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as faultEquipNum,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.index_true_num >0
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as alarmEquipNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as alarmInfoNum
FROM
(
SELECT
s.id as system_id,
equipment.code,
equipment.name,
count(1) AS num
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where spec.system_id <![CDATA[<>]]> ''
GROUP BY equipment.code,s.id, equipment.name ORDER BY system_id, code
) a) as a1) u1
GROUP BY u1.system_id) s1
LEFT JOIN
(SELECT
u1.system_id,
sum(num) as totalEquipNum,
sum(normalEquipNum) as totalNormalEquipNum,
sum(faultEquipNum) as totalFaultEquipNum,
sum(alarmEquipNum) as totalAlarmEquipNum,
sum(alarmInfoNum) as totalAlarmInfoNum
from
(select
a1.*,
(a1.num - a1.alarmEquipNum) as normalEquipNum
from
(SELECT
system_id,
num,
name,
code,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_type LIKE CONCAT('%','Fault')
and report.index_true_num >0
and report.report_date >= DATE_SUB(#{beginDate},INTERVAL 1 MONTH)
and report.report_date <![CDATA[<=]]> DATE_SUB(#{endDate},INTERVAL 1 MONTH)
) as faultEquipNum,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.index_true_num >0
and report.report_date >= DATE_SUB(#{beginDate},INTERVAL 1 MONTH)
and report.report_date <![CDATA[<=]]> DATE_SUB(#{endDate},INTERVAL 1 MONTH)
) as alarmEquipNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.report_date >= DATE_SUB(#{beginDate},INTERVAL 1 MONTH)
and report.report_date<![CDATA[<=]]> DATE_SUB(#{endDate},INTERVAL 1 MONTH)
) as alarmInfoNum
FROM
(
SELECT
s.id as system_id,
equipment.code,
equipment.name,
count(1) AS num
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where
spec.system_id <![CDATA[<>]]> ''
GROUP BY equipment.code,s.id, equipment.name ORDER BY system_id, code
) a) as a1) u1
GROUP BY u1.system_id) s2 ON s1.system_id = s2.system_id
) f1 on s.id = f1.system_id
where s.id = #{systemId}
</insert>
</mapper>
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment