From be3aa0812cb43be7484e162b4fece5344e9eb5c8 Mon Sep 17 00:00:00 2001 From: qushaowei <qushaowei@163.com> Date: 星期四, 14 三月 2024 11:12:43 +0800 Subject: [PATCH] Merge branch 'master' of http://117.34.109.166:18448/r/mdc_430 into develop --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java | 66 +++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 0 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java new file mode 100644 index 0000000..901b846 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java @@ -0,0 +1,66 @@ +package org.jeecg.modules.mdc.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +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.service.IMdcEquipmentService; +import org.jeecg.modules.mdc.vo.MdcCommonVo; +import org.jeecg.modules.system.entity.MdcProduction; +import org.jeecg.modules.system.service.IMdcProductionService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @author Lius + * @Description: MDC棣栭〉鎺ュ彛 + * @date 2024/3/13 14:27 + */ +@Slf4j +@Api(tags = "MDC棣栭〉鎺ュ彛") +@RestController +@RequestMapping("/mdc/home") +public class MdcHomeController { + + @Resource + private IMdcEquipmentService mdcEquipmentService; + + @Resource + private IMdcProductionService mdcProductionService; + + @ApiOperation(value = "MDC棣栭〉鎺ュ彛-璁惧杩愯鐘舵�佺粺璁�", notes = "MDC棣栭〉鎺ュ彛-璁惧杩愯鐘舵�佺粺璁�") + @GetMapping("/equipmentStatusStatistics") + public Result<?> equipmentStatusStatistics(String productionCode) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + Integer userType = user.getUserType(); + 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 { + //鍒ゆ柇鏄叕鍙哥骇杩樻槸鍘傚尯 + MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, "")); + if (userType.equals(MdcConstant.USER_TYPE_4)) { + //鍏徃 + key = mdcProduction.getId(); + } else if (userType.equals(MdcConstant.USER_TYPE_3)) { + //鍘傚尯 + key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId()); + } + } + List<MdcCommonVo> resultMap = mdcEquipmentService.getEquipmentStatusStatistics(userId, key); + return Result.OK(resultMap); + } +} -- Gitblit v1.9.3