diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/entity/DlRepairSo.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/entity/DlRepairSo.java index 3931e90b..9e185191 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/entity/DlRepairSo.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/entity/DlRepairSo.java @@ -10,7 +10,6 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.springframework.format.annotation.DateTimeFormat; -import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; @@ -112,4 +111,10 @@ public class DlRepairSo extends TenantBaseDO { /** 关联的配件申请单的id(dl_ticket_wares表的ID) */ private String twId; + + /** + * 车牌号 + */ + @TableField(exist = false) + private String licenseNumber; } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/entity/DlRepairSoi.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/entity/DlRepairSoi.java index 02309b59..dc8eebdc 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/entity/DlRepairSoi.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/entity/DlRepairSoi.java @@ -1,7 +1,9 @@ package cn.iocoder.yudao.module.stockOperate.entity; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; +import cn.iocoder.yudao.module.project.entity.RepairWares; 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 lombok.Data; @@ -67,4 +69,15 @@ public class DlRepairSoi extends TenantBaseDO { * 备注 */ private String remark; + + /** + * 配件信息 + */ + @TableField(exist = false) + private RepairWares wares; + /** + * 配件类型名称 + */ + @TableField(exist = false) + private String typeName; } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java index 1f1dd665..1b09bf62 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java @@ -38,11 +38,11 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import javax.annotation.Resource; - import java.math.BigDecimal; -import java.util.Iterator; +import java.util.HashMap; import java.util.List; -import java.util.Objects; +import java.util.Map; +import java.util.function.Function; import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; @@ -197,6 +197,21 @@ public class DlRepairSoServiceImpl extends ServiceImpl list = repairSoiService.list(new LambdaQueryWrapper().eq(DlRepairSoi::getSoId, result.getId())); + if(!list.isEmpty()){ + //所有有配件的分类 + List> typeMapList = waresService.getAllTypeList(); + Map typeMap = new HashMap<>(); + for(Map map:typeMapList){ + typeMap.put(map.get("id"),map.get("name")); + } + //关联查配件信息 + List repairWaresList = waresService.listByIds(list.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList())); + Map waresMap = repairWaresList.stream().collect(Collectors.toMap(RepairWares::getId, Function.identity())); + list.forEach(item->{ + item.setWares(waresMap.get(item.getGoodsId())); + item.setTypeName(typeMap.get(item.getWares().getType())); + }); + } result.setGoodsList(list); return result; } @@ -338,7 +353,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl i.getGoodsId().equals(item.getPartId())).findFirst().ifPresent(i -> { titem.setItemCount(item.getItemCount() - i.getGoodsCount()); - titem.setItemMoney(new BigDecimal(titem.getItemCount()).multiply(item.getItemPrice()).multiply(item.getItemDiscount())); + titem.setItemMoney(new BigDecimal(item.getItemCount()).multiply(item.getItemPrice()).multiply(item.getItemDiscount())); }); return titem; }).collect(Collectors.toList()); diff --git a/dl-module-repair/src/main/resources/mapper/stockOperate/DlRepairSoMapper.xml b/dl-module-repair/src/main/resources/mapper/stockOperate/DlRepairSoMapper.xml index beb00091..06abc89b 100644 --- a/dl-module-repair/src/main/resources/mapper/stockOperate/DlRepairSoMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/stockOperate/DlRepairSoMapper.xml @@ -25,40 +25,43 @@ + - select id, - so_type, - purchase_type, - so_no, - supplier_id, - supplier_name, - user_id, - user_name, - so_time, - item_count, - total_price, - so_status, - remark, - corp_id, - corp_name, - dept_id, - create_time, - update_time, - updater, - tw_id + select so.id, + so.so_type, + so.purchase_type, + so.so_no, + so.supplier_id, + so.supplier_name, + so.user_id, + so.user_name, + so.so_time, + so.item_count, + so.total_price, + so.so_status, + so.remark, + so.corp_id, + so.corp_name, + so.dept_id, + so.create_time, + so.update_time, + so.updater, + so.tw_id, + dtw.license_number from dl_repair_so so + LEFT JOIN dl_ticket_wares dtw ON so.tw_id = dtw.id where so.deleted = '0'