6946f063 张雷

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

2 个父辈 3944f075 ad045639
......@@ -108,7 +108,9 @@ public class DigitalUtils {
*/
public static String division(String dividend , String divisor ){
String resultStr = null;
try{
String expression = dividend+ "/ "+ divisor;
resultStr = JSUtils.executeExpression(expression,"0.00");
/* try{
if( isNumber(dividend) && isNumber( divisor) && Double.parseDouble(divisor) != 0 ){
BigDecimal dividend_BD = new BigDecimal(dividend);
BigDecimal divisor_BD = new BigDecimal(divisor);
......@@ -116,8 +118,9 @@ public class DigitalUtils {
resultStr = result.toString();
}
}catch(Exception e){
System.out.println("dividend = "+ dividend +"; divisor = "+ divisor);
e.printStackTrace();
}
}*/
//System.out.print("请输入被除数:");double dividend =scanner.nextDouble();
// System.out.print("请输入除数:");double divisor =scanner.nextDouble();
......
......@@ -29,7 +29,6 @@ public class SkApplication {
"swagger-ui: \thttp://" + ip + ":" + port + path + "/swagger-ui.html\n\t" +
"Doc: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
}
// @Configuration
......
......@@ -55,8 +55,6 @@ import io.swagger.annotations.ApiOperation;
public class AjhMeetingSendController {
@Autowired
private IAjhMeetingSendService ajhMeetingSendService;
@Autowired
private IAjhMeetingService ajhMeetingService;
@Value("${skua.path.upload}")
private String upLoadPath;
......
......@@ -6,7 +6,7 @@
<update id="checkAnswerByUserPaperId" >
update edu_user_answer ua
set ua.score = IFNULL((select pq.score from edu_question q ,edu_paper_question pq where q.id = pq.question_id and ua.answer = q.question_answer and ua.paper_id= pq.paper_id and ua.question_id = q.id) , 0)
where ua.user_paper_id = = #{userPaperId}
where ua.user_paper_id = #{userPaperId}
</update>
</mapper>
\ No newline at end of file
</mapper>
......
......@@ -59,8 +59,7 @@ public class EmergencyRiskEventController {
Result<List<Map<String,Object>>> result = new Result<>();
QueryWrapper<EmergencyRiskEvent> queryWrapper = new QueryWrapper<EmergencyRiskEvent>();//QueryGenerator.initQueryWrapper(equipmentDefectManagement, req.getParameterMap());
queryWrapper.select("count(id) count,handle_result handleResult");
queryWrapper.ge(StringUtils.isNotEmpty(equipmentDefectManagement.getStartTime()),"report_date",equipmentDefectManagement.getStartTime());
queryWrapper.le(StringUtils.isNotEmpty(equipmentDefectManagement.getEndTime()),"report_date",equipmentDefectManagement.getEndTime());
queryWrapper.groupBy("handle_result");
List<Map<String,Object>> list = emergencyRiskEventService.listMaps(queryWrapper);
result.setSuccess(true);
......@@ -79,8 +78,7 @@ public class EmergencyRiskEventController {
emergencyRiskEventQueryWrapper.eq("handle_result","1");
emergencyRiskEventQueryWrapper.ne("event_type","");
emergencyRiskEventQueryWrapper.isNotNull("event_type");
emergencyRiskEventQueryWrapper.ge(StringUtils.isNotEmpty(equipmentDefectManagement.getStartTime()),"report_date",equipmentDefectManagement.getStartTime());
emergencyRiskEventQueryWrapper.le(StringUtils.isNotEmpty(equipmentDefectManagement.getEndTime()),"report_date",equipmentDefectManagement.getEndTime());
emergencyRiskEventQueryWrapper.groupBy("handle_result","event_type");
List<Map<String,Object>> list = emergencyRiskEventService.listMaps(emergencyRiskEventQueryWrapper);
//已处理应急事件
......@@ -89,8 +87,7 @@ public class EmergencyRiskEventController {
emergencyRiskEventQueryWrapper.eq("handle_result","3");
emergencyRiskEventQueryWrapper.ne("event_type","");
emergencyRiskEventQueryWrapper.isNotNull("event_type");
emergencyRiskEventQueryWrapper.ge(StringUtils.isNotEmpty(equipmentDefectManagement.getStartTime()),"report_date",equipmentDefectManagement.getStartTime());
emergencyRiskEventQueryWrapper.le(StringUtils.isNotEmpty(equipmentDefectManagement.getEndTime()),"report_date",equipmentDefectManagement.getEndTime());
emergencyRiskEventQueryWrapper.groupBy("handle_result","event_type");
List<Map<String,Object>> yclList = emergencyRiskEventService.listMaps(emergencyRiskEventQueryWrapper);
//获取未处理、已处理中的应急事件类型
......@@ -133,40 +130,40 @@ public class EmergencyRiskEventController {
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<EmergencyRiskEvent>> result = new Result<IPage<EmergencyRiskEvent>>();
//2023-10-05 00:00:00 2023-10-05 23:59:59
QueryWrapper<EmergencyRiskEvent> queryWrapper = QueryGenerator.initQueryWrapper(emergencyRiskEvent, req.getParameterMap());
Page<EmergencyRiskEvent> page = new Page<EmergencyRiskEvent>(pageNo, pageSize);
if(StringUtils.isNotEmpty(emergencyRiskEvent.getStartTime())){
queryWrapper.ge("report_date",emergencyRiskEvent.getStartTime());
}
if(StringUtils.isNotEmpty(emergencyRiskEvent.getEndTime())){
queryWrapper.le("report_date",emergencyRiskEvent.getEndTime());
}
IPage<EmergencyRiskEvent> pageList = emergencyRiskEventService.page(page, queryWrapper);
//获取流程状态
List<EmergencyRiskEvent> records = pageList.getRecords();
Set<String> processInstanceIdSet = records.stream().filter(data-> StringUtils.isNotBlank(data.getProcessInstanceId()))
.map(EmergencyRiskEvent::getProcessInstanceId).collect(Collectors.toSet());
Map<String, Map<String, String>> processInstanceMap;
try {
processInstanceMap = flowBusinessService.getProcessState(processInstanceIdSet);
} catch (Exception e) {
e.printStackTrace();
processInstanceMap = new HashMap<>();
}
for (EmergencyRiskEvent record : records) {
record.getFlow().setProcessDefinitionKey(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("processDefinitionKey"));
record.getFlow().setTaskDefinitionKey(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("taskDefinitionKey"));
record.getFlow().setStatus(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("state"));
record.getFlow().setTaskName(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("processDefinitionName"));
}
if(records != null && !records.isEmpty()){
Set<String> processInstanceIdSet = records.stream().filter(data-> StringUtils.isNotBlank(data.getProcessInstanceId()))
.map(EmergencyRiskEvent::getProcessInstanceId).collect(Collectors.toSet());
Map<String, Map<String, String>> processInstanceMap;
try {
processInstanceMap = flowBusinessService.getProcessState(processInstanceIdSet);
} catch (Exception e) {
e.printStackTrace();
processInstanceMap = new HashMap<>();
}
for (EmergencyRiskEvent record : records) {
record.getFlow().setProcessDefinitionKey(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("processDefinitionKey"));
record.getFlow().setTaskDefinitionKey(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("taskDefinitionKey"));
record.getFlow().setStatus(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("state"));
record.getFlow().setTaskName(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("processDefinitionName"));
}
}
result.setSuccess(true);
result.setResult(pageList);
return result;
}
/**
/**
......
......@@ -143,10 +143,5 @@ public class EmergencyRiskEvent extends FlowEntity {
@Excel(name = "删除标识,0:正常,1:删除", width = 15)
@ApiModelProperty(value = "删除标识,0:正常,1:删除")
private Integer delFlag;
@TableField(exist = false)
@ApiModelProperty(value = "开始时间")
private String startTime;
@TableField(exist = false)
@ApiModelProperty(value = "结束时间")
private String endTime;
}
......
package com.skua.modules.process.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.context.SpringContextUtils;
import com.skua.modules.equipment.entity.EquipmentMaintainTask;
import com.skua.modules.equipment.service.IEquipmentMaintainTaskService;
import com.skua.modules.flow.core.utils.TaskUtil;
import com.skua.modules.flow.utils.Func;
import com.skua.modules.inspection.entity.InspectionUserWorkingGroup;
import com.skua.modules.inspection.service.IInspectionTaskService;
import com.skua.modules.inspection.service.IInspectionUserWorkingGroupService;
import com.skua.modules.process.vo.ProcessStatisticsVO;
import com.skua.modules.quartz.util.BaseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.flowable.task.api.TaskQuery;
import org.flowable.engine.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Api(tags="测试流程")
@RestController("testProcessController")
@RequestMapping("/web/process")
public class ProcessStatisticsController {
// 注入TaskService
@Autowired
private TaskService taskService;
@Autowired
private IEquipmentMaintainTaskService equipMaintainExecuteService;
@Autowired
private IInspectionTaskService inspectionTaskService;
@Autowired
private IInspectionUserWorkingGroupService inspectionUserWorkingGroupService;
/* 问题上报流程 problemReport
设备维修流程 EquipmentRepair
设备缺陷管理 EquipmentDefectManagement
事故事件流程 EmergencyRiskEvent
生产任务流程 productive_task
数据报警工单 productAlarmProcess
安全隐患流程 AjhRectification
考核评价流程 dataAssessmentSocreMaster
危险作业流程 DangerousOperationManage*/
@AutoLog(value = "测试流程" )
@ApiOperation(value="测试流程-统计", notes="测试流程-统计")
@GetMapping(value = "/statistics")
public Result<List<ProcessStatisticsVO>> statistics() {
Result<List<ProcessStatisticsVO>> result = new Result<List<ProcessStatisticsVO>>();
List<ProcessStatisticsVO> processStatisticsList = new ArrayList<>();
String taskUser = TaskUtil.getTaskUser();
String taskGroup = TaskUtil.getCandidateGroup();
List<String> userGroupList = Func.toStrList(taskGroup);
try {
//巡检任务、维修任务、保养任务、危险作业、事故事件、安全隐患、、药剂入库
// 、、、、、药剂入库
String process_key = "AjhRectification";
processStatisticsList.add( queryProcessStatistics("安全隐患", process_key,taskUser,taskGroup) ) ;
process_key = "problemReport";
processStatisticsList.add( queryProcessStatistics("问题上报", process_key,taskUser,taskGroup)) ;
process_key = "EmergencyRiskEvent";
processStatisticsList.add( queryProcessStatistics("事故事件", process_key,taskUser,taskGroup) ) ;
process_key = "DangerousOperationManage";
processStatisticsList.add( queryProcessStatistics("危险作业", process_key,taskUser,taskGroup) ) ;
process_key = "EquipmentRepair";
processStatisticsList.add( queryProcessStatistics("维修任务", process_key,taskUser,taskGroup)) ;
Integer todoCount = 0;
QueryWrapper equipmentMaintainTaskQueryWrapper = new QueryWrapper<EquipmentMaintainTask>();
equipmentMaintainTaskQueryWrapper.eq("maintainer_id", taskUser);
equipmentMaintainTaskQueryWrapper.eq("results_enforcement", 1);
todoCount = equipMaintainExecuteService.count(equipmentMaintainTaskQueryWrapper);
ProcessStatisticsVO maintainerProcessStatisticsVO = new ProcessStatisticsVO("保养任务" ,"" , "0", todoCount.toString() );
processStatisticsList.add( maintainerProcessStatisticsVO );
//巡检
//得到巡检任务
//得到进行中的任务
//获取用户所在的班组
Integer xunjian_count = 0;
String userId = BaseContextHandler.getUserId();
QueryWrapper<InspectionUserWorkingGroup> inspectionUserWorkingGroupQueryWrapper = new QueryWrapper<>();
inspectionUserWorkingGroupQueryWrapper.eq("user_id", userId);
List<InspectionUserWorkingGroup> inspectionUserWorkingGroupList = inspectionUserWorkingGroupService.list(inspectionUserWorkingGroupQueryWrapper);
List<String> inspectionWorkingGroupIdList = new ArrayList<>();
for (InspectionUserWorkingGroup inspectionUserWorkingGroup : inspectionUserWorkingGroupList) {
inspectionWorkingGroupIdList.add(inspectionUserWorkingGroup.getInspectionWorkingGroupId());
}
if (inspectionWorkingGroupIdList.size() > 0) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("task_state", "1");
queryWrapper.in("inspection_working_group_id", inspectionWorkingGroupIdList);
xunjian_count = inspectionTaskService.count(queryWrapper);
} else {
xunjian_count = 0;
}
ProcessStatisticsVO xunjianProcessStatisticsVO = new ProcessStatisticsVO("巡检任务" ,"" , "0",xunjian_count.toString() );
processStatisticsList.add( xunjianProcessStatisticsVO );
//药剂入库
String userRoleIds = BaseContextHandler.getRoles();
String roleIds = BaseUtil.quoteEach(userRoleIds,",");
Integer materialINCount = 0;
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
StringBuffer sql = new StringBuffer(" select count(1) from sys_role_permission rp ,sys_config c ");
sql.append(" where rp.permission_id = c.config_value and c.config_id = 'MaterialIN_ID' and rp.role_id in ("+roleIds+") " );
Integer authFlag = masterDB.queryForObject(sql.toString(),Integer.class);
if(authFlag.intValue() > 0){
String sql2 = "select count(1) from erp_material_in where confirm_status =2 and audit_status>0 and audit_status<3";
materialINCount = masterDB.queryForObject(sql2,Integer.class);
}
ProcessStatisticsVO materialINProcessStatisticsVO = new ProcessStatisticsVO("药剂入库" ,"" , "0",materialINCount.toString() );
processStatisticsList.add( materialINProcessStatisticsVO );
result.setResult( processStatisticsList );
result.success("获取统计数据");
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
}
return result;
}
/***
* @param process_key
* @return
*/
private ProcessStatisticsVO queryProcessStatistics(String processName,String process_key,String taskUser , String taskGroup){
TaskQuery taskQuery = taskService.createTaskQuery();
taskQuery.processDefinitionKey( process_key );
Long todoCount = taskQuery.taskAssignee(taskUser).count();//代办人数
Long claimCount = taskQuery.taskCandidateGroupIn( Func.toStrList(taskGroup) ).count() ;//todoCount
return new ProcessStatisticsVO(processName ,process_key , todoCount.toString(), claimCount.toString() );
}
}
package com.skua.modules.process.vo;
import com.skua.tool.util.DigitalUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="production_duty_group_user数据传输对象", description="生产值班班组-用户")
public class ProcessStatisticsVO {
@ApiModelProperty(value = "流程名称")
private String processName;
@ApiModelProperty(value = "流程key")
private String processKey;
@ApiModelProperty(value = "未签到数量")
private String claimCount;
@ApiModelProperty(value = "代办任务数量")
private String todoCount;
@ApiModelProperty(value = "总数")
private String totalCount;
public String getTotalCount() {
return DigitalUtils.add( this.getTotalCount() , this.getClaimCount() ) ;
}
public ProcessStatisticsVO(){
}
public ProcessStatisticsVO(String processName, String processKey, String claimCount, String todoCount) {
this.processName = processName;
this.processKey = processKey;
this.claimCount = claimCount;
this.todoCount = todoCount;
}
}
......@@ -52,7 +52,9 @@ public class DangerLevelManageController {
@Autowired
private IDangerLevelManageService dangerLevelManageService;
@Value("${skua.path.upload}")
private String uploadpath;
private String upLoadPath;
@Value("${skua.web-url}")
private String webUrl;
@Autowired
private ISysConfigService configService;
/**
......@@ -104,7 +106,6 @@ public class DangerLevelManageController {
public Result<DangerLevelManage> add(@RequestBody DangerLevelManage dangerLevelManage) {
Result<DangerLevelManage> result = new Result<DangerLevelManage>();
try {
dangerLevelManageService.save(dangerLevelManage);
dangerLevelManage.setQrCode( this.createQR( dangerLevelManage.getId())) ;
dangerLevelManageService.updateById( dangerLevelManage ) ;
......@@ -148,15 +149,17 @@ public class DangerLevelManageController {
* @return
*/
private String createQR(String dangerLevelId){
String qrCodePath = "files"+ File.separator+"qrcode"+File.separator+dangerLevelId+".png";
String qrCodePath = null;
try {
String filePath = upLoadPath + File.separator + "qrcode";
String qrUrl = configService.queryValueByKey("DANGER_LEVLE_QRURL");
QRCodeUtil.encode(qrUrl, "", uploadpath+File.separator+qrCodePath, true);
qrUrl = qrUrl + dangerLevelId;//风险巡检二维码地址
qrCodePath = com.skua.tool.util.QRCodeUtil.getQRCodeImage(qrUrl, filePath, "DL-" + dangerLevelId);
//QRCodeUtil.encode(qrUrl, "", uploadpath+File.separator+qrCodePath, true);
} catch (Exception e) {
log.error("生成二维码失败");
qrCodePath = null;
}
return qrCodePath;
}
......
......@@ -7,19 +7,16 @@ import com.skua.modules.custom.mapper.FCustomReportDatasetMapper;
import com.skua.modules.custom.service.IFCustomReportDatasetService;
import com.skua.modules.custom.vo.DepartWeekReportVO;
import com.skua.modules.custom.vo.FCustomReportDatasetVO;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.time.temporal.WeekFields;
import java.util.*;
import com.skua.modules.report.vo.*;
import com.skua.modules.report.vo.largeScreen.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
......@@ -276,24 +273,28 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
//节能环保 大屏展示
public JnhbLargeScreenVO jnhbLargeScreenShow(DataVO dataVO){
//long startTime = System.nanoTime();
JnhbLargeScreenVO largeScreenVO = new JnhbLargeScreenVO();
//当月数据
String dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime());
String dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime());
String dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime());
List<JnhbReportData> jnhbReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getNowStartTime(), dataVO.getNowEndTime(), null);
//System.out.println("1111---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
// 上月数据 同比
dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime());
dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime());
dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime());
List<JnhbReportData> lastMonthReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime(), null);
//System.out.println("2222---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
Map<String,JnhbReportData> lastMonthMapData= convertJnhbReportDataMap(lastMonthReportDataList);
// 去年数据 环比
dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime());
dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime());
dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime());
List<JnhbReportData> lastYearReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime(), null);
Map<String,JnhbReportData> lastYearMapData= convertJnhbReportDataMap(lastYearReportDataList);
//System.out.println("333333---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
LoadRateVO loadRateVO = null;
PowerConsumeVO powerConsumeVO = null;
ResultNumberVO c02NumberVO = null;//CO2排放对象
......@@ -302,6 +303,11 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
ResultNumberVO tp_NumberVO = null;//TP
ResultNumberVO tn_NumberVO = null;//TN
List<PowerConsumeVO> powerConsumeVOList = new ArrayList();//各站点能源消耗排名
List<LoadRateVO> loadRateVOList = new ArrayList<>();//负荷率对象
List<ResultNumberVO> co2DataList = new ArrayList<>();//CO2排放排名
List<WasteMaterialVO> wasteMaterialList = new ArrayList<>();//废物处理对象集合
JnhbReportData lastMonthReportDataTemp ;//lastMonthMapData
JnhbReportData lastYearReportDataTemp ;//lastYearMapData
ResultChartsVO energyConsumeChart = null;
......@@ -315,7 +321,9 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
//各站点能源消耗排名:
powerConsumeVO = new PowerConsumeVO(reportData.getDepartId(),reportData.getDepartName(),reportData.getDh(), reportData.getGffdl(), reportData.getQy(), reportData.getZhnyxhl() , reportData.getEyhtpfl() , reportData.getDsdh() );
c02NumberVO = new ResultNumberVO();
c02NumberVO.setName( reportData.getDepartName() );
c02NumberVO.setValue( reportData.getCodxjl() );
cod_NumberVO = new ResultNumberVO();cod_NumberVO.setValue(reportData.getCodxjl());
nh3n_NumberVO = new ResultNumberVO();nh3n_NumberVO.setValue(reportData.getTnxjl());
......@@ -370,16 +378,45 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
largeScreenVO.getCo2DataList().add( c02NumberVO ) ;
//排放指标
// String ybgfcsl, String ybgfczl, String jgwnl, String wfcsl, String wfczl
largeScreenVO.getWasteMaterialList().add( new WasteMaterialVO( reportData.getDepartId(),reportData.getDepartName(),reportData.getYbgfcsl(),reportData.getYbgfczl(),reportData.getJgwnl(),reportData.getWfcsl(),reportData.getWfczl() ) ) ;
wasteMaterialList.add( new WasteMaterialVO( reportData.getDepartId(),reportData.getDepartName(),reportData.getYbgfcsl(),reportData.getYbgfczl(),reportData.getJgwnl(),reportData.getWfcsl(),reportData.getWfczl() ) ) ;
}
largeScreenVO.getCo2DataList().add( c02NumberVO ) ;
largeScreenVO.setWasteMaterialList( wasteMaterialList ) ;
//System.out.println("44444444---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
//主库数据源
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
int count1 = masterDB.queryForObject("select count(1) from equipment_info where energy_level = 1",Integer.class);
largeScreenVO.setEquipmentL1( count1 );
//System.out.println("55555---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
int count2 = masterDB.queryForObject("select count(1) from equipment_info where energy_level = 2",Integer.class);
largeScreenVO.setEquipmentL2( count2 );
//System.out.println("666666---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
// 各站点系统负荷率排名:负荷率排序、设置排名
/* if(largeScreenVO.getLoadRateVOList() != null && !largeScreenVO.getLoadRateVOList().isEmpty()){
// 根据分数排序
Collections.sort(largeScreenVO.getLoadRateVOList(), new Comparator<LoadRateVO>() {
public int compare(LoadRateVO s1, LoadRateVO s2) {
return Double.compare(ConvertUtils.getDouble(s1.getWsfhl(),0d), ConvertUtils.getDouble(s1.getWsfhl(),0d)); // 降序排序
}
});
*//*int rank = 1; // 设置排名
for( LoadRateVO loadRateVORank: largeScreenVO.getLoadRateVOList()){
loadRateVORank.setRank( rank++);
}*//*
}*/
//各站点能源消耗排名 吨水电耗
/*if(largeScreenVO.getPowerConsumeVOList() != null && !largeScreenVO.getPowerConsumeVOList().isEmpty()) {
// 根据分数排序
Collections.sort(largeScreenVO.getPowerConsumeVOList(), new Comparator<PowerConsumeVO>() {
public int compare(PowerConsumeVO s1, PowerConsumeVO s2) {
return Double.compare(ConvertUtils.getDouble(s1.getDh(), 0d), ConvertUtils.getDouble(s1.getDh(), 0d)); // 降序排序
}
});
*//*int rank = 1; // 设置排名
for( LoadRateVO loadRateVORank: largeScreenVO.getLoadRateVOList()){
loadRateVORank.setRank( rank++);
}*//*
}*/
return largeScreenVO;
}
/**转换为Map<部门编号,JnhbReportData> */
......@@ -415,6 +452,4 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
map.put("qt", "(1)本周暂无其他情况说明");//其他
return map;
}
}
......
......@@ -50,38 +50,39 @@ public class JnhbLargeScreenVO {
public void setHeadStatisticsValue(JnhbReportData reportData){
// wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh
////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水
this.getHeadStatisticsList().get(0).setValue( reportData.getWssjcll() );
this.getHeadStatisticsList().get(1).setValue( reportData.getWsfhl() );
this.getHeadStatisticsList().get(2).setValue( reportData.getDh() );
this.getHeadStatisticsList().get(3).setValue( reportData.getQy() );
this.getHeadStatisticsList().get(4).setValue( reportData.getXssyl() );
this.getHeadStatisticsList().get(5).setValue( reportData.getZhnyxhl() );
this.getHeadStatisticsList().get(6).setValue( reportData.getEyhtpfl() );
this.getHeadStatisticsList().get(7).setValue( reportData.getDsdh() );
this.getHeadStatisticsList().get(0).setValue( DigitalUtils.add( this.getHeadStatisticsList().get(0).getValue() , reportData.getWssjcll()) );
this.getHeadStatisticsList().get(1).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(1).getValue() , reportData.getWsfhl()) );
this.getHeadStatisticsList().get(2).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(2).getValue() , reportData.getDh() ));
this.getHeadStatisticsList().get(3).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(3).getValue() , reportData.getQy()) );
this.getHeadStatisticsList().get(4).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(4).getValue() , reportData.getXssyl()) );
this.getHeadStatisticsList().get(5).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(5).getValue() , reportData.getZhnyxhl()) );
this.getHeadStatisticsList().get(6).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(6).getValue() , reportData.getEyhtpfl() ));
this.getHeadStatisticsList().get(7).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(7).getValue() , reportData.getDsdh() ));
}
public void setHeadStatisticsValueTB(JnhbReportData reportData){
// wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh
////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水
this.getHeadStatisticsList().get(0).setValueTb( reportData.getWssjcll() );
this.getHeadStatisticsList().get(1).setValueTb( reportData.getWsfhl() );
this.getHeadStatisticsList().get(2).setValueTb( reportData.getDh() );
this.getHeadStatisticsList().get(3).setValueTb( reportData.getQy() );
this.getHeadStatisticsList().get(4).setValueTb( reportData.getXssyl() );
this.getHeadStatisticsList().get(5).setValueTb( reportData.getZhnyxhl() );
this.getHeadStatisticsList().get(6).setValueTb( reportData.getEyhtpfl() );
this.getHeadStatisticsList().get(7).setValueTb( reportData.getDsdh() );
this.getHeadStatisticsList().get(0).setValueTb( DigitalUtils.add( this.getHeadStatisticsList().get(0).getValueTb() , reportData.getWssjcll()) );
this.getHeadStatisticsList().get(1).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(1).getValueTb() , reportData.getWsfhl()) );
this.getHeadStatisticsList().get(2).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(2).getValueTb() , reportData.getDh() ));
this.getHeadStatisticsList().get(3).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(3).getValueTb() , reportData.getQy()) );
this.getHeadStatisticsList().get(4).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(4).getValueTb() , reportData.getXssyl()) );
this.getHeadStatisticsList().get(5).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(5).getValueTb() , reportData.getZhnyxhl()) );
this.getHeadStatisticsList().get(6).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(6).getValueTb() , reportData.getEyhtpfl() ));
this.getHeadStatisticsList().get(7).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(7).getValueTb() , reportData.getDsdh() ));
}
public void setHeadStatisticsValueHB(JnhbReportData reportData){
// wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh
////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水
this.getHeadStatisticsList().get(0).setValueHb( reportData.getWssjcll() );
this.getHeadStatisticsList().get(1).setValueHb( reportData.getWsfhl() );
this.getHeadStatisticsList().get(2).setValueHb( reportData.getDh() );
this.getHeadStatisticsList().get(3).setValueHb( reportData.getQy() );
this.getHeadStatisticsList().get(4).setValueHb( reportData.getXssyl() );
this.getHeadStatisticsList().get(5).setValueHb( reportData.getZhnyxhl() );
this.getHeadStatisticsList().get(6).setValueHb( reportData.getEyhtpfl() );
this.getHeadStatisticsList().get(7).setValueHb( reportData.getDsdh() );
this.getHeadStatisticsList().get(0).setValueHb( DigitalUtils.add( this.getHeadStatisticsList().get(0).getValueHb() , reportData.getWssjcll()) );
this.getHeadStatisticsList().get(1).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(1).getValueHb() , reportData.getWsfhl()) );
this.getHeadStatisticsList().get(2).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(2).getValueHb() , reportData.getDh() ));
this.getHeadStatisticsList().get(3).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(3).getValueHb() , reportData.getQy()) );
this.getHeadStatisticsList().get(4).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(4).getValueHb() , reportData.getXssyl()) );
this.getHeadStatisticsList().get(5).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(5).getValueHb() , reportData.getZhnyxhl()) );
this.getHeadStatisticsList().get(6).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(6).getValueHb() , reportData.getEyhtpfl() ));
this.getHeadStatisticsList().get(7).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(7).getValueHb() , reportData.getDsdh() ));
}
/***
......@@ -98,13 +99,17 @@ public class JnhbLargeScreenVO {
public JnhbLargeScreenVO(){
//头部数值统计
String names = "污水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水";
String unit = "万吨,%,万千瓦时,吨,吨,吨标准煤,吨CO2当量,千瓦时/吨";
String[] nameList = names.split(",");
String[] unitList = unit.split(",");
ResultNumberVO numberVO = null;
for(String name : nameList){
for(int i = 0 ; i< nameList.length ; i++){
numberVO = new ResultNumberVO();
numberVO.setName( name);
numberVO.setName( nameList[i]);
numberVO.setUnit(unitList[i] );
this.getHeadStatisticsList().add(numberVO) ;
}
//消减量统计
names= "COD,NH3-N,TP,TN";
nameList = names.split(",");
......
package com.skua.modules.report.vo.largeScreen;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.report.vo.JnhbReportData;
import com.skua.tool.util.DigitalUtils;
import io.swagger.annotations.ApiModel;
......@@ -32,10 +33,10 @@ public class ResultChartsVO {
public void setData(JnhbReportData reportData ){
this.getXLine().add( reportData.getDepartName() ) ;
this.getCodDataList().add( reportData.getCodxjl() ) ;
this.getNh3DataList().add( reportData.getTnxjl() ) ;
this.getTpDataList().add( reportData.getTpxjl() ) ;
this.getTnDataList().add( reportData.getTnxjl() ) ;
this.getCodDataList().add(ConvertUtils.getString(reportData.getCodxjl(),"0") ) ;
this.getNh3DataList().add( ConvertUtils.getString(reportData.getTnxjl(),"0") ) ;
this.getTpDataList().add( ConvertUtils.getString( reportData.getTpxjl(),"0") ) ;
this.getTnDataList().add( ConvertUtils.getString(reportData.getTnxjl(),"0") ) ;
}
public void setDataByZhnyxhl(JnhbReportData reportData ){
this.getXLine().add( reportData.getDepartName() ) ;
......
package com.skua.modules.report.vo.largeScreen;
import com.skua.tool.util.DigitalUtils;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -14,6 +15,8 @@ public class ResultNumberVO {
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "单位")
private String unit;
@ApiModelProperty(value = "结果")
private String value;
......@@ -24,25 +27,71 @@ public class ResultNumberVO {
@ApiModelProperty(value = "环比(上月)")
private String valueHb;
@ApiModelProperty(value = "同比(去年同期)排名")
private String valueTbRank;
/* @ApiModelProperty(value = "同比(去年同期)排名")
private String valueTbRank;*/
@ApiModelProperty(value = "环比(上月)排名")
private String valueHbRank;
private Integer rank;
/* @ApiModelProperty(value = "环比(上月)排名")
private String valueHbRank;*/
@ApiModelProperty(value = "同比比例")
private String valueTbRatio;
@ApiModelProperty(value = "同比比例箭头")
private Boolean valueTbArrow;
@ApiModelProperty(value = "环比比例")
private String valueHbRatio;
private String valueHbRatio;
@ApiModelProperty(value = "环比比例箭头")
private Boolean valueHbArrow;
public String getValueTbRatio() {
this.valueTbRatio = DigitalUtils.division( this.value , this.valueTb) ;
String expression = this.getValue() +">" + this.getValueTb();
Boolean result = JSUtils.executeExpressionForBoolean(expression);
if( result != null ){
if(result){
expression = "" +this.getValue() +"/"+this.getValueTb()+"* 100 - 100";
}
if( !result ){
expression = " 100-" +this.getValue() +"/"+this.getValueTb()+"* 100 ";
}
}
this.valueTbRatio = JSUtils.executeExpression(expression,"0.0");// DigitalUtils.division( this.value , this.valueTb) ;
return valueTbRatio;
}
public String getValueHbRatio() {
this.valueHbRatio = DigitalUtils.division( this.value , this.valueHb) ;
//this.valueHbRatio = DigitalUtils.division( this.value , this.valueHb) ;
// String expression = "" +this.value +"/"+this.valueHb+"* 100 - 100";
String expression = this.getValue() +">" + this.getValueHb();
Boolean result = JSUtils.executeExpressionForBoolean(expression);
if( result != null ){
if(result){
expression = "" +this.getValue() +"/"+this.getValueHb()+"* 100 - 100";
}
if( !result ){
expression = " 100 -" +this.getValue() +"/"+this.getValueHb()+"* 100 ";
}
}
this.valueHbRatio = JSUtils.executeExpression(expression,"0.0");// DigitalUtils.division( this.value , this.valueTb) ;
return valueHbRatio;
}
public Boolean getValueTbArrow() {
String expression = this.getValue() +">" + this.getValueHb();
Boolean result = JSUtils.executeExpressionForBoolean(expression);
if(result == null ) result = true;
return result;
}
public Boolean getValueHbArrow() {
String expression = this.getValue() +">" + this.getValueHb();
Boolean result = JSUtils.executeExpressionForBoolean(expression);
if(result == null ) result = true;
return result;
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!