From 8918b2f8444db69be6887c9a0959d13e164bbddb Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期三, 27 八月 2025 14:29:32 +0800 Subject: [PATCH] 设备二保定时服务开发,填充车间二保计划数据,三不放过批量导出接口 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamSecondMaintenanceOrderService.java | 1 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderServiceImpl.java | 31 ++ lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamReportThreeNoSpareServiceImpl.java | 43 ++++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamSecondMaintenanceRequest.java | 14 + lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamFactorySecondMaintPlanMapper.xml | 9 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamReportThreeNoSpareController.java | 11 + lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamFactorySecondMaintPlanMapper.java | 6 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamReportThreeNoSpareService.java | 8 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipment.java | 4 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportThreeNoSpareMapper.xml | 19 + lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderAsyncService.java | 153 +++++++++++++++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamSecondMaintenanceOrderMapper.xml | 27 + lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamReportThreeNoSpareMapper.java | 8 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentExtend.java | 3 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/BaseFactoryServiceImpl.java | 12 + lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamHomeController.java | 3 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IBaseFactoryService.java | 7 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamFactorySecondMaintPlanService.java | 24 ++ lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamFactorySecondMaintPlanServiceImpl.java | 175 +++++++++++++++++ lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamFactorySecondMaintPlan.java | 4 20 files changed, 546 insertions(+), 16 deletions(-) diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipment.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipment.java index 198f15f..1667093 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipment.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipment.java @@ -469,6 +469,10 @@ @ApiModelProperty(value = "涓変繚鐢熸垚鏍囪 1 宸茬敓鎴� 0 鏈敓鎴�") @TableField(exist = false) private String thirdMaintenanceGenerateFlag; + /** 浜屼繚鐢熸垚鏍囪 1 宸茬敓鎴� 0 鏈敓鎴� */ + @ApiModelProperty(value = "浜屼繚鐢熸垚鏍囪 1 宸茬敓鎴� 0 鏈敓鎴�") + @TableField(exist = false) + private String secondMaintenanceGenerateFlag; /** * 淇濆吇瑙勮寖鍚嶇О diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentExtend.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentExtend.java index 630c58e..a5de554 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentExtend.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentExtend.java @@ -97,4 +97,7 @@ /** 涓変繚鐢熸垚鏍囪 1 宸茬敓鎴� 0 鏈敓鎴� */ @ApiModelProperty(value = "涓変繚鐢熸垚鏍囪 1 宸茬敓鎴� 0 鏈敓鎴�") private String thirdMaintenanceGenerateFlag; + /** 浜屼繚鐢熸垚鏍囪 1 宸茬敓鎴� 0 鏈敓鎴� */ + @ApiModelProperty(value = "浜屼繚鐢熸垚鏍囪 1 宸茬敓鎴� 0 鏈敓鎴�") + private String secondMaintenanceGenerateFlag; } diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamFactorySecondMaintPlan.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamFactorySecondMaintPlan.java index 7995efa..5a2bae9 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamFactorySecondMaintPlan.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamFactorySecondMaintPlan.java @@ -49,7 +49,7 @@ /**鍒犻櫎鏍囪*/ @Excel(name = "鍒犻櫎鏍囪", width = 15) @ApiModelProperty(value = "鍒犻櫎鏍囪") - private Integer delFlag; + private Integer delFlag=0; /**宸ュ巶ID*/ @Excel(name = "宸ュ巶ID", width = 15) @ApiModelProperty(value = "宸ュ巶ID") @@ -65,5 +65,5 @@ /**鏁伴噺*/ @Excel(name = "鏁伴噺", width = 15) @ApiModelProperty(value = "鏁伴噺") - private String quantity; + private Integer quantity; } diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamFactorySecondMaintPlanMapper.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamFactorySecondMaintPlanMapper.java index b47bad4..30fb2fb 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamFactorySecondMaintPlanMapper.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamFactorySecondMaintPlanMapper.java @@ -14,4 +14,10 @@ */ public interface EamFactorySecondMaintPlanMapper extends BaseMapper<EamFactorySecondMaintPlan> { + /** + * 璁惧绠$悊棣栭〉-杞﹂棿浜屼繚璁″垝鍒楄〃 + * @return + */ + List<EamFactorySecondMaintPlan> queryAllList(); + } diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamReportThreeNoSpareMapper.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamReportThreeNoSpareMapper.java index 48a01f9..7676851 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamReportThreeNoSpareMapper.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamReportThreeNoSpareMapper.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Constants; import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.eam.dto.EamReportThreeNoSpareDto; import org.jeecg.modules.eam.entity.EamReportThreeNoSpare; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.jeecg.modules.eam.request.EamReportThreeNoSpareQuery; @@ -19,4 +20,11 @@ public interface EamReportThreeNoSpareMapper extends BaseMapper<EamReportThreeNoSpare> { IPage<EamReportThreeNoSpareQuery> queryPageList(IPage<EamReportThreeNoSpareQuery> page, @Param(Constants.WRAPPER) QueryWrapper<EamReportThreeNoSpareQuery> EamReportThreeNoSpareQuery); + + /** + * 鈥滀笁涓嶆斁杩囩殑鍘熷垯鈥濆垎鏋愯〃鍒楄〃 + * @param eamReportThreeNoSpareDto + * @return + */ + List<EamReportThreeNoSpareDto> queryList(@Param(Constants.WRAPPER) QueryWrapper<EamReportThreeNoSpareDto> eamReportThreeNoSpareDto); } diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamFactorySecondMaintPlanMapper.xml b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamFactorySecondMaintPlanMapper.xml index 8218c89..a3ea92b 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamFactorySecondMaintPlanMapper.xml +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamFactorySecondMaintPlanMapper.xml @@ -2,4 +2,13 @@ <!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.EamFactorySecondMaintPlanMapper"> + <select id="queryAllList" resultType="org.jeecg.modules.eam.entity.EamFactorySecondMaintPlan"> + SELECT efsmp.* + FROM eam_factory_second_maint_plan efsmp + LEFT JOIN eam_base_factory ebf ON efsmp.factory_id = ebf.id + WHERE efsmp.del_flag = 0 + ORDER BY CAST(SUBSTRING(efsmp.month_plan, 1, 4) AS INT), + CAST(SUBSTRING(efsmp.month_plan, 6, 2) AS INT), + ebf.org_code; + </select> </mapper> diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportThreeNoSpareMapper.xml b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportThreeNoSpareMapper.xml index c3d6173..6942c17 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportThreeNoSpareMapper.xml +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportThreeNoSpareMapper.xml @@ -21,4 +21,23 @@ AND e.del_flag = 0 ${ew.customSqlSegment} </select> + <select id="queryList" resultType="org.jeecg.modules.eam.dto.EamReportThreeNoSpareDto"> + SELECT + ertns.*, + e.equipment_code, + e.equipment_name, + e.equipment_model, + e.installation_position, + erar.accident_phenomenon, + erar.measure, + erar.causing_results + FROM eam_report_three_no_spare ertns + LEFT JOIN eam_report_accidents_register erar + ON ertns.report_id = erar.report_id + AND erar.del_flag = 0 + INNER JOIN eam_equipment e + ON erar.equipment_id = e.id + AND e.del_flag = 0 + ${ew.customSqlSegment} + </select> </mapper> diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamFactorySecondMaintPlanService.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamFactorySecondMaintPlanService.java index d6982db..8181731 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamFactorySecondMaintPlanService.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamFactorySecondMaintPlanService.java @@ -3,6 +3,8 @@ import org.jeecg.modules.eam.entity.EamFactorySecondMaintPlan; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** * @Description: 鈥滈椤佃溅闂翠簩淇濊鍒� * @Author: jeecg-boot @@ -11,4 +13,26 @@ */ public interface IEamFactorySecondMaintPlanService extends IService<EamFactorySecondMaintPlan> { + /** + * 璁惧绠$悊棣栭〉-杞﹂棿浜屼繚璁″垝鍒楄〃 + * @return + */ + public List<EamFactorySecondMaintPlan> queryAllList(); + + /** + * 鏂板棣栭〉杞﹂棿浜屼繚璁″垝 + * @param equipmentId + * @param monthPlan + * @return + */ + public EamFactorySecondMaintPlan add(String equipmentId, String monthPlan); + + /** + * 鏃ユ湡鍙樺寲 + * @param equipmentId + * @param oldMonthPlan + * @param newMonthPlan + * @return + */ + public boolean dateChange(String equipmentId, String oldMonthPlan, String newMonthPlan); } diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamReportThreeNoSpareService.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamReportThreeNoSpareService.java index 0556c50..963025b 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamReportThreeNoSpareService.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamReportThreeNoSpareService.java @@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.eam.request.EamReportThreeNoSpareQuery; +import java.util.List; + /** * @Description: 鈥滀笁涓嶆斁杩囩殑鍘熷垯鈥濆垎鏋愯〃 * @Author: jeecg-boot @@ -38,4 +40,10 @@ */ Result<?> audit(EamReportThreeNoSpareDto eamReportThreeNoSpareDto); + /** + * 鈥滀笁涓嶆斁杩囩殑鍘熷垯鈥濆垎鏋愯〃鎵撳嵃 + * @param ids + * @return + */ + List<EamReportThreeNoSpareDto> print(String ids); } diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamFactorySecondMaintPlanServiceImpl.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamFactorySecondMaintPlanServiceImpl.java index 04ed629..8c83558 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamFactorySecondMaintPlanServiceImpl.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamFactorySecondMaintPlanServiceImpl.java @@ -1,19 +1,192 @@ package org.jeecg.modules.eam.service.impl; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import org.jeecg.modules.eam.entity.EamEquipment; import org.jeecg.modules.eam.entity.EamFactorySecondMaintPlan; import org.jeecg.modules.eam.mapper.EamFactorySecondMaintPlanMapper; +import org.jeecg.modules.eam.service.IEamEquipmentService; import org.jeecg.modules.eam.service.IEamFactorySecondMaintPlanService; +import org.jeecg.modules.system.entity.BaseFactory; +import org.jeecg.modules.system.service.IBaseFactoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; /** * @Description: 鈥滈椤佃溅闂翠簩淇濊鍒� - * @Author: jeecg-boot + * @Author: jeecg-boot * @Date: 2025-08-22 * @Version: V1.0 */ @Service public class EamFactorySecondMaintPlanServiceImpl extends ServiceImpl<EamFactorySecondMaintPlanMapper, EamFactorySecondMaintPlan> implements IEamFactorySecondMaintPlanService { + @Autowired + private IBaseFactoryService baseFactoryService; + @Autowired + private IEamEquipmentService eamEquipmentService; + + /** + * 璁惧绠$悊棣栭〉-杞﹂棿浜屼繚璁″垝鍒楄〃 + * @return + */ + @Override + public List<EamFactorySecondMaintPlan> queryAllList(){ + return this.baseMapper.queryAllList(); + } + + /** + * 鏂板棣栭〉杞﹂棿浜屼繚璁″垝 + * @param equipmentId + * @param monthPlan + * @return + */ + @Override + public EamFactorySecondMaintPlan add(String equipmentId, String monthPlan) { + EamEquipment equipment=eamEquipmentService.getById(equipmentId); + if (equipment==null) { + return null; + } + String factoryId = baseFactoryService.queryByCode(equipment.getFactoryOrgCode().substring(0,6)).getId(); + // 灏濊瘯鐩存帴鏇存柊锛堝師瀛愭搷浣滐級 + LambdaUpdateWrapper<EamFactorySecondMaintPlan> updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(EamFactorySecondMaintPlan::getFactoryId, factoryId) + .eq(EamFactorySecondMaintPlan::getMonthPlan, monthPlan) + .setSql("quantity = quantity + 1"); // 鍘熷瓙澧炲姞 + + int updated = this.baseMapper.update(null, updateWrapper); + + if (updated > 0) { + // 鏇存柊鎴愬姛锛岃繑鍥炴洿鏂板悗鐨勮褰� + return this.getOne(Wrappers.<EamFactorySecondMaintPlan>lambdaQuery() + .eq(EamFactorySecondMaintPlan::getFactoryId, factoryId) + .eq(EamFactorySecondMaintPlan::getMonthPlan, monthPlan)); + } else { + // 鏃犺褰曞瓨鍦紝鍒涘缓鏂拌褰� + return createNewPlan(factoryId, monthPlan); + } + } + + private EamFactorySecondMaintPlan createNewPlan(String factoryId, String monthPlan) { + EamFactorySecondMaintPlan newPlan = new EamFactorySecondMaintPlan(); + newPlan.setFactoryId(factoryId); + newPlan.setMonthPlan(monthPlan); + newPlan.setQuantity(1); + + // 璁剧疆宸ュ巶鍚嶇О锛堜紭鍖栧鐞嗭級 + BaseFactory baseFactory = baseFactoryService.getById(factoryId); + if (baseFactory != null) { + String orgCode = baseFactory.getOrgCode(); + // 浣跨敤鏁翠釜orgCode锛堝鏋滈暱搴︿笉瓒�6锛� + String nameOrgCode = orgCode.length() >= 6 ? orgCode.substring(0, 6) : orgCode; + newPlan.setFactoryName(baseFactoryService.factoryDataNameByOrgCode(nameOrgCode)); + } + + // 澶勭悊骞跺彂鍒涘缓鍐茬獊 + try { + this.save(newPlan); + return newPlan; + } catch (DuplicateKeyException e) { + // 鍏朵粬绾跨▼宸插垱寤猴紝杞负鏇存柊 + return add(factoryId, monthPlan); + } + } + + /** + * 鏃ユ湡鍙樺寲 + * @param equipmentId 璁惧ID + * @param oldMonthPlan 鏃ф湀浠借鍒掞紙鏍煎紡濡倅yyy-MM锛� + * @param newMonthPlan 鏂版湀浠借鍒掞紙鏍煎紡濡倅yyy-MM锛� + * @return 鏄惁鎴愬姛鍙樻洿 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean dateChange(String equipmentId, String oldMonthPlan, String newMonthPlan) { + // 1. 鑾峰彇璁惧淇℃伅 + EamEquipment equipment = eamEquipmentService.getById(equipmentId); + if (equipment == null) { + return false; + } + + // 2. 鑾峰彇宸ュ巶ID + String factoryOrgCodePrefix = equipment.getFactoryOrgCode().substring(0, 6); + BaseFactory factory = baseFactoryService.queryByCode(factoryOrgCodePrefix); + if (factory == null) { + return false; + } + String factoryId = factory.getId(); + + // 3. 濡傛灉鏈堜唤鏈彉鍖栫洿鎺ヨ繑鍥炴垚鍔� + if (oldMonthPlan.equals(newMonthPlan)) { + return true; + } + + try { + // 4. 鍑忓皯鏃ф湀浠借鍒掓暟閲忥紙鍘熷瓙鎿嶄綔锛� + boolean oldDecreased = decreasePlanQuantity(factoryId, oldMonthPlan); + if (!oldDecreased) { + throw new RuntimeException("鍑忓皯鏃ф湀浠借鍒掓暟閲忓け璐ワ紝鍙兘璁板綍涓嶅瓨鍦ㄦ垨鏁伴噺涓�0"); + } + + // 5. 澧炲姞鏂版湀浠借鍒掓暟閲� + increasePlanQuantity(factoryId, newMonthPlan); + + return true; + } catch (Exception e) { + // 浜嬪姟鍥炴粴 + throw new RuntimeException("鏃ユ湡鍙樻洿澶辫触: " + e.getMessage(), e); + } + } + + /** + * 鍑忓皯璁″垝鏁伴噺锛屽鏋滃噺灏戝悗鏁伴噺涓�0鍒欏垹闄よ褰� + */ + private boolean decreasePlanQuantity(String factoryId, String monthPlan) { + // 鍏堝噺灏戞暟閲� + LambdaUpdateWrapper<EamFactorySecondMaintPlan> updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(EamFactorySecondMaintPlan::getFactoryId, factoryId) + .eq(EamFactorySecondMaintPlan::getMonthPlan, monthPlan) + .gt(EamFactorySecondMaintPlan::getQuantity, 0) // 纭繚鏁伴噺澶т簬0 + .setSql("quantity = quantity - 1"); + + int updated = baseMapper.update(null, updateWrapper); + + if (updated > 0) { + // 妫�鏌ユ洿鏂板悗鐨勬暟閲忔槸鍚︿负0锛屽鏋滄槸鍒欏垹闄よ褰� + EamFactorySecondMaintPlan updatedPlan = baseMapper.selectOne( + Wrappers.<EamFactorySecondMaintPlan>lambdaQuery() + .eq(EamFactorySecondMaintPlan::getFactoryId, factoryId) + .eq(EamFactorySecondMaintPlan::getMonthPlan, monthPlan) + ); + + if (updatedPlan != null && updatedPlan.getQuantity() == 0) { + baseMapper.deleteById(updatedPlan.getId()); + } + return true; + } + + return false; + } + + /** + * 澧炲姞璁″垝鏁伴噺 + */ + private void increasePlanQuantity(String factoryId, String monthPlan) { + // 鐩存帴鏇存柊 + LambdaUpdateWrapper<EamFactorySecondMaintPlan> updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(EamFactorySecondMaintPlan::getFactoryId, factoryId) + .eq(EamFactorySecondMaintPlan::getMonthPlan, monthPlan) + .setSql("quantity = quantity + 1"); + + if (baseMapper.update(null, updateWrapper) == 0) { + // 鏇存柊澶辫触璇存槑璁板綍涓嶅瓨鍦紝鍒涘缓鏂拌褰� + createNewPlan(factoryId, monthPlan); + } + } } diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamReportThreeNoSpareServiceImpl.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamReportThreeNoSpareServiceImpl.java index 709081b..bbf09a4 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamReportThreeNoSpareServiceImpl.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamReportThreeNoSpareServiceImpl.java @@ -18,7 +18,9 @@ import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.eam.constant.BusinessCodeConst; +import org.jeecg.modules.eam.constant.EamReportAccidentsRegisterEnum; import org.jeecg.modules.eam.constant.EamReportThreeNoSpareEnum; +import org.jeecg.modules.eam.dto.EamReportThreeNoSpareDto; import org.jeecg.modules.eam.dto.EamReportThreeNoSpareDto; import org.jeecg.modules.eam.entity.EamEquipment; import org.jeecg.modules.eam.entity.EamReportThreeNoSpare; @@ -266,6 +268,47 @@ return Result.ok("瀹℃壒鎴愬姛"); } + /** + * 鈥滀笁涓嶆斁杩囩殑鍘熷垯鈥濆垎鏋愯〃鎵撳嵃 + * @param ids + * @return + */ + @Override + public List<EamReportThreeNoSpareDto> print(String ids){ + QueryWrapper<EamReportThreeNoSpareDto> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("ertns.del_flag",CommonConstant.DEL_FLAG_0.toString()); + queryWrapper.eq("ertns.submit_status", EamReportThreeNoSpareEnum.REPAIR_COMPLETED.name()); + //鐢ㄦ埛鏁版嵁鏉冮檺 + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (sysUser == null) { + return new ArrayList<>(); + } + if (StringUtils.isNotBlank(sysUser.getEamEquipmentIds())) { + //閫夋嫨浜嗚澶囷紝鏍规嵁璁惧id杩囨护璁惧 + List<String> equipArr = Arrays.asList(sysUser.getEamEquipmentIds().split(",")); + queryWrapper.in("e.equipment_code", equipArr); + } else { + //娌℃湁閫夋嫨璁惧锛屾牴鎹腑蹇冭繃婊よ澶� + List<BaseFactoryUser> baseFactoryUserList=baseFactoryUserService. + list(new LambdaQueryWrapper<BaseFactoryUser>().eq(BaseFactoryUser::getUserId,sysUser.getId())); + if(!CollectionUtils.isEmpty(baseFactoryUserList)){ + Set<String> factoryIds = baseFactoryUserList.stream().map(BaseFactoryUser::getFactoryId).collect(Collectors.toSet()); + Set<String> factoryCode= baseFactoryService.listByIds(factoryIds).stream().map(BaseFactory::getOrgCode).collect(Collectors.toSet()); + queryWrapper.in("e.factory_org_code", factoryCode); + } else { + return new ArrayList<>(); + } + } + //鏌ヨ鏉′欢杩囨护 + if (StrUtil.isNotEmpty(ids)) { + List<String> idList = Arrays.asList(ids.split(",")); + queryWrapper.in("ertns.id", idList); + } else { + queryWrapper.orderByDesc("ertns.create_time"); + } + return this.baseMapper.queryList(queryWrapper); + } + private boolean claimTask(String taskId, LoginUser user) { Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); if (task == null) { diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamHomeController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamHomeController.java index 1d10c34..86ce43d 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamHomeController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamHomeController.java @@ -85,8 +85,7 @@ @ApiOperation(value = "璁惧绠$悊棣栭〉-浜屼繚鍒楄〃", notes = "璁惧绠$悊棣栭〉-浜屼繚鍒楄〃") @GetMapping(value = "/secondmaintenance") public Result<?> secondmaintenance() { - //浜岀骇淇濆吇 - List<EamFactorySecondMaintPlan> echartsDtoList = iEamFactorySecondMaintPlanService.list(); + List<EamFactorySecondMaintPlan> echartsDtoList = iEamFactorySecondMaintPlanService.queryAllList(); return Result.ok(echartsDtoList); } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamReportThreeNoSpareController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamReportThreeNoSpareController.java index a30a494..064eedf 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamReportThreeNoSpareController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamReportThreeNoSpareController.java @@ -141,6 +141,17 @@ return eamReportThreeNoSpareService.audit(eamReportThreeNoSpareDto); } + /** + * 鈥滀笁涓嶆斁杩囩殑鍘熷垯鈥濆垎鏋愯〃鎵撳嵃 + * @param ids + * @return + */ + @ApiOperation(value = "鈥滀笁涓嶆斁杩囩殑鍘熷垯鈥濆垎鏋愯〃--鎵撳嵃", notes = "鈥滀笁涓嶆斁杩囩殑鍘熷垯鈥濆垎鏋愯〃--鎵撳嵃") + @GetMapping(value = "/batchExport") + public Result<?> batchExport(String ids){ + return Result.ok(eamReportThreeNoSpareService.print(ids)); + } + /** * 閫氳繃id鍒犻櫎 * diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamSecondMaintenanceOrderMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamSecondMaintenanceOrderMapper.xml index dd75fce..f9aae1e 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamSecondMaintenanceOrderMapper.xml +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamSecondMaintenanceOrderMapper.xml @@ -3,14 +3,25 @@ <mapper namespace="org.jeecg.modules.eam.mapper.EamSecondMaintenanceOrderMapper"> <select id="queryPageList" resultType="org.jeecg.modules.eam.entity.EamSecondMaintenanceOrder"> - select wmo.*, e.equipment_code, e.equipment_name,e.equipment_model,f.process_instance_id as 'procInstId', - f.process_definition_key, - f.process_definition_id, - f.process_instance_id - from eam_second_maintenance_order wmo - inner join eam_equipment e - on wmo.equipment_id = e.id - left join flow_my_business f on f.data_id=wmo.id + SELECT + wmo.*, + e.equipment_code, + e.equipment_name, + e.equipment_model, + f.process_instance_id AS 'procInstId', + f.process_definition_key, + f.process_definition_id, + f.process_instance_id + FROM eam_second_maintenance_order wmo + INNER JOIN eam_equipment e ON wmo.equipment_id = e.id + LEFT JOIN ( + SELECT + data_id, + MAX(id) AS max_id -- 鑾峰彇鏈�澶D + FROM flow_my_business + GROUP BY data_id + ) latest ON wmo.id = latest.data_id + LEFT JOIN flow_my_business f ON f.id = latest.max_id ${ew.customSqlSegment} </select> <select id="queryList" resultType="org.jeecg.modules.eam.dto.EamSecondMaintenanceOrderExport"> diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamSecondMaintenanceRequest.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamSecondMaintenanceRequest.java index 26ed73e..3831e50 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamSecondMaintenanceRequest.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamSecondMaintenanceRequest.java @@ -55,6 +55,20 @@ @DateTimeFormat(pattern = "yyyy-MM-dd") private Date maintenanceDate; /** + * 閿佸畾宸ュ崟鏃ユ湡 + */ + @ApiModelProperty(value = "閿佸畾宸ュ崟鏃ユ湡;鎻愬墠55澶╅攣瀹氬伐鍗�") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date freezeOrderDate; + /** + * 宸ュ崟杩囨湡鏃ユ湡 + */ + @ApiModelProperty(value = "宸ュ崟杩囨湡鏃ユ湡;鍒版湡鏈仛鐩存帴杩囨湡") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date orderExpirationDate; + /** * 瀹為檯寮�濮嬫椂闂� */ @ApiModelProperty(value = "瀹為檯寮�濮嬫椂闂�") diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamSecondMaintenanceOrderService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamSecondMaintenanceOrderService.java index 028c3b9..6606bba 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamSecondMaintenanceOrderService.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamSecondMaintenanceOrderService.java @@ -59,6 +59,7 @@ */ EamSecondMaintenanceOrder approval(EamSecondMaintenanceRequest request); + /** * 鎵归噺鎵撳嵃浜屼繚宸ュ崟 * @param ids diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderAsyncService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderAsyncService.java new file mode 100644 index 0000000..5c1dadc --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderAsyncService.java @@ -0,0 +1,153 @@ +package org.jeecg.modules.eam.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.exception.JeecgBootException; +import org.jeecg.common.util.DateUtils; +import org.jeecg.modules.eam.constant.BusinessCodeConst; +import org.jeecg.modules.eam.constant.HfTemplateCategoryEnum; +import org.jeecg.modules.eam.constant.SecondMaintenanceStatusEnum; +import org.jeecg.modules.eam.entity.EamBaseHFCode; +import org.jeecg.modules.eam.entity.EamMaintenanceStandardDetail; +import org.jeecg.modules.eam.entity.EamSecondMaintenanceOrder; +import org.jeecg.modules.eam.entity.EamSecondMaintenanceOrderDetail; +import org.jeecg.modules.eam.mapper.EamSecondMaintenanceOrderMapper; +import org.jeecg.modules.eam.service.IEamBaseHFCodeService; +import org.jeecg.modules.eam.service.IEamFactorySecondMaintPlanService; +import org.jeecg.modules.eam.service.IEamMaintenanceStandardDetailService; +import org.jeecg.modules.eam.service.IEamSecondMaintenanceOrderDetailService; +import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.temporal.TemporalAdjusters; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class EamSecondMaintenanceOrderAsyncService { + @Resource + private EamSecondMaintenanceOrderMapper eamSecondMaintenanceOrderMapper; + + @Autowired + private IEamSecondMaintenanceOrderDetailService secondMaintenanceOrderDetailService; + + @Autowired + private IEamMaintenanceStandardDetailService eamMaintenanceStandardDetailService; + + @Autowired + private IEamBaseHFCodeService hfCodeService; + + @Autowired + private ISysBusinessCodeRuleService businessCodeRuleService; + + @Autowired + private IEamFactorySecondMaintPlanService factorySecondMaintPlanService; + + @Async + public void asyncGenerateNextMaintenanceOrder(String orderId) { + try { + log.info("寮�濮嬪紓姝ョ敓鎴愪笅娆″伐鍗曪紝鍘熷伐鍗旾D: {}", orderId); + generateNextOrder(orderId); + log.info("寮傛鐢熸垚涓嬫宸ュ崟瀹屾垚锛屽師宸ュ崟ID: {}", orderId); + } catch (Exception e) { + log.error("寮傛鐢熸垚涓嬫宸ュ崟澶辫触锛屽伐鍗旾D: {}", orderId, e); + // 鍙戦�佸憡璀﹂�氱煡鎴栬繘琛岄噸璇� + } + } + + @Transactional(rollbackFor = Exception.class) + public void generateNextOrder(String orderId) { + EamSecondMaintenanceOrder entity = eamSecondMaintenanceOrderMapper.selectById(orderId); + if (entity == null) { + log.warn("鍘熷伐鍗曚笉瀛樺湪锛孖D: {}", orderId); + return; + } + if (!entity.getMaintenanceStatus().equals(SecondMaintenanceStatusEnum.COMPLETE.name())) { + log.warn("鍘熷伐鍗曠姸鎬佹湭瀹屾垚锛屼笉鐢熸垚涓嬫宸ュ崟锛孖D: {}", orderId); + return; + } + + // 鐢熸垚鏂扮殑宸ュ崟缂栧彿 + String newOrderNum = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.SECOND_MAINTENANCE_CODE_RULE); + if (StrUtil.isEmpty(newOrderNum)) { + throw new JeecgBootException("鐢熸垚宸ュ崟缂栧彿澶辫触"); + } + + EamSecondMaintenanceOrder nextOrder = new EamSecondMaintenanceOrder(); + nextOrder.setOrderNum(newOrderNum); + nextOrder.setEquipmentId(entity.getEquipmentId()); + nextOrder.setStandardId(entity.getStandardId()); + nextOrder.setCreationMethod("AUTO"); + // 璁剧疆淇濆吇鏃ユ湡涓哄師宸ュ崟淇濆吇鏃ユ湡鍔�6涓湀 + nextOrder.setMaintenanceDate(calculateNextMaintenanceDate(entity.getMaintenanceDate())); + // 璁剧疆鎶�鏈姸鎬侀壌瀹氳〃HF缂栫爜 + EamBaseHFCode eamBaseHFCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.SECOND_MAINTENANCE.name()); + if (eamBaseHFCode == null) { + throw new JeecgBootException("鏈厤缃妧鏈姸鎬侀壌瀹氳〃鐨凥F缂栫爜锛屾坊鍔犲け璐ワ紒"); + } + nextOrder.setHfCode(eamBaseHFCode.getHfCode()); + nextOrder.setRemark(entity.getRemark()); + nextOrder.setMaintenanceStatus(SecondMaintenanceStatusEnum.WAIT_MAINTENANCE.name()); + nextOrder.setCreationMethod(entity.getCreationMethod()); + nextOrder.setDelFlag(CommonConstant.DEL_FLAG_0); + + // 鎻掑叆鏂板伐鍗� + eamSecondMaintenanceOrderMapper.insert(nextOrder); + + // 澶嶅埗宸ュ崟鏄庣粏 + List<EamMaintenanceStandardDetail> standardDetails = eamMaintenanceStandardDetailService.selectByStandardId(entity.getStandardId()); + if (CollectionUtil.isEmpty(standardDetails)) { + log.warn("鍘熷伐鍗曠殑淇濆吇瑙勮寖鏄庣粏涓虹┖锛屽伐鍗旾D: {}", orderId); + return; + } + + List<EamSecondMaintenanceOrderDetail> orderDetails = standardDetails.stream() + .map(item -> { + EamSecondMaintenanceOrderDetail detail = new EamSecondMaintenanceOrderDetail(); + BeanUtils.copyProperties(item, detail); + detail.setId(null); + detail.setOrderId(nextOrder.getId()); + return detail; + }) + .collect(Collectors.toList()); + + secondMaintenanceOrderDetailService.saveBatch(orderDetails); + + // 鎻掑叆棣栭〉浜屼繚鍏昏鍒� + // 浣跨敤 SimpleDateFormat 鐩存帴鏍煎紡鍖栦负鈥測yyy骞碝M鏈堚�濇牸寮� + SimpleDateFormat sdf = new SimpleDateFormat("yyyy骞碝M鏈�"); + String formattedDate = sdf.format(nextOrder.getMaintenanceDate()); + factorySecondMaintPlanService.add(nextOrder.getEquipmentId(), formattedDate); + } + + + /** + * 璁$畻鍏釜鏈堝悗鐨勫綋鏈堟渶鍚庝竴澶� + * @param currentDate 褰撳墠宸ュ崟鏃ユ湡 + * @return 鍏釜鏈堝悗鐨勫綋鏈堟渶鍚庝竴澶� + */ + private Date calculateNextMaintenanceDate(Date currentDate) { + // 杞崲涓篖ocalDate澶勭悊鏃ユ湡 + LocalDate localDate = DateUtils.dateToLocalDate(currentDate); + // 璁$畻鍏釜鏈堝悗鐨勬棩鏈� + LocalDate sixMonthsLater = localDate.plusMonths(6); + + // 璋冩暣鍒板綋鏈堢殑鏈�鍚庝竴澶� + LocalDate lastDayOfMonth = sixMonthsLater.with(TemporalAdjusters.lastDayOfMonth()); + + // 杞崲鍥濪ate绫诲瀷 + return DateUtils.localDateToDate(lastDayOfMonth); + } + +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderServiceImpl.java index 17fff29..423acba 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderServiceImpl.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.flowable.engine.TaskService; @@ -18,6 +19,7 @@ import org.jeecg.common.constant.DataBaseConstant; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.util.DateUtils; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog; import org.jeecg.modules.eam.constant.*; @@ -50,6 +52,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.text.SimpleDateFormat; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -61,12 +64,12 @@ * @Version: V1.0 */ @Service("IEamSecondMaintenanceOrderService") +@Slf4j public class EamSecondMaintenanceOrderServiceImpl extends ServiceImpl<EamSecondMaintenanceOrderMapper, EamSecondMaintenanceOrder> implements IEamSecondMaintenanceOrderService, FlowCallBackServiceI { @Resource private EamSecondMaintenanceOrderMapper eamSecondMaintenanceOrderMapper; @Autowired private IEamSecondMaintenanceOrderDetailService secondMaintenanceOrderDetailService; - @Autowired private FlowCommonService flowCommonService; @Autowired @@ -97,6 +100,10 @@ private BaseFactoryMapper baseFactoryMapper; @Autowired private IEamSecondMaintenanceOrderDetailService eamSecondMaintenanceOrderDetailService; + @Autowired + private EamSecondMaintenanceOrderAsyncService eamSecondMaintenanceOrderAsyncService; + @Autowired + private IEamFactorySecondMaintPlanService factorySecondMaintPlanService; @Override public IPage<EamSecondMaintenanceOrder> queryPageList(Page<EamSecondMaintenanceOrder> page, EamSecondMaintenanceQuery query) { @@ -340,6 +347,11 @@ }); secondMaintenanceOrderDetailService.saveBatch(requestTableDetailList); } + // 鎻掑叆棣栭〉浜屼繚鍏昏鍒� + // 浣跨敤 SimpleDateFormat 鐩存帴鏍煎紡鍖栦负鈥測yyy骞碝M鏈堚�濇牸寮� + SimpleDateFormat sdf = new SimpleDateFormat("yyyy骞碝M鏈�"); + String formattedDate = sdf.format(order.getMaintenanceDate()); + factorySecondMaintPlanService.add(order.getEquipmentId(), formattedDate); return true; } @@ -357,9 +369,14 @@ if (!SecondMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) { throw new JeecgBootException("鍙湁寰呬繚鍏荤姸鎬佺殑鏁版嵁鎵嶅彲缂栬緫锛�"); } + // 缂栬緫棣栭〉浜屼繚鍏昏鍒� + // 浣跨敤 SimpleDateFormat 鐩存帴鏍煎紡鍖栦负鈥測yyy骞碝M鏈堚�濇牸寮� + SimpleDateFormat sdf = new SimpleDateFormat("yyyy骞碝M鏈�"); + String oldFormattedDate = sdf.format(entity.getMaintenanceDate()); + String newFormattedDate = sdf.format(request.getMaintenanceDate()); + factorySecondMaintPlanService.dateChange(entity.getEquipmentId(), oldFormattedDate,newFormattedDate); entity.setMaintenanceDate(request.getMaintenanceDate()); entity.setRemark(request.getRemark()); - eamSecondMaintenanceOrderMapper.updateById(entity); //鍒ゆ柇鏄惁瀛樺湪淇濆吇浜� 濡傛灉瀛樺湪鍒欏惎鍔ㄦ祦绋� if (StringUtils.isNotBlank(entity.getOperator())) { @@ -389,7 +406,6 @@ eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_SECOND_MAINTENANCE.name()); return result.isSuccess(); } - } return true; } @@ -665,6 +681,15 @@ } //淇濆瓨宸ュ崟 eamSecondMaintenanceOrderMapper.updateById(entity); + //寮傛鐢熸垚涓嬫浜屼繚宸ュ崟 + if (SecondMaintenanceStatusEnum.COMPLETE.name().equals(entity.getMaintenanceStatus())) { + try { + eamSecondMaintenanceOrderAsyncService.asyncGenerateNextMaintenanceOrder(entity.getId()); + } catch (Exception e) { + log.error("瑙﹀彂寮傛鐢熸垚涓嬫宸ュ崟澶辫触锛屽伐鍗旾D: {}", entity.getId(), e); + } + } + return entity; } diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IBaseFactoryService.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IBaseFactoryService.java index 904b722..6e7dde8 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IBaseFactoryService.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IBaseFactoryService.java @@ -16,6 +16,13 @@ public interface IBaseFactoryService extends IService<BaseFactory> { /** + * 閫氳繃code鏌ヨ瀵瑰簲涓績 + * @param code + * @return + */ + BaseFactory queryByCode(String code); + + /** * 鏌ヨ鎵�鏈変骇绾夸俊鎭紝骞跺垎鑺傜偣杩涜鏄剧ず */ List<EamBaseFactoryTreeModel> queryTreeList(); diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/BaseFactoryServiceImpl.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/BaseFactoryServiceImpl.java index a7d6cfd..663bd4a 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/BaseFactoryServiceImpl.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/BaseFactoryServiceImpl.java @@ -49,6 +49,18 @@ private BaseFactoryUserMapper BaseFactoryUserMapper; /** + * 閫氳繃code鏌ヨ瀵瑰簲涓績 + * @param code + * @return + */ + @Override + public BaseFactory queryByCode(String code){ + LambdaQueryWrapper<BaseFactory> query = new LambdaQueryWrapper<BaseFactory>(); + query.eq(BaseFactory::getOrgCode, code); + return this.baseMapper.selectOne(query); + } + + /** * queryTreeList 瀵瑰簲 queryTreeList 鏌ヨ鎵�鏈夌殑璁惧杞﹂棿绠$悊鏁版嵁,浠ユ爲缁撴瀯褰㈠紡鍝嶅簲缁欏墠绔� */ @Override -- Gitblit v1.9.3