新火炬后端单体项目初始化代码
cuilei
2 天以前 e0f827f71f5bb9d1ed9f6414221e90eeb34632a7
src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java
@@ -12,15 +12,21 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.util.TranslateDictTextUtils;
import org.jeecg.modules.eam.constant.AssetStatusEnum;
import org.jeecg.modules.eam.constant.MaintenanceCategoryEnum;
import org.jeecg.modules.eam.constant.MaintenanceStandardStatusEnum;
import org.jeecg.modules.eam.entity.EamEquipment;
import org.jeecg.modules.eam.entity.EamEquipmentExtend;
import org.jeecg.modules.eam.request.EamEquipmentQuery;
import org.jeecg.modules.eam.service.IEamEquipmentExtendService;
import org.jeecg.modules.eam.service.IEamEquipmentService;
import org.jeecg.modules.eam.vo.EquipmentSearchResult;
import org.jeecg.modules.mes.entity.MesProductionWorkOrder;
import org.jeecg.modules.mes.service.IMesProductionWorkOrderService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.springframework.beans.factory.annotation.Autowired;
@@ -33,8 +39,10 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @Description: 设备台账
@@ -60,6 +68,8 @@
    private ObjectMapper objectMapper;
    @Autowired
    private TranslateDictTextUtils translateDictTextUtils;
    @Autowired
    private IMesProductionWorkOrderService mesProductionWorkOrderService;
    /**
     * 分页列表查询
@@ -335,4 +345,26 @@
        return Result.ok(resultList);
    }
    @AutoLog(value = "查询排产工单所属产线下需要点检的设备列表")
    @ApiOperation(value = "查询排产工单所属产线下需要点检的设备列表", notes = "查询排产工单所属产线下需要点检的设备列表")
    @GetMapping(value = "/listProductionLineInspectionEquipment")
    public Result<?> listProductionLineInspectionEquipment(@RequestParam("orderId") String orderId) {
        MesProductionWorkOrder workOrder = mesProductionWorkOrderService.getById(orderId);
        if (workOrder == null) {
            return Result.error("工单不存在!");
        }
        List<Map<String, Object>> equipmentMapList = eamEquipmentService.list(new LambdaQueryWrapper<EamEquipment>()
                        .eq(EamEquipment::getOrgId, workOrder.getFactoryId())
                        .eq(EamEquipment::getDelFlag, CommonConstant.DEL_FLAG_0)
                        .apply("NOT EXISTS (SELECT 1 FROM eam_inspection_order t WHERE t.equipment_id = eam_equipment.id AND t.work_order_id = {0})", orderId)
                        .apply("EXISTS (SELECT 1 FROM eam_maintenance_standard t WHERE t.equipment_id = eam_equipment.id AND t.del_flag = {0} " +
                                        "AND t.standard_status = {1} AND t.maintenance_category = {2})",
                                CommonConstant.DEL_FLAG_0, MaintenanceStandardStatusEnum.NORMAL.name(), MaintenanceCategoryEnum.POINT_INSPECTION.name()))
                .stream().map(e -> (Map<String, Object>) new HashMap<String, Object>() {{
                    put("value", e.getId());
                    put("label", e.getEquipmentCode() + "[" + e.getEquipmentName() + "]");
                    put("text", e.getEquipmentCode() + "[" + e.getEquipmentName() + "]");
                }}).collect(Collectors.toList());
        return Result.ok(equipmentMapList);
    }
}