| | |
| | | package org.jeecg.modules.eam.dto; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | @TableField(exist = false) |
| | | private String installationPosition; |
| | | |
| | | |
| | | /**是否有设备操作证 是否*/ |
| | | @Dict(dicCode = "yn") |
| | | private String operationCertificate; |
| | |
| | | /**造成结果*/ |
| | | private String causingResults; |
| | | |
| | | /**技术状态*/ |
| | | @TableField(exist = false) |
| | | @Excel(name = "技术状态", width = 15, orderNum = "8",dicCode = "equipment_technology_status") |
| | | @ApiModelProperty(value = "技术状态") |
| | | @Dict(dicCode = "equipment_technology_status") |
| | | private String technologyStatus; |
| | | |
| | | @ApiModelProperty(value = "中心") |
| | | @Dict(dictTable = "eam_base_factory",dicText = "factory_name",dicCode = "org_code") |
| | | private transient String zxfactoryOrgCode; |
| | | |
| | | @ApiModelProperty(value = "工区") |
| | | @Dict(dictTable = "eam_base_factory",dicText = "factory_name",dicCode = "org_code") |
| | | private transient String gqfactoryOrgCode; |
| | | |
| | | @ApiModelProperty(value = "中心/工区/工段") |
| | | @Dict(dictTable = "eam_base_factory",dicText = "factory_name",dicCode = "factory_code") |
| | | private String factoryOrgCode; |
| | | |
| | | public void setFactoryOrgCode(String factoryOrgCode){ |
| | | this.factoryOrgCode = factoryOrgCode; |
| | | if(StrUtil.isNotEmpty(factoryOrgCode)){ |
| | | if(factoryOrgCode.length()==12){ |
| | | this.gqfactoryOrgCode = factoryOrgCode.substring(0,9); |
| | | this.zxfactoryOrgCode = factoryOrgCode.substring(0,6); |
| | | } |
| | | |
| | | if(factoryOrgCode.length()==9){ |
| | | this.zxfactoryOrgCode = factoryOrgCode.substring(0,6); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | package org.jeecg.modules.eam.entity; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.annotation.FieldStrategy; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | |
| | | /**流程业务实例id 一个流程业务唯一,本表中也唯一*/ |
| | | @TableField(exist = false) |
| | | private String processInstanceId; |
| | | |
| | | /**技术状态*/ |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "技术状态") |
| | | @Dict(dicCode = "equipment_technology_status") |
| | | private String technologyStatus; |
| | | |
| | | @ApiModelProperty(value = "中心") |
| | | @TableField(exist = false) |
| | | @Dict(dictTable = "eam_base_factory",dicText = "factory_name",dicCode = "org_code") |
| | | private transient String zxfactoryOrgCode; |
| | | |
| | | @ApiModelProperty(value = "工区") |
| | | @TableField(exist = false) |
| | | @Dict(dictTable = "eam_base_factory",dicText = "factory_name",dicCode = "org_code") |
| | | private transient String gqfactoryOrgCode; |
| | | |
| | | @ApiModelProperty(value = "中心/工区/工段") |
| | | @TableField(exist = false) |
| | | @Dict(dictTable = "eam_base_factory",dicText = "factory_name",dicCode = "factory_code") |
| | | private String factoryOrgCode; |
| | | |
| | | public void setFactoryOrgCode(String factoryOrgCode){ |
| | | this.factoryOrgCode = factoryOrgCode; |
| | | if(StrUtil.isNotEmpty(factoryOrgCode)){ |
| | | if(factoryOrgCode.length()==12){ |
| | | this.gqfactoryOrgCode = factoryOrgCode.substring(0,9); |
| | | this.zxfactoryOrgCode = factoryOrgCode.substring(0,6); |
| | | } |
| | | |
| | | if(factoryOrgCode.length()==9){ |
| | | this.zxfactoryOrgCode = factoryOrgCode.substring(0,6); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | </select> |
| | | <select id="queryPageList" resultType="org.jeecg.modules.eam.dto.EamReportRepairDto"> |
| | | select wmo.*, e.equipment_code, e.equipment_name,e.equipment_model, e.installation_position, |
| | | e.factory_org_code, |
| | | aar.operation_certificate, power_off_restart, batch_first_piece, variable_factors, |
| | | variable_factors_value, execute_nc, accident_phenomenon, measure, causing_results |
| | | from eam_report_repair wmo |
| | |
| | | * @return |
| | | */ |
| | | List<EchartsDto> reportRepairList(); |
| | | |
| | | /** |
| | | * 设备管理首页-设备报修故障情况列表 |
| | | * @param code |
| | | * @param page |
| | | * @return |
| | | */ |
| | | IPage<EamReportRepairDto> reportRepairList(String code, Page<EamReportRepairDto> page); |
| | | } |
| | |
| | | queryWrapper.like("e.asset_status", eamEquipment.getAssetStatus()); |
| | | } |
| | | if (StringUtils.isNotBlank(eamEquipment.getTechnologyStatus())) { |
| | | queryWrapper.like("e.technology_status", eamEquipment.getTechnologyStatus()); |
| | | queryWrapper.like("ext.technology_status", eamEquipment.getTechnologyStatus()); |
| | | } |
| | | if (StringUtils.isNotBlank(eamEquipment.getOperationSystem())) { |
| | | queryWrapper.like("e.operation_system", eamEquipment.getOperationSystem()); |
| | |
| | | queryWrapper.like("e.asset_status", eamEquipment.getAssetStatus()); |
| | | } |
| | | if (StringUtils.isNotBlank(eamEquipment.getTechnologyStatus())) { |
| | | queryWrapper.like("e.technology_status", eamEquipment.getTechnologyStatus()); |
| | | queryWrapper.like("ext.technology_status", eamEquipment.getTechnologyStatus()); |
| | | } |
| | | if (StringUtils.isNotBlank(eamEquipment.getOperationSystem())) { |
| | | queryWrapper.like("e.operation_system", eamEquipment.getOperationSystem()); |
| | |
| | | |
| | | @Resource |
| | | private IEamEquipmentExtendService eamEquipmentExtendService; |
| | | |
| | | @Autowired |
| | | private IBaseFactoryUserService baseFactoryUserService; |
| | | @Autowired |
| | |
| | | return entity; |
| | | } |
| | | |
| | | @Override |
| | | public List<EchartsDto> reportRepairList() { |
| | | List<EchartsDto> echartsDtoList = new ArrayList<>(); |
| | | |
| | |
| | | dto.setPercentage(percentage); |
| | | return dto; |
| | | } |
| | | |
| | | /** |
| | | * 设备管理首页-设备报修故障情况列表 |
| | | * @param code |
| | | * @param page |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<EamReportRepairDto> reportRepairList(String code, Page<EamReportRepairDto> page){ |
| | | IPage<EamReportRepairDto> eamReportRepairDtoIPage=new Page<>(); |
| | | // 用户数据权限检查 |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | return null; |
| | | } |
| | | |
| | | QueryWrapper<EamReportRepairDto> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("wmo.del_flag", CommonConstant.DEL_FLAG_0); |
| | | |
| | | // 设备过滤逻辑 |
| | | if (StringUtils.isNotBlank(sysUser.getEamEquipmentIds())) { |
| | | List<String> equipArr = Arrays.asList(sysUser.getEamEquipmentIds().split(",")); |
| | | queryWrapper.in("e.equipment_code", equipArr); |
| | | } else { |
| | | List<BaseFactoryUser> baseFactoryUserList = baseFactoryUserService |
| | | .list(new LambdaQueryWrapper<BaseFactoryUser>() |
| | | .eq(BaseFactoryUser::getUserId, sysUser.getId())); |
| | | |
| | | if (CollectionUtils.isEmpty(baseFactoryUserList)) { |
| | | return null; |
| | | } |
| | | |
| | | Set<String> factoryIds = baseFactoryUserList.stream() |
| | | .map(BaseFactoryUser::getFactoryId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | Set<String> factoryCodes = baseFactoryService.listByIds(factoryIds) |
| | | .stream() |
| | | .map(BaseFactory::getOrgCode) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | queryWrapper.in("e.factory_org_code", factoryCodes); |
| | | } |
| | | queryWrapper.orderByDesc("wmo.create_time"); |
| | | switch (code){ |
| | | case "bx": |
| | | eamReportRepairDtoIPage=baseMapper.queryPageList(page,queryWrapper); |
| | | break; |
| | | case "stop": |
| | | eamReportRepairDtoIPage=baseMapper.queryPageList(page,queryWrapper.eq("breakdown_flag", "1")); |
| | | break; |
| | | default: |
| | | eamReportRepairDtoIPage=baseMapper.queryPageList(page,queryWrapper.eq("breakdown_flag", "0")); |
| | | break; |
| | | } |
| | | eamReportRepairDtoIPage.getRecords().forEach(eamReportRepairDto -> { |
| | | eamReportRepairDto.setTechnologyStatus(eamEquipmentExtendService.getById(eamReportRepairDto.getEquipmentId()).getTechnologyStatus()); |
| | | }); |
| | | return eamReportRepairDtoIPage; |
| | | } |
| | | |
| | | } |
| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.modules.eam.dto.EamReportRepairDto; |
| | | import org.jeecg.modules.eam.dto.EchartsDto; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.entity.EamFactorySecondMaintPlan; |
| | | import org.jeecg.modules.eam.entity.EamThirdMaintenanceOrder; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.service.IEamFactorySecondMaintPlanService; |
| | | import org.jeecg.modules.eam.service.IEamReportRepairService; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.HashMap; |
| | |
| | | List<EamFactorySecondMaintPlan> echartsDtoList = iEamFactorySecondMaintPlanService.list(); |
| | | return Result.ok(echartsDtoList); |
| | | } |
| | | |
| | | /** |
| | | * 设备管理首页-设备报修故障列表 |
| | | * @param code |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "设备管理首页-设备报修故障列表", notes = "设备管理首页-设备报修故障列表") |
| | | @GetMapping(value = "/repairList") |
| | | public Result<?> repair(@RequestParam(name = "code", required = false) String code, |
| | | @RequestParam(name = "pageNo", required = false, defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", required = false, defaultValue = "10") Integer pageSize) { |
| | | Page<EamReportRepairDto> page = new Page<>(pageNo, pageSize); |
| | | IPage<EamReportRepairDto> iPage = iEamReportRepairService.reportRepairList(code,page); |
| | | return Result.ok(iPage); |
| | | } |
| | | |
| | | /** |
| | | * 设备管理首页-三级保养列表 |
| | | * @param code |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "设备管理首页-三级保养列表", notes = "设备管理首页-三级保养列表") |
| | | @GetMapping(value = "/maintenanceList") |
| | | public Result<?> maintenanceList(@RequestParam(name = "code", required = false) String code, |
| | | @RequestParam(name = "pageNo", required = false, defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", required = false, defaultValue = "10") Integer pageSize) { |
| | | Page<EamThirdMaintenanceOrder> page = new Page<>(pageNo, pageSize); |
| | | IPage<EamThirdMaintenanceOrder> iPage = iEamThirdMaintenanceOrderService.maintenanceList(code, page); |
| | | return Result.ok(iPage); |
| | | } |
| | | } |
| | |
| | | <mapper namespace="org.jeecg.modules.eam.mapper.EamThirdMaintenanceOrderMapper"> |
| | | |
| | | <select id="queryPageList" resultType="org.jeecg.modules.eam.entity.EamThirdMaintenanceOrder"> |
| | | select wmo.*, e.equipment_code, e.equipment_name, e.equipment_model,f.process_instance_id as 'procInstId', |
| | | select wmo.*, e.equipment_code, e.equipment_name, e.equipment_model,e.factory_org_code,f.process_instance_id as 'procInstId', |
| | | f.process_definition_key, |
| | | f.process_definition_id, |
| | | f.process_instance_id |
| | |
| | | on wmo.equipment_id = e.id |
| | | left join flow_my_business f on f.data_id=wmo.id |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | |
| | | <select id="queryAsList" resultType="org.jeecg.modules.eam.entity.EamThirdMaintenanceOrder"> |
| | | select wmo.*, e.equipment_code, e.equipment_name, e.equipment_model,f.process_instance_id as 'procInstId', |
| | | f.process_definition_key, |
| | | f.process_definition_id, |
| | | f.process_instance_id |
| | | from eam_third_maintenance_order wmo |
| | | inner join eam_equipment e |
| | | on wmo.equipment_id = e.id |
| | | left join flow_my_business f on f.data_id=wmo.id |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | |
| | | <select id="findThirdMaintenanceBaseInfo" resultType="org.jeecg.modules.eam.request.EamThirdMaintenanceBaseResponse"> |
| | |
| | | inner join eam_equipment e |
| | | on wmo.equipment_id = e.id |
| | | LEFT JOIN eam_base_factory f ON f.org_code = SUBSTRING ( e.factory_org_code , 1, 6 ) |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | <select id="queryAsList" resultType="org.jeecg.modules.eam.entity.EamThirdMaintenanceOrder"> |
| | | select wmo.*, e.equipment_code, e.equipment_name, e.equipment_model,f.process_instance_id as 'procInstId', |
| | | f.process_definition_key, |
| | | f.process_definition_id, |
| | | f.process_instance_id |
| | | from eam_third_maintenance_order wmo |
| | | inner join eam_equipment e |
| | | on wmo.equipment_id = e.id |
| | | left join flow_my_business f on f.data_id=wmo.id |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | List<EchartsDto> selectList(); |
| | | |
| | | /** |
| | | * 设备管理首页-三保计划列表 |
| | | * @param code |
| | | * @param page |
| | | * @return |
| | | */ |
| | | IPage<EamThirdMaintenanceOrder> maintenanceList(String code, Page<EamThirdMaintenanceOrder> page); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设备管理首页-三保计划列表 |
| | | * @param code |
| | | * @param page |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<EamThirdMaintenanceOrder> maintenanceList(String code, Page<EamThirdMaintenanceOrder> page){ |
| | | IPage<EamThirdMaintenanceOrder> eamThirdMaintenanceOrderIPage=new Page<>(); |
| | | // 用户数据权限检查 |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | return null; |
| | | } |
| | | |
| | | QueryWrapper<EamThirdMaintenanceOrder> queryWrapper = new QueryWrapper<>(); |
| | | |
| | | // 设备过滤逻辑 |
| | | if (StringUtils.isNotBlank(sysUser.getEamEquipmentIds())) { |
| | | List<String> equipArr = Arrays.asList(sysUser.getEamEquipmentIds().split(",")); |
| | | queryWrapper.in("e.equipment_code", equipArr); |
| | | } else { |
| | | List<BaseFactoryUser> baseFactoryUserList = baseFactoryUserService |
| | | .list(new LambdaQueryWrapper<BaseFactoryUser>() |
| | | .eq(BaseFactoryUser::getUserId, sysUser.getId())); |
| | | |
| | | if (CollectionUtils.isEmpty(baseFactoryUserList)) { |
| | | return null; |
| | | } |
| | | |
| | | Set<String> factoryIds = baseFactoryUserList.stream() |
| | | .map(BaseFactoryUser::getFactoryId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | Set<String> factoryCodes = baseFactoryService.listByIds(factoryIds) |
| | | .stream() |
| | | .map(BaseFactory::getOrgCode) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | queryWrapper.in("e.factory_org_code", factoryCodes); |
| | | } |
| | | queryWrapper.orderByDesc("wmo.create_time"); |
| | | // 获取当前年月和下两个月的年月字符串 |
| | | String currentYearMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM")); |
| | | switch (code){ |
| | | case "bysbzs": |
| | | // 本月三保计划总数 |
| | | eamThirdMaintenanceOrderIPage=this.baseMapper.queryPageList(page,queryWrapper.clone().like("maintenance_date", currentYearMonth)); |
| | | break; |
| | | case "bwc": |
| | | // 本月完成 |
| | | eamThirdMaintenanceOrderIPage=this.baseMapper.queryPageList(page,queryWrapper.clone().like("maintenance_date", currentYearMonth) |
| | | .eq("maintenance_status", ThirdMaintenanceStatusEnum.COMPLETE.name())); |
| | | break; |
| | | case "xysb": |
| | | // 下月三保计划 |
| | | String nextMonth = LocalDate.now().plusMonths(1).format(DateTimeFormatter.ofPattern("yyyy-MM")); |
| | | eamThirdMaintenanceOrderIPage=this.baseMapper.queryPageList(page,queryWrapper.clone().like("maintenance_date", nextMonth)); |
| | | break; |
| | | case "xxysb": |
| | | // 下下月三保计划 |
| | | String nextNextMonth = LocalDate.now().plusMonths(2).format(DateTimeFormatter.ofPattern("yyyy-MM")); |
| | | eamThirdMaintenanceOrderIPage=this.baseMapper.queryPageList(page,queryWrapper.clone().like("maintenance_date", nextNextMonth)); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | eamThirdMaintenanceOrderIPage.getRecords().forEach(eamThirdMaintenanceOrder -> { |
| | | eamThirdMaintenanceOrder.setTechnologyStatus(eamEquipmentExtendService.getById(eamThirdMaintenanceOrder.getEquipmentId()).getTechnologyStatus()); |
| | | }); |
| | | return eamThirdMaintenanceOrderIPage; |
| | | } |
| | | |
| | | /** |
| | | * 更新工单状态 |
| | | */ |
| | | private void updateOrderStatus(Result result, EamThirdMaintenanceRequest request, EamThirdMaintenanceOrder order, LoginUser user) { |