¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | 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.query.QueryGenerator; |
| | | import org.jeecg.modules.eam.entity.Area; |
| | | import org.jeecg.modules.eam.service.IAreaService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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; |
| | | |
| | | @Api(tags = "è½¦é´ å端æ§å¶å¨") |
| | | @RestController |
| | | @RequestMapping("/base/area") |
| | | public class AreaController { |
| | | |
| | | @Autowired |
| | | private IAreaService areaService; |
| | | |
| | | @AutoLog(value = "车é´-å页æ¥è¯¢") |
| | | @ApiOperation(value = "车é´-å页æ¥è¯¢", notes = "车é´-å页æ¥è¯¢") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> list(Area area, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { |
| | | QueryWrapper<Area> queryWrapper = QueryGenerator.initQueryWrapper(area, req.getParameterMap()); |
| | | Page<Area> page = new Page<Area>(pageNo, pageSize); |
| | | IPage<Area> pageList = areaService.page(page, queryWrapper); |
| | | return Result.ok(pageList); |
| | | } |
| | | |
| | | @AutoLog(value = "车é´-æ°å¢") |
| | | @ApiOperation(value = "车é´-æ°å¢", notes = "车é´-æ°å¢") |
| | | @PostMapping("/add") |
| | | public Result<?> add(@RequestBody Area area) { |
| | | area.setStatus(CommonConstant.STATUS_1); |
| | | areaService.save(area); |
| | | return Result.ok("æ°å¢æå"); |
| | | } |
| | | |
| | | @AutoLog(value = "车é´-ç¼è¾") |
| | | @ApiOperation(value = "车é´-ç¼è¾", notes = "车é´-ç¼è¾") |
| | | @PutMapping("/edit") |
| | | public Result<?> edit(@RequestBody Area area) { |
| | | areaService.updateById(area); |
| | | return Result.ok("ç¼è¾æå"); |
| | | } |
| | | |
| | | @AutoLog(value = "车é´-éè¿idå é¤") |
| | | @ApiOperation(value = "车é´-éè¿idå é¤", notes = "车é´-éè¿idå é¤") |
| | | @DeleteMapping("/delete") |
| | | public Result<?> delete(@RequestParam("id") String id) { |
| | | areaService.removeById(id); |
| | | return Result.ok("å 餿å"); |
| | | } |
| | | |
| | | @AutoLog(value = "车é´-æ¹éå é¤") |
| | | @ApiOperation(value = "车é´-æ¹éå é¤", notes = "车é´-æ¹éå é¤") |
| | | @DeleteMapping("/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam("ids") String ids) { |
| | | areaService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.ok("æ¹éå 餿åï¼"); |
| | | } |
| | | |
| | | @AutoLog(value = "车é´-å¯ç¨&ç¦ç¨") |
| | | @ApiOperation(value = "车é´-å¯ç¨&ç¦ç¨", notes = "车é´-å¯ç¨&ç¦ç¨") |
| | | @PutMapping("/active") |
| | | public Result<?> active(@RequestParam("id") String id) { |
| | | Area area = areaService.getById(id); |
| | | if (CommonConstant.STATUS_1.equals(area.getStatus())) { |
| | | area.setStatus(CommonConstant.STATUS_0); |
| | | } else { |
| | | area.setStatus(CommonConstant.STATUS_1); |
| | | } |
| | | areaService.updateById(area); |
| | | return Result.ok("æ´æ°æåï¼"); |
| | | } |
| | | |
| | | } |
| | |
| | | List<Map<String, Object>> records = maintenanceStandardList.getRecords(); |
| | | for (Map<String, Object> record : records) { |
| | | String maintenanceStandardId = (String) record.get("id"); |
| | | List<Map<String, Object>> maintenanceStandardDetaillist = maintenanceStandardDetailService.getMaintenanceStandardDetailList(maintenanceStandardId); |
| | | // for (Map<String, Object> detail : maintenanceStandardDetaillist) { |
| | | // //è·åæ¯å¦ææ å¼å¸¸ç
§çæ°æ® |
| | | //// List<SysUploadRela> sysUploadRelas = uploadRelaService.lambdaQuery().eq(SysUploadRela::getBusId, (String)detail.get("id")).eq(SysUploadRela::getDelFlag, 0).list(); |
| | | // List<SysUploadRela> sysUploadRelas = sysBaseApi.listByBusIdAndBusType((String) detail.get("id"), null); |
| | | // if (sysUploadRelas.size() > 0) { |
| | | // detail.put("isNoPhotoFlag", true); |
| | | //// List<SysUploadRela> uploadRelas = uploadRelaService.listByBusIdAndBusType((String)detail.get("id"), "daily_maintenance_standard_photo"); |
| | | // List<SysUploadRela> uploadRelas = sysBaseApi.listByBusIdAndBusType((String) detail.get("id"), "daily_maintenance_standard_photo"); |
| | | // SysUpload upload = new SysUpload(); |
| | | // if (CollectionUtils.isNotEmpty(uploadRelas)) { |
| | | //// upload = uploadService.getById(uploadRelas.get(0).getUploadId()); |
| | | // upload = sysBaseApi.getUploadById(uploadRelas.get(0).getUploadId()); |
| | | // } |
| | | // detail.put("upload", upload); |
| | | // } else { |
| | | // detail.put("isNoPhotoFlag", false); |
| | | // SysUpload upload = new SysUpload(); |
| | | // detail.put("upload", upload); |
| | | // } |
| | | // } |
| | | String equipmentId = (String) record.get("equipmentId"); |
| | | List<Map<String, Object>> maintenanceStandardDetaillist = maintenanceStandardDetailService.getMaintenanceStandardDetailList(maintenanceStandardId,equipmentId); |
| | | record.put("maintenanceStandardDetaillist", maintenanceStandardDetaillist); |
| | | } |
| | | return Result.ok(maintenanceStandardList); |
| | |
| | | import org.jeecg.common.system.base.entity.SysUploadRela; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.util.StrUtils; |
| | | import org.jeecg.modules.eam.entity.Equipment; |
| | | import org.jeecg.modules.eam.entity.MaintenanceStandardDetail; |
| | | import org.jeecg.modules.eam.model.MaintenanceCycleVo; |
| | | import org.jeecg.modules.eam.model.MaintenanceModeVo; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.service.IMaintenanceStandardDetailService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @Autowired |
| | | private ISysBaseAPI sysBaseApi; |
| | | |
| | | @Autowired |
| | | private IEamEquipmentService equipmentService; |
| | | |
| | | /** |
| | | * å页å表æ¥è¯¢ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 卿æ§ä¿å
» æ ¹æ®è®¾å¤å°è´¦ABCæ è¯è·åä¸ä¿ä¿å
»å¨æ |
| | | * @return |
| | | */ |
| | | @GetMapping("getPeriodicMaintenanceCycle") |
| | | public Result<?> getPeriodicMaintenanceCycle(@RequestParam("equipmentId") String equipmentId) { |
| | | Equipment equipment = equipmentService.getById(equipmentId); |
| | | List<MaintenanceCycleVo> maintenanceCycles = maintenanceStandardDetailService.getPeriodicMaintenanceCycle(equipment.getEquipmentImportanceId()); |
| | | return Result.ok(maintenanceCycles); |
| | | } |
| | | |
| | | /** |
| | | * ä¿å
»æ¹å¼ |
| | | * qsw 2023-5-5 |
| | | */ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | 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.system.query.QueryGenerator; |
| | | import org.jeecg.common.util.StrUtils; |
| | | import org.jeecg.modules.eam.entity.ProductionLine; |
| | | import org.jeecg.modules.eam.service.IProductionLineService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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; |
| | | |
| | | @Api(tags = "产线 å端æ§å¶å¨") |
| | | @RestController |
| | | @RequestMapping("/base/productionLine") |
| | | public class ProductionLineController extends JeecgController<ProductionLine, IProductionLineService> { |
| | | |
| | | @Autowired |
| | | private IProductionLineService productionLineService; |
| | | |
| | | @AutoLog(value = "产线-å页æ¥è¯¢") |
| | | @ApiOperation(value = "产线-å页æ¥è¯¢", notes = "产线-å页æ¥è¯¢") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> list(ProductionLine productionLine, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { |
| | | QueryWrapper<ProductionLine> queryWrapper = QueryGenerator.initQueryWrapper(productionLine, |
| | | req.getParameterMap()); |
| | | Page<ProductionLine> page = new Page<ProductionLine>(pageNo, pageSize); |
| | | IPage<ProductionLine> pageList = productionLineService.page(page, queryWrapper); |
| | | return Result.ok(pageList); |
| | | } |
| | | |
| | | @AutoLog(value = "产线-æ°å¢") |
| | | @ApiOperation(value = "产线-æ°å¢", notes = "产线-æ°å¢") |
| | | @PostMapping("/add") |
| | | public Result<?> add(@RequestBody ProductionLine productionLine) { |
| | | productionLine.setStatus(CommonConstant.STATUS_1); |
| | | productionLineService.save(productionLine); |
| | | return Result.ok("æ°å¢æå"); |
| | | } |
| | | |
| | | @AutoLog(value = "产线-ç¼è¾") |
| | | @ApiOperation(value = "产线-ç¼è¾", notes = "产线-ç¼è¾") |
| | | @PutMapping("/edit") |
| | | public Result<?> edit(@RequestBody ProductionLine productionLine) { |
| | | if (StrUtils.isBlankOrNull(productionLine.getShiftCategoryId())) { |
| | | productionLine.setShiftCategoryId(""); |
| | | } |
| | | productionLineService.updateById(productionLine); |
| | | return Result.ok("ç¼è¾æå"); |
| | | } |
| | | |
| | | @AutoLog(value = "产线-éè¿idå é¤") |
| | | @ApiOperation(value = "产线-éè¿idå é¤", notes = "产线-éè¿idå é¤") |
| | | @DeleteMapping("/delete") |
| | | public Result<?> delete(@RequestParam("id") String id) { |
| | | productionLineService.removeById(id); |
| | | return Result.ok("å 餿å"); |
| | | } |
| | | |
| | | @AutoLog(value = "产线-æ¹éå é¤") |
| | | @ApiOperation(value = "产线-æ¹éå é¤", notes = "产线-æ¹éå é¤") |
| | | @DeleteMapping("/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam("ids") String ids) { |
| | | productionLineService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.ok("æ¹éå 餿åï¼"); |
| | | } |
| | | |
| | | @AutoLog(value = "产线-å¯ç¨&ç¦ç¨") |
| | | @ApiOperation(value = "产线-å¯ç¨&ç¦ç¨", notes = "产线-å¯ç¨&ç¦ç¨") |
| | | @PutMapping("/active") |
| | | public Result<?> active(@RequestParam("id") String id) { |
| | | ProductionLine productionLine = productionLineService.getById(id); |
| | | if (CommonConstant.STATUS_1.equals(productionLine.getStatus())) { |
| | | productionLine.setStatus(CommonConstant.STATUS_0); |
| | | } else { |
| | | productionLine.setStatus(CommonConstant.STATUS_1); |
| | | } |
| | | productionLineService.updateById(productionLine); |
| | | return Result.ok("æ´æ°æåï¼"); |
| | | } |
| | | |
| | | @AutoLog(value = "æ ¹æ®è½¦é´æ¥è¯¢äº§çº¿") |
| | | @ApiOperation(value = "æ ¹æ®è½¦é´æ¥è¯¢äº§çº¿", notes = "æ ¹æ®è½¦é´æ¥è¯¢äº§çº¿") |
| | | @GetMapping("/listByAreaId") |
| | | public Result<?> listByAreaId(@RequestParam("areaId") String areaId) { |
| | | List<ProductionLine> list = productionLineService.listByAreaId(areaId); |
| | | return Result.ok(list); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import org.jeecg.modules.eam.entity.Site; |
| | | import org.jeecg.modules.eam.service.ISiteService; |
| | | import org.jeecg.modules.eam.vo.CommonCascade; |
| | | import org.jeecg.common.api.vo.CommonGenericTree; |
| | | 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.query.QueryGenerator; |
| | | import org.jeecg.modules.system.model.TreeSelectModel; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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; |
| | | |
| | | @SuppressWarnings("rawtypes") |
| | | @Api(tags = "å·¥å å端æ§å¶å¨") |
| | | @RestController |
| | | @RequestMapping("/base/site") |
| | | public class SiteController { |
| | | |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | |
| | | @AutoLog(value = "å页æ¥è¯¢") |
| | | @ApiOperation(value = "å页æ¥è¯¢", notes = "å页æ¥è¯¢") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> list(Site site, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { |
| | | QueryWrapper<Site> queryWrapper = QueryGenerator.initQueryWrapper(site, req.getParameterMap()); |
| | | Page<Site> page = new Page<Site>(pageNo, pageSize); |
| | | IPage<Site> pageList = siteService.page(page, queryWrapper); |
| | | return Result.ok(pageList); |
| | | } |
| | | |
| | | @AutoLog(value = "è·åå
¨é¨å·¥å") |
| | | @ApiOperation(value = "è·åå
¨é¨å·¥å", notes = "è·åå
¨é¨å·¥å") |
| | | @GetMapping(value = "/getAllList") |
| | | public Result<?> getAllList() { |
| | | return Result.ok(siteService.list()); |
| | | } |
| | | |
| | | @AutoLog(value = "æ°å¢") |
| | | @ApiOperation(value = "æ°å¢", notes = "æ°å¢") |
| | | @PostMapping("/add") |
| | | public Result<?> add(@RequestBody Site site) { |
| | | site.setStatus(CommonConstant.STATUS_1); |
| | | siteService.save(site); |
| | | return Result.ok("æ°å¢æå"); |
| | | } |
| | | |
| | | @AutoLog(value = "ç¼è¾") |
| | | @ApiOperation(value = "ç¼è¾", notes = "ç¼è¾") |
| | | @PutMapping("/edit") |
| | | public Result<?> edit(@RequestBody Site site) { |
| | | siteService.updateById(site); |
| | | return Result.ok("ç¼è¾æå"); |
| | | } |
| | | |
| | | @AutoLog(value = "éè¿idå é¤") |
| | | @ApiOperation(value = "éè¿idå é¤", notes = "éè¿idå é¤") |
| | | @DeleteMapping("/delete") |
| | | public Result<?> delete(@RequestParam("id") String id) { |
| | | siteService.removeById(id); |
| | | return Result.ok("å 餿å"); |
| | | } |
| | | |
| | | @AutoLog(value = "æ¹éå é¤") |
| | | @ApiOperation(value = "æ¹éå é¤", notes = "æ¹éå é¤") |
| | | @DeleteMapping("/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam("ids") String ids) { |
| | | siteService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.ok("æ¹éå 餿åï¼"); |
| | | } |
| | | |
| | | @AutoLog(value = "å¯ç¨&ç¦ç¨") |
| | | @ApiOperation(value = "å¯ç¨&ç¦ç¨", notes = "å¯ç¨&ç¦ç¨") |
| | | @PutMapping("/active") |
| | | public Result<?> active(@RequestParam("id") String id) { |
| | | Site site = siteService.getById(id); |
| | | if (CommonConstant.STATUS_1.equals(site.getStatus())) { |
| | | site.setStatus(CommonConstant.STATUS_0); |
| | | } else { |
| | | site.setStatus(CommonConstant.STATUS_1); |
| | | } |
| | | siteService.updateById(site); |
| | | return Result.ok("æ´æ°æåï¼"); |
| | | } |
| | | |
| | | @AutoLog(value = "å·¥å车é´äº§çº¿æ ") |
| | | @ApiOperation(value = "å·¥å车é´äº§çº¿æ ", notes = "å·¥å车é´äº§çº¿æ ") |
| | | @GetMapping("/loadTree") |
| | | public Result<?> loadTree(HttpServletRequest httpServletRequest) { |
| | | String tenantId = httpServletRequest.getHeader(CommonConstant.TENANT_ID); |
| | | List<CommonGenericTree> list = siteService.loadTree(tenantId); |
| | | return Result.ok(list); |
| | | } |
| | | |
| | | // @AutoLog(value = "å·¥å/车é´/产线-çç» æ ") |
| | | // @ApiOperation(value = "å·¥å/车é´/产线-çç» æ ", notes = "å·¥å/车é´/产线-çç» æ ") |
| | | // @GetMapping("/loadSiteAreaLineTeamTree") |
| | | // public Result<?> loadSiteAreaLineTeamTree(HttpServletRequest httpServletRequest) { |
| | | // String tenantId = httpServletRequest.getHeader(CommonConstant.TENANT_ID); |
| | | // List<CommonGenericTree> list = siteService.loadSiteAreaLineTeamTree(tenantId); |
| | | // return Result.ok(list); |
| | | // } |
| | | |
| | | // @AutoLog(value = "å·¥å/车é´/产线-å·¥ä½ä¸å¿ æ ") |
| | | // @ApiOperation(value = "å·¥å/车é´/产线-å·¥ä½ä¸å¿ æ ", notes = "å·¥å/车é´/产线-å·¥ä½ä¸å¿ æ ") |
| | | // @GetMapping("/loadSiteAreaLineWorkCenterTree") |
| | | // public Result<?> loadSiteAreaLineWorkCenterTree(HttpServletRequest httpServletRequest) { |
| | | // String tenantId = httpServletRequest.getHeader(CommonConstant.TENANT_ID); |
| | | // List<CommonGenericTree> list = siteService.loadSiteAreaLineWorkCenterTree(tenantId); |
| | | // return Result.ok(list); |
| | | // } |
| | | |
| | | // @AutoLog(value = "å·¥å/车é´/产线/å·¥ä½ä¸å¿-è®¾å¤ æ ") |
| | | // @ApiOperation(value = "å·¥å/车é´/产线/å·¥ä½ä¸å¿-è®¾å¤ æ ", notes = "å·¥å/车é´/产线/å·¥ä½ä¸å¿-è®¾å¤ æ ") |
| | | // @GetMapping("/loadSiteAreaLineWorkCenterEquipmentTree") |
| | | // public Result<?> loadSiteAreaLineWorkCenterEquipmentTree(HttpServletRequest httpServletRequest) { |
| | | // String tenantId = httpServletRequest.getHeader(CommonConstant.TENANT_ID); |
| | | // List<CommonGenericTree> list = siteService.loadSiteAreaLineWorkCenterEquipmentTree(tenantId); |
| | | // return Result.ok(list); |
| | | // } |
| | | |
| | | // @AutoLog(value = "å·¥å/车é´/产线-äººå æ ") |
| | | // @ApiOperation(value = "å·¥å/车é´/产线-äººå æ ", notes = "å·¥å/车é´/产线-äººå æ ") |
| | | // @GetMapping("/loadSiteAreaLineStuffTree") |
| | | // public Result<?> loadSiteAreaLineStuffTree() { |
| | | // List<CommonGenericTree> list = siteService.loadSiteAreaLineStuffTree(); |
| | | // return Result.ok(list); |
| | | // } |
| | | |
| | | // @AutoLog(value = "éè¿æè®¡åidåå¹´æä»½å·¥å/车é´/产线-äººå æ ") |
| | | // @ApiOperation(value = "éè¿æè®¡åidåå¹´æä»½å·¥å/车é´/产线-äººå æ ", notes = "éè¿æè®¡åidåå¹´æä»½å·¥å/车é´/产线-äººå æ ") |
| | | // @GetMapping("/stuffTreeByTeamMonthIdAndMonthStamp") |
| | | // public Result<?> stuffTreeByTeamMonthIdAndMonthStamp(String teamMonthId, String monthStamp) { |
| | | // List<CommonGenericTree> list = siteService.stuffTreeByTeamMonthIdAndMonthStamp(teamMonthId, monthStamp); |
| | | // return Result.ok(list); |
| | | // } |
| | | |
| | | @AutoLog(value = "å·¥å/è½¦é´æ ") |
| | | @ApiOperation(value = "å·¥å/è½¦é´æ ", notes = "å·¥å/è½¦é´æ ") |
| | | @GetMapping("/loadSubTree") |
| | | public Result<?> loadSubTree() { |
| | | List<CommonGenericTree> list = siteService.loadSubTree(); |
| | | return Result.ok(list); |
| | | } |
| | | |
| | | @AutoLog(value = "å·¥å/车é´ä¸¤çº§è卿°æ®") |
| | | @ApiOperation(value = "å·¥å/车é´ä¸¤çº§è卿°æ®", notes = "å·¥å/车é´ä¸¤çº§è卿°æ®") |
| | | @GetMapping("/siteAreaCascadeData") |
| | | public Result<?> siteAreaCascadeData() { |
| | | List<CommonCascade> list = siteService.siteAreaCascadeData(); |
| | | return Result.ok(list); |
| | | } |
| | | |
| | | // @AutoLog(value = "å·¥å/å·¥ä½ä¸å¿ä¸¤çº§è卿°æ®") |
| | | // @ApiOperation(value = "å·¥å/å·¥ä½ä¸å¿ä¸¤çº§è卿°æ®", notes = "å·¥å/å·¥ä½ä¸å¿ä¸¤çº§è卿°æ®") |
| | | // @GetMapping("/siteWorkCenterCascadeData") |
| | | // public Result<?> siteWorkCenterCascadeData() { |
| | | // List<CommonCascade> list = siteService.siteWorkCenterCascadeData(); |
| | | // return Result.ok(list); |
| | | // } |
| | | |
| | | @AutoLog(value = "å·¥å/车é´/产线ä¸çº§è卿°æ®") |
| | | @ApiOperation(value = "å·¥å/车é´/产线ä¸çº§è卿°æ®", notes = "å·¥å/车é´/产线ä¸çº§è卿°æ®") |
| | | @GetMapping("/siteAreaLineCascadeData") |
| | | public Result<?> siteAreaLineCascadeData() { |
| | | List<CommonCascade> list = siteService.siteAreaLineCascadeData(); |
| | | return Result.ok(list); |
| | | } |
| | | |
| | | @AutoLog(value = "å°ç¹éæ©å¨") |
| | | @ApiOperation(value = "å°ç¹éæ©å¨", notes = "å°ç¹éæ©å¨") |
| | | @GetMapping("/siteSelect") |
| | | public Result<?> siteSelect() { |
| | | List<TreeSelectModel> siteSelect = siteService.siteSelect(); |
| | | return Result.ok(siteSelect); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.entity; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.entity.JeecgEntity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("mom_base_area") |
| | | @ApiModel(value = "车é´") |
| | | public class Area extends JeecgEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "车é´ç¼å·") |
| | | private String num; |
| | | |
| | | @ApiModelProperty(value = "车é´åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "å·¥åID") |
| | | private String siteId; |
| | | |
| | | @ApiModelProperty(value = "é¨é¨ID") |
| | | @Dict(dicCode = "dept") |
| | | private String deptId; |
| | | |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "å¯/åç¨ç¶æ(0- ç¦ç¨ ,1- å¯ç¨)", hidden = true) |
| | | private String status; |
| | | |
| | | @JsonIgnore |
| | | @ApiModelProperty(value = "å é¤ç¶æ(0-æ£å¸¸,1-å·²å é¤)", hidden = true) |
| | | @TableLogic |
| | | private Integer delFlag = CommonConstant.DEL_FLAG_0; |
| | | |
| | | } |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private java.util.Date loseEfficacyTime; |
| | | |
| | | @ApiModelProperty(value = "ABCæ è¯") |
| | | private String equipmentImportanceId; |
| | | |
| | | @ApiModelProperty(value = "ç»´ä¿ç±»å") |
| | | private String maintenanceType; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.entity.JeecgEntity; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("mom_base_production_line") |
| | | @ApiModel(value = "产线") |
| | | public class ProductionLine extends JeecgEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "å·¥åç¼å·") |
| | | private String num; |
| | | |
| | | @ApiModelProperty(value = "å·¥ååç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "å·¥åID") |
| | | private String siteId; |
| | | |
| | | @ApiModelProperty(value = "车é´ID") |
| | | private String areaId; |
| | | |
| | | @ApiModelProperty(value = "çå¶ID") |
| | | @Dict(dictTable = "mes_base_shift_category", dicCode = "id", dicText = "name") |
| | | private String shiftCategoryId; |
| | | |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "å¯/åç¨ç¶æ(0- ç¦ç¨ ,1-å¯ç¨)", hidden = true) |
| | | private String status; |
| | | |
| | | @JsonIgnore |
| | | @ApiModelProperty(value = "å é¤ç¶æ(0-æ£å¸¸,1-å·²å é¤)", hidden = true) |
| | | @TableLogic |
| | | private Integer delFlag = CommonConstant.DEL_FLAG_0; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.entity; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.entity.JeecgEntity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("mom_base_site") |
| | | @ApiModel(value = "å·¥å") |
| | | public class Site extends JeecgEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "å·¥åç¼å·") |
| | | private String num; |
| | | |
| | | @ApiModelProperty(value = "å·¥ååç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "å¯/åç¨ç¶æ(0- ç¦ç¨ ,1- å¯ç¨)", hidden = true) |
| | | private String status; |
| | | |
| | | @JsonIgnore |
| | | @ApiModelProperty(value = "å é¤ç¶æ(0-æ£å¸¸,1-å·²å é¤)", hidden = true) |
| | | @TableLogic |
| | | private Integer delFlag = CommonConstant.DEL_FLAG_0; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.mapper; |
| | | |
| | | import org.jeecg.modules.eam.entity.Area; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface AreaMapper extends BaseMapper<Area> { |
| | | |
| | | } |
| | |
| | | @Select("select t1.id as value,concat(t1.code, '/', t1.name) as text,concat(t1.code, '/', t1.name) as title from mom_eam_maintenance_cycle t1 where t1.del_flag = '0' and t1.version_status = '2'") |
| | | List<MaintenanceCycleVo> getMaintenanceCycle(); |
| | | |
| | | @Select("select t1.id as value,concat(t1.code, '/', t1.name) as text,concat(t1.code, '/', t1.name) as title from mom_eam_maintenance_cycle t1 where t1.del_flag = '0' and t1.version_status = '2' and t1.equipment_importance_id like concat('%',#{importanceFlag},'%')") |
| | | List<MaintenanceCycleVo> getPeriodicMaintenanceCycle(String importanceFlag); |
| | | |
| | | @Select(" SELECT item_value as value, item_text as text,item_text as title FROM v_sys_dict WHERE dict_code = 'maintenance_method'") |
| | | List<MaintenanceModeVo> getMaintenanceMode(); |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.jeecg.modules.eam.entity.ProductionLine; |
| | | |
| | | public interface ProductionLineMapper extends BaseMapper<ProductionLine> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.mapper; |
| | | |
| | | import org.jeecg.modules.eam.entity.Site; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface SiteMapper extends BaseMapper<Site> { |
| | | |
| | | } |
| | |
| | | t1.overdue_dispose_mode as overdueDisposeMode, |
| | | t1.according_calendar as accordingCalendar, |
| | | t8.item_text overdueDisposeModeName, |
| | | t9.item_text accordingCalendarName |
| | | t9.item_text accordingCalendarName, |
| | | t1.equipment_importance_id as equipmentImportanceId, |
| | | t1.maintenance_type as maintenanceType |
| | | from mom_eam_maintenance_cycle t1 |
| | | left join (select * from v_sys_dict where dict_code = 'maintenance_cycle_unit') t2 on t1.cycle_unit=t2.item_value |
| | | left join (select * from v_sys_dict where dict_code = 'cycle_time_unit') t3 on t1.unit=t3.item_value |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.service; |
| | | import org.jeecg.modules.eam.entity.Area; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | /** |
| | | * |
| | | * @ClassName: IAreaService |
| | | * @Description: 车é´ä¸å¡æ¥å£ |
| | | * @author Wang Mingchao |
| | | * @date 2020-10-20 09:43:20 |
| | | */ |
| | | public interface IAreaService extends IService<Area> { |
| | | |
| | | boolean removeBySiteId(String siteId); |
| | | |
| | | boolean removeBySiteIds(String[] siteIds); |
| | | |
| | | boolean activeBySiteId(String siteId, String status); |
| | | |
| | | } |
| | |
| | | |
| | | IPage<Map<String, Object>> getMaintenanceStandardDetailById(Integer pageNo, Integer pageSize, Map<String, Object> params); |
| | | |
| | | List<Map<String, Object>> getMaintenanceStandardDetailList(String maintenanceStandardId); |
| | | List<Map<String, Object>> getMaintenanceStandardDetailList(String maintenanceStandardId,String equipmentId); |
| | | |
| | | List<Map<String, Object>> getMaintenanceStandardDetailListByIds(List<String> ids); |
| | | |
| | | List<MaintenanceCycleVo> getMaintenanceCycle(); |
| | | |
| | | List<MaintenanceCycleVo> getPeriodicMaintenanceCycle(String importanceFlag); |
| | | |
| | | List<MaintenanceModeVo> getMaintenanceMode(); |
| | | |
| | | boolean realDelete(); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.service; |
| | | import java.util.List; |
| | | |
| | | import org.jeecg.modules.eam.entity.ProductionLine; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | /** |
| | | * |
| | | * @ClassName: IProductionLineService |
| | | * @Description: 产线 ä¸å¡æ¥å£ |
| | | * @author Wang Mingchao |
| | | * @date 2020-11-05 02:32:40 |
| | | */ |
| | | public interface IProductionLineService extends IService<ProductionLine> { |
| | | |
| | | boolean removeByAreaId(String areaId); |
| | | |
| | | boolean removeByAreaIds(String[] areaIds); |
| | | |
| | | boolean removeBySiteId(String siteId); |
| | | |
| | | boolean removeBySiteIds(String[] siteIds); |
| | | |
| | | boolean activeByAreaId(String areaId, String status); |
| | | |
| | | boolean activeByAreaIds(String[] areaIds, String status); |
| | | |
| | | boolean activeBySiteId(String siteId, String status); |
| | | |
| | | List<ProductionLine> listByAreaId(String areaId); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.service; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.jeecg.common.api.vo.CommonGenericTree; |
| | | import org.jeecg.modules.eam.entity.Site; |
| | | import org.jeecg.modules.eam.vo.CommonCascade; |
| | | import org.jeecg.modules.system.model.TreeSelectModel; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * |
| | | * @ClassName: ISiteService |
| | | * @Description: å·¥å ä¸å¡æ¥å£ |
| | | * @author Wang Mingchao |
| | | * @date 2020-10-20 05:07:05 |
| | | */ |
| | | @SuppressWarnings("rawtypes") |
| | | public interface ISiteService extends IService<Site> { |
| | | |
| | | List<Site> listByIds(String ids); |
| | | |
| | | List<CommonGenericTree> loadTree(String tenantId); |
| | | |
| | | List<CommonGenericTree> loadSubTree(); |
| | | |
| | | List<TreeSelectModel> siteSelect(); |
| | | |
| | | List<CommonCascade> siteAreaCascadeData(); |
| | | |
| | | List<CommonCascade> siteAreaLineCascadeData(); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.service.impl; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.modules.eam.entity.Area; |
| | | import org.jeecg.modules.eam.mapper.AreaMapper; |
| | | import org.jeecg.modules.eam.service.IAreaService; |
| | | import org.jeecg.modules.eam.service.IProductionLineService; |
| | | import org.jeecg.modules.eam.service.ISiteService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | /** |
| | | * |
| | | * @ClassName: AreaServiceImpl |
| | | * @Description: 车é´ä¿¡æ¯ä¸å¡æ¥å£å®ç° |
| | | * @author Wang Mingchao |
| | | * @date 2020-10-20 09:29:03 |
| | | */ |
| | | @Service |
| | | public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IAreaService { |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private ISiteService siteService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private IProductionLineService productionLineService; |
| | | |
| | | @Override |
| | | public List<Area> list() { |
| | | return super.lambdaQuery().eq(Area::getStatus, CommonConstant.STATUS_1).orderByAsc(Area::getNum).list(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean removeBySiteId(String siteId) { |
| | | if(StringUtils.isBlank(siteId)) |
| | | return false; |
| | | LambdaQueryWrapper<Area> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
| | | lambdaQueryWrapper.eq(Area::getSiteId, siteId); |
| | | return super.remove(lambdaQueryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean removeBySiteIds(String[] siteIds) { |
| | | if(siteIds == null || siteIds.length < 1) |
| | | return false; |
| | | LambdaQueryWrapper<Area> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
| | | lambdaQueryWrapper.in(Area::getSiteId, Arrays.asList(siteIds)); |
| | | return super.remove(lambdaQueryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean activeBySiteId(String siteId, String status) { |
| | | if(StringUtils.isBlank(siteId) || StringUtils.isBlank(status)) |
| | | return false; |
| | | LambdaUpdateWrapper<Area> updateWrapper = Wrappers.lambdaUpdate(); |
| | | updateWrapper.set(Area::getStatus, status).eq(Area::getSiteId, siteId); |
| | | return super.update(updateWrapper); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.modules.eam.entity.DailyInspectionStandardDetail; |
| | | import org.jeecg.modules.eam.entity.Equipment; |
| | | import org.jeecg.modules.eam.entity.MaintenanceStandard; |
| | | import org.jeecg.modules.eam.entity.MaintenanceStandardDetail; |
| | | import org.jeecg.modules.eam.mapper.DailyInspectionStandardDetailMapper; |
| | |
| | | import org.jeecg.modules.eam.model.MaintenanceCycleVo; |
| | | import org.jeecg.modules.eam.model.MaintenanceModeVo; |
| | | import org.jeecg.modules.eam.service.IDailyInspectionStandardDetailService; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.service.IMaintenanceStandardDetailService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | @Service |
| | | public class MaintenanceStandardDetailServiceImpl extends ServiceImpl<MaintenanceStandardDetailMapper, MaintenanceStandardDetail> implements IMaintenanceStandardDetailService { |
| | | |
| | | @Autowired |
| | | private IEamEquipmentService equipmentService; |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getMaintenanceStandardDetailList(String maintenanceStandardId) { |
| | | public List<Map<String, Object>> getMaintenanceStandardDetailList(String maintenanceStandardId,String equipmentId) { |
| | | List<Map<String, Object>> maintenanceStandardDetailList = super.baseMapper.getMaintenanceStandardDetailList(maintenanceStandardId); |
| | | List<MaintenanceCycleVo> maintenanceCycles = super.baseMapper.getMaintenanceCycle(); |
| | | Equipment equipment = equipmentService.getById(equipmentId); |
| | | List<MaintenanceCycleVo> maintenanceCycles = super.baseMapper.getPeriodicMaintenanceCycle(equipment.getEquipmentImportanceId()); |
| | | List<MaintenanceModeVo> maintenanceModes = super.baseMapper.getMaintenanceMode(); |
| | | for (Map<String, Object> map : maintenanceStandardDetailList) { |
| | | map.put("maintenanceCycles",maintenanceCycles); |
| | |
| | | return super.baseMapper.getMaintenanceCycle(); |
| | | } |
| | | |
| | | /** |
| | | * 卿æ§ä¿å
» æ ¹æ®è®¾å¤å°è´¦ABCæ è¯è·åä¸ä¿ä¿å
»å¨æ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MaintenanceCycleVo> getPeriodicMaintenanceCycle(String importanceFlag) { |
| | | return super.baseMapper.getPeriodicMaintenanceCycle(importanceFlag); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<MaintenanceModeVo> getMaintenanceMode() { |
| | | return super.baseMapper.getMaintenanceMode(); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.service.impl; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.modules.eam.entity.ProductionLine; |
| | | import org.jeecg.modules.eam.mapper.ProductionLineMapper; |
| | | import org.jeecg.modules.eam.service.IAreaService; |
| | | import org.jeecg.modules.eam.service.IProductionLineService; |
| | | import org.jeecg.modules.eam.service.ISiteService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | /** |
| | | * |
| | | * @ClassName: ProductionLineServiceImpl |
| | | * @Description: 产线信æ¯ä¸å¡æ¥å£å®ç° |
| | | * @author Wang Mingchao |
| | | * @date 2020-10-20 09:28:16 |
| | | */ |
| | | @Service |
| | | public class ProductionLineServiceImpl extends ServiceImpl<ProductionLineMapper, ProductionLine> |
| | | implements IProductionLineService { |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private ISiteService siteService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private IAreaService areaService; |
| | | |
| | | @Override |
| | | public List<ProductionLine> list() { |
| | | return super.lambdaQuery().eq(ProductionLine::getStatus, CommonConstant.STATUS_1) |
| | | .orderByAsc(ProductionLine::getNum).list(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = { Exception.class }) |
| | | public boolean removeByAreaId(String areaId) { |
| | | if (StringUtils.isBlank(areaId)) { |
| | | return false; |
| | | } |
| | | LambdaQueryWrapper<ProductionLine> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
| | | lambdaQueryWrapper.eq(ProductionLine::getAreaId, areaId); |
| | | return super.remove(lambdaQueryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = { Exception.class }) |
| | | public boolean removeByAreaIds(String[] areaIds) { |
| | | if (areaIds == null || areaIds.length < 1) { |
| | | return false; |
| | | } |
| | | LambdaQueryWrapper<ProductionLine> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
| | | List<String> strings = Arrays.asList(areaIds); |
| | | lambdaQueryWrapper.in(ProductionLine::getAreaId, strings); |
| | | return super.remove(lambdaQueryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = { Exception.class }) |
| | | public boolean removeBySiteId(String siteId) { |
| | | if (StringUtils.isBlank(siteId)) { |
| | | return false; |
| | | } |
| | | LambdaQueryWrapper<ProductionLine> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
| | | lambdaQueryWrapper.eq(ProductionLine::getSiteId, siteId); |
| | | return super.remove(lambdaQueryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = { Exception.class }) |
| | | public boolean removeBySiteIds(String[] siteIds) { |
| | | if (siteIds == null || siteIds.length < 1) |
| | | return false; |
| | | LambdaQueryWrapper<ProductionLine> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
| | | lambdaQueryWrapper.in(ProductionLine::getSiteId, Arrays.asList(siteIds)); |
| | | return super.remove(lambdaQueryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = { Exception.class }) |
| | | public boolean activeByAreaId(String areaId, String status) { |
| | | if (StringUtils.isBlank(areaId) || StringUtils.isBlank(status)) |
| | | return false; |
| | | LambdaUpdateWrapper<ProductionLine> updateWrapper = Wrappers.lambdaUpdate(); |
| | | updateWrapper.set(ProductionLine::getStatus, status).eq(ProductionLine::getAreaId, areaId); |
| | | return super.update(updateWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = { Exception.class }) |
| | | public boolean activeByAreaIds(String[] areaIds, String status) { |
| | | if (areaIds == null || areaIds.length < 1 || StringUtils.isBlank(status)) |
| | | return false; |
| | | LambdaUpdateWrapper<ProductionLine> updateWrapper = Wrappers.lambdaUpdate(); |
| | | updateWrapper.set(ProductionLine::getStatus, status).in(ProductionLine::getAreaId, Arrays.asList(areaIds)); |
| | | return super.update(updateWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = { Exception.class }) |
| | | public boolean activeBySiteId(String siteId, String status) { |
| | | if (StringUtils.isBlank(siteId) || StringUtils.isBlank(status)) |
| | | return false; |
| | | LambdaUpdateWrapper<ProductionLine> updateWrapper = Wrappers.lambdaUpdate(); |
| | | updateWrapper.set(ProductionLine::getStatus, status).eq(ProductionLine::getSiteId, siteId); |
| | | return super.update(updateWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductionLine> listByAreaId(String areaId) { |
| | | return super.lambdaQuery().eq(ProductionLine::getAreaId, areaId) |
| | | .eq(ProductionLine::getStatus, CommonConstant.STATUS_1).list(); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.service.impl; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | import org.jeecg.common.api.vo.CommonGenericTree; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.modules.eam.entity.Site; |
| | | import org.jeecg.modules.eam.mapper.SiteMapper; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.service.*; |
| | | import org.jeecg.modules.eam.vo.CommonCascade; |
| | | import org.jeecg.modules.eam.wrapper.SiteAreaCascadeWrapper; |
| | | import org.jeecg.modules.eam.wrapper.SiteAreaLineTreeWrapper; |
| | | import org.jeecg.modules.system.entity.SysTenant; |
| | | import org.jeecg.modules.system.model.TreeSelectModel; |
| | | import org.jeecg.modules.system.service.ISysTenantService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.core.env.Environment; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | /** |
| | | * |
| | | * @ClassName: SiteServiceImpl |
| | | * @Description: å·¥å ä¸å¡æ¥å£å®ç° |
| | | * @author Wang Mingchao |
| | | * @date 2020-10-20 09:28:50 |
| | | */ |
| | | @SuppressWarnings("rawtypes") |
| | | @Service |
| | | public class SiteServiceImpl extends ServiceImpl<SiteMapper, Site> implements ISiteService { |
| | | |
| | | @Autowired |
| | | private ISysTenantService sysTenantService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private IAreaService areaService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private IProductionLineService productionLineService; |
| | | |
| | | @Autowired |
| | | private Environment env; |
| | | |
| | | |
| | | @Override |
| | | public List<Site> listByIds(String ids) { |
| | | return super.lambdaQuery().in(Site::getId, Arrays.asList(ids.split(","))).orderByAsc(Site::getNum).list(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Site> list() { |
| | | return super.lambdaQuery().eq(Site::getStatus, CommonConstant.STATUS_1).orderByAsc(Site::getNum).list(); |
| | | } |
| | | |
| | | @Override |
| | | public List<CommonGenericTree> loadTree(String tenantId) { |
| | | // è·åæ çæ ¹èç¹åç§° |
| | | LambdaQueryChainWrapper<SysTenant> wrapper = sysTenantService.lambdaQuery(); |
| | | // wrapper.eq(SysTenant::getTenantId, tenantId); |
| | | List<SysTenant> sysTenantList = wrapper.list(); |
| | | // String title = "-1"; |
| | | String applicationEdEnterpriseName = env.getProperty("enterprise.name"); |
| | | String title = applicationEdEnterpriseName;//ç¨applicationä¸çä¼ä¸ä¿¡æ¯ï¼æ¿ä»£ç¼ºçæ¶ç-1 |
| | | if (sysTenantList.size() > 0) { |
| | | title = sysTenantList.get(0).getName(); |
| | | } |
| | | List<Site> siteList = this.list(); |
| | | List<Area> areaList = areaService.list(); |
| | | List<ProductionLine> productionLineList = productionLineService.list(); |
| | | return SiteAreaLineTreeWrapper.loadTree(title, siteList, areaList, productionLineList); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = { Exception.class }) |
| | | public boolean removeById(Serializable id) { |
| | | productionLineService.removeBySiteId(String.valueOf(id)); |
| | | areaService.removeBySiteId(String.valueOf(id)); |
| | | return super.removeById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<CommonGenericTree> loadSubTree() { |
| | | List<Site> siteList = list(); |
| | | List<Area> areaList = Collections.emptyList(); |
| | | if (siteList == null || siteList.isEmpty()) { |
| | | return SiteAreaLineTreeWrapper.loadTree(siteList, areaList); |
| | | } |
| | | areaList = areaService.list(); |
| | | if (areaList == null || areaList.isEmpty()) { |
| | | areaList = Collections.emptyList(); |
| | | return SiteAreaLineTreeWrapper.loadTree(siteList, areaList); |
| | | } |
| | | return SiteAreaLineTreeWrapper.loadTree(siteList, areaList); |
| | | } |
| | | |
| | | @Override |
| | | public List<CommonCascade> siteAreaCascadeData() { |
| | | List<Site> siteList = list(); |
| | | List<Area> areaList = areaService.list(); |
| | | |
| | | return SiteAreaCascadeWrapper.loadCascade(siteList, areaList); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<CommonCascade> siteAreaLineCascadeData() { |
| | | // å·¥å |
| | | List<Site> siteList = list(); |
| | | // è½¦é´ |
| | | List<Area> areaList = areaService.list(); |
| | | // 产线 |
| | | List<ProductionLine> lineList = productionLineService.list(); |
| | | return SiteAreaCascadeWrapper.loadCascadeBase(siteList, areaList, lineList); |
| | | } |
| | | |
| | | private CommonGenericTree line2Tree(ProductionLine line, boolean b) { |
| | | CommonGenericTree<ProductionLine> lineNode = new CommonGenericTree<>(); |
| | | lineNode.setKey(line.getId()); |
| | | lineNode.setTitle(line.getName()); |
| | | lineNode.setParentId(line.getAreaId()); |
| | | lineNode.setIcon(""); |
| | | lineNode.setType(3); |
| | | lineNode.setDisabled(b); |
| | | lineNode.setEntity(line); |
| | | lineNode.setValue(line.getId()); |
| | | return lineNode; |
| | | } |
| | | |
| | | private CommonGenericTree area2Tree(Area area, boolean b) { |
| | | CommonGenericTree<Area> areaNode = new CommonGenericTree<>(); |
| | | areaNode = new CommonGenericTree<>(); |
| | | areaNode.setKey(area.getId()); |
| | | areaNode.setTitle(area.getName()); |
| | | areaNode.setParentId(area.getSiteId()); |
| | | areaNode.setIcon(""); |
| | | areaNode.setDisabled(b); |
| | | areaNode.setType(2); |
| | | areaNode.setEntity(area); |
| | | areaNode.setValue(area.getId()); |
| | | return areaNode; |
| | | } |
| | | |
| | | private List<CommonGenericTree> list2Tree(List<CommonGenericTree> parentList, List<CommonGenericTree> childList) { |
| | | for (CommonGenericTree tree : parentList) { |
| | | String id = tree.getKey(); |
| | | for (CommonGenericTree cTree : childList) { |
| | | if (id.equals(cTree.getParentId())) { |
| | | tree.addChildren(cTree); |
| | | } |
| | | } |
| | | } |
| | | return parentList; |
| | | } |
| | | |
| | | @Override |
| | | public List<TreeSelectModel> siteSelect() { |
| | | List<TreeSelectModel> list = new ArrayList<>(); |
| | | List<Site> siteList = super.list(); |
| | | TreeSelectModel model; |
| | | for (Site site : siteList) { |
| | | model = new TreeSelectModel(); |
| | | model.setKey(site.getId()); |
| | | model.setValue(site.getId()); |
| | | model.setTitle(site.getName()); |
| | | list.add(model); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.vo; |
| | | |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 级èéæ©æ¡éç¨è¿åå®ä½ç±» |
| | | */ |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | public class CommonCascade { |
| | | |
| | | private String value; |
| | | |
| | | private String label; |
| | | |
| | | private List<CommonCascade> children = new ArrayList<>(); |
| | | |
| | | // æ·»å åèç¹çæ¹æ³ |
| | | public CommonCascade addChildren(CommonCascade node) { |
| | | if (this.children == null) { |
| | | this.children = new ArrayList<CommonCascade>(); |
| | | } |
| | | this.children.add(node); |
| | | return node; |
| | | } |
| | | |
| | | public boolean hasChildren() { |
| | | boolean bu = true; |
| | | if (getChildren() == null || getChildren().isEmpty()) { |
| | | bu = false; |
| | | return bu; |
| | | } |
| | | return bu; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.wrapper; |
| | | |
| | | import org.jeecg.modules.eam.entity.Area; |
| | | import org.jeecg.modules.eam.entity.ProductionLine; |
| | | import org.jeecg.modules.eam.entity.Site; |
| | | import org.jeecg.modules.eam.vo.CommonCascade; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import java.util.*; |
| | | |
| | | public class SiteAreaCascadeWrapper { |
| | | |
| | | /** |
| | | * è·åå·¥å车é´ä¸¤çº§çº§èæ°æ® å¿
须鿩å°äº§çº¿ |
| | | * |
| | | * @param siteList |
| | | * @param areaList |
| | | * @return |
| | | */ |
| | | public static List<CommonCascade> loadCascade(List<Site> siteList, List<Area> areaList) { |
| | | List<CommonCascade> list = loadCascadeBase(siteList, areaList, null); |
| | | List<CommonCascade> result = new ArrayList<>(); |
| | | for (CommonCascade c : list) { |
| | | if (c.hasChildren()) { |
| | | result.add(c); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * å¿
é¡»è¦éæ©å°äº§çº¿ä¸çº§çº§èç»æ |
| | | * |
| | | * @param siteList |
| | | * @param areaList |
| | | * @return |
| | | */ |
| | | public static List<CommonCascade> loadCascade(List<Site> siteList, List<Area> areaList, |
| | | List<ProductionLine> lineList) { |
| | | List<CommonCascade> list = loadCascadeBase(siteList, areaList, lineList); |
| | | // è¿æ»¤å·¥å䏿²¡æè½¦é´ 车é´ä¸æ²¡æäº§çº¿çæ°æ® |
| | | List<CommonCascade> result = new ArrayList<>(); |
| | | for (CommonCascade c : list) { |
| | | if (c.hasChildren()) { |
| | | List<CommonCascade> children = c.getChildren(); |
| | | List<CommonCascade> dList = new ArrayList<>(); |
| | | for (CommonCascade d : children) { |
| | | if (d.hasChildren()) { |
| | | dList.add(d); |
| | | } |
| | | } |
| | | if (!dList.isEmpty()) { |
| | | c.setChildren(dList); |
| | | result.add(c); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * è·åå·¥å车é´äº§çº¿ä¸çº§çº§èæ°æ® è¿åå
¨æ°æ® ä¸åè¿æ»¤ |
| | | * |
| | | * @param siteList |
| | | * @param areaList |
| | | * @param lineList |
| | | * @return |
| | | */ |
| | | public static List<CommonCascade> loadCascadeBase(List<Site> siteList, List<Area> areaList, |
| | | List<ProductionLine> productionLineList) { |
| | | List<CommonCascade> commonCascadeList = new ArrayList<CommonCascade>(); |
| | | if (CollectionUtils.isNotEmpty(siteList) || CollectionUtils.isNotEmpty(areaList)) { |
| | | Map<String, CommonCascade> siteMap = new HashMap<>(); |
| | | Map<String, CommonCascade> areaMap = new HashMap<>(); |
| | | CommonCascade siteNode; |
| | | CommonCascade areaNode; |
| | | CommonCascade productionLineNode; |
| | | for (Site site : siteList) { |
| | | siteNode = new CommonCascade(); |
| | | siteNode = siteNode.setValue(site.getId()).setLabel(site.getName()); |
| | | commonCascadeList.add(siteNode); |
| | | siteMap.put(site.getId(), siteNode); |
| | | } |
| | | for (Area area : areaList) { |
| | | if (siteMap.containsKey(area.getSiteId())) { |
| | | siteNode = siteMap.get(area.getSiteId()); |
| | | areaNode = new CommonCascade(); |
| | | areaNode = areaNode.setValue(area.getId()).setLabel(area.getName()); |
| | | siteNode.addChildren(areaNode); |
| | | areaMap.put(area.getId(), areaNode); |
| | | } |
| | | } |
| | | // è¿åä¸¤çº§æ°æ® |
| | | if (CollectionUtils.isNotEmpty(productionLineList)) { |
| | | for (ProductionLine productionLine : productionLineList) { |
| | | if (areaMap.containsKey(productionLine.getAreaId())) { |
| | | areaNode = areaMap.get(productionLine.getAreaId()); |
| | | productionLineNode = new CommonCascade(); |
| | | productionLineNode = productionLineNode.setValue(productionLine.getId()) |
| | | .setLabel(productionLine.getName()); |
| | | areaNode.addChildren(productionLineNode); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return commonCascadeList; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.wrapper; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.jeecg.common.api.vo.CommonGenericTree; |
| | | import org.jeecg.common.util.StrUtils; |
| | | import org.jeecg.modules.eam.entity.Area; |
| | | import org.jeecg.modules.eam.entity.ProductionLine; |
| | | import org.jeecg.modules.eam.entity.Site; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | |
| | | @SuppressWarnings("rawtypes") |
| | | public class SiteAreaLineTreeWrapper { |
| | | |
| | | /** |
| | | * å·¥å/è½¦é´æ |
| | | */ |
| | | public static List<CommonGenericTree> loadTree(List<Site> siteList, List<Area> areaList) { |
| | | //return loadTree(siteList, areaList, Collections.emptyList()); |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * å·¥å/车é´/产线æ |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static List<CommonGenericTree> loadTree(String title,List<Site> siteList, List<Area> areaList, |
| | | List<ProductionLine> productionLineList) { |
| | | List<CommonGenericTree> list = new ArrayList<>(); |
| | | Map<String, CommonGenericTree> siteMap = new HashMap<>(); |
| | | Map<String, CommonGenericTree> areaMap = new HashMap<>(); |
| | | CommonGenericTree<Site> root = new CommonGenericTree<>(); |
| | | root.setKey("-1"); |
| | | root.setTitle("ä¸å½èªå"); |
| | | root.setType(0); |
| | | list.add(root); |
| | | if (CollectionUtils.isNotEmpty(siteList)) { |
| | | CommonGenericTree<Site> siteNode; |
| | | CommonGenericTree<Area> areaNode; |
| | | CommonGenericTree<ProductionLine> lineNode; |
| | | for (Site site : siteList) { |
| | | siteNode = new CommonGenericTree<>(); |
| | | siteNode.setKey(site.getId()); |
| | | siteNode.setTitle(site.getName()); |
| | | siteNode.setParentId(root.getKey()); |
| | | siteNode.setIcon(""); |
| | | siteNode.setType(1); |
| | | siteNode.setEntity(site); |
| | | root.addChildren(siteNode); |
| | | siteMap.put(site.getId(), siteNode); |
| | | } |
| | | for (Area area : areaList) { |
| | | if (siteMap.containsKey(area.getSiteId())) { |
| | | siteNode = siteMap.get(area.getSiteId()); |
| | | areaNode = new CommonGenericTree<>(); |
| | | areaNode.setKey(area.getId()); |
| | | areaNode.setTitle(area.getName()); |
| | | areaNode.setParentId(area.getSiteId()); |
| | | areaNode.setIcon(""); |
| | | areaNode.setType(2); |
| | | areaNode.setEntity(area); |
| | | siteNode.addChildren(areaNode); |
| | | areaMap.put(area.getId(), areaNode); |
| | | } |
| | | } |
| | | for (ProductionLine line : productionLineList) { |
| | | if (areaMap.containsKey(line.getAreaId())) { |
| | | areaNode = areaMap.get(line.getAreaId()); |
| | | lineNode = new CommonGenericTree<>(); |
| | | lineNode.setKey(line.getId()); |
| | | lineNode.setTitle(line.getName()); |
| | | lineNode.setParentId(line.getAreaId()); |
| | | lineNode.setIcon(""); |
| | | lineNode.setType(3); |
| | | lineNode.setEntity(line); |
| | | lineNode.setDisabled(true); |
| | | areaNode.addChildren(lineNode); |
| | | } |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.wrapper; |
| | | |
| | | import org.jeecg.modules.eam.entity.Area; |
| | | import org.jeecg.modules.eam.entity.ProductionLine; |
| | | import org.jeecg.modules.eam.entity.Site; |
| | | import org.jeecg.modules.eam.vo.CommonCascade; |
| | | |
| | | import java.util.*; |
| | | |
| | | public class SiteAreaProductLineWrapper { |
| | | |
| | | public static List<CommonCascade> loadCascadePlus(List<Site> siteList, List<Area> areaList, |
| | | List<ProductionLine> productionLineList) { |
| | | if (siteList == null || siteList.isEmpty() || areaList == null || areaList.isEmpty() |
| | | || productionLineList == null || productionLineList.isEmpty()) |
| | | return Collections.emptyList(); |
| | | List<CommonCascade> list = new ArrayList<>(); |
| | | Map<String, CommonCascade> siteMap = new HashMap<>(); |
| | | Map<String, CommonCascade> areaMap = new HashMap<>(); |
| | | if (siteList == null || siteList.isEmpty()) |
| | | return list; |
| | | CommonCascade siteNode; |
| | | CommonCascade areaNode; |
| | | CommonCascade productionLineNode; |
| | | for (Site site : siteList) { |
| | | siteNode = new CommonCascade(); |
| | | siteNode = siteNode.setValue(site.getId()).setLabel(site.getName()); |
| | | list.add(siteNode); |
| | | siteMap.put(site.getId(), siteNode); |
| | | } |
| | | for (Area area : areaList) { |
| | | if (siteMap.containsKey(area.getSiteId())) { |
| | | siteNode = siteMap.get(area.getSiteId()); |
| | | areaNode = new CommonCascade(); |
| | | areaNode = areaNode.setValue(area.getId()).setLabel(area.getName()); |
| | | siteNode.addChildren(areaNode); |
| | | areaMap.put(area.getId(), areaNode); |
| | | } |
| | | } |
| | | for (ProductionLine productionLine : productionLineList) { |
| | | if (areaMap.containsKey(productionLine.getAreaId())) { |
| | | areaNode = areaMap.get(productionLine.getAreaId()); |
| | | productionLineNode = new CommonCascade(); |
| | | productionLineNode = productionLineNode.setValue(productionLine.getId()) |
| | | .setLabel(productionLine.getName()); |
| | | areaNode.addChildren(productionLineNode); |
| | | |
| | | } |
| | | } |
| | | List<CommonCascade> secondList = new ArrayList<>(); |
| | | for (CommonCascade c : list) { |
| | | if (c.hasChildren()) { |
| | | secondList.add(c); |
| | | } |
| | | } |
| | | List<CommonCascade> middleList = new ArrayList<>(); |
| | | for (CommonCascade c : secondList) { |
| | | if (c.hasChildren()) { |
| | | middleList.add(c); |
| | | } |
| | | } |
| | | List<CommonCascade> result = new ArrayList<>(); |
| | | for (CommonCascade c : middleList) { |
| | | if (c.hasChildren()) { |
| | | result.add(c); |
| | | } |
| | | } |
| | | return middleList; |
| | | } |
| | | |
| | | } |