a2d7cc6f 张雷

Merge remote-tracking branch 'origin/master' into master

2 个父辈 d81e5c62 9b05e167
package com.skua.modules.dataAnalysis.controller;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.skua.common.constant.BusinessConstant;
import com.skua.core.api.vo.Result;
import com.skua.core.context.SpringContextUtils;
import com.skua.modules.dataAnalysis.service.IFactoryCenterService;
import com.skua.modules.dataAnalysis.service.IFactoryOperateCenterService;
import com.skua.modules.dataAnalysis.vo.*;
import com.skua.modules.flow.business.service.FlowBusinessService;
import com.skua.modules.flow.core.entity.BladeFlow;
import com.skua.modules.flow.support.Condition;
import com.skua.modules.flow.support.Query;
import com.skua.tool.util.DateUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -25,6 +34,9 @@ public class FactoryOperateCenterController {
@Autowired
private IFactoryOperateCenterService factoryOperateCenterService;
@Autowired
private FlowBusinessService flowBusinessService;
@ApiOperation(value="厂区统计数据", notes="厂区统计数据")
@GetMapping(value = "/getData")
public Result<Map<String,Object>> getData(String departId,String month) {
......@@ -100,8 +112,39 @@ public class FactoryOperateCenterController {
@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);
// Map<String,Object> map = factoryOperateCenterService.getFlowData(departId,month);
WorkAnalysisController workAnalysisController = (WorkAnalysisController) SpringContextUtils.getBean(WorkAnalysisController.class);
int days = DateUtils.lengthOfSomeMonth(Integer.parseInt(month.split("-")[0]), Integer.parseInt(month.split("-")[1]));
String startTime = month + "-01" + BusinessConstant.startTimeSuffix;
String endTime = month + "-" + days + BusinessConstant.endTimeSuffix;
Result<List<ProcessProgressVO>> voResult = workAnalysisController.analysisByProcessProgress(1, departId, 1, startTime.substring(0, 10), endTime.substring(0 ,10));
int ing = 0, no = 0, yes = 0, total = 0;
if (!voResult.getResult().isEmpty()) {
Map<String, Object> tmpMap = BeanUtil.beanToMap(voResult.getResult().get(0), false, true);
for (String key: tmpMap.keySet()) {
if (key.endsWith("TotalNum")) {
total += Integer.parseInt(tmpMap.get(key).toString());
} else if (key.endsWith("HandleNum")) {
yes += Integer.parseInt(tmpMap.get(key).toString());
}
}
}
// 查询工作流待签收
BladeFlow bladeFlow = new BladeFlow();
bladeFlow.setBeginDate(DateUtils.strToDate(startTime, BusinessConstant.dateFormat));
bladeFlow.setEndDate(DateUtils.strToDate(endTime, BusinessConstant.dateFormat));
Query query = new Query();
query.setCurrent(1);
query.setSize(10000);
IPage<BladeFlow> claimPage = this.flowBusinessService.selectClaimPage(Condition.getPage(query), bladeFlow);
no = claimPage.getRecords().size();
result.setSuccess(true);
Map<String, Object> map = new HashMap<>();
map.put("no", no);
map.put("ing", total - yes - no);
map.put("yes", yes);
map.put("total", total);
result.setResult(map);
return result;
}
......
......@@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.stream.Collectors;
/**
* 维修维护报表
......@@ -88,20 +89,20 @@ public class EquipmentInfoMonthReportController {
// 设备管理情况
Map<String,Object> childDataMap = equipmentDetail(childDepartIds, startDate, endDate);
// 设备大修、更新开展情况
CaseWhen caseWhen = new CaseWhen();
caseWhen.selectCaseWhen("equipment_maintain_task.results_enforcement = 3", "hasFinish");
caseWhen.selectCaseWhen("equipment_maintain_task.results_enforcement != 3", "notFinish");
QueryWrapper<?> queryWrapper0 = new QueryWrapper<>();
queryWrapper0.ge("equipment_maintain_task.maintain_time", startDate + BusinessConstant.startTimeSuffix)
.le("equipment_maintain_task.maintain_time", endDate + BusinessConstant.endTimeSuffix)
.eq("equipment_maintain_plan.maintenance_type", "dxjg")
.eq("equipment_maintain_plan.release_status", "1")
.ge("equipment_maintain_plan.start_time", startDate + BusinessConstant.startTimeSuffix)
.le("equipment_maintain_plan.end_time", endDate + BusinessConstant.endTimeSuffix)
.in("equipment_maintain_plan.depart_id", Arrays.asList(childDepartIds.split(",")));
Map<String, Object> queryMap0 = baseService.queryForMap("select " + caseWhen.print() + " from equipment_maintain_task left join equipment_maintain_plan on equipment_maintain_task.plan_id = equipment_maintain_plan.id", queryWrapper0);
childDataMap.put("hasFinish", queryMap0.get("hasFinish"));
childDataMap.put("notFinish", queryMap0.get("notFinish"));
// CaseWhen caseWhen = new CaseWhen();
// caseWhen.selectCaseWhen("equipment_maintain_task.results_enforcement = 3", "hasFinish");
// caseWhen.selectCaseWhen("equipment_maintain_task.results_enforcement != 3", "notFinish");
// QueryWrapper<?> queryWrapper0 = new QueryWrapper<>();
// queryWrapper0.ge("equipment_maintain_task.maintain_time", startDate + BusinessConstant.startTimeSuffix)
// .le("equipment_maintain_task.maintain_time", endDate + BusinessConstant.endTimeSuffix)
// .eq("equipment_maintain_plan.maintenance_type", "dxjg")
// .eq("equipment_maintain_plan.release_status", "1")
// .ge("equipment_maintain_plan.start_time", startDate + BusinessConstant.startTimeSuffix)
// .le("equipment_maintain_plan.end_time", endDate + BusinessConstant.endTimeSuffix)
// .in("equipment_maintain_plan.depart_id", Arrays.asList(childDepartIds.split(",")));
// Map<String, Object> queryMap0 = baseService.queryForMap("select " + caseWhen.print() + " from equipment_maintain_task left join equipment_maintain_plan on equipment_maintain_task.plan_id = equipment_maintain_plan.id", queryWrapper0);
// childDataMap.put("hasFinish", queryMap0.get("hasFinish"));
// childDataMap.put("notFinish", queryMap0.get("notFinish"));
// 设备更新情况
List<Map<String,Object>> childEquipmentUpdateList = equipmentUpdateList(childDepartIds, startDate, endDate);
childDataMap.put("equipmentUpdateList", childEquipmentUpdateList);
......@@ -199,14 +200,15 @@ public class EquipmentInfoMonthReportController {
//设备管理情况
private Map<String,Object> equipmentDetail(String departIds,String startDate,String endDate){
Map<String,Object> dataMap = new HashMap<>();
String inDepartIds = Arrays.stream(departIds.split(",")).map(item -> "'" + item + "'").collect(Collectors.joining(","));
String sql = "";
//月度计划维修费合计XX万元
sql = "select round(sum(ifnull(plan_cost,0))/10000,2) 'plan_cost' from equipment_maintain_plan where release_status = '1' and start_time >= '"+startDate+" 00:00:00' and end_time <='"+endDate+" 23:59:59'";
sql = "select round(sum(ifnull(plan_cost,0))/10000,2) 'plan_cost' from equipment_maintain_plan where release_status = '1' and start_time >= '"+startDate+" 00:00:00' and end_time <='"+endDate+" 23:59:59' and depart_id in (" + inDepartIds + ")";
String plan_cost = commonSqlService.queryForString(sql);
dataMap.put("planCost",plan_cost);//月度计划维修费合计XX万元
//执行XX万元
// sql = "select round(ifnull(sum(total_cost),0)/10000,2) 'repair_cost' from equipment_repair where reality_maintenance_end_time >= '"+startDate+" 00:00:00' and reality_maintenance_end_time <='"+endDate+" 23:59:59'";
sql = "select round(ifnull(sum(maintenance_cost),0)/10000,2) 'repair_cost' from equipment_maintain_task where real_end_time >= '"+startDate+" 00:00:00' and real_end_time <='"+endDate+" 23:59:59'";
sql = "select round(ifnull(sum(maintenance_cost),0)/10000,2) 'repair_cost' from equipment_maintain_task where real_end_time >= '"+startDate+" 00:00:00' and real_end_time <='"+endDate+" 23:59:59' and depart_id in (" + inDepartIds + ")";
String repair_cost = commonSqlService.queryForString(sql);
dataMap.put("repairCost",repair_cost);//执行XX万元
String expression = "100 * "+ repair_cost +" /"+plan_cost;
......@@ -214,21 +216,21 @@ public class EquipmentInfoMonthReportController {
//本月计划开展大修技改项目XX项,完成XX项
sql = " select count(1) 'count' from ( select emp.maintenance_type , emt.results_enforcement from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id ";
sql += " where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.maintenance_type = 'dxjg' ";
sql = " select count(1) 'count' from ( select emp.maintenance_type , emt.results_enforcement, emt.depart_id from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id ";
sql += " where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.maintenance_type = 'dxjg' and aaa.depart_id in (" + inDepartIds + ")";
String dxjg_count = commonSqlService.queryForString(sql);
dataMap.put("dxjgCount",dxjg_count);//本月计划开展大修技改项目XX项,完成XX项
sql = " select count(1) 'count' from ( select emp.maintenance_type , emt.results_enforcement from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id ";
sql += " where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.results_enforcement >2 and aaa.maintenance_type = 'dxjg' ";
sql = " select count(1) 'count' from ( select emp.maintenance_type , emt.results_enforcement, emt.depart_id from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id ";
sql += " where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.results_enforcement >2 and aaa.maintenance_type = 'dxjg' and aaa.depart_id in (" + inDepartIds + ")";
String dxjg_complete_count = commonSqlService.queryForString(sql);
dataMap.put("dxjg_complete_count",dxjg_complete_count);//完成XX项
dataMap.put("dxjg_sy_count",dxjg_complete_count);//剩余
//生产类设备资产购置XX台
sql = " select count(1) 'count' from (select emp.maintenance_type , emt.results_enforcement from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id ";
sql += " where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.results_enforcement >2 and aaa.maintenance_type = 'dxjg'";
sql = " select count(1) 'count' from (select emp.maintenance_type , emt.results_enforcement, emt.depart_id from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id ";
sql += " where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.results_enforcement >2 and aaa.maintenance_type = 'dxjg' and aaa.depart_id in (" + inDepartIds + ")";
String equipment_count = commonSqlService.queryForString(sql);
dataMap.put("equipmentCount",equipment_count);//生产类设备资产购置XX台
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!