080d8b12 康伟

kangwei :巡检任务、维修任务、保养任务、危险作业、事故事件、安全隐患、、药剂入库

1 个父辈 1ca30618
......@@ -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>
......
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;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!