Lius
2024-04-02 4bd74ded216856176d47a87f69572084023be329
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java
@@ -10,6 +10,7 @@
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.mdc.constant.MdcConstant;
import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.service.IMdcHomeService;
import org.jeecg.modules.mdc.vo.MdcCommonVo;
@@ -64,6 +65,9 @@
            } else if (userType.equals(MdcConstant.USER_TYPE_3)) {
                //厂区
                key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId());
            } else if (userType.equals(MdcConstant.USER_TYPE_2)) {
                //工段 查询用户拥有的工段权限
                key = mdcProductionService.findThreeProductionId(userId);
            }
        }
        List<MdcCommonVo> resultMap = mdcHomeService.getEquipmentStatusStatistics(userId, key);
@@ -150,4 +154,42 @@
        Map<String, Object> result = mdcHomeService.getEquipmentMonthStatistics(userId, key);
        return Result.OK(result);
    }
    @ApiOperation(value = "MDC首页接口-工段级前七天利用率折线图", notes = "MDC首页接口-工段级前七天利用率折线图")
    @GetMapping("/equipmentDayUtilizationStatistics")
    public Result<?> equipmentDayUtilizationStatistics(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);
        }
        Map<String, Object> result = mdcHomeService.getEquipmentDayUtilizationStatistics(userId, key);
        return Result.OK(result);
    }
    @ApiOperation(value = "MDC首页接口-上月各设备OEE统计", notes = "MDC首页接口-上月各设备OEE统计")
    @GetMapping("/equipmentOEEMonthStatistics")
    public Result<?> equipmentOEEMonthStatistics(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);
        }
        List<MdcOverallEquipmentEfficiency> result = mdcHomeService.getEquipmentOEEMonthStatistics(userId, key);
        return Result.OK(result);
    }
}