From 7c77e020b81e42fb65aa966742ff7c93e73668e1 Mon Sep 17 00:00:00 2001 From: cuikaidong <ckd2942379034@163.com> Date: 星期一, 26 五月 2025 17:57:55 +0800 Subject: [PATCH] 设备调拨功能增加 --- db/数据库产品化设计.pdma.json | 58 ++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentTransferRequest.java | 126 +++++ lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentTransfer.java | 152 ++++++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentTransferService.java | 49 ++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentTransferMapper.java | 18 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentTransferServiceImpl.java | 350 +++++++++++++++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentTransferQuery.java | 23 + lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentTransferController.java | 346 ++++++++------ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentSealUpController.java | 6 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/aspect/EquipmentHistoryLogAspect.java | 25 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java | 2 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentTransfer.java | 160 ++++-- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentTransferMapper.xml | 7 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EquipmentTransferStatusEnum.java | 22 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentSealUpServiceImpl.java | 11 15 files changed, 1,132 insertions(+), 223 deletions(-) diff --git "a/db/\346\225\260\346\215\256\345\272\223\344\272\247\345\223\201\345\214\226\350\256\276\350\256\241.pdma.json" "b/db/\346\225\260\346\215\256\345\272\223\344\272\247\345\223\201\345\214\226\350\256\276\350\256\241.pdma.json" index 2d5287d..9c54df4 100644 --- "a/db/\346\225\260\346\215\256\345\272\223\344\272\247\345\223\201\345\214\226\350\256\276\350\256\241.pdma.json" +++ "b/db/\346\225\260\346\215\256\345\272\223\344\272\247\345\223\201\345\214\226\350\256\276\350\256\241.pdma.json" @@ -4,7 +4,7 @@ "avatar": "", "version": "4.9.2", "createdTime": "2025-3-10 16:38:19", - "updatedTime": "2025-5-23 10:09:30", + "updatedTime": "2025-5-26 14:55:20", "dbConns": [], "profile": { "default": { @@ -13473,6 +13473,62 @@ "extProps": {}, "domain": "9092C4E0-1A54-4859-ABBB-5B62DBC27573", "id": "66B3E2F7-B450-4D20-B3B2-5F6E80F99110" + }, + { + "defKey": "approval_deal_type", + "defName": "瀹℃牳绫诲瀷", + "comment": "", + "type": "", + "len": "", + "scale": "", + "primaryKey": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "", + "hideInGraph": false, + "domain": "73FD2BAD-2358-4336-B96D-45DC897BD792", + "refDict": "", + "extProps": {}, + "notes": {}, + "attr1": "", + "attr2": "", + "attr3": "", + "attr4": "", + "attr5": "", + "attr6": "", + "attr7": "", + "attr8": "", + "attr9": "", + "id": "3F991F63-D842-4D0B-86BD-4CAEB0F1D33D", + "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" + }, + { + "defKey": "approval_comment", + "defName": "瀹℃牳鎰忚", + "comment": "", + "type": "", + "len": "", + "scale": "", + "primaryKey": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "", + "hideInGraph": false, + "domain": "9092C4E0-1A54-4859-ABBB-5B62DBC27573", + "refDict": "", + "extProps": {}, + "notes": {}, + "attr1": "", + "attr2": "", + "attr3": "", + "attr4": "", + "attr5": "", + "attr6": "", + "attr7": "", + "attr8": "", + "attr9": "", + "id": "A885F9EB-FAAE-4D76-ACF5-8E6CBCBA02DD", + "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" } ], "correlations": [], diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/aspect/EquipmentHistoryLogAspect.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/aspect/EquipmentHistoryLogAspect.java index 3175021..b9daa45 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/aspect/EquipmentHistoryLogAspect.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/aspect/EquipmentHistoryLogAspect.java @@ -7,10 +7,7 @@ import org.aspectj.lang.annotation.*; import org.aspectj.lang.reflect.MethodSignature; import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog; -import org.jeecg.modules.eam.constant.EquipmentOperationTagEnum; -import org.jeecg.modules.eam.constant.InspectionStatus; -import org.jeecg.modules.eam.constant.ReportRepairEnum; -import org.jeecg.modules.eam.constant.WeekMaintenanceStatusEnum; +import org.jeecg.modules.eam.constant.*; import org.jeecg.modules.eam.entity.*; import org.jeecg.modules.eam.service.IEamEquipmentHistoryLogService; import org.springframework.beans.factory.annotation.Autowired; @@ -114,6 +111,16 @@ log.setCreateTime(repair.getFaultStartTime()); } break; + /** + * 鑸畤鏁戠敓椤圭洰 + * + * + * + * + * + * + * + */ case REPAIRED: if (result instanceof EamRepairOrder) { EamRepairOrder order = (EamRepairOrder) result; @@ -139,6 +146,16 @@ case UNSEALED: break; case TRANSFERRED: + if (result instanceof EamEquipmentTransfer) { + EamEquipmentTransfer order = (EamEquipmentTransfer) result; + if (EquipmentTransferStatusEnum.COMPLETE.name().equals(order.getTransferStatus())) { + log.setEquipmentId(order.getEquipmentId()); + log.setBusinessId(order.getId()); + log.setOperator(order.getReportUser()); + log.setDescription(order.getTransferReason()); + log.setCreateTime(order.getTransferTime()); + } + } break; case SCRAPPED: break; diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java index 034a747..15c9210 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java @@ -23,6 +23,8 @@ String LEAN_OUT_CODE_RULE = "EquipmentLeanOutCodeRule"; //璁惧灏佸瓨鍚皝 String SEAL_UP_CODE_RULE = "EquipmentSealUpCodeRule"; + //璁惧璋冩嫧缂栫爜瑙勫垯 + String TRANSFER_CODE_RULE = "EquipmentTransferCodeRule"; /** * 澶囦欢璇疯喘鍗曠姸鎬� 1:宸插垱寤� 2:宸叉彁浜� 3:宸查�氳繃 4:宸查┏鍥� 5:宸插畬鎴� */ diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EquipmentTransferStatusEnum.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EquipmentTransferStatusEnum.java new file mode 100644 index 0000000..f061fb2 --- /dev/null +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EquipmentTransferStatusEnum.java @@ -0,0 +1,22 @@ +package org.jeecg.modules.eam.constant; + +/** + * @author cuikaidong + * @date 2025/5/26 + */ +public enum EquipmentTransferStatusEnum { + WAIT_SUBMIT, //寰呮彁浜� + WAIT_CHECK, //寰呭鏍� + COMPLETE, //宸插畬鎴� + ; + + public static EquipmentTransferStatusEnum getInstance(String code) { + EquipmentTransferStatusEnum[] values = EquipmentTransferStatusEnum.values(); + for (EquipmentTransferStatusEnum value : values) { + if (value.name().equals(code)) { + return value; + } + } + return null; + } +} diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentTransfer.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentTransfer.java new file mode 100644 index 0000000..8fc1465 --- /dev/null +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentTransfer.java @@ -0,0 +1,152 @@ +package org.jeecg.modules.eam.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecg.common.aspect.annotation.Dict; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description: 璁惧褰掑睘鍙樺姩 + * @Author: jeecg-boot + * @Date: 2025-05-13 + * @Version: V1.0 + */ +@Data +@TableName("eam_equipment_transfer") +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "eam_equipment_transfer瀵硅薄", description = "璁惧褰掑睘鍙樺姩") +public class EamEquipmentTransfer implements Serializable { + + /** + * 涓婚敭 + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "涓婚敭") + private String id; + /** + * 鍒涘缓浜� + */ + @Excel(name = "鍒涘缓浜�", width = 15) + @ApiModelProperty(value = "鍒涘缓浜�") + private String createBy; + /** + * 鍒涘缓鏃堕棿 + */ + @ApiModelProperty(value = "鍒涘缓鏃堕棿") + private Date createTime; + /** + * 鏇存柊浜� + */ + @Excel(name = "鏇存柊浜�", width = 15) + @ApiModelProperty(value = "鏇存柊浜�") + private String updateBy; + /** + * 鏇存柊鏃堕棿 + */ + @ApiModelProperty(value = "鏇存柊鏃堕棿") + private Date updateTime; + /** + * 鍒犻櫎鏍囪 + */ + @Excel(name = "鍒犻櫎鏍囪", width = 15) + @ApiModelProperty(value = "鍒犻櫎鏍囪") + private Integer delFlag; + /** + * 鍗曟嵁鍙� + */ + @Excel(name = "鍗曟嵁鍙�", width = 15) + @ApiModelProperty(value = "鍗曟嵁鍙�") + private String code; + /** + * 璁惧ID + */ + @Excel(name = "璁惧ID", width = 15) + @ApiModelProperty(value = "璁惧ID") + private String equipmentId; + /** + * 璋冨嚭閮ㄩ棬 + */ + @Excel(name = "璋冨嚭閮ㄩ棬", width = 15) + @ApiModelProperty(value = "璋冨嚭閮ㄩ棬") + @Dict(dicCode = "mdc_production, production_name, id") + private String oldDepartId; + /** + * 璋冨叆閮ㄩ棬 + */ + @Excel(name = "璋冨叆閮ㄩ棬", width = 15) + @ApiModelProperty(value = "璋冨叆閮ㄩ棬") + @Dict(dicCode = "mdc_production, production_name, id") + private String newDepartId; + /** + * 鐢宠浜� + */ + @Excel(name = "鐢宠浜�", width = 15) + @ApiModelProperty(value = "鐢宠浜�") + @Dict(dicCode = "sys_user, realname, username") + private String reportUser; + /** + * 鍙樺姩鍘熷洜 + */ + @Excel(name = "鍙樺姩鍘熷洜", width = 15) + @ApiModelProperty(value = "鍙樺姩鍘熷洜") + private String transferReason; + /** + * 鍙樺姩鐘舵�� + */ + @Excel(name = "鍙樺姩鐘舵��", width = 15) + @ApiModelProperty(value = "鍙樺姩鐘舵��") + @Dict(dicCode = "equipment_transfer_status") + private String transferStatus; + /** + * 鍙樺姩鏃ユ湡 + */ + @ApiModelProperty(value = "鍙樺姩鏃ユ湡") + private Date transferTime; + /** + * 瀹℃牳浜� + */ + @Excel(name = "瀹℃牳浜�", width = 15) + @ApiModelProperty(value = "瀹℃牳浜�") + @Dict(dicCode = "sys_user, realname, username") + private String approvalUser; + /** + * 瀹℃牳绫诲瀷 + */ + @ApiModelProperty(value = "瀹℃牳绫诲瀷") + @Dict(dicCode = "approved_rejected") + private String approvalDealType; + /** + * 瀹℃牳鎰忚 + */ + @ApiModelProperty(value = "瀹℃牳鎰忚") + private String approvalComment; + /** + * 瀹℃牳鏃堕棿 + */ + @ApiModelProperty(value = "瀹℃牳鏃堕棿") + private Date approvalTime; + /** + * 澶囨敞 + */ + @Excel(name = "澶囨敞", width = 15) + @ApiModelProperty(value = "澶囨敞") + private String remark; + + //鍒楄〃灞曠ず + @TableField(exist = false) + private String equipmentCode; + @TableField(exist = false) + private String equipmentName; + +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentSealUpController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentSealUpController.java index 30b2954..8775cfb 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentSealUpController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentSealUpController.java @@ -210,13 +210,13 @@ } /** - * 缂栬緫 + * 瀹℃壒娴� * * @param request * @return */ - @AutoLog(value = "璁惧鍊熷嚭褰掕繕-瀹℃壒娴�") - @ApiOperation(value = "璁惧鍊熷嚭褰掕繕-瀹℃壒娴�", notes = "璁惧鍊熷嚭褰掕繕-瀹℃壒娴�") + @AutoLog(value = "鍚皝灏佸瓨-瀹℃壒娴�") + @ApiOperation(value = "鍚皝灏佸瓨-瀹℃壒娴�", notes = "鍚皝灏佸瓨-瀹℃壒娴�") @RequestMapping(value = "/approval", method = {RequestMethod.PUT, RequestMethod.POST}) public Result<?> approval(@RequestBody EamEquipmentSealUpRequest request) { if (request == null) { diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentTransferController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentTransferController.java index 4be8d17..f45c9b8 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentTransferController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentTransferController.java @@ -1,167 +1,217 @@ package org.jeecg.modules.eam.controller; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -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.aspect.annotation.AutoLog; -import org.jeecg.common.util.oConvertUtils; -import org.jeecg.modules.eam.entity.EamEquipmentTransfer; -import org.jeecg.modules.eam.service.IEamEquipmentTransferService; -import java.util.Date; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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 lombok.extern.slf4j.Slf4j; -import org.jeecg.common.system.base.controller.JeecgController; -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.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 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.EquipmentTransferStatusEnum; +import org.jeecg.modules.eam.entity.EamEquipmentTransfer; +import org.jeecg.modules.eam.request.EamEquipmentTransferQuery; +import org.jeecg.modules.eam.request.EamEquipmentTransferRequest; +import org.jeecg.modules.eam.service.IEamEquipmentTransferService; +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 + * @Date: 2025-05-13 * @Version: V1.0 */ @Slf4j -@Api(tags="璁惧褰掑睘鍙樺姩") +@Api(tags = "璁惧褰掑睘鍙樺姩") @RestController @RequestMapping("/eam/eamEquipmentTransfer") public class EamEquipmentTransferController extends JeecgController<EamEquipmentTransfer, IEamEquipmentTransferService> { - @Autowired - private IEamEquipmentTransferService eamEquipmentTransferService; - - /** - * 鍒嗛〉鍒楄〃鏌ヨ - * - * @param eamEquipmentTransfer - * @param pageNo - * @param pageSize - * @param req - * @return - */ - @AutoLog(value = "璁惧褰掑睘鍙樺姩-鍒嗛〉鍒楄〃鏌ヨ") - @ApiOperation(value="璁惧褰掑睘鍙樺姩-鍒嗛〉鍒楄〃鏌ヨ", notes="璁惧褰掑睘鍙樺姩-鍒嗛〉鍒楄〃鏌ヨ") - @GetMapping(value = "/list") - public Result<?> queryPageList(EamEquipmentTransfer eamEquipmentTransfer, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - HttpServletRequest req) { - QueryWrapper<EamEquipmentTransfer> queryWrapper = QueryGenerator.initQueryWrapper(eamEquipmentTransfer, req.getParameterMap()); - Page<EamEquipmentTransfer> page = new Page<EamEquipmentTransfer>(pageNo, pageSize); - IPage<EamEquipmentTransfer> pageList = eamEquipmentTransferService.page(page, queryWrapper); - return Result.OK(pageList); - } - - /** - * 娣诲姞 - * - * @param eamEquipmentTransfer - * @return - */ - @AutoLog(value = "璁惧褰掑睘鍙樺姩-娣诲姞") - @ApiOperation(value="璁惧褰掑睘鍙樺姩-娣诲姞", notes="璁惧褰掑睘鍙樺姩-娣诲姞") - @PostMapping(value = "/add") - public Result<?> add(@RequestBody EamEquipmentTransfer eamEquipmentTransfer) { - eamEquipmentTransferService.save(eamEquipmentTransfer); - return Result.OK("娣诲姞鎴愬姛锛�"); - } - - /** - * 缂栬緫 - * - * @param eamEquipmentTransfer - * @return - */ - @AutoLog(value = "璁惧褰掑睘鍙樺姩-缂栬緫") - @ApiOperation(value="璁惧褰掑睘鍙樺姩-缂栬緫", notes="璁惧褰掑睘鍙樺姩-缂栬緫") - @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) - public Result<?> edit(@RequestBody EamEquipmentTransfer eamEquipmentTransfer) { - eamEquipmentTransferService.updateById(eamEquipmentTransfer); - 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) { - eamEquipmentTransferService.removeById(id); - return Result.OK("鍒犻櫎鎴愬姛!"); - } - - /** - * 鎵归噺鍒犻櫎 - * - * @param ids - * @return - */ - @AutoLog(value = "璁惧褰掑睘鍙樺姩-鎵归噺鍒犻櫎") - @ApiOperation(value="璁惧褰掑睘鍙樺姩-鎵归噺鍒犻櫎", notes="璁惧褰掑睘鍙樺姩-鎵归噺鍒犻櫎") - @DeleteMapping(value = "/deleteBatch") - public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.eamEquipmentTransferService.removeByIds(Arrays.asList(ids.split(","))); - 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) { - EamEquipmentTransfer eamEquipmentTransfer = eamEquipmentTransferService.getById(id); - return Result.OK(eamEquipmentTransfer); - } + @Autowired + private IEamEquipmentTransferService eamEquipmentTransferService; + @Autowired + private ISysBusinessCodeRuleService businessCodeRuleService; + @Autowired + private ObjectMapper objectMapper; + @Autowired + private TranslateDictTextUtils translateDictTextUtils; - /** - * 瀵煎嚭excel - * - * @param request - * @param eamEquipmentTransfer - */ - @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(HttpServletRequest request, EamEquipmentTransfer eamEquipmentTransfer) { - return super.exportXls(request, eamEquipmentTransfer, EamEquipmentTransfer.class, "璁惧褰掑睘鍙樺姩"); - } + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param query + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "璁惧褰掑睘鍙樺姩-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value = "璁惧褰掑睘鍙樺姩-鍒嗛〉鍒楄〃鏌ヨ", notes = "璁惧褰掑睘鍙樺姩-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<?> queryPageList(EamEquipmentTransferQuery query, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + Page<EamEquipmentTransfer> page = new Page<EamEquipmentTransfer>(pageNo, pageSize); + IPage<EamEquipmentTransfer> pageList = eamEquipmentTransferService.queryPageList(page, query); + return Result.OK(pageList); + } - /** - * 閫氳繃excel瀵煎叆鏁版嵁 - * - * @param request - * @param response - * @return - */ - @RequestMapping(value = "/importExcel", method = RequestMethod.POST) - public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, EamEquipmentTransfer.class); - } + /** + * 娣诲姞 + * + * @param request + * @return + */ + @AutoLog(value = "璁惧褰掑睘鍙樺姩-娣诲姞") + @ApiOperation(value = "璁惧褰掑睘鍙樺姩-娣诲姞", notes = "璁惧褰掑睘鍙樺姩-娣诲姞") + @PostMapping(value = "/add") + public Result<?> add(@RequestBody EamEquipmentTransfer request) { + if (request == null) { + return Result.error("娣诲姞鐨勫璞′笉鑳戒负绌猴紒"); + } + request.setCode(businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.TRANSFER_CODE_RULE)); + request.setTransferStatus(EquipmentTransferStatusEnum.WAIT_SUBMIT.name()); + request.setDelFlag(CommonConstant.DEL_FLAG_0); + boolean b = eamEquipmentTransferService.addTransfer(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 EamEquipmentTransfer request) { + if (request == null) { + return Result.error("缂栬緫鐨勫璞′笉鑳戒负绌猴紒"); + } + boolean b = eamEquipmentTransferService.editTransfer(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) { + EamEquipmentTransfer entity = eamEquipmentTransferService.getById(id); + if (entity != null) { + entity.setDelFlag(CommonConstant.DEL_FLAG_1); + eamEquipmentTransferService.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) { + this.eamEquipmentTransferService.removeByIds(Arrays.asList(ids.split(","))); + List<String> list = Arrays.asList(ids.split(",")); + list.forEach(id -> { + EamEquipmentTransfer entity = eamEquipmentTransferService.getById(id); + if (entity != null) { + entity.setDelFlag(CommonConstant.DEL_FLAG_1); + eamEquipmentTransferService.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) { + EamEquipmentTransfer equipmentTransfer = eamEquipmentTransferService.getById(id); + if (equipmentTransfer == null) { + return Result.error("鏈壘鍒板搴旀暟鎹�"); + } + try { + String json = objectMapper.writeValueAsString(equipmentTransfer); + JSONObject item = JSONObject.parseObject(json, Feature.OrderedField); + translateDictTextUtils.translateField("reportUser", equipmentTransfer.getReportUser(), item, "sys_user,realname,username"); + translateDictTextUtils.translateField("newDepartId", equipmentTransfer.getNewDepartId(), item, "mdc_production,production_name,id"); + translateDictTextUtils.translateField("oldDepartId", equipmentTransfer.getOldDepartId(), item, "mdc_production,production_name,id"); + 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 = eamEquipmentTransferService.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 EamEquipmentTransferRequest request) { + if (request == null) { + return Result.error("娣诲姞鐨勫璞′笉鑳戒负绌猴紒"); + } + EamEquipmentTransfer entity = eamEquipmentTransferService.approval(request); + if (entity == null) { + return Result.error("鎿嶄綔澶辫触锛�"); + } + return Result.OK("鎿嶄綔鎴愬姛!"); + } } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentTransfer.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentTransfer.java index 1415cf9..8fc1465 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentTransfer.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentTransfer.java @@ -1,6 +1,7 @@ package org.jeecg.modules.eam.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -8,85 +9,144 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import org.jeecg.common.aspect.annotation.Dict; import org.jeecgframework.poi.excel.annotation.Excel; import java.io.Serializable; import java.util.Date; + /** * @Description: 璁惧褰掑睘鍙樺姩 * @Author: jeecg-boot - * @Date: 2025-05-13 + * @Date: 2025-05-13 * @Version: V1.0 */ @Data @TableName("eam_equipment_transfer") @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) -@ApiModel(value="eam_equipment_transfer瀵硅薄", description="璁惧褰掑睘鍙樺姩") +@ApiModel(value = "eam_equipment_transfer瀵硅薄", description = "璁惧褰掑睘鍙樺姩") public class EamEquipmentTransfer implements Serializable { - - /**涓婚敭*/ - @TableId(type = IdType.ASSIGN_ID) + + /** + * 涓婚敭 + */ + @TableId(type = IdType.ASSIGN_ID) @ApiModelProperty(value = "涓婚敭") - private String id; - /**鍒涘缓浜�*/ - @Excel(name = "鍒涘缓浜�", width = 15) + private String id; + /** + * 鍒涘缓浜� + */ + @Excel(name = "鍒涘缓浜�", width = 15) @ApiModelProperty(value = "鍒涘缓浜�") - private String createBy; - /**鍒涘缓鏃堕棿*/ + private String createBy; + /** + * 鍒涘缓鏃堕棿 + */ @ApiModelProperty(value = "鍒涘缓鏃堕棿") - private Date createTime; - /**鏇存柊浜�*/ - @Excel(name = "鏇存柊浜�", width = 15) + private Date createTime; + /** + * 鏇存柊浜� + */ + @Excel(name = "鏇存柊浜�", width = 15) @ApiModelProperty(value = "鏇存柊浜�") - private String updateBy; - /**鏇存柊鏃堕棿*/ + private String updateBy; + /** + * 鏇存柊鏃堕棿 + */ @ApiModelProperty(value = "鏇存柊鏃堕棿") - private Date updateTime; - /**鍒犻櫎鏍囪*/ - @Excel(name = "鍒犻櫎鏍囪", width = 15) + private Date updateTime; + /** + * 鍒犻櫎鏍囪 + */ + @Excel(name = "鍒犻櫎鏍囪", width = 15) @ApiModelProperty(value = "鍒犻櫎鏍囪") - private Integer delFlag; - /**鍗曟嵁鍙�*/ - @Excel(name = "鍗曟嵁鍙�", width = 15) + private Integer delFlag; + /** + * 鍗曟嵁鍙� + */ + @Excel(name = "鍗曟嵁鍙�", width = 15) @ApiModelProperty(value = "鍗曟嵁鍙�") - private String code; - /**璁惧ID*/ - @Excel(name = "璁惧ID", width = 15) + private String code; + /** + * 璁惧ID + */ + @Excel(name = "璁惧ID", width = 15) @ApiModelProperty(value = "璁惧ID") - private String equipmentId; - /**璋冨嚭閮ㄩ棬*/ - @Excel(name = "璋冨嚭閮ㄩ棬", width = 15) + private String equipmentId; + /** + * 璋冨嚭閮ㄩ棬 + */ + @Excel(name = "璋冨嚭閮ㄩ棬", width = 15) @ApiModelProperty(value = "璋冨嚭閮ㄩ棬") - private String oldDepartId; - /**璋冨叆閮ㄩ棬*/ - @Excel(name = "璋冨叆閮ㄩ棬", width = 15) + @Dict(dicCode = "mdc_production, production_name, id") + private String oldDepartId; + /** + * 璋冨叆閮ㄩ棬 + */ + @Excel(name = "璋冨叆閮ㄩ棬", width = 15) @ApiModelProperty(value = "璋冨叆閮ㄩ棬") - private String newDepartId; - /**鐢宠浜�*/ - @Excel(name = "鐢宠浜�", width = 15) + @Dict(dicCode = "mdc_production, production_name, id") + private String newDepartId; + /** + * 鐢宠浜� + */ + @Excel(name = "鐢宠浜�", width = 15) @ApiModelProperty(value = "鐢宠浜�") - private String reportUser; - /**鍙樺姩鍘熷洜*/ - @Excel(name = "鍙樺姩鍘熷洜", width = 15) + @Dict(dicCode = "sys_user, realname, username") + private String reportUser; + /** + * 鍙樺姩鍘熷洜 + */ + @Excel(name = "鍙樺姩鍘熷洜", width = 15) @ApiModelProperty(value = "鍙樺姩鍘熷洜") - private String transferReason; - /**鍙樺姩鐘舵��*/ - @Excel(name = "鍙樺姩鐘舵��", width = 15) + private String transferReason; + /** + * 鍙樺姩鐘舵�� + */ + @Excel(name = "鍙樺姩鐘舵��", width = 15) @ApiModelProperty(value = "鍙樺姩鐘舵��") - private String transferStatus; - /**鍙樺姩鏃ユ湡*/ + @Dict(dicCode = "equipment_transfer_status") + private String transferStatus; + /** + * 鍙樺姩鏃ユ湡 + */ @ApiModelProperty(value = "鍙樺姩鏃ユ湡") - private Date transferTime; - /**瀹℃牳浜�*/ - @Excel(name = "瀹℃牳浜�", width = 15) + private Date transferTime; + /** + * 瀹℃牳浜� + */ + @Excel(name = "瀹℃牳浜�", width = 15) @ApiModelProperty(value = "瀹℃牳浜�") - private String approvalUser; - /**瀹℃牳鏃堕棿*/ + @Dict(dicCode = "sys_user, realname, username") + private String approvalUser; + /** + * 瀹℃牳绫诲瀷 + */ + @ApiModelProperty(value = "瀹℃牳绫诲瀷") + @Dict(dicCode = "approved_rejected") + private String approvalDealType; + /** + * 瀹℃牳鎰忚 + */ + @ApiModelProperty(value = "瀹℃牳鎰忚") + private String approvalComment; + /** + * 瀹℃牳鏃堕棿 + */ @ApiModelProperty(value = "瀹℃牳鏃堕棿") - private Date approvalTime; - /**澶囨敞*/ - @Excel(name = "澶囨敞", width = 15) + private Date approvalTime; + /** + * 澶囨敞 + */ + @Excel(name = "澶囨敞", width = 15) @ApiModelProperty(value = "澶囨敞") - private String remark; + private String remark; + + //鍒楄〃灞曠ず + @TableField(exist = false) + private String equipmentCode; + @TableField(exist = false) + private String equipmentName; + } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentTransferMapper.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentTransferMapper.java index 81cf478..a009088 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentTransferMapper.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentTransferMapper.java @@ -1,17 +1,27 @@ package org.jeecg.modules.eam.mapper; -import java.util.List; - +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.eam.entity.EamEquipmentTransfer; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * @Description: 璁惧褰掑睘鍙樺姩 * @Author: jeecg-boot - * @Date: 2025-05-13 + * @Date: 2025-05-13 * @Version: V1.0 */ public interface EamEquipmentTransferMapper extends BaseMapper<EamEquipmentTransfer> { + /** + * 鍒嗛〉鏌ヨ + * + * @param page + * @param queryWrapper + * @return + */ + IPage<EamEquipmentTransfer> queryPageList(Page<EamEquipmentTransfer> page, @Param(Constants.WRAPPER) QueryWrapper<EamEquipmentTransfer> queryWrapper); } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentTransferMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentTransferMapper.xml index 7262154..5777d9c 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentTransferMapper.xml +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentTransferMapper.xml @@ -2,4 +2,11 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.jeecg.modules.eam.mapper.EamEquipmentTransferMapper"> + <select id="queryPageList" resultType="org.jeecg.modules.eam.entity.EamEquipmentTransfer"> + select wmo.*, e.equipment_code, e.equipment_name + from eam_equipment_transfer wmo + inner join eam_equipment e + on wmo.equipment_id = e.id + ${ew.customSqlSegment} + </select> </mapper> \ No newline at end of file diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentTransferQuery.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentTransferQuery.java new file mode 100644 index 0000000..8038f71 --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentTransferQuery.java @@ -0,0 +1,23 @@ +package org.jeecg.modules.eam.request; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +@Data +public class EamEquipmentTransferQuery { + private String code; + private String equipmentId; + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date leanDateBegin; + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date leanDateEnd; + private String sealStatus; + + private String column; + private String order; +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentTransferRequest.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentTransferRequest.java new file mode 100644 index 0000000..612227e --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentTransferRequest.java @@ -0,0 +1,126 @@ +package org.jeecg.modules.eam.request; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description: 璁惧褰掑睘鍙樺姩 + * @Author: jeecg-boot + * @Date: 2025-05-13 + * @Version: V1.0 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class EamEquipmentTransferRequest extends FlowTaskVo implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "涓婚敭") + private String id; + /** + * 鍒涘缓浜� + */ + @ApiModelProperty(value = "鍒涘缓浜�") + private String createBy; + /** + * 鍒涘缓鏃堕棿 + */ + @ApiModelProperty(value = "鍒涘缓鏃堕棿") + private Date createTime; + /** + * 鏇存柊浜� + */ + @ApiModelProperty(value = "鏇存柊浜�") + private String updateBy; + /** + * 鏇存柊鏃堕棿 + */ + @ApiModelProperty(value = "鏇存柊鏃堕棿") + private Date updateTime; + /** + * 鍒犻櫎鏍囪 + */ + @ApiModelProperty(value = "鍒犻櫎鏍囪") + private Integer delFlag; + /** + * 鍗曟嵁鍙� + */ + @ApiModelProperty(value = "鍗曟嵁鍙�") + private String code; + /** + * 璁惧ID + */ + @ApiModelProperty(value = "璁惧ID") + private String equipmentId; + /** + * 璋冨嚭閮ㄩ棬 + */ + @ApiModelProperty(value = "璋冨嚭閮ㄩ棬") + private String oldDepartId; + /** + * 璋冨叆閮ㄩ棬 + */ + @ApiModelProperty(value = "璋冨叆閮ㄩ棬") + private String newDepartId; + /** + * 鐢宠浜� + */ + @ApiModelProperty(value = "鐢宠浜�") + private String reportUser; + /** + * 鍙樺姩鍘熷洜 + */ + @ApiModelProperty(value = "鍙樺姩鍘熷洜") + private String transferReason; + /** + * 鍙樺姩鐘舵�� + */ + @ApiModelProperty(value = "鍙樺姩鐘舵��") + private String transferStatus; + /** + * 鍙樺姩鏃ユ湡 + */ + @ApiModelProperty(value = "鍙樺姩鏃ユ湡") + private Date transferTime; + /** + * 瀹℃牳浜� + */ + @Excel(name = "瀹℃牳浜�", width = 15) + @ApiModelProperty(value = "瀹℃牳浜�") + private String approvalUser; + /** + * 瀹℃牳鏃堕棿 + */ + @ApiModelProperty(value = "瀹℃牳鏃堕棿") + private Date approvalTime; + /** + * 瀹℃牳绫诲瀷 + */ + @Excel(name = "瀹℃牳绫诲瀷", width = 15) + @ApiModelProperty(value = "瀹℃牳绫诲瀷") + private String approvalDealType; + /** + * 瀹℃牳鎰忚 + */ + @ApiModelProperty(value = "瀹℃牳鎰忚") + private String approvalComment; + /** + * 澶囨敞 + */ + @ApiModelProperty(value = "澶囨敞") + private String remark; + //鍒楄〃灞曠ず + @TableField(exist = false) + private String equipmentCode; + @TableField(exist = false) + private String equipmentName; + +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentTransferService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentTransferService.java index 6659b86..beecfed 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentTransferService.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentTransferService.java @@ -1,14 +1,59 @@ package org.jeecg.modules.eam.service; -import org.jeecg.modules.eam.entity.EamEquipmentTransfer; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.eam.entity.EamEquipmentTransfer; +import org.jeecg.modules.eam.request.EamEquipmentTransferQuery; +import org.jeecg.modules.eam.request.EamEquipmentTransferRequest; /** * @Description: 璁惧褰掑睘鍙樺姩 * @Author: jeecg-boot - * @Date: 2025-05-13 + * @Date: 2025-05-13 * @Version: V1.0 */ public interface IEamEquipmentTransferService extends IService<EamEquipmentTransfer> { + /** + * 鍒嗛〉鏌ヨ + * + * @param page + * @param query + * @return + */ + IPage<EamEquipmentTransfer> queryPageList(Page<EamEquipmentTransfer> page, EamEquipmentTransferQuery query); + + /** + * 娣诲姞灏佸瓨璁板綍 + * + * @param request + * @return + */ + boolean addTransfer(EamEquipmentTransfer request); + + /** + * 鎻愪氦鐢宠 + * + * @param id + * @return + */ + boolean submit(String id); + + /** + * 瀹℃壒娴佺▼鎺у埗 + * + * @param request + * @return + */ + EamEquipmentTransfer approval(EamEquipmentTransferRequest request); + + /** + * 缂栬緫 + * + * @param request + * @return + */ + boolean editTransfer(EamEquipmentTransfer request); + } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentSealUpServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentSealUpServiceImpl.java index a0fbad9..b02edfc 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentSealUpServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentSealUpServiceImpl.java @@ -20,10 +20,8 @@ import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.eam.constant.AssetStatusEnum; import org.jeecg.modules.eam.constant.BusinessCodeConst; -import org.jeecg.modules.eam.constant.EquipmentLeanOutStatusEnum; import org.jeecg.modules.eam.constant.EquipmentSealUpStatusEnum; import org.jeecg.modules.eam.entity.EamEquipment; -import org.jeecg.modules.eam.entity.EamEquipmentLeanOut; import org.jeecg.modules.eam.entity.EamEquipmentSealUp; import org.jeecg.modules.eam.mapper.EamEquipmentSealUpMapper; import org.jeecg.modules.eam.request.EamEquipmentSealUpQuery; @@ -124,7 +122,6 @@ } else { queryWrapper.orderByDesc("wmo.create_time"); } - return equipmentSealUpMapper.queryPageList(page, queryWrapper); } @@ -213,7 +210,7 @@ if (result != null) { entity.setSealEndTime(new Date()); entity.setSealStatus(EquipmentSealUpStatusEnum.WAIT_UNSEALING_AUDIT.name()); - //淇濆瓨宸ュ崟 + //淇濆瓨宸ュ崟 equipmentSealUpMapper.updateById(entity); return result.isSuccess(); } @@ -320,7 +317,7 @@ Map<String, Object> values = new HashMap<>(); switch (status) { // 瀹℃壒 - case WAIT_UNSEALING_AUDIT: + case WAIT_CHECK: //鎵ц瀹屾垚 values.put("dataId", entity.getId()); values.put("organization", request.getApprovalComment()); @@ -346,7 +343,7 @@ } break; // 宸插皝瀛� - case SEALED: + case WAIT_UNSEALING_AUDIT: values.put("dataId", entity.getId()); values.put("organization", request.getUnsealApprovalComment()); values.put("comment", request.getUnsealApprovalComment()); @@ -360,11 +357,11 @@ } else { //璁剧疆entity entity.setSealStatus(EquipmentSealUpStatusEnum.SEALED.name()); + entity.setSealEndTime(null); } entity.setUnsealApprovalUser(user.getUsername()); entity.setUnsealApprovalComment(request.getUnsealApprovalComment()); entity.setUnsealApprovalTime(new Date()); - // 淇敼璁惧鐘舵�� equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); eamEquipmentService.updateById(equipment); diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentTransferServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentTransferServiceImpl.java index 1eb1313..de1b2b1 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentTransferServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentTransferServiceImpl.java @@ -1,19 +1,361 @@ package org.jeecg.modules.eam.service.impl; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.flowable.engine.TaskService; +import org.flowable.task.api.Task; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.constant.DataBaseConstant; +import org.jeecg.common.exception.JeecgBootException; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog; +import org.jeecg.modules.eam.constant.*; +import org.jeecg.modules.eam.entity.EamEquipment; import org.jeecg.modules.eam.entity.EamEquipmentTransfer; import org.jeecg.modules.eam.mapper.EamEquipmentTransferMapper; +import org.jeecg.modules.eam.request.EamEquipmentTransferQuery; +import org.jeecg.modules.eam.request.EamEquipmentTransferRequest; +import org.jeecg.modules.eam.service.IEamEquipmentService; import org.jeecg.modules.eam.service.IEamEquipmentTransferService; +import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; +import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; +import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; +import org.jeecg.modules.flowable.apithird.service.FlowCommonService; +import org.jeecg.modules.flowable.service.IFlowDefinitionService; +import org.jeecg.modules.flowable.service.IFlowTaskService; +import org.jeecg.modules.system.service.ISysUserService; +import org.jeecg.modules.system.vo.UserSelector; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; /** * @Description: 璁惧褰掑睘鍙樺姩 * @Author: jeecg-boot - * @Date: 2025-05-13 + * @Date: 2025-05-13 * @Version: V1.0 */ -@Service -public class EamEquipmentTransferServiceImpl extends ServiceImpl<EamEquipmentTransferMapper, EamEquipmentTransfer> implements IEamEquipmentTransferService { +@Service("IEamEquipmentTransferService") +public class EamEquipmentTransferServiceImpl extends ServiceImpl<EamEquipmentTransferMapper, EamEquipmentTransfer> implements IEamEquipmentTransferService, FlowCallBackServiceI { + + @Resource + private EamEquipmentTransferMapper equipmentTransferMapper; + @Autowired + private IEamEquipmentService eamEquipmentService; + @Autowired + private FlowCommonService flowCommonService; + @Autowired + private IFlowDefinitionService flowDefinitionService; + @Autowired + private IFlowMyBusinessService flowMyBusinessService; + @Autowired + private TaskService taskService; + @Autowired + private IFlowTaskService flowTaskService; + + @Autowired + private ISysUserService sysUserService; + + @Override + public IPage<EamEquipmentTransfer> queryPageList(Page<EamEquipmentTransfer> page, EamEquipmentTransferQuery query) { + QueryWrapper<EamEquipmentTransfer> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("wmo.del_flag", CommonConstant.DEL_FLAG_0); + //鐢ㄦ埛鏁版嵁鏉冮檺 + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (sysUser == null) { + return page; + } + if (StringUtils.isNotBlank(sysUser.getEquipmentIds())) { + //閫夋嫨浜嗚澶囷紝鏍规嵁璁惧id杩囨护璁惧 + List<String> equipArr = Arrays.asList(sysUser.getEquipmentIds().split(",")); + queryWrapper.in("e.equipment_code", equipArr); + } else { + //娌℃湁閫夋嫨璁惧锛屾牴鎹溅闂磋繃婊よ澶� + queryWrapper.exists("select 1 from mdc_user_production t where t.user_id={0} and t.pro_id=e.org_id ", sysUser.getId()); + } + //鎺у埗寰呮彁浜ょ姸鎬佺殑鏁版嵁鍙兘鏈汉鏌ョ湅 + queryWrapper.and(i -> i.ne("wmo.transfer_status", EquipmentTransferStatusEnum.WAIT_SUBMIT).or().eq("wmo.report_user", sysUser.getUsername())); + //鏌ヨ鏉′欢杩囨护 + if (query != null) { + if (StringUtils.isNotBlank(query.getEquipmentId())) { + queryWrapper.eq("wmo.equipment_id", query.getEquipmentId()); + } + if (StringUtils.isNotBlank(query.getCode())) { + queryWrapper.like("wmo.code", query.getCode()); + } + if (StringUtils.isNotBlank(query.getSealStatus())) { + queryWrapper.eq("wmo.transfer_status", query.getSealStatus()); + } + if (query.getLeanDateBegin() != null && query.getLeanDateEnd() != null) { + queryWrapper.between("wmo.lean_start_time", query.getLeanDateBegin(), query.getLeanDateEnd()); + } + //鎺掑簭 + if (StringUtils.isNotBlank(query.getColumn()) && StringUtils.isNotBlank(query.getOrder())) { + String column = query.getColumn(); + if (column.endsWith(CommonConstant.DICT_TEXT_SUFFIX)) { + column = column.substring(0, column.lastIndexOf(CommonConstant.DICT_TEXT_SUFFIX)); + } + if (DataBaseConstant.SQL_ASC.equalsIgnoreCase(query.getOrder())) { + queryWrapper.orderByAsc("wmo." + oConvertUtils.camelToUnderline(column)); + } else { + queryWrapper.orderByDesc("wmo." + oConvertUtils.camelToUnderline(column)); + } + } else { + queryWrapper.orderByDesc("wmo.create_time"); + } + } else { + queryWrapper.orderByDesc("wmo.create_time"); + } + + return equipmentTransferMapper.queryPageList(page, queryWrapper); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean addTransfer(EamEquipmentTransfer request) { + //妫�鏌ヨ澶� + EamEquipment equipment = eamEquipmentService.getById(request.getEquipmentId()); + if (equipment == null) { + throw new JeecgBootException("璁惧涓嶅瓨鍦紒"); + } + if (!AssetStatusEnum.NORMAL.name().equals(equipment.getAssetStatus())) { + throw new JeecgBootException("姝よ澶囧綋鍓嶈祫浜х姸鎬佷笉鍏佽鍊熷嚭锛�"); + } + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (sysUser == null) { + throw new JeecgBootException("褰撳墠鐢ㄦ埛鏃犳硶娣诲姞鍊熺敤璁板綍锛�"); + } + if (equipment.getOrgId().equals(request.getNewDepartId())) { + throw new JeecgBootException("褰撳墠璁惧灞炰簬姝よ溅闂达紝涓嶉渶瑕佸彉鍔紒"); + } + request.setOldDepartId(equipment.getOrgId()); + request.setReportUser(sysUser.getUsername()); + return equipmentTransferMapper.insert(request) > 0; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean submit(String id) { + EamEquipmentTransfer entity = equipmentTransferMapper.selectById(id); + if (entity == null) { + throw new JeecgBootException("瑕佹彁浜ょ殑鏁版嵁涓嶅瓨鍦紝璇峰埛鏂伴噸璇曪紒"); + } + if (!EquipmentTransferStatusEnum.WAIT_SUBMIT.name().equals(entity.getTransferStatus())) { + throw new JeecgBootException("褰撳墠鏁版嵁鐘舵�佷笉鍏佽缂栬緫锛�"); + } + //妫�鏌ヨ澶� + EamEquipment equipment = eamEquipmentService.getById(entity.getEquipmentId()); + if (equipment == null) { + throw new JeecgBootException("璁惧涓嶅瓨鍦紒"); + } + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (sysUser == null) { + throw new JeecgBootException("褰撳墠鐢ㄦ埛鏃犳硶缂栬緫杞璁板綍锛�"); + } + UpdateWrapper<EamEquipmentTransfer> updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("transfer_status", EquipmentSealUpStatusEnum.WAIT_SUBMIT.name()); + updateWrapper.eq("id", id); + updateWrapper.eq("report_user", sysUser.getUsername()); + boolean success = super.update(updateWrapper); + if (success) { + equipment.setAssetStatus(AssetStatusEnum.DEALT.name()); // 璁惧杞 + eamEquipmentService.updateById(equipment); + } + //鍚姩瀹℃壒娴佺▼ + flowCommonService.initActBusiness("宸ュ崟鍙�:" + entity.getCode() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";杩涜璁惧杞", + entity.getId(), "IEamEquipmentTransferService", "equipment_transfer", null); + Map<String, Object> variables = new HashMap<>(); + variables.put("dataId", entity.getId()); + variables.put("organization", entity.getTransferReason()); + variables.put("comment", entity.getTransferReason()); + variables.put("proofreading", true); + // 鍒嗛厤缁欒澶囩鐞嗗憳 + List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0004); + if (CollectionUtil.isEmpty(userSelectors)) { + throw new JeecgBootException("璁惧鏈垎閰嶇粰璁惧绠$悊鍛橈紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�"); + } + List<String> usernames = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); + variables.put("NextAssignee", usernames); + Result result = flowDefinitionService.startProcessInstanceByKey("equipment_transfer", variables); + if (result != null) { + entity.setTransferTime(new Date()); + entity.setTransferStatus(EquipmentTransferStatusEnum.WAIT_CHECK.name()); + //淇濆瓨宸ュ崟 + equipmentTransferMapper.updateById(entity); + return result.isSuccess(); + } + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + @EquipmentHistoryLog(operationTag = EquipmentOperationTagEnum.TRANSFERRED, businessTable = "eam_equipment_transfer") + public EamEquipmentTransfer approval(EamEquipmentTransferRequest request) { + EamEquipmentTransfer entity = equipmentTransferMapper.selectById(request.getId()); + if (entity == null) { + throw new JeecgBootException("瀹℃壒鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�"); + } + // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (user == null || StrUtil.isBlank(user.getId())) { + throw new JeecgBootException("鏈幏鍙栧埌鐧诲綍鐢ㄦ埛锛岃閲嶆柊鐧诲綍鍚庡啀璇曪紒"); + } + request.setApprovalUser(user.getUsername()); + // 鑾峰彇娴佺▼涓氬姟璁板綍 + FlowMyBusiness flowMyBusiness = flowMyBusinessService.getFlowMyBusiness(request.getInstanceId()); + if (flowMyBusiness == null) { + throw new JeecgBootException("娴佺▼瀹炰緥涓嶅瓨鍦紝璇峰埛鏂板悗閲嶈瘯锛�"); + } + + boolean userAuthorized = isUserAuthorized(flowMyBusiness, user); + if (!userAuthorized) { + throw new JeecgBootException("鐢ㄦ埛鏃犳潈鎿嶄綔姝や换鍔★紝璇峰埛鏂板悗閲嶈瘯锛�"); + } + // 璁ら浠诲姟 + if (!claimTask(flowMyBusiness.getTaskId(), user)) { + throw new JeecgBootException("浠诲姟涓嶅瓨鍦ㄣ�佸凡瀹屾垚鎴栧凡琚粬浜鸿棰嗭紒"); + } + + EamEquipment equipment = eamEquipmentService.getById(entity.getEquipmentId()); + if (equipment == null) { + throw new JeecgBootException("璁惧涓嶅瓨鍦紝璇锋鏌ワ紒"); + } + + EquipmentTransferStatusEnum status = EquipmentTransferStatusEnum.getInstance(entity.getTransferStatus()); + if (status == null) { + return null; + } + //娴佺▼鍙橀噺 + Map<String, Object> values = new HashMap<>(); + // 瀹℃壒 + if (status == EquipmentTransferStatusEnum.WAIT_CHECK) {//鎵ц瀹屾垚 + values.put("dataId", entity.getId()); + values.put("organization", request.getApprovalComment()); + values.put("comment", request.getApprovalComment()); + values.put("approvalDealType", request.getApprovalDealType()); + request.setComment(request.getApprovalComment()); + entity.setApprovalUser(user.getUsername());// 瀹℃牳浜� + entity.setApprovalComment(request.getApprovalComment());// 瀹℃牳鎰忚 + entity.setApprovalTime(new Date());// 瀹℃牳鏃堕棿 + entity.setApprovalDealType(request.getApprovalDealType()); // 瀹℃壒绫诲瀷 + // 楠岃瘉閫氳繃杩樻槸椹冲洖 + if (request.getApprovalDealType().equals("1")) { + //璁剧疆entity + entity.setTransferStatus(EquipmentTransferStatusEnum.COMPLETE.name()); + List<String> userApprovalList = new ArrayList<>(Collections.singletonList(entity.getReportUser())); + values.put("NextAssignee", userApprovalList); + // 淇敼璁惧鐘舵�� + equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); + } else { + //璁剧疆entity + entity.setTransferStatus(EquipmentTransferStatusEnum.WAIT_SUBMIT.name()); + // 淇敼璁惧鐘舵�� + } + entity.setApprovalUser(user.getUsername()); + entity.setApprovalComment(request.getApprovalComment()); + entity.setApprovalTime(new Date()); + eamEquipmentService.updateById(equipment); + } + request.setValues(values); + + // 瀹屾垚娴佺▼浠诲姟 + Result result = flowTaskService.complete(request); + if (!result.isSuccess()) { + throw new JeecgBootException("瀹℃壒澶辫触锛岃鍒锋柊鏌ョ湅锛�"); + } + //淇濆瓨宸ュ崟 + equipmentTransferMapper.updateById(entity); + return entity; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean editTransfer(EamEquipmentTransfer request) { + EamEquipmentTransfer entity = equipmentTransferMapper.selectById(request.getId()); + if (entity == null) { + throw new JeecgBootException("瑕佺紪杈戠殑鏁版嵁涓嶅瓨鍦紝璇峰埛鏂伴噸璇曪紒"); + } + if (!EquipmentSealUpStatusEnum.WAIT_SUBMIT.name().equals(entity.getTransferStatus())) { + throw new JeecgBootException("褰撳墠鏁版嵁鐘舵�佷笉鍏佽缂栬緫锛�"); + } + //妫�鏌ヨ澶� + EamEquipment equipment = eamEquipmentService.getById(request.getEquipmentId()); + if (equipment == null) { + throw new JeecgBootException("璁惧涓嶅瓨鍦紒"); + } + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (sysUser == null) { + throw new JeecgBootException("褰撳墠鐢ㄦ埛鏃犳硶缂栬緫鍊熺敤璁板綍锛�"); + } + UpdateWrapper<EamEquipmentTransfer> updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("equipment_id", request.getEquipmentId()); + updateWrapper.set("remark", request.getRemark()); + updateWrapper.set("transfer_reason", request.getTransferReason()); + updateWrapper.set("old_depart_id", equipment.getOrgId()); + updateWrapper.set("new_depart_id", request.getNewDepartId()); + updateWrapper.eq("id", request.getId()); + updateWrapper.eq("report_user", sysUser.getUsername()); + return super.update(updateWrapper); + } + + @Override + public void afterFlowHandle(FlowMyBusiness business) { + business.getTaskNameId();//鎺ヤ笅鏉ュ鎵圭殑鑺傜偣 + business.getValues();//鍓嶇浼犺繘鏉ョ殑鍙傛暟 + business.getActStatus(); + } + + @Override + public Object getBusinessDataById(String dataId) { + return this.getById(dataId); + } + + @Override + public Map<String, Object> flowValuesOfTask(String taskNameId, Map<String, Object> values) { + return null; + } + + @Override + public List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values) { + return null; + } + + /** + * 鍒ゆ柇鐢ㄦ埛鏄惁鎷ユ湁姝ゆ潈闄� + * + * @param flowMyBusiness + * @param user + * @return + */ + private boolean isUserAuthorized(FlowMyBusiness flowMyBusiness, LoginUser user) { + List<String> todoUsers = JSON.parseArray(flowMyBusiness.getTodoUsers(), String.class); + return todoUsers != null && todoUsers.contains(user.getUsername()); + } + + private boolean claimTask(String taskId, LoginUser user) { + Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); + if (task == null) { + return false; + } + if (task.getAssignee() != null && !task.getAssignee().equals(user.getUsername())) { + return false; + } + taskService.claim(taskId, user.getUsername()); + return true; + } } -- Gitblit v1.9.3