| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.entity.DailyInspectionStandard; |
| | | import org.jeecg.modules.eam.entity.DailyInspectionStandardDetail; |
| | | import org.jeecg.modules.eam.entity.Equipment; |
| | | import org.jeecg.modules.eam.entity.EquipmentChange; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.spare.entity.*; |
| | | import org.jeecg.modules.spare.service.*; |
| | | import org.jeecg.modules.spare.vo.SparePartRequirementDeatilPage; |
| | |
| | | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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 javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.text.ParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description: 备件需求 |
| | |
| | | private ISparePartRequirementService sparePartScrapRequirementService; |
| | | @Autowired |
| | | private ISparePartRequirementDeatilService sparePartScrapRequirementDetailService; |
| | | |
| | | @Autowired |
| | | private IEamEquipmentService equipmentService; |
| | | |
| | | |
| | | /** |
| | |
| | | QueryWrapper<SparePartRequirement> queryWrapper = QueryGenerator.initQueryWrapper(sparePartScrap, req.getParameterMap()); |
| | | Page<SparePartRequirement> page = new Page<SparePartRequirement>(pageNo, pageSize); |
| | | IPage<SparePartRequirement> pageList = sparePartScrapRequirementService.page(page, queryWrapper); |
| | | for (SparePartRequirement record : pageList.getRecords()) { |
| | | String equipmentId = record.getEquipmentId(); |
| | | String id = record.getId(); |
| | | List<SparePartRequirementDeatil> sparePartRequirementDeatils = sparePartScrapRequirementDetailService.lambdaQuery() |
| | | .eq(SparePartRequirementDeatil::getSparePartRequirementId, id).eq(SparePartRequirementDeatil::getDelFlag, 0).list(); |
| | | record.setSparePartRequirementDeatilList(sparePartRequirementDeatils); |
| | | |
| | | if(StringUtils.isNotBlank(equipmentId)){ |
| | | Equipment equipment = equipmentService.getById(equipmentId); |
| | | record.setEquipmentNumNameModel(equipment.getNum()+"/"+equipment.getName()+"/"+equipment.getModel()); |
| | | } |
| | | } |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | @ApiOperation(value = "备件需求-分页列表查询", notes = "备件需求-分页列表查询") |
| | | @GetMapping(value = "/getSparePartRequirementDetails") |
| | | public Result<IPage<SparePartRequirementDeatil>> getSparePartRequirementDetails(SparePartRequirementDeatil sparePartRequirementDeatil, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<SparePartRequirementDeatil> queryWrapper = QueryGenerator.initQueryWrapper(sparePartRequirementDeatil, req.getParameterMap()); |
| | | Page<SparePartRequirementDeatil> page = new Page<SparePartRequirementDeatil>(pageNo, pageSize); |
| | | IPage<SparePartRequirementDeatil> pageList = sparePartScrapRequirementDetailService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | |
| | | SparePartRequirement sparePartRequirement = new SparePartRequirement(); |
| | | BeanUtils.copyProperties(sparePartRequirementDeatilPage, sparePartRequirement); |
| | | sparePartScrapRequirementService.saveMain(sparePartRequirement, sparePartRequirementDeatilPage.getSparePartRequirementDeatilList()); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添 |
| | | */ |
| | | @AutoLog(value = "备件需求-添加") |
| | | @ApiOperation(value = "备件需求-添加", notes = "备件需求-添加") |
| | | @PostMapping(value = "/addNew") |
| | | public Result<String> addNew(@RequestBody SparePartRequirement sparePartRequirement) { |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | sparePartRequirement.setPerson(sysUser.getRealname()); |
| | | sparePartScrapRequirementService.save(sparePartRequirement); |
| | | List<SparePartRequirementDeatil> sparePartRequirementDeatilList = sparePartRequirement.getSparePartRequirementDeatilList(); |
| | | for (SparePartRequirementDeatil sparePartRequirementDeatil : sparePartRequirementDeatilList) { |
| | | sparePartRequirementDeatil.setSparePartRequirementId(sparePartRequirement.getId()); |
| | | sparePartScrapRequirementDetailService.save(sparePartRequirementDeatil); |
| | | } |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | */ |
| | | @AutoLog(value = "备件需求-编辑") |
| | | @ApiOperation(value = "备件需求-编辑", notes = "备件需求-编辑") |
| | | @RequestMapping(value = "/editNew", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<String> editNew(@RequestBody SparePartRequirement sparePartRequirement) { |
| | | sparePartScrapRequirementService.updateById(sparePartRequirement); |
| | | //1.删除备件明细 |
| | | List<SparePartRequirementDeatil> sparePartRequirementDeatils = sparePartScrapRequirementDetailService.lambdaQuery() |
| | | .eq(SparePartRequirementDeatil::getSparePartRequirementId, sparePartRequirement.getId()) |
| | | .eq(SparePartRequirementDeatil::getDelFlag, 0).list(); |
| | | for (SparePartRequirementDeatil sparePartRequirementDeatil : sparePartRequirementDeatils) { |
| | | sparePartScrapRequirementDetailService.removeById(sparePartRequirementDeatil); |
| | | } |
| | | //2.重新持久备件明细 |
| | | List<SparePartRequirementDeatil> sparePartRequirementDeatilList = sparePartRequirement.getSparePartRequirementDeatilList(); |
| | | for (SparePartRequirementDeatil sparePartRequirementDeatil : sparePartRequirementDeatilList) { |
| | | sparePartRequirementDeatil.setId(""); |
| | | sparePartRequirementDeatil.setSparePartRequirementId(sparePartRequirement.getId()); |
| | | sparePartScrapRequirementDetailService.save(sparePartRequirementDeatil); |
| | | } |
| | | return Result.OK("编辑成功!"); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<String> delete(@RequestParam(name = "id", required = true) String id) { |
| | | sparePartScrapRequirementService.delMain(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | @AutoLog(value = "备件需求-通过id删除") |
| | | @ApiOperation(value = "备件需求-通过id删除", notes = "备件需求-通过id删除") |
| | | @DeleteMapping(value = "/deleteNew") |
| | | public Result<String> deleteNew(@RequestParam(name = "id", required = true) String id) { |
| | | sparePartScrapRequirementService.removeById(id); |
| | | List<SparePartRequirementDeatil> sparePartRequirementDeatils = sparePartScrapRequirementDetailService.lambdaQuery() |
| | | .eq(SparePartRequirementDeatil::getSparePartRequirementId, id).list(); |
| | | for (SparePartRequirementDeatil sparePartRequirementDeatil : sparePartRequirementDeatils) { |
| | | sparePartScrapRequirementDetailService.removeById(sparePartRequirementDeatil); |
| | | } |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | |
| | | sparePartScrapRequirementService.submit(id); |
| | | |
| | | return Result.OK("提交成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 签审流程 |
| | | */ |
| | | @RequestMapping(value = "/auditApproval", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | @Transactional(rollbackFor = { Exception.class }) |
| | | public Result<String> auditApproval(@RequestBody SparePartRequirement sparePartRequirement) { |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | sparePartRequirement.setAuditPerson(sysUser.getRealname()); |
| | | sparePartRequirement.setAuditTime(new Date()); |
| | | boolean b = sparePartScrapRequirementService.updateById(sparePartRequirement); |
| | | if (b){ |
| | | return Result.OK("审核成功!"); |
| | | }else{ |
| | | return Result.error("审核失败!"); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | return Result.OK("文件导入失败!"); |
| | | } |
| | | |
| | | |
| | | |
| | | } |