20472ca1 张雷

水厂运营大屏接口开发

1 个父辈 c3ba1225
正在显示 13 个修改的文件 包含 676 行增加110 行删除
package com.skua.modules.flow.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.skua.modules.flow.core.entity.BladeFlow;
import com.skua.modules.flow.core.entity.FlowAssemblyEntity;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 流程业务类
......@@ -21,13 +15,27 @@ public interface FlowForThirdBusinessService {
* @param bladeFlow 流程类
* @return
*/
List<BladeFlow> selectClaimPage(BladeFlow bladeFlow, String userId, String roles);
List<BladeFlow> selectClaimList(BladeFlow bladeFlow, String userId, String roles);
/**
* 流程待办列表
* @param bladeFlow 流程类
* @return
*/
List<BladeFlow> selectTodoPage(BladeFlow bladeFlow, String userId);
List<BladeFlow> selectTodoList(BladeFlow bladeFlow, String userId);
/**
* 流程已发列表
* @param bladeFlow 流程类
* @return
*/
List<BladeFlow> selectSendList(BladeFlow bladeFlow, String userId);
/**
* 流程办结列表
* @param bladeFlow 流程类
* @return
*/
List<BladeFlow> selectDoneList(BladeFlow bladeFlow, String userId);
}
......
......@@ -7,6 +7,7 @@ import com.skua.modules.flow.core.entity.BladeFlow;
import com.skua.modules.flow.core.utils.TaskUtil;
import com.skua.modules.flow.custombiz.handle.IFlowBusinessDescService;
import com.skua.modules.flow.engine.constant.FlowEngineConstant;
import com.skua.modules.flow.engine.utils.FlowCache;
import com.skua.modules.flow.service.FlowForThirdBusinessService;
import com.skua.modules.flow.utils.Func;
import com.skua.modules.flow.utils.StringPool;
......@@ -15,9 +16,12 @@ import org.flowable.engine.HistoryService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.history.HistoricProcessInstanceQuery;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.task.api.Task;
import org.flowable.task.api.TaskQuery;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.task.api.history.HistoricTaskInstanceQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
......@@ -42,7 +46,7 @@ public class FlowForThirdBusinessServiceImpl implements FlowForThirdBusinessServ
private IFlowService flowService;
@Override
public List<BladeFlow> selectClaimPage(BladeFlow bladeFlow, String userId, String roles) {
public List<BladeFlow> selectClaimList(BladeFlow bladeFlow, String userId, String roles) {
String taskUser = TaskUtil.getTaskUser(userId);
String taskGroup = roles;
List<BladeFlow> flowList = new LinkedList<>();
......@@ -63,7 +67,7 @@ public class FlowForThirdBusinessServiceImpl implements FlowForThirdBusinessServ
}
@Override
public List<BladeFlow> selectTodoPage(BladeFlow bladeFlow, String userId) {
public List<BladeFlow> selectTodoList(BladeFlow bladeFlow, String userId) {
String taskUser = TaskUtil.getTaskUser(userId);
List<BladeFlow> flowList = new LinkedList<>();
......@@ -80,6 +84,202 @@ public class FlowForThirdBusinessServiceImpl implements FlowForThirdBusinessServ
return flowList;
}
@Override
public List<BladeFlow> selectSendList(BladeFlow bladeFlow, String userId) {
String taskUser = TaskUtil.getTaskUser(userId);
List<BladeFlow> flowList = new LinkedList<>();
HistoricProcessInstanceQuery historyQuery = historyService.createHistoricProcessInstanceQuery().startedBy(taskUser).orderByProcessInstanceStartTime().desc();
if (bladeFlow.getCategory() != null) {
historyQuery.processDefinitionCategory(bladeFlow.getCategory());
}
if (bladeFlow.getBeginDate() != null) {
historyQuery.startedAfter(bladeFlow.getBeginDate());
}
if (bladeFlow.getEndDate() != null) {
historyQuery.startedBefore(bladeFlow.getEndDate());
}
if (bladeFlow.getProcessDefinitionName() != null) {
historyQuery.processDefinitionName(bladeFlow.getProcessDefinitionName());
}
if (!org.apache.commons.lang3.StringUtils.isBlank(bladeFlow.getProcessInstanceId())){
historyQuery.processInstanceId(bladeFlow.getProcessInstanceId());
}
if (!org.apache.commons.lang3.StringUtils.isBlank(bladeFlow.getProcessDefinitionId())){
historyQuery.processDefinitionId(bladeFlow.getProcessDefinitionId());
}
if (!org.apache.commons.lang3.StringUtils.isBlank(bladeFlow.getProcessDefinitionKey())){
historyQuery.processDefinitionKey(bladeFlow.getProcessDefinitionKey());
}
// 查询列表
List<HistoricProcessInstance> historyList = historyQuery.list();
if (historyList.size() > 0) {
List<String> processInstanceIdList = new ArrayList<>();
Set<String> processDefinitionIdSet = new HashSet<>();
historyList.forEach(task -> {
processInstanceIdList.add(task.getId());
processDefinitionIdSet.add(task.getProcessDefinitionId());
});
List<ProcessDefinition> processDefinitionList = getProcessDefinitionList(processDefinitionIdSet);
Map<String, ProcessDefinition> processDefinitionMap = new HashMap<>();
processDefinitionList.forEach(processDefinition -> {
processDefinitionMap.put(processDefinition.getId(), processDefinition);
});
List<HistoricTaskInstance> historicTaskInstanceList = getHistoricTaskInstanceList(processInstanceIdList);
Map<String, HistoricTaskInstance> historicTaskInstanceMap = new HashMap<>();
historicTaskInstanceList.forEach(historicTaskInstance -> {
historicTaskInstanceMap.put(historicTaskInstance.getProcessInstanceId(), historicTaskInstance);
});
historyList.forEach(historicProcessInstance -> {
BladeFlow flow = new BladeFlow();
// historicProcessInstance
flow.setCreateTime(historicProcessInstance.getStartTime());
flow.setEndTime(historicProcessInstance.getEndTime());
flow.setVariables(historicProcessInstance.getProcessVariables());
String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey());
if (businessKey.length > 1) {
flow.setBusinessTable(businessKey[0]);
flow.setBusinessId(businessKey[1]);
}
flow.setHistoryActivityName(historicProcessInstance.getName());
flow.setProcessInstanceId(historicProcessInstance.getId());
flow.setHistoryProcessInstanceId(historicProcessInstance.getId());
// ProcessDefinition
ProcessDefinition processDefinition = processDefinitionMap.get(historicProcessInstance.getProcessDefinitionId());
if (Func.isNotEmpty(processDefinition)) {
flow.setProcessDefinitionId(processDefinition.getId());
flow.setProcessDefinitionName(processDefinition.getName());
flow.setProcessDefinitionVersion(processDefinition.getVersion());
flow.setProcessDefinitionKey(processDefinition.getKey());
flow.setCategory(processDefinition.getCategory());
}
flow.setCategoryName(FlowCache.getCategoryName(processDefinition.getCategory()));
flow.setProcessInstanceId(historicProcessInstance.getId());
// HistoricTaskInstance
HistoricTaskInstance historicTaskInstance = historicTaskInstanceMap.get(historicProcessInstance.getId());
if (Func.isNotEmpty(historicTaskInstance)) {
flow.setTaskId(historicTaskInstance.getId());
flow.setTaskName(historicTaskInstance.getName());
flow.setTaskDefinitionKey(historicTaskInstance.getTaskDefinitionKey());
}
// Status
if (historicProcessInstance.getEndActivityId() != null) {
flow.setProcessIsFinished(FlowEngineConstant.STATUS_FINISHED);
} else {
flow.setProcessIsFinished(FlowEngineConstant.STATUS_UNFINISHED);
}
flow.setStatus(FlowEngineConstant.STATUS_FINISH);
flowList.add(flow);
});
}
getFlowBusinessDesc(flowList);
return flowList;
}
private List<HistoricTaskInstance> getHistoricTaskInstanceList(List<String> processInstanceIdList) {
return historyService.createHistoricTaskInstanceQuery().processInstanceIdIn(processInstanceIdList).orderByHistoricTaskInstanceEndTime().desc().list();
}
@Override
public List<BladeFlow> selectDoneList(BladeFlow bladeFlow, String userId) {
String taskUser = TaskUtil.getTaskUser(userId);
List<BladeFlow> flowList = new LinkedList<>();
HistoricTaskInstanceQuery doneQuery = historyService.createHistoricTaskInstanceQuery().taskAssignee(taskUser).finished()
.includeProcessVariables().orderByHistoricTaskInstanceEndTime().desc();
if (bladeFlow.getCategory() != null) {
doneQuery.processCategoryIn(Func.toStrList(bladeFlow.getCategory()));
}
if (bladeFlow.getBeginDate() != null) {
doneQuery.taskCompletedAfter(bladeFlow.getBeginDate());
}
if (bladeFlow.getEndDate() != null) {
doneQuery.taskCompletedBefore(bladeFlow.getEndDate());
}
if (bladeFlow.getProcessDefinitionName() != null) {
doneQuery.processDefinitionNameLike(bladeFlow.getProcessDefinitionName());
}
if (!org.apache.commons.lang3.StringUtils.isBlank(bladeFlow.getProcessInstanceId())){
doneQuery.processInstanceId(bladeFlow.getProcessInstanceId());
}
if (!org.apache.commons.lang3.StringUtils.isBlank(bladeFlow.getProcessDefinitionId())){
doneQuery.processDefinitionId(bladeFlow.getProcessDefinitionId());
}
if (!org.apache.commons.lang3.StringUtils.isBlank(bladeFlow.getProcessDefinitionKey())){
doneQuery.processDefinitionKey(bladeFlow.getProcessDefinitionKey());
}
// 查询列表
List<HistoricTaskInstance> doneList = doneQuery.list();
Set<String> processInstanceIdSet = new HashSet<>();
Set<String> processDefinitionIdSet = new HashSet<>();
doneList.forEach(task -> {
processInstanceIdSet.add(task.getProcessInstanceId());
processDefinitionIdSet.add(task.getProcessDefinitionId());
});
List<HistoricProcessInstance> historicProcessInstanceList = getHistoricProcessInstances(processInstanceIdSet);
Map<String,HistoricProcessInstance> historicProcessInstanceMap = new HashMap<>();
historicProcessInstanceList.forEach(historicProcessInstance -> {
historicProcessInstanceMap.put(historicProcessInstance.getId(),historicProcessInstance);
});
List<ProcessDefinition> processDefinitionList = getProcessDefinitionList(processDefinitionIdSet);
Map<String,ProcessDefinition> processDefinitionMap = new HashMap<>();
processDefinitionList.forEach(processDefinition -> {
processDefinitionMap.put(processDefinition.getId(),processDefinition);
});
doneList.forEach(historicTaskInstance -> {
BladeFlow flow = new BladeFlow();
flow.setTaskId(historicTaskInstance.getId());
flow.setTaskDefinitionKey(historicTaskInstance.getTaskDefinitionKey());
flow.setTaskName(historicTaskInstance.getName());
flow.setAssignee(historicTaskInstance.getAssignee());
flow.setCreateTime(historicTaskInstance.getCreateTime());
flow.setExecutionId(historicTaskInstance.getExecutionId());
flow.setHistoryTaskEndTime(historicTaskInstance.getEndTime());
flow.setVariables(historicTaskInstance.getProcessVariables());
//ProcessDefinition processDefinition = FlowCache.getProcessDefinition(historicTaskInstance.getProcessDefinitionId());
ProcessDefinition processDefinition = processDefinitionMap.get(historicTaskInstance.getProcessDefinitionId());
if (Func.isNotEmpty(processDefinition)) {
flow.setProcessDefinitionId(processDefinition.getId());
flow.setProcessDefinitionName(processDefinition.getName());
flow.setProcessDefinitionKey(processDefinition.getKey());
flow.setProcessDefinitionVersion(processDefinition.getVersion());
flow.setCategory(processDefinition.getCategory());
}
flow.setCategoryName(FlowCache.getCategoryName(processDefinition.getCategory()));
flow.setProcessInstanceId(historicTaskInstance.getProcessInstanceId());
flow.setHistoryProcessInstanceId(historicTaskInstance.getProcessInstanceId());
HistoricProcessInstance historicProcessInstance = historicProcessInstanceMap.get(historicTaskInstance.getProcessInstanceId());
if (Func.isNotEmpty(historicProcessInstance)) {
String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey());
flow.setBusinessTable(businessKey[0]);
flow.setBusinessId(businessKey[1]);
if (historicProcessInstance.getEndActivityId() != null) {
flow.setProcessIsFinished(FlowEngineConstant.STATUS_FINISHED);
} else {
flow.setProcessIsFinished(FlowEngineConstant.STATUS_UNFINISHED);
}
}
flow.setStatus(FlowEngineConstant.STATUS_FINISH);
flowList.add(flow);
});
getFlowBusinessDesc(flowList);
return flowList;
}
/**
* 构建流程
*
......@@ -150,7 +350,7 @@ public class FlowForThirdBusinessServiceImpl implements FlowForThirdBusinessServ
ProcessDefinition processDefinition = processDefinitionMap.get(task.getProcessDefinitionId());
if (Func.isNotEmpty(processDefinition)) {
flow.setCategory(processDefinition.getCategory());
flow.setCategoryName("请假流程");
flow.setCategoryName(FlowCache.getCategoryName(processDefinition.getCategory()));
flow.setProcessDefinitionId(processDefinition.getId());
flow.setProcessDefinitionName(processDefinition.getName());
flow.setProcessDefinitionKey(processDefinition.getKey());
......
......@@ -189,7 +189,7 @@ public class ProcessStatisticsController {
List<String> roleList = sysBaseAPI.getRolesByUserId(sysUser.getId());
String roles = roleList.stream().map(s -> s.trim()).collect(Collectors.joining(","));
if(roleList.size() > 0){
claimList = flowForThirdBusinessService.selectClaimPage(bladeFlow, sysUser.getId(), roles);
claimList = flowForThirdBusinessService.selectClaimList(bladeFlow, sysUser.getId(), roles);
for (BladeFlow claim : claimList) {
ThirdProcessVO claimVO = new ThirdProcessVO();
claimVO.setMsgid(claim.getTaskId());
......@@ -204,7 +204,7 @@ public class ProcessStatisticsController {
list.add(claimVO);
}
}
todoList = flowForThirdBusinessService.selectTodoPage(bladeFlow, sysUser.getId());
todoList = flowForThirdBusinessService.selectTodoList(bladeFlow, sysUser.getId());
for (BladeFlow todo : todoList) {
ThirdProcessVO todoVO = new ThirdProcessVO();
todoVO.setMsgid(todo.getTaskId());
......
......@@ -197,7 +197,7 @@ public class SysMonitorLocationController {
String sExpress = bean.getMonitorStop();
str.append(getFields(sExpress)).append(",");
}
str.append(bean.getMonitorId()).append(",");
str.append(bean.getMonitorId()).append(",");
}
}
//查询点信息
......@@ -516,7 +516,7 @@ public class SysMonitorLocationController {
Map<String, Object> map = new HashMap<>();
// Map<String,Object> dataMap = sysMonitorLocationService.getLocationDataList(monitorLocationVO.getDepartId(),monitorLocationVO.getStructId());
List<MonitorLocationVO> list = sysMonitorLocationService.getLoctionList(monitorLocationVO.getDepartId(), monitorLocationVO.getPictureId());
if (list.size() > 0) {
if(list!=null&&list.size() > 0){
map = getLoctionGroup(list, true);
}
result.setSuccess(true);
......@@ -673,11 +673,11 @@ public class SysMonitorLocationController {
}
}
//保存设备台账信息
JSONArray materialArray = jsonObject.getJSONArray("materialData");
delLoctionCache(null,null);
result.success("添加成功!");
......
......@@ -3,8 +3,7 @@ package com.skua.modules.dataAnalysis.controller;
import com.skua.core.api.vo.Result;
import com.skua.modules.dataAnalysis.service.IFactoryCenterService;
import com.skua.modules.dataAnalysis.service.IFactoryOperateCenterService;
import com.skua.modules.dataAnalysis.vo.StatisticsParam;
import com.skua.modules.dataAnalysis.vo.WaterQualityMonitoringDetailVO;
import com.skua.modules.dataAnalysis.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -36,4 +35,64 @@ public class FactoryOperateCenterController {
return result;
}
@ApiOperation(value="厂区报表统计数据", notes="厂区报表统计数据")
@GetMapping(value = "/report")
public Result<Map<String,Object>> getReportData(String departId,String month) {
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
Map<String,Object> map = factoryOperateCenterService.getReportData(departId,month);
result.setSuccess(true);
result.setResult(map);
return result;
}
@ApiOperation(value="厂区设备报警信息", notes="厂区设备报警信息")
@GetMapping(value = "/alarm")
public Result<List<EquipAlarmVO>> getEquipAlarm(String departId, String month) {
Result<List<EquipAlarmVO>> result = new Result<List<EquipAlarmVO>>();
List<EquipAlarmVO> list = factoryOperateCenterService.getEquipAlarm(departId,month);
result.setSuccess(true);
result.setResult(list);
return result;
}
@ApiOperation(value="厂区设备预警数据", notes="厂区设备预警数据")
@GetMapping(value = "/equip/warn")
public Result<List<EquipWarnVO>> getEquipWarn(String departId, String month) {
Result<List<EquipWarnVO>> result = new Result<List<EquipWarnVO>>();
List<EquipWarnVO> list = factoryOperateCenterService.getEquipWarn(departId,month);
result.setSuccess(true);
result.setResult(list);
return result;
}
@ApiOperation(value="厂区设备运行时间", notes="厂区设备运行时间")
@GetMapping(value = "/equip/runtime")
public Result<List<EquipRunTimeVO>> getEquipRunTime(String departId, String month) {
Result<List<EquipRunTimeVO>> result = new Result<List<EquipRunTimeVO>>();
List<EquipRunTimeVO> list = factoryOperateCenterService.getEquipRunTime(departId,month);
result.setSuccess(true);
result.setResult(list);
return result;
}
@ApiOperation(value="厂区报表档案到期提醒", notes="厂区报表档案到期提醒")
@GetMapping(value = "/archives/warn")
public Result<List<ArchivesWarnVO>> getArchivesWarn(String departId,String month) {
Result<List<ArchivesWarnVO>> result = new Result<List<ArchivesWarnVO>>();
List<ArchivesWarnVO> list = factoryOperateCenterService.getArchivesWarn(departId);
result.setSuccess(true);
result.setResult(list);
return result;
}
@ApiOperation(value="厂区工单完成情况", notes="厂区工单完成情况")
@GetMapping(value = "/flow")
public Result<Map<String,Object>> getFlowData(String departId,String month) {
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
Map<String,Object> map = factoryOperateCenterService.getFlowData(departId,month);
result.setSuccess(true);
result.setResult(map);
return result;
}
}
......
package com.skua.modules.dataAnalysis.mapper;
import com.skua.modules.dataAnalysis.vo.ArchivesWarnVO;
import com.skua.modules.dataAnalysis.vo.EquipAlarmVO;
import com.skua.modules.dataAnalysis.vo.EquipRunTimeVO;
import com.skua.modules.dataAnalysis.vo.EquipWarnVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -10,4 +14,13 @@ public interface FactoryOperateCenterMapper {
Map<String, Object> getData(@Param("month") String month, @Param("departId") String departId,
@Param("view3a24") String view3a24, @Param("view2119") String view2119);
List<EquipAlarmVO> getEquipAlarm(@Param("departId") String departId, @Param("month") String month);
List<EquipWarnVO> getEquipWarn(@Param("departId") String departId, @Param("month") String month);
List<EquipRunTimeVO> getEquipRunTime(@Param("departId") String departId, @Param("month") String month);
List<ArchivesWarnVO> getArchivesWarn(@Param("departId") String departId);
List<Map<String, Object>> getFlowData(@Param("departId") String departId, @Param("month") String month);
}
......
<?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.skua.modules.dataAnalysis.mapper.FactoryCenterMapper">
<mapper namespace="com.skua.modules.dataAnalysis.mapper.FactoryOperateCenterMapper">
<select id="getData" resultType="java.util.HashMap">
SELECT
ROUND(SUM( v3.DLHJ )/10000,2) AS yzdl,
......@@ -15,6 +15,109 @@
${view3a24} v3
LEFT JOIN (select v.CSL,v.time from ${view2119} v where LEFT ( v.time, 7 ) = #{month} and v.depart_id = #{departId}) v2 ON v2.time = v3.time
where LEFT ( v3.time, 7 ) = #{month}
and v3.depart_id = #{departId}
and v3.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getEquipAlarm" resultType="com.skua.modules.dataAnalysis.vo.EquipAlarmVO">
SELECT
a.alarm_content AS content,
a.record_time AS date_time,
a.alarm_rule_level_name AS level,
a.alarm_rule_level_name AS type
FROM
alarm_record_history a
WHERE
a.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
AND a.record_time LIKE CONCAT(#{month},'%')
AND a.alarm_rule_type IN ( 'B001B001', 'B001B002', 'B001B003', 'B001B004' )
ORDER BY
a.record_time
</select>
<select id="getEquipWarn" resultType="com.skua.modules.dataAnalysis.vo.EquipWarnVO">
SELECT
e.equipment_name AS equip_name,
'报废提醒' AS equip_type,
e.scrap_date AS over_time
FROM
equipment_info e
WHERE
e.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
AND e.scrap_date != ''
AND LEFT(e.scrap_date,11) &lt; DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 3 MONTH), '%Y-%m-%d')
</select>
<select id="getEquipRunTime" resultType="com.skua.modules.dataAnalysis.vo.EquipRunTimeVO">
SELECT
e.equipment_name AS equip_name,
c.des AS equip_type,
m.id AS run_time
FROM
sys_monitor_metric_info m
LEFT JOIN equipment_info e ON m.equipment_code = e.id
LEFT JOIN equipment_category c ON e.equipment_type = c.id
WHERE
m.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
AND m.metric_type = 1
AND m.equipment_code IS NOT NULL
</select>
<select id="getArchivesWarn" resultType="com.skua.modules.dataAnalysis.vo.ArchivesWarnVO">
SELECT
CONCAT( u.user_name, '人员合同' ) AS archives_name,
'人员合同' AS archives_type,
u.contract_enddate AS over_time
FROM
sys_factory_user_info u
WHERE
u.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
AND LEFT ( u.contract_enddate, 11 ) &lt; DATE_FORMAT( DATE_SUB( CURDATE( ), INTERVAL - 3 MONTH ), '%Y-%m-%d' )
UNION ALL
SELECT
CONCAT( u.user_name, d.certifies_name ) AS archives_name,
'证件证书' AS archives_type,
d.end_time AS over_time
FROM
sys_factory_user_data d
LEFT JOIN sys_factory_user_info u ON d.base_id = u.id
WHERE
u.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
AND LEFT ( d.end_time, 11 ) &lt; DATE_FORMAT( DATE_SUB( CURDATE( ), INTERVAL - 3 MONTH ), '%Y-%m-%d' )
</select>
<select id="getFlowData" resultType="java.util.HashMap">
SELECT
a.REV_ AS status,
COUNT(a.ASSIGNEE_) AS count
FROM
act_ru_task a
LEFT JOIN sys_user u ON a.ASSIGNEE_ = CONCAT( 'taskUser_', u.id )
LEFT JOIN sys_user_depart d ON u.id = d.user_id
WHERE
a.ASSIGNEE_ IS NOT NULL
AND d.dep_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
AND CREATE_TIME_ LIKE CONCAT(#{month},'%')
GROUP BY a.REV_
</select>
</mapper>
......
package com.skua.modules.dataAnalysis.service;
import com.skua.modules.dataAnalysis.vo.ArchivesWarnVO;
import com.skua.modules.dataAnalysis.vo.EquipAlarmVO;
import com.skua.modules.dataAnalysis.vo.EquipRunTimeVO;
import com.skua.modules.dataAnalysis.vo.EquipWarnVO;
import java.util.List;
import java.util.Map;
public interface IFactoryOperateCenterService {
Map<String, Object> getData(String departId,String month);
Map<String, Object> getReportData(String departId, String month);
List<EquipAlarmVO> getEquipAlarm(String departId, String month);
List<EquipWarnVO> getEquipWarn(String departId, String month);
List<EquipRunTimeVO> getEquipRunTime(String departId, String month);
List<ArchivesWarnVO> getArchivesWarn(String departId);
Map<String, Object> getFlowData(String departId, String month);
}
......
......@@ -5,10 +5,18 @@ import com.skua.common.report.ReportViewUtil;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.dataAnalysis.mapper.FactoryOperateCenterMapper;
import com.skua.modules.dataAnalysis.service.IFactoryOperateCenterService;
import com.skua.modules.dataAnalysis.vo.ArchivesWarnVO;
import com.skua.modules.dataAnalysis.vo.EquipAlarmVO;
import com.skua.modules.dataAnalysis.vo.EquipRunTimeVO;
import com.skua.modules.dataAnalysis.vo.EquipWarnVO;
import com.skua.modules.flow.service.FlowForThirdBusinessService;
import com.skua.tool.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
......@@ -16,104 +24,183 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
@Resource
private FactoryOperateCenterMapper factoryOperateCenterMapper;
@Autowired
private FlowForThirdBusinessService flowForThirdBusinessService;
@Override
public Map<String, Object> getData(String departId, String month) {
Map<String, Object> map = new HashMap<>();
String monthTb = DateUtils.getTbMonth(month);
String monthHb = DateUtils.getHbMonth(month);
String field3a24 = "DLHJ,PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," +
"YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2";
String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, month);
String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, month);
Map<String, Object> valueMap = factoryOperateCenterMapper.getData(month, departId, dataViewName3a24, dataViewName2119);
String dataViewName3a24Hb = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, monthHb);
String dataViewName2119Hb = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, monthHb);
Map<String, Object> hbValueMap = factoryOperateCenterMapper.getData(monthHb, departId, dataViewName3a24Hb, dataViewName2119Hb);
String dataViewName3a24Tb = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, monthTb);
String dataViewName2119Tb = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, monthTb);
Map<String, Object> tbValueMap = factoryOperateCenterMapper.getData(monthTb, departId, dataViewName3a24Tb, dataViewName2119Tb);
map.put("nclsl",new HashMap<>());
Map<String, Object> nclslMap = new HashMap<>();
nclslMap.put("nsjsl","1267");
nclslMap.put("wcbfb","80");
nclslMap.put("nmb","1678");
nclslMap.put("nmbTb","5");
nclslMap.put("nwcd","1234");
nclslMap.put("nwcdTb","5");
map.put("yclsl",new HashMap<>());
Map<String, Object> yclslMap = new HashMap<>();
yclslMap.put("unit","万吨");
map.put("rjclsl",new HashMap<>());
Map<String, Object> rjclslMap = new HashMap<>();
rjclslMap.put("unit","万吨");
map.put("yzdl",new HashMap<>());
Map<String, Object> yzdlMap = new HashMap<>();
yzdlMap.put("unit","万Kw.h");
map.put("dsdh",new HashMap<>());
Map<String, Object> dsdhMap = new HashMap<>();
dsdhMap.put("unit","Kw.h/吨水");
map.put("yzcnl",new HashMap<>());
Map<String, Object> yzcnlMap = new HashMap<>();
yzcnlMap.put("unit","吨");
map.put("wdscnl",new HashMap<>());
Map<String, Object> wdscnlMap = new HashMap<>();
wdscnlMap.put("unit","吨/万吨");
map.put("rjdl",new HashMap<>());
Map<String, Object> rjdlMap = new HashMap<>();
rjdlMap.put("unit","万Kw.h");
if(valueMap != null){
yclslMap.put("value", ConvertUtils.isNotEmpty(valueMap.get("yclsl")) ? valueMap.get("yclsl").toString() : "-");//月总处理水量
rjclslMap.put("value", ConvertUtils.isNotEmpty(valueMap.get("rjclsl")) ? valueMap.get("rjclsl").toString() : "-");//日均处理水量
yzdlMap.put("value", ConvertUtils.isNotEmpty(valueMap.get("yzdl")) ? valueMap.get("yzdl").toString() : "-");//月总电量
dsdhMap.put("value", ConvertUtils.isNotEmpty(valueMap.get("dsdh")) ? valueMap.get("dsdh").toString() : "-");//吨水电耗
yzcnlMap.put("value", ConvertUtils.isNotEmpty(valueMap.get("yzcnl")) ? valueMap.get("yzcnl").toString() : "-");//月总产泥量
wdscnlMap.put("value", ConvertUtils.isNotEmpty(valueMap.get("wdscnl")) ? valueMap.get("wdscnl").toString() : "-");//万吨水产泥量
rjdlMap.put("value", ConvertUtils.isNotEmpty(valueMap.get("rjdl")) ? valueMap.get("rjdl").toString() : "-");//日均电量
}else{
yclslMap.put("value","-");//月总处理水量
rjclslMap.put("value","-");//日均处理水量
yzdlMap.put("value","-");//月总电量
dsdhMap.put("value","-");//吨水电耗
yzcnlMap.put("value","-");//月总产泥量
wdscnlMap.put("value","-");//万吨水产泥量
rjdlMap.put("value","-");//日均电量
}
if(hbValueMap != null){
yclslMap.put("valueHb", ConvertUtils.isNotEmpty(hbValueMap.get("yclsl")) ? hbValueMap.get("yclsl").toString() : "-");//月总处理水量
rjclslMap.put("valueHb", ConvertUtils.isNotEmpty(hbValueMap.get("rjclsl")) ? hbValueMap.get("rjclsl").toString() : "-");//日均处理水量
yzdlMap.put("valueHb", ConvertUtils.isNotEmpty(hbValueMap.get("yzdl")) ? hbValueMap.get("yzdl").toString() : "-");//月总电量
dsdhMap.put("valueHb", ConvertUtils.isNotEmpty(hbValueMap.get("dsdh")) ? hbValueMap.get("dsdh").toString() : "-");//吨水电耗
yzcnlMap.put("valueHb", ConvertUtils.isNotEmpty(hbValueMap.get("yzcnl")) ? hbValueMap.get("yzcnl").toString() : "-");//月总产泥量
wdscnlMap.put("valueHb", ConvertUtils.isNotEmpty(hbValueMap.get("wdscnl")) ? hbValueMap.get("wdscnl").toString() : "-");//万吨水产泥量
rjdlMap.put("valueHb", ConvertUtils.isNotEmpty(hbValueMap.get("rjdl")) ? hbValueMap.get("rjdl").toString() : "-");//日均电量
}else{
yclslMap.put("valueHb","-");//月总处理水量
rjclslMap.put("valueHb","-");//日均处理水量
yzdlMap.put("valueHb","-");//月总电量
dsdhMap.put("valueHb","-");//吨水电耗
yzcnlMap.put("valueHb","-");//月总产泥量
wdscnlMap.put("valueHb","-");//万吨水产泥量
rjdlMap.put("valueHb","-");//日均电量
}
if(tbValueMap != null){
yclslMap.put("valueTb", ConvertUtils.isNotEmpty(tbValueMap.get("yclsl")) ? tbValueMap.get("yclsl").toString() : "-");//月总处理水量
rjclslMap.put("valueTb", ConvertUtils.isNotEmpty(tbValueMap.get("rjclsl")) ? tbValueMap.get("rjclsl").toString() : "-");//日均处理水量
yzdlMap.put("valueTb", ConvertUtils.isNotEmpty(tbValueMap.get("yzdl")) ? tbValueMap.get("yzdl").toString() : "-");//月总电量
dsdhMap.put("valueTb", ConvertUtils.isNotEmpty(tbValueMap.get("dsdh")) ? tbValueMap.get("dsdh").toString() : "-");//吨水电耗
yzcnlMap.put("valueTb", ConvertUtils.isNotEmpty(tbValueMap.get("yzcnl")) ? tbValueMap.get("yzcnl").toString() : "-");//月总产泥量
wdscnlMap.put("valueTb", ConvertUtils.isNotEmpty(tbValueMap.get("wdscnl")) ? tbValueMap.get("wdscnl").toString() : "-");//万吨水产泥量
rjdlMap.put("valueTb", ConvertUtils.isNotEmpty(tbValueMap.get("rjdl")) ? tbValueMap.get("rjdl").toString() : "-");//日均电量
}else{
yclslMap.put("valueTb","-");//月总处理水量
rjclslMap.put("valueTb","-");//日均处理水量
yzdlMap.put("valueTb","-");//月总电量
dsdhMap.put("valueTb","-");//吨水电耗
yzcnlMap.put("valueTb","-");//月总产泥量
wdscnlMap.put("valueTb","-");//万吨水产泥量
rjdlMap.put("valueTb","-");//日均电量
}
yclslMap.put("ysjsl","185");
yclslMap.put("wcbfb","80");
yclslMap.put("ymb","161");
yclslMap.put("ymbTb","5");
yclslMap.put("ywcd","161");
yclslMap.put("ywcdTb","5");
map.put("ndsdh",new HashMap<>());
Map<String, Object> ndsdhMap = new HashMap<>();
ndsdhMap.put("ndsdh","0.5");
ndsdhMap.put("nmb","0.45");
ndsdhMap.put("nmbTb","5");
ndsdhMap.put("ydsdh","1234");
ndsdhMap.put("ydsdhTb","5");
map.put("ndsyf",new HashMap<>());
Map<String, Object> ndsyfMap = new HashMap<>();
ndsyfMap.put("ndsyf","0.8");
ndsyfMap.put("nmb","0.65");
ndsyfMap.put("nmbTb","4");
ndsyfMap.put("ydsyf","0.68");
ndsyfMap.put("ydsyfTb","5");
map.put("zhpf",new HashMap<>());
Map<String, Object> zhpfMap = new HashMap<>();
int sl = 100;int dh = 98;int yh = 91;
int slTb = 95;int dhTb = 93;int yhTb = 95;
int zh = (sl + dh + yh)/3;
int zhTb = (slTb + dhTb + yhTb)/3;
int zhBfb = 100 * (zh - zhTb)/zhTb;
int slBfb = 100 * (sl - slTb)/slTb;
int dhBfb = 100 * (dh - dhTb)/dhTb;
int yhBfb = 100 * (yh - yhTb)/yhTb;
zhpfMap.put("zh", zh);
zhpfMap.put("zhTb", zhBfb);
zhpfMap.put("sl", sl);
zhpfMap.put("slTb", slBfb);
zhpfMap.put("dh", dh);
zhpfMap.put("dhTb", dhBfb);
zhpfMap.put("yh", yh);
zhpfMap.put("yhTb", yhBfb);
//汇总
map.put("nclsl", nclslMap);
map.put("yclsl", yclslMap);
map.put("rjclsl", rjclslMap);
map.put("yzdl", yzdlMap);
map.put("dsdh", dsdhMap);
map.put("yzcnl", yzcnlMap);
map.put("wdscnl", wdscnlMap);
map.put("rjdl", rjdlMap);
map.put("ndsdh", ndsdhMap);
map.put("ndsyf", ndsyfMap);
map.put("zhpf", zhpfMap);
return map;
}
@Override
public Map<String, Object> getReportData(String departId, String month) {
Map<String, Object> map = new HashMap<>();
int nh = 100;
int hy = 100;
int df = 100;
int yyzb = 100;
int ndmb = 100;
int scyb = 100;
int zhf = 100;
map.put("nh",new HashMap<>());
Map<String, Object> nhMap = new HashMap<>();
nhMap.put("bfb",98);
nhMap.put("done",29);
nhMap.put("should",30);
map.put("hy",new HashMap<>());
Map<String, Object> hyMap = new HashMap<>();
hyMap.put("bfb",98);
hyMap.put("done",29);
hyMap.put("should",30);
map.put("df",new HashMap<>());
Map<String, Object> dfMap = new HashMap<>();
dfMap.put("bfb",98);
dfMap.put("done",29);
dfMap.put("should",30);
map.put("yyzb",new HashMap<>());
Map<String, Object> yyzbMap = new HashMap<>();
yyzbMap.put("bfb",75);
yyzbMap.put("done",3);
yyzbMap.put("should",4);
map.put("ndmb",new HashMap<>());
Map<String, Object> ndmbMap = new HashMap<>();
ndmbMap.put("bfb",100);
ndmbMap.put("done",1);
ndmbMap.put("should",1);
map.put("scyb",new HashMap<>());
Map<String, Object> scybMap = new HashMap<>();
scybMap.put("bfb",100);
scybMap.put("done",1);
scybMap.put("should",1);
map.put("zhf",new HashMap<>());
Map<String, Object> zhfMap = new HashMap<>();
zhfMap.put("zhf",98);
zhfMap.put("zhfHb",3);
//汇总
map.put("nh", nhMap);
map.put("hy", hyMap);
map.put("df", dfMap);
map.put("yyzb", yyzbMap);
map.put("ndmb", ndmbMap);
map.put("scyb", scybMap);
map.put("zhf", zhfMap);
return map;
}
@Override
public List<EquipAlarmVO> getEquipAlarm(String departId, String month) {
List<EquipAlarmVO> list = new ArrayList<>();
list = factoryOperateCenterMapper.getEquipAlarm(departId, month);
return list;
}
@Override
public List<EquipWarnVO> getEquipWarn(String departId, String month) {
List<EquipWarnVO> list = new ArrayList<>();
list = factoryOperateCenterMapper.getEquipWarn(departId, month);
return list;
}
@Override
public List<EquipRunTimeVO> getEquipRunTime(String departId, String month) {
List<EquipRunTimeVO> list = new ArrayList<>();
list = factoryOperateCenterMapper.getEquipRunTime(departId, month);
return list;
}
@Override
public List<ArchivesWarnVO> getArchivesWarn(String departId) {
List<ArchivesWarnVO> list = new ArrayList<>();
list = factoryOperateCenterMapper.getArchivesWarn(departId);
return list;
}
@Override
public Map<String, Object> getFlowData(String departId, String month) {
Map<String, Object> map = new HashMap<>();
int no = 0;//未完成工单
int yes = 0;//完成工单
List<Map<String, Object>> list = factoryOperateCenterMapper.getFlowData(departId,month);
if(list.size() > 0){
for (Map<String, Object> flowMap : list) {
if("2".equals(flowMap.get("status").toString())){
yes = Integer.parseInt(flowMap.get("status").toString());
}else{
no = no + Integer.parseInt(flowMap.get("status").toString());
}
}
}
map.put("total", yes + no);
map.put("no", no);
map.put("ing", no);
map.put("yes", yes);
return map;
}
}
......
package com.skua.modules.dataAnalysis.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ArchivesWarnVO {
@ApiModelProperty(value = "档案名称")
private String archivesName;
@ApiModelProperty(value = "档案类型")
private String archivesType;
@ApiModelProperty(value = "到期时间")
private String overTime;
}
package com.skua.modules.dataAnalysis.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class EquipAlarmVO {
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty(value = "时间")
private String dateTime;
@ApiModelProperty(value = "级别")
private String level;
@ApiModelProperty(value = "类型")
private String type;
}
package com.skua.modules.dataAnalysis.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class EquipRunTimeVO {
@ApiModelProperty(value = "设备名称")
private String equipName;
@ApiModelProperty(value = "设备类型")
private String equipType;
@ApiModelProperty(value = "运行时间")
private String runTime;
}
package com.skua.modules.dataAnalysis.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class EquipWarnVO {
@ApiModelProperty(value = "设备名称")
private String equipName;
@ApiModelProperty(value = "设备类型")
private String equipType;
@ApiModelProperty(value = "逾期时间")
private String overTime;
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!