|
|
|
|
@ -3,11 +3,14 @@ package org.springblade.modules.business.contraller; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.modules.business.enums.WorkOrderStatusEnum; |
|
|
|
|
import org.springblade.modules.business.pojo.entity.Device; |
|
|
|
|
import org.springblade.modules.business.pojo.entity.maintenance.MaintenancePersonnel; |
|
|
|
|
import org.springblade.modules.business.pojo.entity.maintenance.MaintenancePlan; |
|
|
|
|
@ -15,7 +18,6 @@ import org.springblade.modules.business.pojo.entity.maintenance.MaintenanceTask; |
|
|
|
|
import org.springblade.modules.business.pojo.entity.workorder.WorkOrder; |
|
|
|
|
import org.springblade.modules.business.pojo.vo.MaintenanceTaskVO; |
|
|
|
|
import org.springblade.modules.business.pojo.vo.PieStatVO; |
|
|
|
|
import org.springblade.modules.business.pojo.vo.SearchMaintenancePersonnelVO; |
|
|
|
|
import org.springblade.modules.business.service.IDeviceService; |
|
|
|
|
import org.springblade.modules.business.service.IMaintenancePlanService; |
|
|
|
|
import org.springblade.modules.business.service.IMaintenanceTaskService; |
|
|
|
|
@ -42,6 +44,7 @@ import static org.springblade.modules.business.enums.WorkOrderStatusEnum.*; |
|
|
|
|
* @author BladeX |
|
|
|
|
* @since 2024-10-14 |
|
|
|
|
*/ |
|
|
|
|
@Slf4j |
|
|
|
|
@RestController |
|
|
|
|
@AllArgsConstructor |
|
|
|
|
@RequestMapping("/workBenches") |
|
|
|
|
@ -58,16 +61,29 @@ public class WorkBenchesController extends BladeController { |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/overview") |
|
|
|
|
public R<List<Map<String, Object>>> overview() { |
|
|
|
|
BladeUser bladeUser = AuthUtil.getUser(); |
|
|
|
|
Long userId = bladeUser.getUserId(); |
|
|
|
|
List<Map<String, Object>> list = new ArrayList<>(); |
|
|
|
|
// 实验室巡检数量
|
|
|
|
|
Map<String, Object> map1 = new HashMap<>(); |
|
|
|
|
map1.put("name", "实验室巡检"); |
|
|
|
|
map1.put("num", maintenancePlanService.count(Wrappers.lambdaQuery(MaintenancePlan.class))); |
|
|
|
|
LambdaQueryWrapper<MaintenancePlan> wrapper1 = Wrappers.lambdaQuery(MaintenancePlan.class); |
|
|
|
|
if (!bladeUser.getRoleName().contains("administrator") && !bladeUser.getRoleName().contains("admin")) { |
|
|
|
|
wrapper1.eq(MaintenancePlan::getDeptId, bladeUser.getDeptId()); |
|
|
|
|
} |
|
|
|
|
map1.put("num", maintenancePlanService.count(wrapper1)); |
|
|
|
|
list.add(map1); |
|
|
|
|
// 报送记录数量
|
|
|
|
|
Map<String, Object> map2 = new HashMap<>(); |
|
|
|
|
map2.put("name", "报送记录"); |
|
|
|
|
map2.put("num", workOrderService.count(Wrappers.lambdaQuery(WorkOrder.class).ne(WorkOrder::getStatus, -1))); |
|
|
|
|
LambdaQueryWrapper<WorkOrder> wrapper2 = Wrappers.lambdaQuery(WorkOrder.class); |
|
|
|
|
User user = userService.getById(userId); |
|
|
|
|
if (user.getRoleId().equals("1123598816738675201")) { |
|
|
|
|
map2.put("num", workOrderService.count(wrapper2)); |
|
|
|
|
} else { |
|
|
|
|
wrapper2.eq(WorkOrder::getCreateUser, userId); |
|
|
|
|
map2.put("num", workOrderService.count(wrapper2)); |
|
|
|
|
} |
|
|
|
|
list.add(map2); |
|
|
|
|
// 设备报警数量
|
|
|
|
|
Map<String, Object> map3 = new HashMap<>(); |
|
|
|
|
|