Lius
2024-04-11 db0cd1d60268811918f38a165052f94911f18e1e
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java
@@ -14,6 +14,7 @@
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.service.IMdcHomeService;
import org.jeecg.modules.mdc.vo.MdcCommonVo;
import org.jeecg.modules.mdc.vo.MdcHomeEfficiencyVo;
import org.jeecg.modules.system.entity.MdcProduction;
import org.jeecg.modules.system.service.IMdcProductionService;
import org.springframework.web.bind.annotation.GetMapping;
@@ -73,7 +74,7 @@
        List<MdcCommonVo> resultMap = mdcHomeService.getEquipmentStatusStatistics(userId, key);
        Map<String, Object> map = new HashMap<>();
        map.put("list", resultMap);
        map.put("producitonId", key);
        map.put("productionId", key);
        return Result.OK(map);
    }
@@ -191,5 +192,23 @@
        return Result.OK(result);
    }
    @ApiOperation(value = "MDC首页接口-工段级设备效率统计", notes = "MDC首页接口-工段级设备效率统计")
    @GetMapping("/equipmentEfficiencyStatistics")
    public Result<?> equipmentEfficiencyStatistics(String productionCode) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        String key = "";
        if (StringUtils.isNotBlank(productionCode)) {
            //厂区
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()));
            key = mdcProduction.getId();
        } else {
            //工段 查询用户拥有的工段权限
            key = mdcProductionService.findThreeProductionId(userId);
        }
        MdcHomeEfficiencyVo result = mdcHomeService.getEquipmentEfficiencyStatistics(userId, key);
        return Result.OK(result);
    }
}