| | |
| | | * @return |
| | | */ |
| | | List<EchartsDto> reportRepairList(); |
| | | |
| | | /** |
| | | * 设备管理首页-设备报修故障情况列表 |
| | | * @param code |
| | | * @param page |
| | | * @return |
| | | */ |
| | | IPage<EamReportRepairDto> reportRepairList(String code, Page<EamReportRepairDto> page); |
| | | } |
| | |
| | | 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){ |
| | | // 用户数据权限检查 |
| | | 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": |
| | | return baseMapper.queryPageList(page,queryWrapper); |
| | | case "stop": |
| | | return baseMapper.queryPageList(page,queryWrapper.eq("breakdown_flag", "1")); |
| | | default: |
| | | return baseMapper.queryPageList(page,queryWrapper.eq("breakdown_flag", "0")); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | ${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"> |
| | | SELECT |
| | | t1.hf_code_a, |
| | |
| | | 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){ |
| | | // 用户数据权限检查 |
| | | 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": |
| | | // 本月三保计划总数 |
| | | return this.baseMapper.queryPageList(page,queryWrapper.clone().like("maintenance_date", currentYearMonth)); |
| | | case "bwc": |
| | | // 本月完成 |
| | | return this.baseMapper.queryPageList(page,queryWrapper.clone().like("maintenance_date", currentYearMonth) |
| | | .eq("maintenance_status", ThirdMaintenanceStatusEnum.COMPLETE.name())); |
| | | case "xysb": |
| | | // 下月三保计划 |
| | | String nextMonth = LocalDate.now().plusMonths(1).format(DateTimeFormatter.ofPattern("yyyy-MM")); |
| | | return this.baseMapper.queryPageList(page,queryWrapper.clone().like("maintenance_date", nextMonth)); |
| | | case "xxysb": |
| | | // 下下月三保计划 |
| | | String nextNextMonth = LocalDate.now().plusMonths(2).format(DateTimeFormatter.ofPattern("yyyy-MM")); |
| | | return this.baseMapper.queryPageList(page,queryWrapper.clone().like("maintenance_date", nextNextMonth)); |
| | | default: |
| | | break; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 更新工单状态 |
| | | */ |
| | | private void updateOrderStatus(Result result, EamThirdMaintenanceRequest request, EamThirdMaintenanceOrder order, LoginUser user) { |