| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.dto.message.MessageDTO; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.PermissionData; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.api.ISysBaseAPI; |
| | | import org.jeecg.common.system.base.entity.SysUpload; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.base.entity.Constructor; |
| | | import org.jeecg.modules.base.service.IConstructorService; |
| | | import org.jeecg.modules.base.service.IFactoryModelService; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.model.DepartVo; |
| | | import org.jeecg.modules.eam.model.MaintenanceCycleVo; |
| | | import org.jeecg.modules.eam.service.*; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | |
| | | import org.jeecg.modules.system.entity.SysDepart; |
| | | import org.jeecg.modules.system.service.ISysDepartService; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.TranslateDictTextUtils; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.dto.EamEquipmentDto; |
| | | 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.EamEquipmentTree; |
| | | import org.jeecg.modules.eam.vo.EquipmentSearchResult; |
| | | import org.jeecg.modules.system.entity.BaseFactory; |
| | | import org.jeecg.modules.system.entity.EamBaseRepairDepart; |
| | | import org.jeecg.modules.system.service.IBaseFactoryService; |
| | | import org.jeecg.modules.system.service.IEamBaseRepairDepartService; |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | | import org.jeecgframework.poi.excel.entity.ImportParams; |
| | | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | |
| | | /** |
| | | * @Description: mom_eam_equipment |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Description: 设备台账 |
| | | * @Author: jeecg-boot |
| | | * @Date: 2023-03-23 |
| | | * @Date: 2025-03-19 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Api(tags="mom_eam_equipment") |
| | | @Slf4j |
| | | @Api(tags = "设备台账") |
| | | @RestController |
| | | @RequestMapping("/eam/equipment") |
| | | @Slf4j |
| | | public class EamEquipmentController extends JeecgController<Equipment, IEamEquipmentService> { |
| | | @Autowired |
| | | private IEamEquipmentService equipmentService; |
| | | public class EamEquipmentController extends JeecgController<EamEquipment, IEamEquipmentService> { |
| | | @Autowired |
| | | private IEamEquipmentService eamEquipmentService; |
| | | |
| | | @Autowired |
| | | private IPrecisionParametersTemplateDetailService precisionParametersTemplateDetailService; |
| | | @Autowired |
| | | private IEamEquipmentExtendService eamEquipmentExtendService; |
| | | |
| | | @Autowired |
| | | private IProcessParametersTemplateDetailService processParametersTemplateDetailService; |
| | | // @Autowired |
| | | // private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | @Autowired |
| | | private IEquipmentProcessParametersService equipmentProcessParametersService; |
| | | |
| | | @Autowired |
| | | private IEquipmentPrecisionParametersService equipmentPrecisionParametersService; |
| | | |
| | | @Autowired |
| | | private IPrecisionParametersTemplateService precisionParametersTemplateService; |
| | | |
| | | @Autowired |
| | | private IProcessParametersTemplateService processParametersTemplateService; |
| | | |
| | | @Autowired |
| | | private ISysBaseAPI sysBaseApi; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private IEquipmentSealDetailService equipmentSealDetailService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private IInspectionOrderDetailService inspectionOrderDetailService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private ISpecialtyInspectionOrderDetailService specialtyInspectionOrderDetailService; |
| | | |
| | | @Autowired |
| | | private ICalibrationOrderDetailService calibrationOrderDetailService; |
| | | |
| | | @Autowired |
| | | private ICalibrationOrderReportService calibrationOrderReportService; |
| | | |
| | | @Autowired |
| | | private IEquipmentCategoryService equipmentCategoryService; |
| | | |
| | | @Autowired |
| | | private ISysDepartService departService; |
| | | |
| | | @Autowired |
| | | private ITeamService teamService; |
| | | |
| | | @Autowired |
| | | private IConstructorService constructorService; |
| | | |
| | | @Autowired |
| | | private IAreaService areaService; |
| | | |
| | | @Autowired |
| | | private IDailyInspectionStandardService dailyInspectionStandardService; |
| | | |
| | | @Autowired |
| | | private IMaintenanceStandardService maintenanceStandardService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | | * @param equipment |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "mom_eam_equipment-分页列表查询") |
| | | @ApiOperation(value="mom_eam_equipment-分页列表查询", notes="mom_eam_equipment-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<IPage<Equipment>> queryPageList(Equipment equipment, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | //QueryWrapper<Equipment> queryWrapper = QueryGenerator.initQueryWrapper(equipment, req.getParameterMap()); |
| | | QueryWrapper<Equipment> queryWrapper = new QueryWrapper<>(); |
| | | if(StringUtils.isNotBlank(equipment.getNum())){ |
| | | queryWrapper.like("num",equipment.getNum()); |
| | | } |
| | | if(StringUtils.isNotBlank(equipment.getName())){ |
| | | queryWrapper.like("name",equipment.getName()); |
| | | } |
| | | if(StringUtils.isNotBlank(equipment.getEquipmentStatus())){ |
| | | queryWrapper.eq("equipment_status",equipment.getEquipmentStatus()); |
| | | } |
| | | if(StringUtils.isNotBlank(equipment.getTechnologyStatus())){ |
| | | queryWrapper.eq("technology_status",equipment.getTechnologyStatus()); |
| | | } |
| | | if(StringUtils.isNotBlank(equipment.getEquipmentCategoryId())){ |
| | | queryWrapper.eq("equipment_category_id",equipment.getEquipmentCategoryId()); |
| | | } |
| | | queryWrapper.isNull("line_id"); |
| | | queryWrapper.eq("status","1"); |
| | | queryWrapper.eq("del_flag",0); |
| | | queryWrapper.orderByDesc("create_time"); |
| | | |
| | | Page<Equipment> page = new Page<Equipment>(pageNo, pageSize); |
| | | IPage<Equipment> pageList = equipmentService.page(page, queryWrapper); |
| | | List<Equipment> equipmentList = pageList.getRecords(); |
| | | for (Equipment eq : equipmentList) { |
| | | String precisionParametersTemplateId = eq.getPrecisionParametersTemplateId(); |
| | | if(StringUtils.isNotBlank(precisionParametersTemplateId)){ |
| | | PrecisionParametersTemplate precisionParametersTemplate = precisionParametersTemplateService.getById(precisionParametersTemplateId); |
| | | if(precisionParametersTemplate != null){ |
| | | eq.setPrecisionParametersTemplateName(precisionParametersTemplate.getName()); |
| | | }else{ |
| | | eq.setPrecisionParametersTemplateName(""); |
| | | } |
| | | }else{ |
| | | eq.setPrecisionParametersTemplateName(""); |
| | | } |
| | | |
| | | String processParametersTemplateId = eq.getProcessParametersTemplateId(); |
| | | if(StringUtils.isNotBlank(processParametersTemplateId)){ |
| | | ProcessParametersTemplate processParametersTemplate = processParametersTemplateService.getById(processParametersTemplateId); |
| | | if(processParametersTemplate != null){ |
| | | eq.setProcessParametersTemplateName(processParametersTemplate.getName()); |
| | | }else{ |
| | | eq.setProcessParametersTemplateName(""); |
| | | } |
| | | }else{ |
| | | eq.setProcessParametersTemplateName(""); |
| | | } |
| | | //查询封存原因和封存日期 |
| | | List<EquipmentSealDetail> equipmentSealDetailList = equipmentSealDetailService.lambdaQuery().eq(EquipmentSealDetail::getEquipmentId,eq.getId()) |
| | | .eq(EquipmentSealDetail::getDelFlag, CommonConstant.DEL_FLAG_0).orderByDesc(EquipmentSealDetail::getCreateTime).list(); |
| | | if(CollectionUtils.isNotEmpty(equipmentSealDetailList)){ |
| | | eq.setSealReason(equipmentSealDetailList.get(0).getSealReason()); |
| | | eq.setSealDate(equipmentSealDetailList.get(0).getSealDate()); |
| | | } |
| | | } |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | @ApiOperation(value="mom_eam_equipment-分页列表查询", notes="mom_eam_equipment-分页列表查询") |
| | | @GetMapping(value = "/showEquipmentList") |
| | | public Result<IPage<Equipment>> showEquipmentList(Equipment equipment, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<Equipment> queryWrapper = new QueryWrapper<>(); |
| | | if(StringUtils.isNotBlank(equipment.getNum())){ |
| | | queryWrapper.like("num",equipment.getNum()); |
| | | } |
| | | if(StringUtils.isNotBlank(equipment.getName())){ |
| | | queryWrapper.like("name",equipment.getName()); |
| | | } |
| | | queryWrapper.eq("equipment_status","1"); |
| | | queryWrapper.in("technology_status","qualified","limitedUse"); |
| | | queryWrapper.eq("status","1"); |
| | | queryWrapper.eq("del_flag",0); |
| | | queryWrapper.orderByDesc("create_time"); |
| | | |
| | | Page<Equipment> page = new Page<Equipment>(pageNo, pageSize); |
| | | IPage<Equipment> pageList = equipmentService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | @ApiOperation(value="mom_eam_equipment-分页列表查询", notes="mom_eam_equipment-分页列表查询") |
| | | @GetMapping(value = "/findEquipmentList") |
| | | public Result<IPage<Equipment>> findEquipmentList(Equipment equipment, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<Equipment> queryWrapper = new QueryWrapper<>(); |
| | | if(StringUtils.isNotBlank(equipment.getNum())){ |
| | | queryWrapper.like("num",equipment.getNum()); |
| | | } |
| | | if(StringUtils.isNotBlank(equipment.getName())){ |
| | | queryWrapper.like("name",equipment.getName()); |
| | | } |
| | | queryWrapper.eq("equipment_status","1"); |
| | | queryWrapper.in("technology_status","qualified","limitedUse"); |
| | | queryWrapper.in("equipment_importance_id","A","B","C"); |
| | | queryWrapper.eq("status","1"); |
| | | queryWrapper.eq("del_flag",0); |
| | | queryWrapper.orderByDesc("create_time"); |
| | | |
| | | Page<Equipment> page = new Page<Equipment>(pageNo, pageSize); |
| | | IPage<Equipment> pageList = equipmentService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设备保修 获取设备列表组件 |
| | | * qsw 2023-7-14 |
| | | */ |
| | | |
| | | @GetMapping(value = "/getEquipmentList") |
| | | @PermissionData |
| | | public Result<IPage<Equipment>> getEquipmentList(Equipment equipment, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<Equipment> queryWrapper = QueryGenerator.initQueryWrapper(equipment, req.getParameterMap()); |
| | | Page<Equipment> page = new Page<Equipment>(pageNo, pageSize); |
| | | IPage<Equipment> pageList = equipmentService.getEquipmentList(page, equipment); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | @GetMapping(value = "/pageEquipment") |
| | | public Result<IPage<Equipment>> pageEquipment(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | IPage<Equipment> pageList = equipmentService.pageEquipment(pageNo, pageSize, params); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param equipment |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "mom_eam_equipment-添加") |
| | | @ApiOperation(value="mom_eam_equipment-添加", notes="mom_eam_equipment-添加") |
| | | @PostMapping(value = "/add") |
| | | @Transactional(rollbackFor = { Exception.class }) |
| | | public Result<String> add(@RequestBody Equipment equipment) { |
| | | equipmentService.save(equipment); |
| | | //获取工艺参数模板明细 |
| | | String processParametersTemplateId = equipment.getProcessParametersTemplateId(); |
| | | List<ProcessParametersTemplateDetail> processParameters = processParametersTemplateDetailService.lambdaQuery() |
| | | .eq(ProcessParametersTemplateDetail::getProcessParametersTemplateId, processParametersTemplateId) |
| | | .eq(ProcessParametersTemplateDetail::getDelFlag, 0).list(); |
| | | for (ProcessParametersTemplateDetail processParameter : processParameters) { |
| | | EquipmentProcessParameters equipmentProcessParameters = new EquipmentProcessParameters(); |
| | | equipmentProcessParameters.setEquipmentId(equipment.getId()); |
| | | equipmentProcessParameters.setProcessParametersId(processParameter.getProcessParametersId()); |
| | | equipmentProcessParametersService.save(equipmentProcessParameters); |
| | | } |
| | | //获取设备精度参数模板明细 |
| | | String precisionParametersTemplateId = equipment.getPrecisionParametersTemplateId(); |
| | | List<PrecisionParametersTemplateDetail> precisionParameters = precisionParametersTemplateDetailService.lambdaQuery() |
| | | .eq(PrecisionParametersTemplateDetail::getPrecisionParametersTemplateId, precisionParametersTemplateId) |
| | | .eq(PrecisionParametersTemplateDetail::getDelFlag, 0).list(); |
| | | for (PrecisionParametersTemplateDetail precisionParameter : precisionParameters) { |
| | | EquipmentPrecisionParameters equipmentPrecisionParameters = new EquipmentPrecisionParameters(); |
| | | equipmentPrecisionParameters.setEquipmentId(equipment.getId()); |
| | | equipmentPrecisionParameters.setPrecisionParametersId(precisionParameter.getPrecisionParametersId()); |
| | | equipmentPrecisionParametersService.save(equipmentPrecisionParameters); |
| | | } |
| | | |
| | | List<SysUpload> sysUploads = equipment.getSysUploadList(); |
| | | if (sysUploads!= null){ |
| | | // uploadRelaService.saveOrUpdateUploadRale(equipment.getId(), "equipment_photo",sysUploads.get(0).getId()); |
| | | sysBaseApi.saveOrUpdateUploadRale(equipment.getId(), "equipment_photo",sysUploads.get(0).getId()); |
| | | } |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param equipment |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "mom_eam_equipment-编辑") |
| | | @ApiOperation(value="mom_eam_equipment-编辑", notes="mom_eam_equipment-编辑") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | @Transactional(rollbackFor = { Exception.class }) |
| | | public Result<String> edit(@RequestBody Equipment equipment) { |
| | | |
| | | List<EquipmentProcessParameters> proParameters = equipmentProcessParametersService.lambdaQuery() |
| | | .eq(EquipmentProcessParameters::getEquipmentId, equipment.getId()) |
| | | .eq(EquipmentProcessParameters::getDelFlag, 0).list(); |
| | | for (EquipmentProcessParameters proParameter : proParameters) { |
| | | equipmentProcessParametersService.removeById(proParameter); |
| | | } |
| | | |
| | | List<EquipmentPrecisionParameters> preParameters = equipmentPrecisionParametersService.lambdaQuery() |
| | | .eq(EquipmentPrecisionParameters::getEquipmentId, equipment.getId()) |
| | | .eq(EquipmentPrecisionParameters::getDelFlag, 0).list(); |
| | | for (EquipmentPrecisionParameters preParameter : preParameters) { |
| | | equipmentPrecisionParametersService.removeById(preParameter); |
| | | } |
| | | |
| | | //获取工艺参数模板明细 |
| | | String processParametersTemplateId = equipment.getProcessParametersTemplateId(); |
| | | List<ProcessParametersTemplateDetail> processParameters = processParametersTemplateDetailService.lambdaQuery() |
| | | .eq(ProcessParametersTemplateDetail::getProcessParametersTemplateId, processParametersTemplateId) |
| | | .eq(ProcessParametersTemplateDetail::getDelFlag, 0).list(); |
| | | for (ProcessParametersTemplateDetail processParameter : processParameters) { |
| | | EquipmentProcessParameters equipmentProcessParameters = new EquipmentProcessParameters(); |
| | | equipmentProcessParameters.setEquipmentId(equipment.getId()); |
| | | equipmentProcessParameters.setProcessParametersId(processParameter.getProcessParametersId()); |
| | | equipmentProcessParametersService.save(equipmentProcessParameters); |
| | | } |
| | | //获取设备精度参数模板明细 |
| | | String precisionParametersTemplateId = equipment.getPrecisionParametersTemplateId(); |
| | | List<PrecisionParametersTemplateDetail> precisionParameters = precisionParametersTemplateDetailService.lambdaQuery() |
| | | .eq(PrecisionParametersTemplateDetail::getPrecisionParametersTemplateId, precisionParametersTemplateId) |
| | | .eq(PrecisionParametersTemplateDetail::getDelFlag, 0).list(); |
| | | for (PrecisionParametersTemplateDetail precisionParameter : precisionParameters) { |
| | | EquipmentPrecisionParameters equipmentPrecisionParameters = new EquipmentPrecisionParameters(); |
| | | equipmentPrecisionParameters.setEquipmentId(equipment.getId()); |
| | | equipmentPrecisionParameters.setPrecisionParametersId(precisionParameter.getPrecisionParametersId()); |
| | | equipmentPrecisionParametersService.save(equipmentPrecisionParameters); |
| | | } |
| | | |
| | | equipmentService.updateById(equipment); |
| | | |
| | | List<SysUpload> sysUploads = equipment.getSysUploadList(); |
| | | if (sysUploads!= null){ |
| | | // uploadRelaService.saveOrUpdateUploadRale(equipment.getId(), "equipment_photo",sysUploads.get(0).getId()); |
| | | sysBaseApi.saveOrUpdateUploadRale(equipment.getId(), "equipment_photo",sysUploads.get(0).getId()); |
| | | } |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "mom_eam_equipment-通过id删除") |
| | | @ApiOperation(value="mom_eam_equipment-通过id删除", notes="mom_eam_equipment-通过id删除") |
| | | //@RequiresPermissions("org.jeecg.modules.demo:mom_eam_equipment:delete") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<String> delete(@RequestParam(name="id",required=true) String id) { |
| | | Equipment equipment = equipmentService.getById(id); |
| | | equipmentService.update(new UpdateWrapper<Equipment>().eq("line_id",id).set("line_id",null).set("is_meta",null)); |
| | | equipment.setDelFlag(1); |
| | | equipmentService.updateById(equipment); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "mom_eam_equipment-批量删除") |
| | | @ApiOperation(value="mom_eam_equipment-批量删除", notes="mom_eam_equipment-批量删除") |
| | | //@RequiresPermissions("org.jeecg.modules.demo:mom_eam_equipment:deleteBatch") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | List<String> stringList = Arrays.asList(ids.split(",")); |
| | | for (String id : stringList) { |
| | | Equipment equipment = equipmentService.getById(id); |
| | | equipment.setDelFlag(1); |
| | | equipmentService.updateById(equipment); |
| | | } |
| | | // this.equipmentService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "mom_eam_equipment-通过id查询") |
| | | @ApiOperation(value="mom_eam_equipment-通过id查询", notes="mom_eam_equipment-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<Equipment> queryById(@RequestParam(name="id",required=true) String id) { |
| | | Equipment equipment = equipmentService.getById(id); |
| | | if(equipment==null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |
| | | return Result.OK(equipment); |
| | | } |
| | | |
| | | @Autowired |
| | | private ObjectMapper objectMapper; |
| | | @Autowired |
| | | private TranslateDictTextUtils translateDictTextUtils; |
| | | @Autowired |
| | | private IBaseFactoryService baseFactoryService; |
| | | @Autowired |
| | | private IEamBaseRepairDepartService eamBaseRepairDepartService; |
| | | /** |
| | | * 导出excel |
| | | * |
| | | * @param request |
| | | * @param equipment |
| | | */ |
| | | //@RequiresPermissions("org.jeecg.modules.demo:mom_eam_equipment:exportXls") |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, Equipment equipment) { |
| | | return super.exportXls(request, equipment, Equipment.class, "设备台账导出"); |
| | | * 分页列表查询 |
| | | * |
| | | * @param eamEquipment |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | // @AutoLog(value = "设备台账-分页列表查询") |
| | | @ApiOperation(value = "设备台账-分页列表查询", notes = "设备台账-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(EamEquipmentQuery eamEquipment, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | // QueryWrapper<EamEquipment> queryWrapper = QueryGenerator.initQueryWrapper(eamEquipment, req.getParameterMap()); |
| | | IPage<EamEquipment> page = new Page<>(pageNo, pageSize); |
| | | IPage<EamEquipment> pageList = eamEquipmentService.queryPageList(page, eamEquipment); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | // /** |
| | | // * 通过excel导入数据 |
| | | // * |
| | | // * @param request |
| | | // * @param response |
| | | // * @return |
| | | // */ |
| | | // //@RequiresPermissions("mom_eam_equipment:importExcel") |
| | | // @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | // public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | // return super.importExcel(request, response, Equipment.class); |
| | | // } |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param eamEquipment |
| | | * @return |
| | | */ |
| | | // @AutoLog(value = "设备台账-添加") |
| | | @ApiOperation(value = "设备台账-添加", notes = "设备台账-添加") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EamEquipment eamEquipment) { |
| | | EamEquipment entity = eamEquipmentService.saveEquipment(eamEquipment); |
| | | if (entity == null) { |
| | | return Result.OK("添加失败!"); |
| | | } |
| | | //调用mdcEquipment插入MDC设备 |
| | | // if (CommonConstant.DEFAULT_1.equals(eamEquipment.getMdcFlag())) { |
| | | //插入MDC设备 |
| | | // MdcEquipment mdcEquipment = new MdcEquipment(); |
| | | // mdcEquipment.setEquipmentId(entity.getEquipmentCode()); |
| | | // mdcEquipment.setEquipmentType(entity.getDeviceType()); |
| | | // mdcEquipment.setEquipmentName(entity.getEquipmentName()); |
| | | // mdcEquipmentService.addNewEquipmentFromEam(mdcEquipment, eamEquipment.getOrgId()); |
| | | // } |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param eamEquipment |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "设备台账-编辑", notes = "设备台账-编辑") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<?> edit(@RequestBody EamEquipment eamEquipment) { |
| | | eamEquipmentService.updateEquipment(eamEquipment); |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 设备建账 获取组织部门 |
| | | * qsw 2023-4-28 |
| | | */ |
| | | @GetMapping("getSysDeparts") |
| | | public Result<?> getSysDeparts() { |
| | | List<DepartVo> sysDeparts = equipmentService.getSysDeparts(); |
| | | return Result.ok(sysDeparts); |
| | | } |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "设备台账-通过id删除", notes = "设备台账-通过id删除") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
| | | EamEquipment entity = eamEquipmentService.getById(id); |
| | | if (entity != null) { |
| | | entity.setDelFlag(CommonConstant.DEL_FLAG_1); |
| | | eamEquipmentService.updateById(entity); |
| | | } |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "设备台账-批量删除", notes = "设备台账-批量删除") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | | List<String> list = Arrays.asList(ids.split(",")); |
| | | list.forEach(id -> { |
| | | EamEquipment entity = eamEquipmentService.getById(id); |
| | | if (entity != null) { |
| | | entity.setDelFlag(CommonConstant.DEL_FLAG_1); |
| | | eamEquipmentService.updateById(entity); |
| | | } |
| | | }); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | *设备履历 获取设备使用记录 |
| | | * qsw 2023-7-28 |
| | | */ |
| | | @GetMapping(value = "/getResumeUseRecordList") |
| | | public Result<?> getResumeUseRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> resumeUseRecordList = equipmentService.getResumeUseRecordList(pageNo, pageSize, params); |
| | | return Result.ok(resumeUseRecordList); |
| | | } |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "设备台账-通过id查询", notes = "设备台账-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
| | | EamEquipment eamEquipment = eamEquipmentService.getById(id); |
| | | if (eamEquipment == null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |
| | | EamEquipmentExtend extend = eamEquipmentExtendService.getById(id); |
| | | if(extend != null){ |
| | | eamEquipment.setRepairStatus(extend.getRepairStatus()); |
| | | eamEquipment.setMaintenanceStatus(extend.getMaintenanceStatus()); |
| | | } |
| | | try { |
| | | String json = objectMapper.writeValueAsString(eamEquipment); |
| | | JSONObject item = JSONObject.parseObject(json, Feature.OrderedField); |
| | | translateDictTextUtils.translateField("createBy", eamEquipment.getCreateBy(), item, "sys_user,realname,username"); |
| | | translateDictTextUtils.translateField("updateBy", eamEquipment.getUpdateBy(), item, "sys_user,realname,username"); |
| | | // translateDictTextUtils.translateField("technologyStatus", eamEquipment.getTechnologyStatus(), item, "technology_status"); |
| | | // translateDictTextUtils.translateField("orgId", eamEquipment.getOrgId(), item, "mdc_production,production_name,id"); |
| | | // translateDictTextUtils.translateField("equipmentManager", eamEquipment.getEquipmentManager(), item, "sys_user,realname,username"); |
| | | translateDictTextUtils.translateField("equipmentCategory", eamEquipment.getEquipmentCategory(), item, "equipment_category"); |
| | | translateDictTextUtils.translateField("assetStatus", eamEquipment.getAssetStatus(), item, "asset_status"); |
| | | translateDictTextUtils.translateField("repairStatus", eamEquipment.getRepairStatus(), item, "equipment_repair_status"); |
| | | translateDictTextUtils.translateField("maintenanceStatus", eamEquipment.getMaintenanceStatus(), item, "equipment_maintenance_status"); |
| | | return Result.OK(item); |
| | | } catch (JsonProcessingException e) { |
| | | return Result.error("数据转译失败!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | *设备履历 获取设备点检记录 |
| | | * qsw 2023-7-28 |
| | | */ |
| | | @GetMapping(value = "/getResumeInspectionRecordList") |
| | | public Result<?> getResumeInspectionRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> resumeInspectionRecordList = equipmentService.getResumeInspectionRecordList(pageNo, pageSize, params); |
| | | LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | for (Map<String, Object> record : resumeInspectionRecordList.getRecords()) { |
| | | String id = (String)record.get("id"); |
| | | String inspectionType = (String)record.get("inspectionType"); |
| | | if("日常点检".equals(inspectionType)){ |
| | | List<InspectionOrderDetail> failCount = inspectionOrderDetailService.lambdaQuery() |
| | | .eq(InspectionOrderDetail::getInspectionOrderId, id) |
| | | .eq(InspectionOrderDetail::getJudgmentResult, "fail") |
| | | .eq(InspectionOrderDetail::getDelFlag, 0).list(); |
| | | /** |
| | | * 导出excel |
| | | * @param eamEquipment |
| | | */ |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request,EamEquipmentQuery eamEquipment) { |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | List<EamEquipment> equipmentList=eamEquipmentService.exportList(eamEquipment); |
| | | List<EamEquipmentDto> eamEquipmentDtos=new ArrayList<>(); |
| | | String selections = request.getParameter("selections"); |
| | | if (oConvertUtils.isNotEmpty(selections)) { |
| | | List<String> selectionList = Arrays.asList(selections.split(",")); |
| | | equipmentList = equipmentList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); |
| | | } |
| | | equipmentList.forEach(item -> { |
| | | EamEquipmentDto eamEquipmentDto = new EamEquipmentDto(); |
| | | BeanUtils.copyProperties(item,eamEquipmentDto); |
| | | if (eamEquipmentDto.getFactoryOrgCode().length()==12){ |
| | | eamEquipmentDto.setFactoryOrgCode( |
| | | baseFactoryService.factoryDataNameByOrgCode(eamEquipmentDto.getZxfactoryOrgCode()) |
| | | +"/"+baseFactoryService.factoryDataNameByOrgCode(eamEquipmentDto.getGqfactoryOrgCode())+"/"+ |
| | | baseFactoryService.factoryDataNameByOrgCode(eamEquipmentDto.getFactoryOrgCode())); |
| | | }else { |
| | | eamEquipmentDto.setFactoryOrgCode( |
| | | baseFactoryService.factoryDataNameByOrgCode(eamEquipmentDto.getZxfactoryOrgCode()) |
| | | +"/"+ baseFactoryService.factoryDataNameByOrgCode(eamEquipmentDto.getFactoryOrgCode())); |
| | | } |
| | | eamEquipmentDto.setEquipmentWeightStr(eamEquipmentDto.getEquipmentWeight().toEngineeringString()); |
| | | eamEquipmentDtos.add(eamEquipmentDto); |
| | | }); |
| | | // Step.3 AutoPoi 导出Excel |
| | | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
| | | mv.addObject(NormalExcelConstants.FILE_NAME, "设备台账"); //此处设置的filename无效 ,前端会重更新设置一下 |
| | | mv.addObject(NormalExcelConstants.CLASS, EamEquipmentDto.class); |
| | | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("设备台账" + "报表", "导出人:" + sysUser.getRealname(), "设备台账")); |
| | | mv.addObject(NormalExcelConstants.DATA_LIST, eamEquipmentDtos); |
| | | return mv; |
| | | |
| | | List<InspectionOrderDetail> passCount = inspectionOrderDetailService.lambdaQuery() |
| | | .eq(InspectionOrderDetail::getInspectionOrderId, id) |
| | | .eq(InspectionOrderDetail::getJudgmentResult,"pass") |
| | | .eq(InspectionOrderDetail::getDelFlag, 0).list(); |
| | | record.put("result","正常:"+passCount.size()+","+"异常:"+failCount.size()); |
| | | }else{ |
| | | List<SpecialtyInspectionOrderDetail> failCount = specialtyInspectionOrderDetailService.lambdaQuery() |
| | | .eq(SpecialtyInspectionOrderDetail::getSpecialtyInspectionOrderId, id) |
| | | .eq(SpecialtyInspectionOrderDetail::getJudgmentResult,"fail") |
| | | .eq(SpecialtyInspectionOrderDetail::getDelFlag, 0).list(); |
| | | } |
| | | |
| | | List<SpecialtyInspectionOrderDetail> passCount = specialtyInspectionOrderDetailService.lambdaQuery() |
| | | .eq(SpecialtyInspectionOrderDetail::getSpecialtyInspectionOrderId, id) |
| | | .eq(SpecialtyInspectionOrderDetail::getJudgmentResult,"pass") |
| | | .eq(SpecialtyInspectionOrderDetail::getDelFlag, 0).list(); |
| | | record.put("result","正常:"+passCount.size()+","+"异常:"+failCount.size()); |
| | | } |
| | | } |
| | | return Result.ok(resumeInspectionRecordList); |
| | | } |
| | | /** |
| | | * 通过excel导入数据 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); |
| | | for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { |
| | | // 获取上传文件对象 |
| | | MultipartFile file = entity.getValue(); |
| | | ImportParams params = new ImportParams(); |
| | | params.setTitleRows(2); |
| | | params.setHeadRows(1); |
| | | params.setNeedSave(true); |
| | | params.setStartSheetIndex(0); |
| | | params.setSheetNum(1); |
| | | try { |
| | | List<EamEquipment> list = ExcelImportUtil.importExcel(file.getInputStream(), EamEquipment.class, params); |
| | | //update-begin-author:taoyan date:20190528 for:批量插入数据 |
| | | long start = System.currentTimeMillis(); |
| | | // service.saveBatch(list); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (EamEquipment eamEquipment : list) { |
| | | //必填字段校验 |
| | | if (StringUtils.isBlank(eamEquipment.getEquipmentCode()) || StringUtils.isBlank(eamEquipment.getEquipmentName())) { |
| | | sb.append(String.format("设备编码[%s]或设备名称[%s]为空,无法导入\n\n", eamEquipment.getEquipmentCode(), eamEquipment.getEquipmentName())); |
| | | continue; |
| | | } |
| | | if (StringUtils.isBlank(eamEquipment.getEquipmentCategory())) { |
| | | sb.append(String.format("设备编码[%s]设备分类为空,无法导入\n\n", eamEquipment.getEquipmentCode())); |
| | | continue; |
| | | } |
| | | EamEquipment one = eamEquipmentService.getOne(new LambdaQueryWrapper<EamEquipment>().eq(EamEquipment::getEquipmentCode, eamEquipment.getEquipmentCode()).eq(EamEquipment::getDelFlag, CommonConstant.DEL_FLAG_0)); |
| | | if (one != null) { |
| | | sb.append(String.format("设备编码[%s]已存在,无法重复导入\n\r", eamEquipment.getEquipmentCode())); |
| | | continue; |
| | | } |
| | | BaseFactory baseFactory=baseFactoryService.searchCenterByKeyWord(eamEquipment.getFactoryOrgCode()); |
| | | if(baseFactory==null){ |
| | | sb.append(String.format("EAM中心信息[%s]不存在,无法导入\n\r", eamEquipment.getFactoryOrgCode())); |
| | | continue; |
| | | }else { |
| | | eamEquipment.setFactoryOrgCode(baseFactory.getOrgCode()); |
| | | } |
| | | EamBaseRepairDepart eamBaseRepairDepart=eamBaseRepairDepartService.searchCenterByKeyWord(eamEquipment.getRepairDepartOrgCode()); |
| | | if(eamBaseRepairDepart==null){ |
| | | sb.append(String.format("维修班组信息[%s]不存在,无法导入\n\r", eamEquipment.getRepairDepartOrgCode())); |
| | | continue; |
| | | }else { |
| | | eamEquipment.setRepairDepartOrgCode(eamBaseRepairDepart.getOrgCode()); |
| | | } |
| | | EamEquipment equipment = eamEquipmentService.saveEquipment(eamEquipment); |
| | | if (equipment == null) { |
| | | //保存失败,跳过本次循环 |
| | | sb.append(String.format("设备编码[%s]保存失败,无法导入\n\r", eamEquipment.getEquipmentCode())); |
| | | continue; |
| | | } |
| | | EamEquipmentExtend eamEquipmentExtend=new EamEquipmentExtend(); |
| | | BeanUtils.copyProperties(eamEquipmentExtend,equipment); |
| | | eamEquipmentExtendService.save(eamEquipmentExtend); |
| | | } |
| | | log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒"); |
| | | //update-end-author:taoyan date:20190528 for:批量插入数据 |
| | | if (sb.length() > 0) { |
| | | return Result.ok(sb.toString()); |
| | | } |
| | | return Result.ok("文件导入成功!数据行数:" + list.size()); |
| | | } catch (Exception e) { |
| | | //update-begin-author:taoyan date:20211124 for: 导入数据重复增加提示 |
| | | String msg = e.getMessage(); |
| | | log.error(msg, e); |
| | | if (msg != null && msg.indexOf("Duplicate entry") >= 0) { |
| | | return Result.error("文件导入失败:有重复数据!"); |
| | | } else { |
| | | return Result.error("文件导入失败:" + e.getMessage()); |
| | | } |
| | | //update-end-author:taoyan date:20211124 for: 导入数据重复增加提示 |
| | | } finally { |
| | | try { |
| | | file.getInputStream().close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return Result.error("文件导入失败!"); |
| | | } |
| | | |
| | | /** |
| | | *设备履历 获取设备保养记录 |
| | | * qsw 2023-7-31 |
| | | */ |
| | | @GetMapping(value = "/getResumeMaintenanceRecordList") |
| | | public Result<?> getResumeMaintenanceRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> resumeMaintenanceRecordList = equipmentService.getResumeMaintenanceRecordList(pageNo, pageSize, params); |
| | | return Result.ok(resumeMaintenanceRecordList); |
| | | } |
| | | @ApiOperation(value = "设备表-通过车间ids获取设备树", notes = "设备表-通过车间ids获取设备树") |
| | | @GetMapping(value = "/loadTreeListByProductionIds") |
| | | public Result<List<EamEquipmentTree>> loadTreeListByProductionIds(@RequestParam(name = "ids", required = true) String ids) { |
| | | Result<List<EamEquipmentTree>> result = new Result<>(); |
| | | try { |
| | | List<EamEquipmentTree> mdcEquipmentTreeList = eamEquipmentService.loadTreeListByProductionIds(ids); |
| | | result.setSuccess(true); |
| | | result.setResult(mdcEquipmentTreeList); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | *设备履历 获取设备维修记录 |
| | | * qsw 2023-7-31 |
| | | */ |
| | | @GetMapping(value = "/getResumeRepairRecordList") |
| | | public Result<?> getResumeRepairRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> resumeRepairRecordList = equipmentService.getResumeRepairRecordList(pageNo, pageSize, params); |
| | | return Result.ok(resumeRepairRecordList); |
| | | } |
| | | @ApiOperation(value = "设备表-通过EAM中心ids获取设备树", notes = "设备表-通过EAM中心ids获取设备树") |
| | | @GetMapping(value = "/loadTreeListByEamCenterIds") |
| | | public Result<List<EamEquipmentTree>> loadTreeListByEamCenterIds(@RequestParam(name = "ids", required = true) String ids) { |
| | | Result<List<EamEquipmentTree>> result = new Result<>(); |
| | | try { |
| | | List<EamEquipmentTree> mdcEquipmentTreeList = eamEquipmentService.loadTreeListByEamCenterIds(ids); |
| | | result.setSuccess(true); |
| | | result.setResult(mdcEquipmentTreeList); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | *设备履历 获取设备检定记录 |
| | | * qsw 2023-7-31 |
| | | */ |
| | | @GetMapping(value = "/getResumeCalibrationRecordList") |
| | | public Result<?> getResumeCalibrationRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> resumeCalibrationRecordList = equipmentService.getResumeCalibrationRecordList(pageNo, pageSize, params); |
| | | // for (Map<String, Object> record : resumeCalibrationRecordList.getRecords()) { |
| | | // String id = (String)record.get("id"); |
| | | // String status = (String)record.get("status"); |
| | | // String managementMode = (String)record.get("managementMode"); |
| | | // if("4".equals(status)){ |
| | | // if("data".equals(managementMode)){ |
| | | // List<CalibrationOrderDetail> calibrationOrderDetails = calibrationOrderDetailService.lambdaQuery() |
| | | // .eq(CalibrationOrderDetail::getCalibrationOrderId, id) |
| | | // .eq(CalibrationOrderDetail::getJudgmentResult, "fail") |
| | | // .eq(CalibrationOrderDetail::getDelFlag,"0").list(); |
| | | // if(calibrationOrderDetails.size()>0){ |
| | | // record.put("calibrationResult","异常"); |
| | | // }else{ |
| | | // record.put("calibrationResult","正常常"); |
| | | // } |
| | | // }else{ |
| | | // List<CalibrationOrderReport> calibrationOrderReports = calibrationOrderReportService.lambdaQuery() |
| | | // .eq(CalibrationOrderReport::getCalibrationOrderId, id) |
| | | // .eq(CalibrationOrderReport::getJudgmentResult, "fail") |
| | | // .eq(CalibrationOrderReport::getDelFlag, "0").list(); |
| | | // if(calibrationOrderReports.size()>0){ |
| | | // record.put("calibrationResult","异常"); |
| | | // }else{ |
| | | // record.put("calibrationResult","正常常"); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | return Result.ok(resumeCalibrationRecordList); |
| | | } |
| | | |
| | | /** |
| | | *设备履历 获取设备处置记录 |
| | | * qsw 2023-7-31 |
| | | */ |
| | | @GetMapping(value = "/getResumeChangeRecordList") |
| | | public Result<?> getResumeChangeRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> resumeChangeRecordList = equipmentService.getResumeChangeRecordList(pageNo, pageSize, params); |
| | | return Result.ok(resumeChangeRecordList); |
| | | } |
| | | |
| | | /** |
| | | * 根据状态查询设备列表 |
| | | */ |
| | | @GetMapping(value = "/getEquipmentListByStatus") |
| | | public Result<IPage<Equipment>> getEquipmentList(Equipment equipment,String status, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<Equipment> queryWrapper = QueryGenerator.initQueryWrapper(equipment, req.getParameterMap()); |
| | | List<String> statusList = Arrays.asList(status.split(",")); |
| | | Page<Equipment> page = new Page<Equipment>(pageNo, pageSize); |
| | | queryWrapper.in("equipment_status",statusList); |
| | | IPage<Equipment> pageList = equipmentService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | /** |
| | | * 导入 |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | //工区、型号、设备状态、技术状态、ABC标识有空值;维护部门、维修班组为编码需要有对照值。 |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); |
| | | String exceptionInfo = ""; |
| | | int exceptionNum = 0; |
| | | for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { |
| | | MultipartFile file = entity.getValue(); |
| | | ImportParams params = new ImportParams(); |
| | | params.setNeedSave(true); |
| | | try { |
| | | List<EquipmentImportVo> list = ExcelImportUtil.importExcel(file.getInputStream(), EquipmentImportVo.class, params); |
| | | for(int i = 0;i<list.size();i++){ |
| | | Equipment equipment = new Equipment(); |
| | | EquipmentImportVo equipmentImportVo = list.get(i); |
| | | String equipmentCategoryName = equipmentImportVo.getEquipmentCategoryName(); |
| | | String useId = equipmentImportVo.getUseId(); |
| | | String areaId = equipmentImportVo.getFactoryModelId(); |
| | | String manageId = equipmentImportVo.getManageId(); |
| | | String constructorId = equipmentImportVo.getConstructorId(); |
| | | String teamId = equipmentImportVo.getTeamId(); |
| | | String propertyStatus = equipmentImportVo.getPropertyStatus(); |
| | | String abc = equipmentImportVo.getEquipmentImportanceId(); |
| | | if(StringUtils.isBlank(equipmentImportVo.getNum())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:统一编码缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getName())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备名称缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getEquipmentImportanceId())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:ABC标识缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // continue; |
| | | // } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getEquipmentStatus())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备状态缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getTechnologyStatus())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:技术状态缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getModel())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备型号缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(useId)){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:使用部门缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(areaId)){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:工区缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(manageId)){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:维护部门缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentCategoryName)){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备分类缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(teamId)){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:维修班组缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | //非必填项 |
| | | // else if(ObjectUtils.isNotNull(equipmentImportVo.getWarrantyStart())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:质保开始日期缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getPropertyStatus())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:资产状态缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getEquipmentUda5())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:功能位置缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getLocation())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:安装位置缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getLeaveFactoryDate())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:出厂日期缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getProjectApprovalNo())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:立项卡号缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getFundSource())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:资金来源缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getAcceptanceCheckDate())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:验收日期缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getLeaveFactoryDate())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:出厂日期缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getFactoryNo())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:出厂编号缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if( StringUtils.isBlank(equipmentImportVo.getConstructorId())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:资产制造商缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getSpecification())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备规格缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getGpo())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备功率缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | else{ |
| | | SysDepart use = departService.getOne(new QueryWrapper<SysDepart>().eq("depart_name",useId.trim()).eq("del_flag",0),false); |
| | | if(ObjectUtils.isNotNull(use)){ |
| | | equipment.setUseId(use.getId()); |
| | | }else { |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:不存在该使用部门,请维护部门数据后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | Area area = areaService.getOne(new QueryWrapper<Area>().eq("name",areaId.trim()).eq("del_flag",0)); |
| | | Area area1 = areaService.getOne(new QueryWrapper<Area>().eq("num",areaId.trim()).eq("del_flag",0)); |
| | | if(ObjectUtils.isNotNull(area)){ |
| | | equipment.setFactoryModelId(area.getId()); |
| | | }else if(ObjectUtils.isNotNull(area1)) { |
| | | equipment.setFactoryModelId(area1.getId()); |
| | | }else { |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:不存在该工区,请维护工区数据后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | SysDepart manage = departService.getOne(new QueryWrapper<SysDepart>().eq("depart_name",manageId.trim()).eq("del_flag",0)); |
| | | if(ObjectUtils.isNotNull(manage)){ |
| | | equipment.setManageId(manage.getId()); |
| | | }else{ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:不存在该维护部门,请先维护部门数据后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | EquipmentCategory equipmentCategory = equipmentCategoryService |
| | | .getOne(new QueryWrapper<EquipmentCategory>() |
| | | .eq("name",equipmentCategoryName.trim()).eq("del_flag",0),false); |
| | | if(ObjectUtils.isNotNull(equipmentCategory)){ |
| | | equipment.setEquipmentCategoryId(equipmentCategory.getId()); |
| | | } |
| | | else { |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:不存在该设备分类,请先维护设备分类数据后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | Team team = teamService.getOne(new QueryWrapper<Team>().eq("name",teamId.trim()).eq("del_flag",0),false); |
| | | Team team1 = teamService.getOne(new QueryWrapper<Team>().eq("num",teamId.trim()).eq("del_flag",0),false); |
| | | if(ObjectUtils.isNotNull(team)){ |
| | | equipment.setTeamId(team.getId()); |
| | | }else if(ObjectUtils.isNotNull(team1)) { |
| | | equipment.setTeamId(team1.getId()); |
| | | }else { |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:不存在该班组,请先维护班组数据后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | if(StringUtils.isNotBlank(constructorId)){ |
| | | Constructor constructor = constructorService.getByName(constructorId.trim()); |
| | | if(ObjectUtils.isNotNull(constructor)){ |
| | | equipment.setConstructorId(constructor.getId()); |
| | | }else { |
| | | constructor = new Constructor(); |
| | | constructor.setName(constructorId); |
| | | constructor.setDelFlag(0); |
| | | constructorService.save(constructor); |
| | | equipment.setConstructorId(constructor.getId()); |
| | | } |
| | | } |
| | | if(StringUtils.isNotBlank(propertyStatus)&&propertyStatus.equals("warranty")){ |
| | | if( |
| | | ObjectUtils.isNull(equipmentImportVo.getWarrantyStart()) |
| | | ||ObjectUtils.isNull(equipmentImportVo.getWarrantyEnd()) |
| | | ){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:该设备处于质保期,质保信息缺失,请先维护质保开始时间或结束时间;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | |
| | | }else{ |
| | | Equipment oriEquipment = equipmentService |
| | | .getOne(new QueryWrapper<Equipment>() |
| | | .eq("num",equipmentImportVo.getNum()).eq("del_flag",0),false); |
| | | if(ObjectUtils.isNull(oriEquipment)){ |
| | | equipment.setNum(equipmentImportVo.getNum()) |
| | | .setName(equipmentImportVo.getName()) |
| | | .setTechnologyStatus(equipmentImportVo.getTechnologyStatus()) |
| | | .setEquipmentImportanceId(equipmentImportVo.getEquipmentImportanceId()) |
| | | .setSpecificEquipment(equipmentImportVo.getKeyEquipmentIdentification()) |
| | | .setSecurityConfiguration(equipmentImportVo.getSecurityConfiguration()) |
| | | .setCoolingSystem(equipmentImportVo.getCoolingSystem()) |
| | | .setFireExtinguisher(equipmentImportVo.getFireExtinguisher()) |
| | | .setFireExtinguisherValidityPeriod(equipmentImportVo.getFireExtinguisherValidityPeriod()) |
| | | .setSystem(equipmentImportVo.getSystem()) |
| | | .setPort(equipmentImportVo.getPort()) |
| | | .setCoordinateNum(equipmentImportVo.getCoordinateNum()) |
| | | .setEquipmentStatus(equipmentImportVo.getEquipmentStatus()) |
| | | .setEquipmentUda3(equipmentImportVo.getEquipmentUda3()) |
| | | .setEquipmentUda4(equipmentImportVo.getEquipmentUda4()) |
| | | .setEquipmentUda5(equipmentImportVo.getEquipmentUda5()) |
| | | .setLocation(equipmentImportVo.getLocation()) |
| | | .setLastVerificationDate(equipmentImportVo.getLeaveFactoryDate()) |
| | | .setProjectApprovalNo(equipmentImportVo.getProjectApprovalNo()) |
| | | .setFundSource(equipmentImportVo.getFundSource()) |
| | | .setAcceptanceCheckDate(equipmentImportVo.getAcceptanceCheckDate()) |
| | | .setFactoryNumber(equipmentImportVo.getFactoryNumber()) |
| | | .setSourceCountry(equipmentImportVo.getSourceCountry()) |
| | | .setModel(equipmentImportVo.getModel()) |
| | | .setSpecification(equipmentImportVo.getSpecification()) |
| | | .setPropertyStatus(equipmentImportVo.getPropertyStatus()) |
| | | .setWarrantyStart(equipmentImportVo.getWarrantyStart()) |
| | | .setWarrantyEnd(equipmentImportVo.getWarrantyEnd()) |
| | | .setIsLineEquip("no") |
| | | .setIsLine("no") |
| | | .setNextTechnologyStatusQualificationTime(equipmentImportVo.getNextTechnologyStatusQualificationTime()) |
| | | .setGpo(equipmentImportVo.getGpo()); |
| | | if(equipmentCategory.getEquipmentCategoryUda1().equals("weldingMachine")){ |
| | | equipment.setCheckPeriod(365*3+""); |
| | | } |
| | | if(equipmentCategory.getEquipmentCategoryUda1().equals("filesCarousel")){ |
| | | equipment.setCheckPeriod(365*4+""); |
| | | } |
| | | if(equipmentCategory.getEquipmentCategoryUda1().equals("tester")){ |
| | | equipment.setCheckPeriod(365*1+""); |
| | | } |
| | | if( |
| | | !equipmentCategory.getEquipmentCategoryUda1().equals("weldingMachine") |
| | | &&!equipmentCategory.getEquipmentCategoryUda1().equals("filesCarousel") |
| | | &&!equipmentCategory.getEquipmentCategoryUda1().equals("tester") |
| | | ){ |
| | | if(StringUtils.isNotBlank(abc)){ |
| | | if(abc.equals("A")){ |
| | | equipment.setCheckPeriod(365*3+""); |
| | | } |
| | | if( |
| | | abc.equals("B") |
| | | ||abc.equals("C") |
| | | ||abc.equals("D") |
| | | ){ |
| | | equipment.setCheckPeriod(365*4+""); |
| | | } |
| | | } |
| | | } |
| | | equipmentService.save(equipment); |
| | | }else { |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:统一编码已存在,数据重复导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if(exceptionNum!=0){ |
| | | String headInfo = "小导提醒您!设备台账:导入成功"+(list.size()-exceptionNum)+"条,失败"+exceptionNum+"条"; |
| | | MessageDTO messageDTO = new MessageDTO(); |
| | | messageDTO.setTitle(headInfo); |
| | | messageDTO.setFromUser("数据导入小助手-小导"); |
| | | messageDTO.setCategory("导入操作附加信息"); |
| | | messageDTO.setContent(exceptionInfo); |
| | | messageDTO.setToUser(user.getUsername()); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | return Result.OK(headInfo+",可在-系统消息-查看导入详情"); |
| | | } |
| | | return Result.OK("导入成功,已导入全部数据。"); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | return Result.error("文件导入失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | return Result.error("文件导入失败!"); |
| | | } |
| | | @GetMapping(value = "/getEquipmentStansdardList") |
| | | @PermissionData |
| | | public Result<IPage<DailyInspectionStandardDetail>> getEquipmentStansdardList(DailyInspectionStandardDetail standardDetail, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<DailyInspectionStandardDetail> queryWrapper = QueryGenerator.initQueryWrapper(standardDetail, req.getParameterMap()); |
| | | Page<DailyInspectionStandardDetail> page = new Page<DailyInspectionStandardDetail>(pageNo, pageSize); |
| | | IPage<DailyInspectionStandardDetail> pageList = equipmentService.getStandardList(page,standardDetail.getEquipmentId(),standardDetail.getType()); |
| | | return Result.OK(pageList); |
| | | } |
| | | @PostMapping("addLine") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> addLine(@RequestBody Equipment equipment){ |
| | | equipment.setIsLineEquip("no"); |
| | | equipment.setIsLine("yes"); |
| | | equipmentService.save(equipment); |
| | | List<Equipment> equipmentList = equipment.getEquipmentOfLineTable(); |
| | | for(Equipment equipment1:equipmentList){ |
| | | equipment1.setId(equipment1.getShowId()); |
| | | equipment1.setIsLineEquip("yes"); |
| | | equipment1.setLineId(equipment.getId()); |
| | | } |
| | | equipmentService.updateBatchById(equipmentList); |
| | | return Result.OK("添加成功"); |
| | | } |
| | | @PutMapping("editLine") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> editLine(@RequestBody Equipment equipment){ |
| | | equipmentService.updateById(equipment); |
| | | equipmentService.update(new UpdateWrapper<Equipment>() |
| | | .eq("line_id",equipment.getId()) |
| | | .set("line_id",null) |
| | | .set("is_meta",null) |
| | | .set("is_line_equip","no")); |
| | | List<Equipment> equipmentList = equipment.getEquipmentOfLineTable(); |
| | | for(Equipment equipment1:equipmentList){ |
| | | equipment1.setLineId(equipment.getId()); |
| | | String id = equipment1.getId(); |
| | | if(StringUtils.isBlank(id)){ |
| | | equipment1.setId(equipment1.getShowId()); |
| | | } |
| | | equipment1.setIsLineEquip("yes"); |
| | | } |
| | | equipmentService.updateBatchById(equipmentList); |
| | | return Result.OK("编辑成功"); |
| | | } |
| | | @PostMapping("/updateKeyEquipment") |
| | | public Result<?>updateKeyEquipment(@RequestBody Equipment equipment){ |
| | | equipmentService.update(new UpdateWrapper<Equipment>().eq("specific_equipment","0").set("specific_equipment",null)); |
| | | List<Equipment> keyEquipmentUpdateList = equipment.getKeyEquipmentUpdateList(); |
| | | for(Equipment updateEquipment:keyEquipmentUpdateList){ |
| | | updateEquipment.setId(updateEquipment.getEquipmentId()); |
| | | equipmentService.updateById(updateEquipment); |
| | | } |
| | | return Result.OK("修改成功"); |
| | | } |
| | | |
| | | /** |
| | | *设备台站-保养标准 |
| | | */ |
| | | @GetMapping("getEquipmentListAllStandard") |
| | | public Result<?> getEquipmentListAllStandard(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> equipmentListAllStandards = equipmentService.getEquipmentListAllStandard(pageNo, pageSize, params); |
| | | List<Map<String, Object>> records = equipmentListAllStandards.getRecords(); |
| | | for (Map<String, Object> record : records) { |
| | | String id = (String) record.get("id"); |
| | | String precisionParameters = (String)record.get("precisionParameters"); |
| | | if("1".equals(precisionParameters)){ |
| | | record.put("yseNoPrecisionParameters","0"); |
| | | }else{ |
| | | record.put("yseNoPrecisionParameters","1"); |
| | | } |
| | | List<DailyInspectionStandard> dailyInspectionStandards = dailyInspectionStandardService.lambdaQuery() |
| | | .eq(DailyInspectionStandard::getEquipmentId, id) |
| | | .eq(DailyInspectionStandard::getVersionStatus, "2") |
| | | .list(); |
| | | if(dailyInspectionStandards.size()>0){ |
| | | record.put("yseNoInspectionStandard","0"); |
| | | }else{ |
| | | record.put("yseNoInspectionStandard","1"); |
| | | } |
| | | List<MaintenanceStandard> maintenance2Standards = maintenanceStandardService.lambdaQuery() |
| | | .eq(MaintenanceStandard::getEquipmentId, id) |
| | | .eq(MaintenanceStandard::getMaintenanceType, "2") |
| | | .eq(MaintenanceStandard::getVersionStatus, "2").list(); |
| | | if(maintenance2Standards.size()>0){ |
| | | record.put("yseNoMaintenance2Standard","0"); |
| | | }else{ |
| | | record.put("yseNoMaintenance2Standard","1"); |
| | | } |
| | | |
| | | List<MaintenanceStandard> maintenance3Standards = maintenanceStandardService.lambdaQuery() |
| | | .eq(MaintenanceStandard::getEquipmentId, id) |
| | | .eq(MaintenanceStandard::getMaintenanceType, "3") |
| | | .eq(MaintenanceStandard::getVersionStatus, "2").list(); |
| | | if(maintenance3Standards.size()>0){ |
| | | record.put("yseNoMaintenance3Standard","0"); |
| | | }else{ |
| | | record.put("yseNoMaintenance3Standard","1"); |
| | | } |
| | | |
| | | } |
| | | return Result.ok(equipmentListAllStandards); |
| | | } |
| | | @GetMapping(value = "/planEquipmentList") |
| | | @PermissionData |
| | | public Result<IPage<Equipment>> planEquipmentList(Equipment equipment, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<Equipment> queryWrapper = QueryGenerator.initQueryWrapper(equipment, req.getParameterMap()); |
| | | //根据下次三保时间排序 |
| | | queryWrapper.orderByAsc("next_third_maintenance_time"); |
| | | //如果startTime和endTime不为空,则查询下次三保时间在这个时间段内的设备 |
| | | if(equipment.getStartTime()!=null && equipment.getEndTime()!=null){ |
| | | queryWrapper.between("next_third_maintenance_time",equipment.getStartTime(),equipment.getEndTime()); |
| | | } |
| | | Page<Equipment> page = new Page<Equipment>(pageNo, pageSize); |
| | | IPage<Equipment> pageList = equipmentService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | /** |
| | | * 检索设备 |
| | | * @param keyword 查询关键词 设备编号,设备名称模糊匹配 |
| | | * @param pageSize 一次返回多少记录 |
| | | * @param id 设备主键 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "设备表-异步加载设备列表", notes = "设备表-异步加载设备列表") |
| | | @GetMapping(value = "/asyncLoadEquipment") |
| | | public Result<?> asyncLoadEquipment(@RequestParam(name="keyword",required = false) String keyword, |
| | | @RequestParam(value = "pageSize", required = false, defaultValue = "20") Integer pageSize, |
| | | @RequestParam(name="id",required = false) String id) { |
| | | List<EquipmentSearchResult> resultList = eamEquipmentService.asyncLoadEquipment(keyword, pageSize, id); |
| | | return Result.ok(resultList); |
| | | } |
| | | |
| | | } |