| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import org.apache.commons.lang3.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.system.api.ISysBaseAPI; |
| | | import org.jeecg.common.system.base.entity.SysUpload; |
| | | import org.jeecg.common.system.base.entity.SysUploadRela; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.StrUtils; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.entity.CalibrationOrderReport; |
| | | import org.jeecg.modules.eam.entity.EquipmentDocument; |
| | | import org.jeecg.modules.eam.service.ICalibrationOrderReportService; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.service.*; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import org.jeecg.modules.system.entity.*; |
| | | import org.jeecg.modules.system.service.*; |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | |
| | | /** |
| | | /** |
| | | * @Description: mom_eam_calibration_order_report |
| | | * @Author: jeecg-boot |
| | | * @Date: 2023-07-20 |
| | | * @Date: 2023-07-20 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Api(tags="mom_eam_calibration_order_report") |
| | | @Api(tags = "mom_eam_calibration_order_report") |
| | | @RestController |
| | | @RequestMapping("/eam/calibrationOrderReport") |
| | | @Slf4j |
| | | public class CalibrationOrderReportController extends JeecgController<CalibrationOrderReport, ICalibrationOrderReportService> { |
| | | @Autowired |
| | | private ICalibrationOrderReportService calibrationOrderReportService; |
| | | @Autowired |
| | | private ICalibrationOrderReportService calibrationOrderReportService; |
| | | |
| | | @Autowired |
| | | private ISysBaseAPI sysBaseApi; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | | * @param calibrationOrderReport |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "mom_eam_calibration_order_report-分页列表查询") |
| | | @ApiOperation(value="mom_eam_calibration_order_report-分页列表查询", notes="mom_eam_calibration_order_report-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<IPage<CalibrationOrderReport>> queryPageList(CalibrationOrderReport calibrationOrderReport, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<CalibrationOrderReport> queryWrapper = QueryGenerator.initQueryWrapper(calibrationOrderReport, req.getParameterMap()); |
| | | Page<CalibrationOrderReport> page = new Page<CalibrationOrderReport>(pageNo, pageSize); |
| | | IPage<CalibrationOrderReport> pageList = calibrationOrderReportService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | @Autowired |
| | | private ICalibrationOrderService calibrationOrderService; |
| | | @Autowired |
| | | private ISysBaseAPI sysBaseApi; |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/add") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> add(MultipartHttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | String str = request.getParameter("data"); |
| | | JSONObject json = JSONObject.parseObject(str); |
| | | @Autowired |
| | | private IEamEquipmentService eamEquipmentService; |
| | | |
| | | boolean isFileChange = true; |
| | | String uploadId = json.getString("uploadId"); |
| | | String fileType = json.getString("fileType"); |
| | | String description = json.getString("remark"); |
| | | String type = json.getString("type"); |
| | | @Autowired |
| | | private IDailyInspectionStandardService dailyInspectionStandardService; |
| | | |
| | | CalibrationOrderReport calibrationOrderReport = json.toJavaObject(CalibrationOrderReport.class); |
| | | calibrationOrderReport.setType(fileType); |
| | | calibrationOrderReportService.save(calibrationOrderReport); |
| | | // 文件变更 |
| | | if (isFileChange) { |
| | | if (StrUtils.isNotBlankOrNull(uploadId)) { |
| | | // 情形一、从文件管理中选择 |
| | | // uploadRelaService.saveOrUpdateUploadRale(partRouteFile.getId(), partRouteFile.getType(), uploadId); |
| | | } else { |
| | | // 情形二、重新上传 |
| | | // 1、持久upload |
| | | MultipartFile multipartFile = request.getFile("file"); |
| | | List<MultipartFile> multipartFileList = new ArrayList<>(); |
| | | multipartFileList.add(multipartFile); |
| | | // List<SysUpload> sysUploads = uploadService.batchUploadFile(fileType, multipartFileList, description); |
| | | // // 2、创建/修改 uploadRela |
| | | // // 注:当前视为单文件上传控制,后续可能会有单个产品工艺文件对应多个上传文件的升级调整,修改后注意更细此段注释 |
| | | // uploadRelaService.saveOrUpdateUploadRale(equipmentDocument.getId(), type, sysUploads.get(0).getId()); |
| | | List<SysUpload> sysUploads = sysBaseApi.batchUploadFile(fileType, multipartFileList, description); |
| | | // 2、创建/修改 uploadRela |
| | | // 注:当前视为单文件上传控制,后续可能会有单个产品工艺文件对应多个上传文件的升级调整,修改后注意更细此段注释 |
| | | sysBaseApi.saveOrUpdateUploadRale(calibrationOrderReport.getId(), type, sysUploads.get(0).getId()); |
| | | } |
| | | } |
| | | @Autowired |
| | | private IInspectionOrderService inspectionOrderService; |
| | | |
| | | return Result.ok("上传成功!"); |
| | | } |
| | | @Autowired |
| | | private IDailyMaintenanceOrderService dailyMaintenanceOrderService; |
| | | |
| | | @PostMapping(value = "/edit") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> edit(MultipartHttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | String str = request.getParameter("data"); |
| | | JSONObject json = JSONObject.parseObject(str); |
| | | |
| | | boolean isFileChange = json.getBoolean("isFileChange"); |
| | | String uploadId = json.getString("uploadId"); |
| | | String fileType = json.getString("fileType"); |
| | | String description = json.getString("remark"); |
| | | String type = json.getString("type"); |
| | | |
| | | CalibrationOrderReport calibrationOrderReport = json.toJavaObject(CalibrationOrderReport.class); |
| | | calibrationOrderReport.setType(fileType); |
| | | calibrationOrderReportService.saveOrUpdate(calibrationOrderReport); |
| | | // 文件变更 |
| | | if (isFileChange) { |
| | | if (StrUtils.isNotBlankOrNull(uploadId)) { |
| | | // 情形一、从文件管理中选择 |
| | | // uploadRelaService.saveOrUpdateUploadRale(partRouteFile.getId(), partRouteFile.getType(), uploadId); |
| | | } else { |
| | | // 情形二、重新上传 |
| | | // 1、持久upload |
| | | MultipartFile multipartFile = request.getFile("file"); |
| | | List<MultipartFile> multipartFileList = new ArrayList<>(); |
| | | multipartFileList.add(multipartFile); |
| | | // List<SysUpload> sysUploads = uploadService.batchUploadFile(fileType, multipartFileList, description); |
| | | // // 2、创建/修改 uploadRela |
| | | // // 注:当前视为单文件上传控制,后续可能会有单个产品工艺文件对应多个上传文件的升级调整,修改后注意更细此段注释 |
| | | // uploadRelaService.saveOrUpdateUploadRale(equipmentDocument.getId(), type, sysUploads.get(0).getId()); |
| | | List<SysUpload> sysUploads = sysBaseApi.batchUploadFile(fileType, multipartFileList, description); |
| | | // 2、创建/修改 uploadRela |
| | | // 注:当前视为单文件上传控制,后续可能会有单个产品工艺文件对应多个上传文件的升级调整,修改后注意更细此段注释 |
| | | sysBaseApi.saveOrUpdateUploadRale(calibrationOrderReport.getId(), type, sysUploads.get(0).getId()); |
| | | } |
| | | } |
| | | |
| | | return Result.ok("上传成功!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "mom_eam_calibration_order_report-通过id删除") |
| | | @ApiOperation(value="mom_eam_calibration_order_report-通过id删除", notes="mom_eam_calibration_order_report-通过id删除") |
| | | //@RequiresPermissions("org.jeecg.modules:mom_eam_calibration_order_report:delete") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<String> delete(@RequestParam(name="id",required=true) String id) { |
| | | //删除文件管理与业务数据关系 |
| | | // List<SysUploadRela> sysUploadRelas = uploadRelaService.lambdaQuery().eq(SysUploadRela::getBusId, id).eq(SysUploadRela::getDelFlag, 0).list(); |
| | | List<SysUploadRela> sysUploadRelas = sysBaseApi.listByBusIdAndBusType(id, null); |
| | | for (SysUploadRela sysUploadRela : sysUploadRelas) { |
| | | String uploadId = sysUploadRela.getUploadId(); |
| | | // uploadService.removeById(uploadId); |
| | | // uploadRelaService.removeById(sysUploadRela); |
| | | sysBaseApi.removeUploadById(uploadId); |
| | | sysBaseApi.removeUploadRelaById(sysUploadRela.getId()); |
| | | } |
| | | calibrationOrderReportService.removeById(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "mom_eam_calibration_order_report-批量删除") |
| | | @ApiOperation(value="mom_eam_calibration_order_report-批量删除", notes="mom_eam_calibration_order_report-批量删除") |
| | | //@RequiresPermissions("org.jeecg.modules:mom_eam_calibration_order_report:deleteBatch") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | this.calibrationOrderReportService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "mom_eam_calibration_order_report-通过id查询") |
| | | @ApiOperation(value="mom_eam_calibration_order_report-通过id查询", notes="mom_eam_calibration_order_report-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<CalibrationOrderReport> queryById(@RequestParam(name="id",required=true) String id) { |
| | | CalibrationOrderReport calibrationOrderReport = calibrationOrderReportService.getById(id); |
| | | if(calibrationOrderReport==null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |
| | | return Result.OK(calibrationOrderReport); |
| | | } |
| | | @Resource |
| | | private ISysRoleService sysRoleService; |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | @Resource |
| | | private ISysDictItemService sysDictItemService; |
| | | @Resource |
| | | private ISysUserRoleService sysUserRoleService; |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | /** |
| | | * 导出excel |
| | | * |
| | | * @param request |
| | | * @param calibrationOrderReport |
| | | */ |
| | | * 分页列表查询 |
| | | * |
| | | * @param calibrationOrderReport |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "mom_eam_calibration_order_report-分页列表查询") |
| | | @ApiOperation(value = "mom_eam_calibration_order_report-分页列表查询", notes = "mom_eam_calibration_order_report-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<IPage<CalibrationOrderReport>> queryPageList(CalibrationOrderReport calibrationOrderReport, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { |
| | | QueryWrapper<CalibrationOrderReport> queryWrapper = QueryGenerator.initQueryWrapper(calibrationOrderReport, req.getParameterMap()); |
| | | Page<CalibrationOrderReport> page = new Page<CalibrationOrderReport>(pageNo, pageSize); |
| | | IPage<CalibrationOrderReport> pageList = calibrationOrderReportService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/add") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> add(MultipartHttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | String str = request.getParameter("data"); |
| | | JSONObject json = JSONObject.parseObject(str); |
| | | |
| | | boolean isFileChange = true; |
| | | String uploadId = json.getString("uploadId"); |
| | | String fileType = json.getString("fileType"); |
| | | String description = json.getString("remark"); |
| | | String type = json.getString("type"); |
| | | |
| | | CalibrationOrderReport calibrationOrderReport = json.toJavaObject(CalibrationOrderReport.class); |
| | | calibrationOrderReport.setType(fileType); |
| | | calibrationOrderReportService.save(calibrationOrderReport); |
| | | |
| | | // 文件变更 |
| | | if (isFileChange) { |
| | | if (StrUtils.isNotBlankOrNull(uploadId)) { |
| | | // 情形一、从文件管理中选择 |
| | | // uploadRelaService.saveOrUpdateUploadRale(partRouteFile.getId(), partRouteFile.getType(), uploadId); |
| | | } else { |
| | | // 情形二、重新上传 |
| | | // 1、持久upload |
| | | MultipartFile multipartFile = request.getFile("file"); |
| | | List<MultipartFile> multipartFileList = new ArrayList<>(); |
| | | multipartFileList.add(multipartFile); |
| | | // List<SysUpload> sysUploads = uploadService.batchUploadFile(fileType, multipartFileList, description); |
| | | // // 2、创建/修改 uploadRela |
| | | // // 注:当前视为单文件上传控制,后续可能会有单个产品工艺文件对应多个上传文件的升级调整,修改后注意更细此段注释 |
| | | // uploadRelaService.saveOrUpdateUploadRale(equipmentDocument.getId(), type, sysUploads.get(0).getId()); |
| | | List<SysUpload> sysUploads = sysBaseApi.batchUploadFile(fileType, multipartFileList, description); |
| | | // 2、创建/修改 uploadRela |
| | | // 注:当前视为单文件上传控制,后续可能会有单个产品工艺文件对应多个上传文件的升级调整,修改后注意更细此段注释 |
| | | sysBaseApi.saveOrUpdateUploadRale(calibrationOrderReport.getId(), type, sysUploads.get(0).getId()); |
| | | } |
| | | } |
| | | // 更新主表为已完成 |
| | | CalibrationOrder calibrationOrder = calibrationOrderService.getById(calibrationOrderReport.getCalibrationOrderId()); |
| | | // status 已完成 |
| | | calibrationOrder.setStatus("2"); |
| | | // calibrationOrder.setCalibrationResult(calibrationOrderReport.getJudgmentResult()); |
| | | // calibrationOrder.setCalibrationTime(new Date()); |
| | | calibrationOrderService.updateById(calibrationOrder); |
| | | // // 更新设备技术状态 |
| | | // Equipment equipment = eamEquipmentService.getById(calibrationOrder.getEquipmentId()); |
| | | // |
| | | // if (StringUtils.isNotBlank(equipment.getId())) { |
| | | // equipment.setTechnologyStatus(calibrationOrderReport.getJudgmentResult()); |
| | | // eamEquipmentService.updateById(equipment); |
| | | // } |
| | | return Result.ok("上传成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 根据检定结果 修改设备技术状态 |
| | | * @return |
| | | */ |
| | | // @PostMapping(value = "/editEquipmentTechnologyStatus") |
| | | @RequestMapping(value = "/editEquipmentTechnologyStatus", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> editEquipmentTechnologyStatus(@RequestBody CalibrationOrderReport calibrationOrderReport){ |
| | | String status = calibrationOrderReport.getStatus(); |
| | | CalibrationOrder calibrationOrder = calibrationOrderService.getById(calibrationOrderReport.getId()); |
| | | if("3".equals(status)){//3:已驳回 |
| | | calibrationOrder.setStatus("3"); |
| | | calibrationOrder.setRemark(calibrationOrderReport.getRemark()); |
| | | calibrationOrder.setCalibrationResult(calibrationOrderReport.getJudgmentResult()); |
| | | calibrationOrderService.updateById(calibrationOrder); |
| | | return Result.ok("驳回成功!"); |
| | | }else{ |
| | | calibrationOrder.setStatus("4"); |
| | | calibrationOrder.setRemark(calibrationOrderReport.getRemark()); |
| | | calibrationOrder.setCalibrationResult(calibrationOrderReport.getJudgmentResult()); |
| | | calibrationOrder.setCalibrationTime(new Date()); |
| | | calibrationOrderService.updateById(calibrationOrder); |
| | | // 更新设备技术状态 |
| | | Equipment equipment = eamEquipmentService.getById(calibrationOrder.getEquipmentId()); |
| | | |
| | | if (StringUtils.isNotBlank(equipment.getId())) { |
| | | equipment.setTechnologyStatus(calibrationOrderReport.getJudgmentResult()); |
| | | eamEquipmentService.updateById(equipment); |
| | | |
| | | this.equipmentTechnologyStatuAlart(equipment.getNum(),equipment.getTechnologyStatus()); |
| | | } |
| | | String judgmentResult = calibrationOrderReport.getJudgmentResult(); |
| | | if("disabledScrapping".equals(judgmentResult)){ |
| | | this.cancleAllOrder(equipment.getId()); |
| | | } |
| | | return Result.ok("设备技术状态修改完成!"); |
| | | } |
| | | } |
| | | |
| | | void equipmentTechnologyStatuAlart(String equipmentNum,String technologyStatus){ |
| | | |
| | | SysDict sysDictT = sysDictService.getOne(new QueryWrapper<SysDict>().eq("dict_code","technology_status"),false); |
| | | SysDictItem sysDictItemt = sysDictItemService.getOne(new QueryWrapper<SysDictItem>().eq("item_value",technologyStatus) |
| | | .eq("dict_id",sysDictT.getId()),false); |
| | | |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | SysDict sysDict = sysDictService.getOne(new QueryWrapper<SysDict>().eq("dict_code","info_type"),false); |
| | | SysDictItem sysDictItem = sysDictItemService.getOne(new QueryWrapper<SysDictItem>().eq("item_text","运保设备管理员") |
| | | .eq("dict_id",sysDict.getId()),false); |
| | | String roleCode = sysDictItem.getItemValue(); |
| | | SysRole sysRole = sysRoleService.getOne(new QueryWrapper<SysRole>().eq("role_code",roleCode),false); |
| | | List<SysUserRole> sysUserRoles = sysUserRoleService.list(new QueryWrapper<SysUserRole>().eq("role_id",sysRole.getId())); |
| | | for(SysUserRole sysUserRole:sysUserRoles){ |
| | | SysUser user = sysUserService.getById(sysUserRole.getUserId()); |
| | | String msg = sysUser.getRealname()+"将统一编号为【"+equipmentNum+"】的技术状态修改为【"+sysDictItemt.getItemText()+"】"; |
| | | MessageDTO messageDTO = new MessageDTO(); |
| | | messageDTO.setTitle("设备台账技术状态修改"); |
| | | messageDTO.setContent(msg); |
| | | messageDTO.setCategory("运保设备管理员"); |
| | | messageDTO.setFromUser("设备台账技术状态修改提醒小助手"); |
| | | messageDTO.setToUser(user.getUsername()); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | } |
| | | } |
| | | |
| | | void cancleAllOrder(String equipmentId){ |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | //如果技术状态鉴定 为禁用(已提交报废) 状态 对应当前点检标准失效,改为统一的点检标准(徐静提供),原点检工单、二保工单、三保工单全部取消, |
| | | List<DailyInspectionStandard> dailyInspectionStandards = dailyInspectionStandardService.lambdaQuery() |
| | | .eq(DailyInspectionStandard::getVersionStatus, "2") |
| | | .eq(DailyInspectionStandard::getEquipmentId, equipmentId) |
| | | .eq(DailyInspectionStandard::getDelFlag, "0").list(); |
| | | for (DailyInspectionStandard dailyInspectionStandard : dailyInspectionStandards) { |
| | | dailyInspectionStandard.setVersionStatus("3"); |
| | | dailyInspectionStandard.setLoseEfficacyPerson(sysUser.getRealname()); |
| | | dailyInspectionStandard.setLoseEfficacyTime(new Date()); |
| | | dailyInspectionStandardService.updateById(dailyInspectionStandard); |
| | | } |
| | | |
| | | List<InspectionOrder> inspectionOrders = inspectionOrderService.lambdaQuery() |
| | | .eq(InspectionOrder::getStatus, "1") |
| | | .eq(InspectionOrder::getEquipmentId, equipmentId) |
| | | .eq(InspectionOrder::getDelFlag, "0").list(); |
| | | for (InspectionOrder inspectionOrder : inspectionOrders) { |
| | | inspectionOrder.setStatus("7"); |
| | | inspectionOrderService.updateById(inspectionOrder); |
| | | } |
| | | |
| | | List<DailyMaintenanceOrder> dailyMaintenanceOrders = dailyMaintenanceOrderService.lambdaQuery() |
| | | .eq(DailyMaintenanceOrder::getStatus, "1") |
| | | .eq(DailyMaintenanceOrder::getEquipmentId, equipmentId) |
| | | .eq(DailyMaintenanceOrder::getDelFlag, "0").list(); |
| | | for (DailyMaintenanceOrder dailyMaintenanceOrder : dailyMaintenanceOrders) { |
| | | dailyMaintenanceOrder.setStatus("7"); |
| | | dailyMaintenanceOrderService.updateById(dailyMaintenanceOrder); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping(value = "/edit") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> edit(MultipartHttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | String str = request.getParameter("data"); |
| | | JSONObject json = JSONObject.parseObject(str); |
| | | |
| | | boolean isFileChange = json.getBoolean("isFileChange"); |
| | | String uploadId = json.getString("uploadId"); |
| | | String fileType = json.getString("fileType"); |
| | | String description = json.getString("remark"); |
| | | String type = json.getString("type"); |
| | | |
| | | CalibrationOrderReport calibrationOrderReport = json.toJavaObject(CalibrationOrderReport.class); |
| | | calibrationOrderReport.setType(fileType); |
| | | calibrationOrderReportService.saveOrUpdate(calibrationOrderReport); |
| | | // 文件变更 |
| | | if (isFileChange) { |
| | | if (StrUtils.isNotBlankOrNull(uploadId)) { |
| | | // 情形一、从文件管理中选择 |
| | | // uploadRelaService.saveOrUpdateUploadRale(partRouteFile.getId(), partRouteFile.getType(), uploadId); |
| | | } else { |
| | | // 情形二、重新上传 |
| | | // 1、持久upload |
| | | MultipartFile multipartFile = request.getFile("file"); |
| | | List<MultipartFile> multipartFileList = new ArrayList<>(); |
| | | multipartFileList.add(multipartFile); |
| | | // List<SysUpload> sysUploads = uploadService.batchUploadFile(fileType, multipartFileList, description); |
| | | // // 2、创建/修改 uploadRela |
| | | // // 注:当前视为单文件上传控制,后续可能会有单个产品工艺文件对应多个上传文件的升级调整,修改后注意更细此段注释 |
| | | // uploadRelaService.saveOrUpdateUploadRale(equipmentDocument.getId(), type, sysUploads.get(0).getId()); |
| | | List<SysUpload> sysUploads = sysBaseApi.batchUploadFile(fileType, multipartFileList, description); |
| | | // 2、创建/修改 uploadRela |
| | | // 注:当前视为单文件上传控制,后续可能会有单个产品工艺文件对应多个上传文件的升级调整,修改后注意更细此段注释 |
| | | sysBaseApi.saveOrUpdateUploadRale(calibrationOrderReport.getId(), type, sysUploads.get(0).getId()); |
| | | } |
| | | } |
| | | |
| | | return Result.ok("上传成功!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "mom_eam_calibration_order_report-通过id删除") |
| | | @ApiOperation(value = "mom_eam_calibration_order_report-通过id删除", notes = "mom_eam_calibration_order_report-通过id删除") |
| | | //@RequiresPermissions("org.jeecg.modules:mom_eam_calibration_order_report:delete") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<String> delete(@RequestParam(name = "id", required = true) String id) { |
| | | //删除文件管理与业务数据关系 |
| | | // List<SysUploadRela> sysUploadRelas = uploadRelaService.lambdaQuery().eq(SysUploadRela::getBusId, id).eq(SysUploadRela::getDelFlag, 0).list(); |
| | | List<SysUploadRela> sysUploadRelas = sysBaseApi.listByBusIdAndBusType(id, null); |
| | | for (SysUploadRela sysUploadRela : sysUploadRelas) { |
| | | String uploadId = sysUploadRela.getUploadId(); |
| | | // uploadService.removeById(uploadId); |
| | | // uploadRelaService.removeById(sysUploadRela); |
| | | sysBaseApi.removeUploadById(uploadId); |
| | | sysBaseApi.removeUploadRelaById(sysUploadRela.getId()); |
| | | } |
| | | calibrationOrderReportService.removeById(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "mom_eam_calibration_order_report-批量删除") |
| | | @ApiOperation(value = "mom_eam_calibration_order_report-批量删除", notes = "mom_eam_calibration_order_report-批量删除") |
| | | //@RequiresPermissions("org.jeecg.modules:mom_eam_calibration_order_report:deleteBatch") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | | this.calibrationOrderReportService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "mom_eam_calibration_order_report-通过id查询") |
| | | @ApiOperation(value = "mom_eam_calibration_order_report-通过id查询", notes = "mom_eam_calibration_order_report-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<CalibrationOrderReport> queryById(@RequestParam(name = "id", required = true) String id) { |
| | | CalibrationOrderReport calibrationOrderReport = calibrationOrderReportService.getById(id); |
| | | if (calibrationOrderReport == null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |
| | | return Result.OK(calibrationOrderReport); |
| | | } |
| | | |
| | | /** |
| | | * 导出excel |
| | | * |
| | | * @param request |
| | | * @param calibrationOrderReport |
| | | */ |
| | | //@RequiresPermissions("org.jeecg.modules:mom_eam_calibration_order_report:exportXls") |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, CalibrationOrderReport calibrationOrderReport) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 通过excel导入数据 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | * 通过excel导入数据 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | //@RequiresPermissions("mom_eam_calibration_order_report:importExcel") |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设备检定 获取检定报告 |
| | | * qsw 2023-7-20 |
| | | */ |
| | | @GetMapping("getCalibrationOrderReportList") |
| | | public Result<?> getCalibrationOrderReportList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> calibrationOrderReports = calibrationOrderReportService.getCalibrationOrderReportById(pageNo, pageSize, params); |
| | | for (Map<String, Object> calibrationOrderReport : calibrationOrderReports.getRecords()) { |
| | | //获取是否有无异常照片数据 |
| | | /** |
| | | * 设备检定 获取检定报告 |
| | | * qsw 2023-7-20 |
| | | */ |
| | | @GetMapping("getCalibrationOrderReportList") |
| | | public Result<?> getCalibrationOrderReportList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> calibrationOrderReports = calibrationOrderReportService.getCalibrationOrderReportById(pageNo, pageSize, params); |
| | | for (Map<String, Object> calibrationOrderReport : calibrationOrderReports.getRecords()) { |
| | | //获取是否有无异常照片数据 |
| | | // List<SysUploadRela> sysUploadRelas = uploadRelaService.lambdaQuery().eq(SysUploadRela::getBusId, (String) calibrationOrderReport.get("id")).eq(SysUploadRela::getDelFlag, 0).list(); |
| | | List<SysUploadRela> sysUploadRelas =sysBaseApi.listByBusIdAndBusType((String) calibrationOrderReport.get("id"), null); |
| | | if (sysUploadRelas.size() > 0) { |
| | | List<SysUploadRela> sysUploadRelas = sysBaseApi.listByBusIdAndBusType((String) calibrationOrderReport.get("id"), null); |
| | | if (sysUploadRelas.size() > 0) { |
| | | |
| | | // List<SysUploadRela> uploadRelas = uploadRelaService.listByBusIdAndBusType((String) calibrationOrderReport.get("id"), "calibration_order_report"); |
| | | List<SysUploadRela> uploadRelas = sysBaseApi.listByBusIdAndBusType((String) calibrationOrderReport.get("id"), "calibration_order_report"); |
| | | SysUpload upload = new SysUpload(); |
| | | if (CollectionUtils.isNotEmpty(uploadRelas)) { |
| | | //upload = uploadService.getById(uploadRelas.get(0).getUploadId()); |
| | | upload = sysBaseApi.getUploadById(uploadRelas.get(0).getUploadId()); |
| | | } |
| | | calibrationOrderReport.put("upload", upload); |
| | | } else { |
| | | List<SysUploadRela> uploadRelas = sysBaseApi.listByBusIdAndBusType((String) calibrationOrderReport.get("id"), "calibration_order_report"); |
| | | SysUpload upload = new SysUpload(); |
| | | if (CollectionUtils.isNotEmpty(uploadRelas)) { |
| | | //upload = uploadService.getById(uploadRelas.get(0).getUploadId()); |
| | | upload = sysBaseApi.getUploadById(uploadRelas.get(0).getUploadId()); |
| | | } |
| | | calibrationOrderReport.put("upload", upload); |
| | | } else { |
| | | |
| | | SysUpload upload = new SysUpload(); |
| | | calibrationOrderReport.put("upload", upload); |
| | | } |
| | | } |
| | | return Result.ok(calibrationOrderReports); |
| | | } |
| | | SysUpload upload = new SysUpload(); |
| | | calibrationOrderReport.put("upload", upload); |
| | | } |
| | | } |
| | | return Result.ok(calibrationOrderReports); |
| | | } |
| | | |
| | | } |