From 23855599412c4d61b38d78f0f3abd3430a48b5b1 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期三, 25 六月 2025 11:51:38 +0800 Subject: [PATCH] Merge branch 'mdc_hyjs_master' --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentLeanOutController.java | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 216 insertions(+), 0 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentLeanOutController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentLeanOutController.java new file mode 100644 index 0000000..d9a1ad8 --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentLeanOutController.java @@ -0,0 +1,216 @@ +package org.jeecg.modules.eam.controller; + +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; +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.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.util.TranslateDictTextUtils; +import org.jeecg.modules.eam.constant.BusinessCodeConst; +import org.jeecg.modules.eam.constant.EquipmentLeanOutStatusEnum; +import org.jeecg.modules.eam.entity.EamEquipmentLeanOut; +import org.jeecg.modules.eam.request.EamEquipmentLeanOutQuery; +import org.jeecg.modules.eam.request.EamEquipmentLeanOutRequest; +import org.jeecg.modules.eam.service.IEamEquipmentLeanOutService; +import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.Arrays; +import java.util.List; + +/** + * @Description: 璁惧鍊熷嚭褰掕繕 + * @Author: jeecg-boot + * @Date: 2025-05-13 + * @Version: V1.0 + */ +@Slf4j +@Api(tags = "璁惧鍊熷嚭褰掕繕") +@RestController +@RequestMapping("/eam/eamEquipmentLeanOut") +public class EamEquipmentLeanOutController extends JeecgController<EamEquipmentLeanOut, IEamEquipmentLeanOutService> { + @Autowired + private IEamEquipmentLeanOutService eamEquipmentLeanOutService; + @Autowired + private ISysBusinessCodeRuleService businessCodeRuleService; + @Autowired + private ObjectMapper objectMapper; + @Autowired + private TranslateDictTextUtils translateDictTextUtils; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param query + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @ApiOperation(value = "璁惧鍊熷嚭褰掕繕-鍒嗛〉鍒楄〃鏌ヨ", notes = "璁惧鍊熷嚭褰掕繕-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<?> queryPageList(EamEquipmentLeanOutQuery query, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + Page<EamEquipmentLeanOut> page = new Page<EamEquipmentLeanOut>(pageNo, pageSize); + IPage<EamEquipmentLeanOut> pageList = eamEquipmentLeanOutService.queryPageList(page, query); + return Result.OK(pageList); + } + + /** + * 娣诲姞 + * + * @param request + * @return + */ + @AutoLog(value = "璁惧鍊熷嚭褰掕繕-娣诲姞") + @ApiOperation(value = "璁惧鍊熷嚭褰掕繕-娣诲姞", notes = "璁惧鍊熷嚭褰掕繕-娣诲姞") + @PostMapping(value = "/add") + public Result<?> add(@RequestBody EamEquipmentLeanOut request) { + if (request == null) { + return Result.error("娣诲姞鐨勫璞′笉鑳戒负绌猴紒"); + } + String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.LEAN_OUT_CODE_RULE); + request.setCode(codeSeq); + request.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_SUBMIT.name()); + request.setDelFlag(CommonConstant.DEL_FLAG_0); + boolean b = eamEquipmentLeanOutService.addLeanOut(request); + if (!b) { + return Result.error("娣诲姞澶辫触锛�"); + } + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param request + * @return + */ + @AutoLog(value = "璁惧鍊熷嚭褰掕繕-缂栬緫") + @ApiOperation(value = "璁惧鍊熷嚭褰掕繕-缂栬緫", notes = "璁惧鍊熷嚭褰掕繕-缂栬緫") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<?> edit(@RequestBody EamEquipmentLeanOut request) { + if (request == null) { + return Result.error("缂栬緫鐨勫璞′笉鑳戒负绌猴紒"); + } + boolean b = eamEquipmentLeanOutService.editLeanOut(request); + if (!b) { + return Result.error("缂栬緫澶辫触锛�"); + } + return Result.OK("缂栬緫鎴愬姛!"); + } + + /** + * 閫氳繃id鍒犻櫎 + * + * @param id + * @return + */ + @AutoLog(value = "璁惧鍊熷嚭褰掕繕-閫氳繃id鍒犻櫎") + @ApiOperation(value = "璁惧鍊熷嚭褰掕繕-閫氳繃id鍒犻櫎", notes = "璁惧鍊熷嚭褰掕繕-閫氳繃id鍒犻櫎") + @DeleteMapping(value = "/delete") + public Result<?> delete(@RequestParam(name = "id", required = true) String id) { + EamEquipmentLeanOut entity = eamEquipmentLeanOutService.getById(id); + if (entity != null) { + entity.setDelFlag(CommonConstant.DEL_FLAG_1); + eamEquipmentLeanOutService.updateById(entity); + } + return Result.OK("鍒犻櫎鎴愬姛!"); + } + + /** + * 鎵归噺鍒犻櫎 + * + * @param ids + * @return + */ + @AutoLog(value = "璁惧鍊熷嚭褰掕繕-鎵归噺鍒犻櫎") + @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 -> { + EamEquipmentLeanOut entity = eamEquipmentLeanOutService.getById(id); + if (entity != null) { + entity.setDelFlag(CommonConstant.DEL_FLAG_1); + eamEquipmentLeanOutService.updateById(entity); + } + }); + return Result.OK("鎵归噺鍒犻櫎鎴愬姛锛�"); + } + + /** + * 閫氳繃id鏌ヨ + * + * @param id + * @return + */ + @AutoLog(value = "璁惧鍊熷嚭褰掕繕-閫氳繃id鏌ヨ") + @ApiOperation(value = "璁惧鍊熷嚭褰掕繕-閫氳繃id鏌ヨ", notes = "璁惧鍊熷嚭褰掕繕-閫氳繃id鏌ヨ") + @GetMapping(value = "/queryById") + public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { + EamEquipmentLeanOut eamEquipmentLeanOut = eamEquipmentLeanOutService.getById(id); + if (eamEquipmentLeanOut == null) { + return Result.error("鏈壘鍒板搴旀暟鎹�"); + } + try { + String json = objectMapper.writeValueAsString(eamEquipmentLeanOut); + JSONObject item = JSONObject.parseObject(json, Feature.OrderedField); + translateDictTextUtils.translateField("leanDepartId", eamEquipmentLeanOut.getLeanDepartId(), item, "mdc_production,production_name,id"); + translateDictTextUtils.translateField("leanPerson", eamEquipmentLeanOut.getLeanPerson(), item, "sys_user,realname,username"); + return Result.OK(item); + } catch (JsonProcessingException e) { + return Result.error("鏁版嵁杞瘧澶辫触锛�"); + } + } + + /** + * 鎻愪氦 + * + * @param id + * @return + */ + @AutoLog(value = "璁惧鍊熷嚭褰掕繕-鎻愪氦") + @ApiOperation(value = "璁惧鍊熷嚭褰掕繕-鎻愪氦", notes = "璁惧鍊熷嚭褰掕繕-鎻愪氦") + @GetMapping(value = "/submit") + public Result<?> submit(@RequestParam(name = "id", required = true) String id) { + boolean b = eamEquipmentLeanOutService.submit(id); + if (!b) { + return Result.error("鎿嶄綔澶辫触锛�"); + } + return Result.OK("鎿嶄綔鎴愬姛!"); + } + + /** + * 瀹℃壒 + * + * @param request + * @return + */ + @AutoLog(value = "璁惧鍊熷嚭褰掕繕-瀹℃壒娴�") + @ApiOperation(value = "璁惧鍊熷嚭褰掕繕-瀹℃壒娴�", notes = "璁惧鍊熷嚭褰掕繕-瀹℃壒娴�") + @RequestMapping(value = "/approval", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<?> approval(@RequestBody EamEquipmentLeanOutRequest request) { + if (request == null) { + return Result.error("娣诲姞鐨勫璞′笉鑳戒负绌猴紒"); + } + EamEquipmentLeanOut entity = eamEquipmentLeanOutService.approval(request); + if (entity == null) { + return Result.error("鎿嶄綔澶辫触锛�"); + } + return Result.OK("鎿嶄綔鎴愬姛!"); + } + +} -- Gitblit v1.9.3