kangwei :巡检任务、维修任务、保养任务、危险作业、事故事件、安全隐患、、药剂入库
正在显示
5 个修改的文件
包含
195 行增加
和
8 行删除
... | @@ -55,8 +55,6 @@ import io.swagger.annotations.ApiOperation; | ... | @@ -55,8 +55,6 @@ import io.swagger.annotations.ApiOperation; |
55 | public class AjhMeetingSendController { | 55 | public class AjhMeetingSendController { |
56 | @Autowired | 56 | @Autowired |
57 | private IAjhMeetingSendService ajhMeetingSendService; | 57 | private IAjhMeetingSendService ajhMeetingSendService; |
58 | @Autowired | ||
59 | private IAjhMeetingService ajhMeetingService; | ||
60 | 58 | ||
61 | @Value("${skua.path.upload}") | 59 | @Value("${skua.path.upload}") |
62 | private String upLoadPath; | 60 | private String upLoadPath; | ... | ... |
... | @@ -6,7 +6,7 @@ | ... | @@ -6,7 +6,7 @@ |
6 | <update id="checkAnswerByUserPaperId" > | 6 | <update id="checkAnswerByUserPaperId" > |
7 | update edu_user_answer ua | 7 | update edu_user_answer ua |
8 | 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) | 8 | 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) |
9 | where ua.user_paper_id = = #{userPaperId} | 9 | where ua.user_paper_id = #{userPaperId} |
10 | </update> | 10 | </update> |
11 | 11 | ||
12 | </mapper> | 12 | </mapper> | ... | ... |
sk-module-biz/src/main/java/com/skua/modules/process/controller/ProcessStatisticsController.java
0 → 100644
1 | package com.skua.modules.process.controller; | ||
2 | |||
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
4 | import com.skua.core.api.vo.Result; | ||
5 | import com.skua.core.aspect.annotation.AutoLog; | ||
6 | import com.skua.core.context.BaseContextHandler; | ||
7 | import com.skua.core.context.SpringContextUtils; | ||
8 | import com.skua.modules.equipment.entity.EquipmentMaintainTask; | ||
9 | import com.skua.modules.equipment.service.IEquipmentMaintainTaskService; | ||
10 | import com.skua.modules.flow.core.utils.TaskUtil; | ||
11 | import com.skua.modules.flow.utils.Func; | ||
12 | import com.skua.modules.inspection.entity.InspectionUserWorkingGroup; | ||
13 | import com.skua.modules.inspection.service.IInspectionTaskService; | ||
14 | import com.skua.modules.inspection.service.IInspectionUserWorkingGroupService; | ||
15 | import com.skua.modules.process.vo.ProcessStatisticsVO; | ||
16 | import com.skua.modules.quartz.util.BaseUtil; | ||
17 | import io.swagger.annotations.Api; | ||
18 | import io.swagger.annotations.ApiOperation; | ||
19 | import lombok.extern.slf4j.Slf4j; | ||
20 | import org.flowable.task.api.TaskQuery; | ||
21 | import org.flowable.engine.TaskService; | ||
22 | import org.springframework.beans.factory.annotation.Autowired; | ||
23 | import org.springframework.jdbc.core.JdbcTemplate; | ||
24 | import org.springframework.web.bind.annotation.GetMapping; | ||
25 | import org.springframework.web.bind.annotation.PostMapping; | ||
26 | import org.springframework.web.bind.annotation.RequestMapping; | ||
27 | import org.springframework.web.bind.annotation.RestController; | ||
28 | |||
29 | import java.util.ArrayList; | ||
30 | import java.util.List; | ||
31 | |||
32 | @Slf4j | ||
33 | @Api(tags="测试流程") | ||
34 | @RestController("testProcessController") | ||
35 | @RequestMapping("/web/process") | ||
36 | public class ProcessStatisticsController { | ||
37 | |||
38 | // 注入TaskService | ||
39 | @Autowired | ||
40 | private TaskService taskService; | ||
41 | @Autowired | ||
42 | private IEquipmentMaintainTaskService equipMaintainExecuteService; | ||
43 | @Autowired | ||
44 | private IInspectionTaskService inspectionTaskService; | ||
45 | @Autowired | ||
46 | private IInspectionUserWorkingGroupService inspectionUserWorkingGroupService; | ||
47 | |||
48 | /* 问题上报流程 problemReport | ||
49 | 设备维修流程 EquipmentRepair | ||
50 | 设备缺陷管理 EquipmentDefectManagement | ||
51 | 事故事件流程 EmergencyRiskEvent | ||
52 | 生产任务流程 productive_task | ||
53 | 数据报警工单 productAlarmProcess | ||
54 | 安全隐患流程 AjhRectification | ||
55 | 考核评价流程 dataAssessmentSocreMaster | ||
56 | 危险作业流程 DangerousOperationManage*/ | ||
57 | @AutoLog(value = "测试流程" ) | ||
58 | @ApiOperation(value="测试流程-统计", notes="测试流程-统计") | ||
59 | @GetMapping(value = "/statistics") | ||
60 | public Result<List<ProcessStatisticsVO>> statistics() { | ||
61 | Result<List<ProcessStatisticsVO>> result = new Result<List<ProcessStatisticsVO>>(); | ||
62 | List<ProcessStatisticsVO> processStatisticsList = new ArrayList<>(); | ||
63 | String taskUser = TaskUtil.getTaskUser(); | ||
64 | String taskGroup = TaskUtil.getCandidateGroup(); | ||
65 | List<String> userGroupList = Func.toStrList(taskGroup); | ||
66 | try { | ||
67 | //巡检任务、维修任务、保养任务、危险作业、事故事件、安全隐患、、药剂入库 | ||
68 | // 、、、、、药剂入库 | ||
69 | String process_key = "AjhRectification"; | ||
70 | processStatisticsList.add( queryProcessStatistics("安全隐患", process_key,taskUser,taskGroup) ) ; | ||
71 | process_key = "problemReport"; | ||
72 | processStatisticsList.add( queryProcessStatistics("问题上报", process_key,taskUser,taskGroup)) ; | ||
73 | process_key = "EmergencyRiskEvent"; | ||
74 | processStatisticsList.add( queryProcessStatistics("事故事件", process_key,taskUser,taskGroup) ) ; | ||
75 | process_key = "DangerousOperationManage"; | ||
76 | processStatisticsList.add( queryProcessStatistics("危险作业", process_key,taskUser,taskGroup) ) ; | ||
77 | process_key = "EquipmentRepair"; | ||
78 | processStatisticsList.add( queryProcessStatistics("维修任务", process_key,taskUser,taskGroup)) ; | ||
79 | |||
80 | Integer todoCount = 0; | ||
81 | QueryWrapper equipmentMaintainTaskQueryWrapper = new QueryWrapper<EquipmentMaintainTask>(); | ||
82 | equipmentMaintainTaskQueryWrapper.eq("maintainer_id", taskUser); | ||
83 | equipmentMaintainTaskQueryWrapper.eq("results_enforcement", 1); | ||
84 | todoCount = equipMaintainExecuteService.count(equipmentMaintainTaskQueryWrapper); | ||
85 | ProcessStatisticsVO maintainerProcessStatisticsVO = new ProcessStatisticsVO("保养任务" ,"" , "0", todoCount.toString() ); | ||
86 | processStatisticsList.add( maintainerProcessStatisticsVO ); | ||
87 | //巡检 | ||
88 | //得到巡检任务 | ||
89 | //得到进行中的任务 | ||
90 | //获取用户所在的班组 | ||
91 | Integer xunjian_count = 0; | ||
92 | String userId = BaseContextHandler.getUserId(); | ||
93 | QueryWrapper<InspectionUserWorkingGroup> inspectionUserWorkingGroupQueryWrapper = new QueryWrapper<>(); | ||
94 | inspectionUserWorkingGroupQueryWrapper.eq("user_id", userId); | ||
95 | List<InspectionUserWorkingGroup> inspectionUserWorkingGroupList = inspectionUserWorkingGroupService.list(inspectionUserWorkingGroupQueryWrapper); | ||
96 | |||
97 | List<String> inspectionWorkingGroupIdList = new ArrayList<>(); | ||
98 | for (InspectionUserWorkingGroup inspectionUserWorkingGroup : inspectionUserWorkingGroupList) { | ||
99 | inspectionWorkingGroupIdList.add(inspectionUserWorkingGroup.getInspectionWorkingGroupId()); | ||
100 | } | ||
101 | if (inspectionWorkingGroupIdList.size() > 0) { | ||
102 | QueryWrapper queryWrapper = new QueryWrapper(); | ||
103 | queryWrapper.eq("task_state", "1"); | ||
104 | queryWrapper.in("inspection_working_group_id", inspectionWorkingGroupIdList); | ||
105 | xunjian_count = inspectionTaskService.count(queryWrapper); | ||
106 | } else { | ||
107 | xunjian_count = 0; | ||
108 | } | ||
109 | ProcessStatisticsVO xunjianProcessStatisticsVO = new ProcessStatisticsVO("巡检任务" ,"" , "0",xunjian_count.toString() ); | ||
110 | |||
111 | processStatisticsList.add( xunjianProcessStatisticsVO ); | ||
112 | |||
113 | //药剂入库 | ||
114 | String userRoleIds = BaseContextHandler.getRoles(); | ||
115 | String roleIds = BaseUtil.quoteEach(userRoleIds,","); | ||
116 | |||
117 | Integer materialINCount = 0; | ||
118 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); | ||
119 | StringBuffer sql = new StringBuffer(" select count(1) from sys_role_permission rp ,sys_config c "); | ||
120 | sql.append(" where rp.permission_id = c.config_value and c.config_id = 'MaterialIN_ID' and rp.role_id in ("+roleIds+") " ); | ||
121 | Integer authFlag = masterDB.queryForObject(sql.toString(),Integer.class); | ||
122 | if(authFlag.intValue() > 0){ | ||
123 | String sql2 = "select count(1) from erp_material_in where confirm_status =2 and audit_status>0 and audit_status<3"; | ||
124 | materialINCount = masterDB.queryForObject(sql2,Integer.class); | ||
125 | } | ||
126 | |||
127 | ProcessStatisticsVO materialINProcessStatisticsVO = new ProcessStatisticsVO("药剂入库" ,"" , "0",materialINCount.toString() ); | ||
128 | processStatisticsList.add( materialINProcessStatisticsVO ); | ||
129 | |||
130 | result.setResult( processStatisticsList ); | ||
131 | result.success("获取统计数据"); | ||
132 | } catch (Exception e) { | ||
133 | log.error(e.getMessage(),e); | ||
134 | result.error500("操作失败"); | ||
135 | } | ||
136 | return result; | ||
137 | } | ||
138 | |||
139 | /*** | ||
140 | * @param process_key | ||
141 | * @return | ||
142 | */ | ||
143 | private ProcessStatisticsVO queryProcessStatistics(String processName,String process_key,String taskUser , String taskGroup){ | ||
144 | TaskQuery taskQuery = taskService.createTaskQuery(); | ||
145 | taskQuery.processDefinitionKey( process_key ); | ||
146 | Long todoCount = taskQuery.taskAssignee(taskUser).count();//代办人数 | ||
147 | Long claimCount = taskQuery.taskCandidateGroupIn( Func.toStrList(taskGroup) ).count() ;//todoCount | ||
148 | return new ProcessStatisticsVO(processName ,process_key , todoCount.toString(), claimCount.toString() ); | ||
149 | } | ||
150 | } |
1 | package com.skua.modules.process.vo; | ||
2 | |||
3 | import com.skua.tool.util.DigitalUtils; | ||
4 | import io.swagger.annotations.ApiModel; | ||
5 | import io.swagger.annotations.ApiModelProperty; | ||
6 | import lombok.Data; | ||
7 | |||
8 | @Data | ||
9 | @ApiModel(value="production_duty_group_user数据传输对象", description="生产值班班组-用户") | ||
10 | public class ProcessStatisticsVO { | ||
11 | @ApiModelProperty(value = "流程名称") | ||
12 | private String processName; | ||
13 | @ApiModelProperty(value = "流程key") | ||
14 | private String processKey; | ||
15 | @ApiModelProperty(value = "未签到数量") | ||
16 | private String claimCount; | ||
17 | @ApiModelProperty(value = "代办任务数量") | ||
18 | private String todoCount; | ||
19 | |||
20 | @ApiModelProperty(value = "总数") | ||
21 | private String totalCount; | ||
22 | |||
23 | public String getTotalCount() { | ||
24 | return DigitalUtils.add( this.getTotalCount() , this.getClaimCount() ) ; | ||
25 | } | ||
26 | |||
27 | public ProcessStatisticsVO(){ | ||
28 | } | ||
29 | |||
30 | public ProcessStatisticsVO(String processName, String processKey, String claimCount, String todoCount) { | ||
31 | this.processName = processName; | ||
32 | this.processKey = processKey; | ||
33 | this.claimCount = claimCount; | ||
34 | this.todoCount = todoCount; | ||
35 | } | ||
36 | } |
... | @@ -52,7 +52,9 @@ public class DangerLevelManageController { | ... | @@ -52,7 +52,9 @@ public class DangerLevelManageController { |
52 | @Autowired | 52 | @Autowired |
53 | private IDangerLevelManageService dangerLevelManageService; | 53 | private IDangerLevelManageService dangerLevelManageService; |
54 | @Value("${skua.path.upload}") | 54 | @Value("${skua.path.upload}") |
55 | private String uploadpath; | 55 | private String upLoadPath; |
56 | @Value("${skua.web-url}") | ||
57 | private String webUrl; | ||
56 | @Autowired | 58 | @Autowired |
57 | private ISysConfigService configService; | 59 | private ISysConfigService configService; |
58 | /** | 60 | /** |
... | @@ -104,7 +106,6 @@ public class DangerLevelManageController { | ... | @@ -104,7 +106,6 @@ public class DangerLevelManageController { |
104 | public Result<DangerLevelManage> add(@RequestBody DangerLevelManage dangerLevelManage) { | 106 | public Result<DangerLevelManage> add(@RequestBody DangerLevelManage dangerLevelManage) { |
105 | Result<DangerLevelManage> result = new Result<DangerLevelManage>(); | 107 | Result<DangerLevelManage> result = new Result<DangerLevelManage>(); |
106 | try { | 108 | try { |
107 | |||
108 | dangerLevelManageService.save(dangerLevelManage); | 109 | dangerLevelManageService.save(dangerLevelManage); |
109 | dangerLevelManage.setQrCode( this.createQR( dangerLevelManage.getId())) ; | 110 | dangerLevelManage.setQrCode( this.createQR( dangerLevelManage.getId())) ; |
110 | dangerLevelManageService.updateById( dangerLevelManage ) ; | 111 | dangerLevelManageService.updateById( dangerLevelManage ) ; |
... | @@ -148,15 +149,17 @@ public class DangerLevelManageController { | ... | @@ -148,15 +149,17 @@ public class DangerLevelManageController { |
148 | * @return | 149 | * @return |
149 | */ | 150 | */ |
150 | private String createQR(String dangerLevelId){ | 151 | private String createQR(String dangerLevelId){ |
151 | String qrCodePath = "files"+ File.separator+"qrcode"+File.separator+dangerLevelId+".png"; | 152 | String qrCodePath = null; |
152 | try { | 153 | try { |
154 | String filePath = upLoadPath + File.separator + "qrcode"; | ||
153 | String qrUrl = configService.queryValueByKey("DANGER_LEVLE_QRURL"); | 155 | String qrUrl = configService.queryValueByKey("DANGER_LEVLE_QRURL"); |
154 | QRCodeUtil.encode(qrUrl, "", uploadpath+File.separator+qrCodePath, true); | 156 | qrUrl = qrUrl + dangerLevelId;//风险巡检二维码地址 |
157 | qrCodePath = com.skua.tool.util.QRCodeUtil.getQRCodeImage(qrUrl, filePath, "DL-" + dangerLevelId); | ||
158 | //QRCodeUtil.encode(qrUrl, "", uploadpath+File.separator+qrCodePath, true); | ||
155 | } catch (Exception e) { | 159 | } catch (Exception e) { |
156 | log.error("生成二维码失败"); | 160 | log.error("生成二维码失败"); |
157 | qrCodePath = null; | 161 | qrCodePath = null; |
158 | } | 162 | } |
159 | |||
160 | return qrCodePath; | 163 | return qrCodePath; |
161 | } | 164 | } |
162 | 165 | ... | ... |
-
请 注册 或 登录 后发表评论