From 37ad4f4417c940b2b376cbcdcc22a097f2cd12a9 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期四, 14 八月 2025 16:55:35 +0800 Subject: [PATCH] 二保批量打印接口 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamSecondMaintenanceOrderService.java | 8 + lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderServiceImpl.java | 65 +++++++++++++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSecondMaintenanceOrderController.java | 12 ++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamSecondMaintenanceOrderMapper.xml | 7 + lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/dto/EamSecondMaintenanceOrderExport.java | 164 ++++++++++++++++++++++++++++++++ lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamSecondMaintenanceOrderDetail.java | 2 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamSecondMaintenanceOrderMapper.java | 12 ++ 7 files changed, 268 insertions(+), 2 deletions(-) diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/dto/EamSecondMaintenanceOrderExport.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/dto/EamSecondMaintenanceOrderExport.java new file mode 100644 index 0000000..d3e97ee --- /dev/null +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/dto/EamSecondMaintenanceOrderExport.java @@ -0,0 +1,164 @@ +package org.jeecg.modules.eam.dto; + +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 com.fasterxml.jackson.annotation.JsonFormat; +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.jeecg.common.aspect.annotation.DictList; +import org.jeecg.modules.eam.entity.EamSecondMaintenanceOrderDetail; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + +@Data +@TableName("eam_second_maintenance_order") +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "eam_second_maintenance_order瀵硅薄", description = "璁惧浜岀骇淇濆吇") +public class EamSecondMaintenanceOrderExport { + /** + * 涓婚敭 + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "涓婚敭") + private String id; + /** + * 宸ュ崟鍙� + */ + @Excel(name = "宸ュ崟鍙�", width = 15) + @ApiModelProperty(value = "宸ュ崟鍙�") + private String orderNum; + /** + * 璁惧ID + */ + @Excel(name = "璁惧ID", width = 15) + @ApiModelProperty(value = "璁惧ID") + private String equipmentId; + /** + * 鏍囧噯ID + */ + @Excel(name = "鏍囧噯ID", width = 15) + @ApiModelProperty(value = "鏍囧噯ID") + @Dict(dictTable = "eam_maintenance_standard", dicCode = "id", dicText = "standard_name") + private String standardId; + /** + * 璁″垝淇濆吇鏃ユ湡 + */ + @ApiModelProperty(value = "璁″垝淇濆吇鏃ユ湡") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date maintenanceDate; + /** + * 瀹為檯寮�濮嬫椂闂� + */ + @ApiModelProperty(value = "瀹為檯寮�濮嬫椂闂�") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date actualStartTime; + /** + * 瀹為檯缁撴潫鏃堕棿 + */ + @ApiModelProperty(value = "瀹為檯缁撴潫鏃堕棿") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date actualEndTime; + /** 鎿嶄綔宸� */ + @ApiModelProperty(value = "鎿嶄綔宸�") + @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") + private String operator ; + /** 缁翠慨宸� */ + @ApiModelProperty(value = "缁翠慨宸�") + @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") + private String repairman ; + /** + * 淇濆吇鐘舵�� 寰呬繚鍏汇�佷繚鍏讳腑銆佺鐞嗗憳纭銆佹鏌ヤ汉纭銆佸凡瀹屾垚 + */ + @Excel(name = "淇濆吇鐘舵��", width = 15) + @ApiModelProperty(value = "淇濆吇鐘舵��") + @Dict(dicCode = "second_maintenance_status") + private String maintenanceStatus; + /** + * 鍒涘缓鏂瑰紡 + */ + @Excel(name = "鍒涘缓鏂瑰紡", width = 15) + @ApiModelProperty(value = "鍒涘缓鏂瑰紡") + @Dict(dicCode = "order_creation_method") + private String creationMethod; + /** + * 绠$悊鍛樼‘璁� + */ + @Excel(name = "绠$悊鍛樼‘璁�", width = 15) + @ApiModelProperty(value = "绠$悊鍛樼‘璁�") + @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") + private String manageUser; + /** + * 绠$悊鍛樼‘璁ょ粨鏋� + */ + @ApiModelProperty(value = "绠$悊鍛樼‘璁ょ粨鏋�") + @Dict(dicCode = "approve_reject") + private String manageUserResult; + /** 闂鎻忚堪;榛樿 鏃� */ + @ApiModelProperty(name = "闂鎻忚堪",notes = "榛樿 鏃�") + private String problemDescription ; + /** 澶勭悊鎻忚堪;榛樿 鏃� */ + @ApiModelProperty(name = "澶勭悊鎻忚堪",notes = "榛樿 鏃�") + private String dealDescription ; + /** 绠$悊鍛樼‘璁ゆ椂闂� */ + @ApiModelProperty(name = "绠$悊鍛樼‘璁ゆ椂闂�",notes = "") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date confirmTime; + /** 妫�鏌ヤ汉纭 */ + @ApiModelProperty(name = "妫�鏌ヤ汉纭",notes = "") + @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") + private String inspector; + /** + * 妫�鏌ヤ汉纭缁撴灉 + */ + @ApiModelProperty(name = "妫�鏌ヤ汉纭缁撴灉",notes = "") + @Dict(dicCode = "approve_reject") + private String inspectorResult; + /** 妫�鏌ヤ汉鎰忚 */ + @ApiModelProperty(name = "妫�鏌ヤ汉鎰忚",notes = "") + private String inspectConfirmComment; + /** 妫�鏌ヤ汉纭鏃堕棿 */ + @ApiModelProperty(name = "妫�鏌ヤ汉纭鏃堕棿",notes = "") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date inspectConfirmTime; + /** HF缂栫爜 */ + @ApiModelProperty(name = "HF缂栫爜",notes = "") + private String hfCode; + /** + * 澶囨敞 + */ + @Excel(name = "澶囨敞", width = 15) + @ApiModelProperty(value = "澶囨敞") + private String remark; + + //鍒楄〃灞曠ず + @TableField(exist = false) + private String equipmentCode; + @TableField(exist = false) + private String equipmentName; + //鍨嬪彿 + @TableField(exist = false) + private String equipmentModel; + + //缁翠慨浜哄憳淇濆吇鍐呭 + @DictList + private List<EamSecondMaintenanceOrderDetail> maintenanceOrderDetails; + + //鎿嶄綔浜哄憳淇濆吇鍐呭 + @DictList + private List<EamSecondMaintenanceOrderDetail> operationOrderDetails; +} diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamSecondMaintenanceOrderDetail.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamSecondMaintenanceOrderDetail.java index 6712847..6bc31cb 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamSecondMaintenanceOrderDetail.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamSecondMaintenanceOrderDetail.java @@ -8,6 +8,7 @@ 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; @@ -59,6 +60,7 @@ private String itemName; /** 淇濆吇缁撴灉 */ @ApiModelProperty(name = "淇濆吇缁撴灉",notes = "") + @Dict(dicCode = "maintenance_result") private String maintenanceResult; /** 鎶ヤ慨鏍囪 */ @ApiModelProperty(name = "鎶ヤ慨鏍囪",notes = "") diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSecondMaintenanceOrderController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSecondMaintenanceOrderController.java index e5c3882..2b6b560 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSecondMaintenanceOrderController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSecondMaintenanceOrderController.java @@ -251,6 +251,18 @@ } /** + * 鎵归噺鎵撳嵃浜屼繚宸ュ崟 + * @param ids + * @return + */ + @AutoLog(value = "璁惧浜岀骇淇濆吇-鎵归噺鎵撳嵃浜屼繚宸ュ崟") + @ApiOperation(value = "璁惧浜岀骇淇濆吇-鎵归噺鎵撳嵃浜屼繚宸ュ崟", notes = "璁惧浜岀骇淇濆吇-鎵归噺鎵撳嵃浜屼繚宸ュ崟") + @GetMapping(value = "/batchExport") + public Result<?> export(String ids){ + return Result.ok(eamSecondMaintenanceOrderService.export(ids)); + } + + /** * 閫氳繃id鏌ヨ * * @param id diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamSecondMaintenanceOrderMapper.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamSecondMaintenanceOrderMapper.java index 52eb99a..c9145a9 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamSecondMaintenanceOrderMapper.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamSecondMaintenanceOrderMapper.java @@ -6,8 +6,7 @@ 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.EamEquipment; -import org.jeecg.modules.eam.entity.EamMaintenanceStandard; +import org.jeecg.modules.eam.dto.EamSecondMaintenanceOrderExport; import org.jeecg.modules.eam.entity.EamSecondMaintenanceOrder; import java.util.List; @@ -22,9 +21,18 @@ /** * 鍒嗛〉鏌ヨ + * * @param page * @param queryWrapper * @return */ IPage<EamSecondMaintenanceOrder> queryPageList(Page<EamSecondMaintenanceOrder> page, @Param(Constants.WRAPPER) QueryWrapper<EamSecondMaintenanceOrder> queryWrapper); + + /** + * 鍒楄〃鏌ヨ + * @param queryWrapper + * @return + */ + List<EamSecondMaintenanceOrderExport> queryList(@Param(Constants.WRAPPER) QueryWrapper<EamSecondMaintenanceOrderExport> queryWrapper); + } 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 d0e591c..4084ac4 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 @@ -10,4 +10,11 @@ left join flow_my_business f on f.data_id=wmo.id ${ew.customSqlSegment} </select> + <select id="queryList" resultType="org.jeecg.modules.eam.dto.EamSecondMaintenanceOrderExport"> + select wmo.*, e.equipment_code, e.equipment_name,e.equipment_model + from eam_second_maintenance_order wmo + inner join eam_equipment e + on wmo.equipment_id = e.id + ${ew.customSqlSegment} + </select> </mapper> 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 6501ae8..028c3b9 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 @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.jeecg.modules.eam.dto.EamSecondMaintenanceOrderExport; import org.jeecg.modules.eam.entity.EamSecondMaintenanceOrder; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.eam.request.EamSecondMaintenanceQuery; @@ -57,4 +58,11 @@ * @return */ EamSecondMaintenanceOrder approval(EamSecondMaintenanceRequest request); + + /** + * 鎵归噺鎵撳嵃浜屼繚宸ュ崟 + * @param ids + * @return + */ + List<EamSecondMaintenanceOrderExport> export(String ids); } 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 2b9c57c..f7ae1c9 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 @@ -22,6 +22,7 @@ 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.dto.EamSecondMaintenanceOrderExport; import org.jeecg.modules.eam.entity.*; import org.jeecg.modules.eam.mapper.EamEquipmentMapper; import org.jeecg.modules.eam.mapper.EamMaintenanceStandardMapper; @@ -95,6 +96,8 @@ private EamMaintenanceStandardMapper eamMaintenanceStandardMapper; @Resource private BaseFactoryMapper baseFactoryMapper; + @Autowired + private IEamSecondMaintenanceOrderDetailService eamSecondMaintenanceOrderDetailService; @Override public IPage<EamSecondMaintenanceOrder> queryPageList(Page<EamSecondMaintenanceOrder> page, EamSecondMaintenanceQuery query) { @@ -666,6 +669,68 @@ return entity; } + /** + * 鎵归噺鎵撳嵃浜屼繚宸ュ崟 + * @param ids + * @return + */ + @Override + public List<EamSecondMaintenanceOrderExport> export(String ids){ + QueryWrapper<EamSecondMaintenanceOrderExport> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("wmo.del_flag",CommonConstant.DEL_FLAG_0.toString()); + //鐢ㄦ埛鏁版嵁鏉冮檺 + 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("wmo.id", idList); + } else { + queryWrapper.orderByDesc("wmo.create_time"); + } + List<EamSecondMaintenanceOrderExport> eamSecondMaintenanceOrderExports=eamSecondMaintenanceOrderMapper.queryList(queryWrapper); + //濉厖瀵瑰簲浜屼繚鏄庣粏 + if (!eamSecondMaintenanceOrderExports.isEmpty()){ + eamSecondMaintenanceOrderExports.forEach(item->{ + //缁翠慨浜哄憳淇濆吇鍐呭 + List<EamSecondMaintenanceOrderDetail> maintenanceOrderDetails=eamSecondMaintenanceOrderDetailService. + list(new QueryWrapper<EamSecondMaintenanceOrderDetail>().eq("order_id",item.getId()). + eq("item_category",EamMaintenanceStandardDetailCategory.REPAIRER_MAINTENANCE.name()) + .orderByAsc("item_code")); + if (!maintenanceOrderDetails.isEmpty()){ + item.setMaintenanceOrderDetails(maintenanceOrderDetails); + } + //鎿嶄綔浜哄憳淇濆吇鍐呭 + List<EamSecondMaintenanceOrderDetail> operationOrderDetails=eamSecondMaintenanceOrderDetailService. + list(new QueryWrapper<EamSecondMaintenanceOrderDetail>().eq("order_id",item.getId()). + eq("item_category",EamMaintenanceStandardDetailCategory.OPERATOR_MAINTENANCE.name()) + .orderByAsc("item_code")); + if (!operationOrderDetails.isEmpty()) { + item.setOperationOrderDetails(operationOrderDetails); + } + }); + } + return eamSecondMaintenanceOrderExports; + } + private boolean isUserAuthorized(FlowMyBusiness flowMyBusiness, LoginUser user) { List<String> todoUsers = JSON.parseArray(flowMyBusiness.getTodoUsers(), String.class); return todoUsers != null && todoUsers.contains(user.getUsername()); -- Gitblit v1.9.3