1
This commit is contained in:
parent
8c22a78224
commit
77036c32f5
@ -10,7 +10,6 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -112,4 +111,10 @@ public class DlRepairSo extends TenantBaseDO {
|
|||||||
|
|
||||||
/** 关联的配件申请单的id(dl_ticket_wares表的ID) */
|
/** 关联的配件申请单的id(dl_ticket_wares表的ID) */
|
||||||
private String twId;
|
private String twId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车牌号
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String licenseNumber;
|
||||||
}
|
}
|
@ -1,7 +1,9 @@
|
|||||||
package cn.iocoder.yudao.module.stockOperate.entity;
|
package cn.iocoder.yudao.module.stockOperate.entity;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
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.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -67,4 +69,15 @@ public class DlRepairSoi extends TenantBaseDO {
|
|||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配件信息
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private RepairWares wares;
|
||||||
|
/**
|
||||||
|
* 配件类型名称
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String typeName;
|
||||||
}
|
}
|
@ -38,11 +38,11 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Iterator;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
@ -197,6 +197,21 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
|||||||
|
|
||||||
// 查子表
|
// 查子表
|
||||||
List<DlRepairSoi> list = repairSoiService.list(new LambdaQueryWrapper<DlRepairSoi>().eq(DlRepairSoi::getSoId, result.getId()));
|
List<DlRepairSoi> list = repairSoiService.list(new LambdaQueryWrapper<DlRepairSoi>().eq(DlRepairSoi::getSoId, result.getId()));
|
||||||
|
if(!list.isEmpty()){
|
||||||
|
//所有有配件的分类
|
||||||
|
List<Map<String,String>> typeMapList = waresService.getAllTypeList();
|
||||||
|
Map<String,String> typeMap = new HashMap<>();
|
||||||
|
for(Map<String,String> map:typeMapList){
|
||||||
|
typeMap.put(map.get("id"),map.get("name"));
|
||||||
|
}
|
||||||
|
//关联查配件信息
|
||||||
|
List<RepairWares> repairWaresList = waresService.listByIds(list.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()));
|
||||||
|
Map<String,RepairWares> 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);
|
result.setGoodsList(list);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -338,7 +353,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
|||||||
titem.setId(item.getId());
|
titem.setId(item.getId());
|
||||||
sois.stream().filter(i -> i.getGoodsId().equals(item.getPartId())).findFirst().ifPresent(i -> {
|
sois.stream().filter(i -> i.getGoodsId().equals(item.getPartId())).findFirst().ifPresent(i -> {
|
||||||
titem.setItemCount(item.getItemCount() - i.getGoodsCount());
|
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;
|
return titem;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
@ -25,40 +25,43 @@
|
|||||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||||
<result property="updater" column="updater" jdbcType="VARCHAR"/>
|
<result property="updater" column="updater" jdbcType="VARCHAR"/>
|
||||||
<result property="twId" column="tw_id" />
|
<result property="twId" column="tw_id" />
|
||||||
|
<result property="licenseNumber" column="license_number" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_SQL">
|
<sql id="Base_SQL">
|
||||||
select id,
|
select so.id,
|
||||||
so_type,
|
so.so_type,
|
||||||
purchase_type,
|
so.purchase_type,
|
||||||
so_no,
|
so.so_no,
|
||||||
supplier_id,
|
so.supplier_id,
|
||||||
supplier_name,
|
so.supplier_name,
|
||||||
user_id,
|
so.user_id,
|
||||||
user_name,
|
so.user_name,
|
||||||
so_time,
|
so.so_time,
|
||||||
item_count,
|
so.item_count,
|
||||||
total_price,
|
so.total_price,
|
||||||
so_status,
|
so.so_status,
|
||||||
remark,
|
so.remark,
|
||||||
corp_id,
|
so.corp_id,
|
||||||
corp_name,
|
so.corp_name,
|
||||||
dept_id,
|
so.dept_id,
|
||||||
create_time,
|
so.create_time,
|
||||||
update_time,
|
so.update_time,
|
||||||
updater,
|
so.updater,
|
||||||
tw_id
|
so.tw_id,
|
||||||
|
dtw.license_number
|
||||||
from dl_repair_so so
|
from dl_repair_so so
|
||||||
|
LEFT JOIN dl_ticket_wares dtw ON so.tw_id = dtw.id
|
||||||
where so.deleted = '0'
|
where so.deleted = '0'
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="getRepairSoPage" resultMap="BaseResultMap">
|
<select id="getRepairSoPage" resultMap="BaseResultMap">
|
||||||
<include refid="Base_SQL"/>
|
<include refid="Base_SQL"/>
|
||||||
<if test="map.soType != null and map.soType">
|
<if test="map.soType != null and map.soType">
|
||||||
and so_type = #{map.soType}
|
and so.so_type = #{map.soType}
|
||||||
</if>
|
</if>
|
||||||
<if test="map.purchaseType != null and map.purchaseType != ''">
|
<if test="map.purchaseType != null and map.purchaseType != ''">
|
||||||
and purchase_type = #{map.purchaseType}
|
and so.purchase_type = #{map.purchaseType}
|
||||||
</if>
|
</if>
|
||||||
<if test="map.soStatus != null and map.soStatus != ''">
|
<if test="map.soStatus != null and map.soStatus != ''">
|
||||||
and so.so_status = #{map.soStatus}
|
and so.so_status = #{map.soStatus}
|
||||||
|
Loading…
Reference in New Issue
Block a user