From 4d6cf92e30c2c7f81f8cc31dfb7559a745782ec1 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期一, 23 六月 2025 13:24:07 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/controller/AssignEquipmentFileStreamController.java | 252 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 252 insertions(+), 0 deletions(-) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/controller/AssignEquipmentFileStreamController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/controller/AssignEquipmentFileStreamController.java new file mode 100644 index 0000000..5b57491 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/controller/AssignEquipmentFileStreamController.java @@ -0,0 +1,252 @@ +package org.jeecg.modules.dncFlow.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.dnc.entity.DeviceManagement; +import org.jeecg.modules.dnc.entity.DeviceType; +import org.jeecg.modules.dnc.entity.DocInfo; +import org.jeecg.modules.dnc.entity.DocRelative; +import org.jeecg.modules.dnc.service.IDeviceManagementService; +import org.jeecg.modules.dnc.service.IDeviceTypeService; +import org.jeecg.modules.dnc.service.IDocInfoService; +import org.jeecg.modules.dnc.service.IDocRelativeService; +import org.jeecg.modules.dncFlow.entity.AssignEquipmentFileStream; +import org.jeecg.modules.dncFlow.service.IAssignEquipmentFileStreamService; + +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.dncFlow.vo.AssignEquipmentFileStreamVo; +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.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +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 com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲 + * @Author: jeecg-boot + * @Date: 2025-06-17 + * @Version: V1.0 + */ +@Api(tags="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲") +@RestController +@RequestMapping("/dncFlow/assignEquipmentFileStream") +@Slf4j +public class AssignEquipmentFileStreamController extends JeecgController<AssignEquipmentFileStream, IAssignEquipmentFileStreamService> { + @Autowired + private IAssignEquipmentFileStreamService assignEquipmentFileStreamService; + + @Autowired + private IDeviceTypeService deviceTypeService; + + @Autowired + private IDeviceManagementService deviceManagementService; + + @Autowired + private IDocRelativeService docRelativeService; + + @Autowired + private IDocInfoService docInfoService; + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param assignEquipmentFileStream + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-鍒嗛〉鍒楄〃鏌ヨ", notes="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<IPage<AssignEquipmentFileStream>> queryPageList(AssignEquipmentFileStream assignEquipmentFileStream, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<AssignEquipmentFileStream> queryWrapper = QueryGenerator.initQueryWrapper(assignEquipmentFileStream, req.getParameterMap()); + Page<AssignEquipmentFileStream> page = new Page<AssignEquipmentFileStream>(pageNo, pageSize); + IPage<AssignEquipmentFileStream> pageList = assignEquipmentFileStreamService.page(page, queryWrapper); + return Result.OK(pageList); + } + + + /** + * 娴佺▼鍚姩,淇濆瓨瀵瑰簲鐨勬暟鎹� + * @param assignEquipmentFileStream + * @return + */ + @AutoLog(value = "DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-娴佺▼鍚姩,淇濆瓨瀵瑰簲鐨勬暟鎹�") + @ApiOperation(value="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-娴佺▼鍚姩,淇濆瓨瀵瑰簲鐨勬暟鎹�", notes="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-娴佺▼鍚姩,淇濆瓨瀵瑰簲鐨勬暟鎹�") + @PostMapping(value = "savaFlow") + public Result<?> saveAssignEquipmentFileStream(@RequestBody AssignEquipmentFileStream assignEquipmentFileStream){ + return assignEquipmentFileStreamService.saveAssignEquipmentFileStream(assignEquipmentFileStream); + } + + /** + * 娴佺▼鑺傜偣瀹℃牳 + * @param assignEquipmentFileStreamVo + * @return + */ + @AutoLog(value = "DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-娴佺▼鑺傜偣瀹℃牳") + @ApiOperation(value="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-娴佺▼鑺傜偣瀹℃牳", notes="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-娴佺▼鑺傜偣瀹℃牳") + @PostMapping(value = "audit") + public Result<?> auditAssignEquipmentFileStream(@RequestBody AssignEquipmentFileStreamVo assignEquipmentFileStreamVo){ + return assignEquipmentFileStreamService.auditAssignEquipmentFileStream(assignEquipmentFileStreamVo); + } + + /** + * 娣诲姞 + * + * @param assignEquipmentFileStream + * @return + */ + @AutoLog(value = "DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-娣诲姞") + @ApiOperation(value="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-娣诲姞", notes="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-娣诲姞") + //@RequiresPermissions("org.jeecg.modules:nc_assign_equipment_file_stream:add") + @PostMapping(value = "/add") + public Result<String> add(@RequestBody AssignEquipmentFileStream assignEquipmentFileStream) { + assignEquipmentFileStreamService.save(assignEquipmentFileStream); + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 鏌ヨ瀹$鍩烘湰淇℃伅 + * @param id + * @return + */ + @ApiOperation(value = "鏌ヨ瀹$鍩烘湰淇℃伅", notes = "鏌ヨ瀹$鍩烘湰淇℃伅") + @GetMapping(value = "/selectVoById") + public Result<?> selectVoById(@RequestParam(name="id") String id){ + List<AssignEquipmentFileStream> list = assignEquipmentFileStreamService.list(new QueryWrapper<AssignEquipmentFileStream>().eq("id", id)); + if (!list.isEmpty()){ + list.forEach(item->{ + DeviceType deviceType = deviceTypeService.getById(item.getDeviceTypeId()); + if (deviceType!=null){ + DeviceManagement deviceManagement = deviceManagementService.getById(deviceType.getDeviceManagementId()); + if (deviceManagement!=null){ + item.setDeviceTypeName(deviceManagement.getDeviceManagementName()); + } + } + DocRelative docRelative=docRelativeService.getById(item.getDocId()); + if (docRelative!=null){ + DocInfo docInfo = docInfoService.getById(docRelative.getDocId()); + item.setDocName(docInfo.getDocName()); + } + + }); + return Result.OK(list); + } + return Result.error("鏈壘鍒板搴旀暟鎹�"); + } + + /** + * 缂栬緫 + * + * @param assignEquipmentFileStream + * @return + */ + @AutoLog(value = "DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-缂栬緫") + @ApiOperation(value="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-缂栬緫", notes="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-缂栬緫") + //@RequiresPermissions("org.jeecg.modules:nc_assign_equipment_file_stream:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result<String> edit(@RequestBody AssignEquipmentFileStream assignEquipmentFileStream) { + assignEquipmentFileStreamService.updateById(assignEquipmentFileStream); + return Result.OK("缂栬緫鎴愬姛!"); + } + + /** + * 閫氳繃id鍒犻櫎 + * + * @param id + * @return + */ + @AutoLog(value = "DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-閫氳繃id鍒犻櫎") + @ApiOperation(value="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-閫氳繃id鍒犻櫎", notes="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-閫氳繃id鍒犻櫎") + //@RequiresPermissions("org.jeecg.modules:nc_assign_equipment_file_stream:delete") + @DeleteMapping(value = "/delete") + public Result<String> delete(@RequestParam(name="id",required=true) String id) { + assignEquipmentFileStreamService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } + + /** + * 鎵归噺鍒犻櫎 + * + * @param ids + * @return + */ + @AutoLog(value = "DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-鎵归噺鍒犻櫎") + @ApiOperation(value="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-鎵归噺鍒犻櫎", notes="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-鎵归噺鍒犻櫎") + //@RequiresPermissions("org.jeecg.modules:nc_assign_equipment_file_stream:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.assignEquipmentFileStreamService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("鎵归噺鍒犻櫎鎴愬姛!"); + } + + /** + * 閫氳繃id鏌ヨ + * + * @param id + * @return + */ + //@AutoLog(value = "DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-閫氳繃id鏌ヨ") + @ApiOperation(value="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-閫氳繃id鏌ヨ", notes="DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲-閫氳繃id鏌ヨ") + @GetMapping(value = "/queryById") + public Result<AssignEquipmentFileStream> queryById(@RequestParam(name="id",required=true) String id) { + AssignEquipmentFileStream assignEquipmentFileStream = assignEquipmentFileStreamService.getById(id); + if(assignEquipmentFileStream==null) { + return Result.error("鏈壘鍒板搴旀暟鎹�"); + } + return Result.OK(assignEquipmentFileStream); + } + + /** + * 瀵煎嚭excel + * + * @param request + * @param assignEquipmentFileStream + */ + //@RequiresPermissions("org.jeecg.modules:nc_assign_equipment_file_stream:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, AssignEquipmentFileStream assignEquipmentFileStream) { + return super.exportXls(request, assignEquipmentFileStream, AssignEquipmentFileStream.class, "DNC-璁惧缁撴瀯鏍戞寚娲句骇鍝佺粨鏋勬爲"); + } + + /** + * 閫氳繃excel瀵煎叆鏁版嵁 + * + * @param request + * @param response + * @return + */ + //@RequiresPermissions("nc_assign_equipment_file_stream:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, AssignEquipmentFileStream.class); + } + +} -- Gitblit v1.9.3