客户查询明细表
This commit is contained in:
parent
8dc5e2b0ea
commit
21f1d2b884
|
|
@ -85,6 +85,39 @@
|
||||||
ORDER BY a.bill_date DESC,a.create_time DESC
|
ORDER BY a.bill_date DESC,a.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 根据条件参数查询盘点子表列表 -->
|
||||||
|
<select id="findCrmInventoryDetail1" resultMap="crmInventoryDetailMap" parameterType="map">
|
||||||
|
SELECT
|
||||||
|
a.bill_no, a.bill_date, a.count_num, a.prod_date
|
||||||
|
FROM crm_inventory_detail a
|
||||||
|
<where>
|
||||||
|
<if test="billId != null and billId != ''">
|
||||||
|
AND a.bill_id = #{billId}
|
||||||
|
</if>
|
||||||
|
<if test="clientId != null and clientId != ''">
|
||||||
|
AND a.client_id = #{clientId}
|
||||||
|
</if>
|
||||||
|
<if test="confirmStatus != null and confirmStatus != ''">
|
||||||
|
AND a.confirm_status = #{confirmStatus}
|
||||||
|
</if>
|
||||||
|
<if test="goodsNo != null and goodsNo != ''">
|
||||||
|
AND a.goods_no = #{goodsNo}
|
||||||
|
</if>
|
||||||
|
<if test="companyId != null and companyId != ''">
|
||||||
|
AND a.company_id = #{companyId}
|
||||||
|
</if>
|
||||||
|
<if test="startDate != null and startDate !=''">
|
||||||
|
AND TO_CHAR(TO_DATE(SUBSTR(a.bill_date,1,10),'yyyy-MM-dd'),'yyyy-MM-dd') >=
|
||||||
|
TO_CHAR(TO_DATE(SUBSTR(#{startDate},1,10),'yyyy-MM-dd'),'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
<if test="endDate != null and endDate !=''">
|
||||||
|
AND TO_CHAR(TO_DATE(SUBSTR(a.bill_date,1,10),'yyyy-MM-dd'),'yyyy-MM-dd') <=
|
||||||
|
TO_CHAR(TO_DATE(SUBSTR(#{endDate},1,10),'yyyy-MM-dd'),'yyyy-MM-dd')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY a.bill_date, a.create_time
|
||||||
|
</select>
|
||||||
|
|
||||||
<!-- 根据条件参数合计数量 -->
|
<!-- 根据条件参数合计数量 -->
|
||||||
<select id="sumCountNum" resultType="Double" parameterType="map">
|
<select id="sumCountNum" resultType="Double" parameterType="map">
|
||||||
SELECT NVL(SUM(count_num), 0) num FROM crm_inventory_detail
|
SELECT NVL(SUM(count_num), 0) num FROM crm_inventory_detail
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@ package com.yb.lb.webapp.stock.service;
|
||||||
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.yb.lb.common.base.oracle.BaseOracleDao;
|
import com.yb.lb.common.base.oracle.BaseOracleDao;
|
||||||
|
import com.yb.lb.common.utils.DateUtil;
|
||||||
import com.yb.lb.webapp.stock.entity.ClientStockReport;
|
import com.yb.lb.webapp.stock.entity.ClientStockReport;
|
||||||
|
import com.yb.lb.webapp.stock.entity.CrmInventoryDetail;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
@ -10,6 +12,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 盘点单
|
* 盘点单
|
||||||
|
|
@ -49,13 +52,43 @@ public class ClientStockReportService {
|
||||||
* @date 2024/10/31
|
* @date 2024/10/31
|
||||||
**/
|
**/
|
||||||
public List listClientStockDetail(Map<String, Object> params) {
|
public List listClientStockDetail(Map<String, Object> params) {
|
||||||
|
// 最后返回的数据
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
// 查询日期范围内的日期
|
||||||
|
String startDate = params.getOrDefault("startDate", "") + "";
|
||||||
|
String endDate = params.getOrDefault("endDate", "") + "";
|
||||||
|
List<String> dateList = DateUtil.findDateList(startDate, endDate);
|
||||||
List<Map<String, Object>> goodsList = this.findList(params, ".getClientInventoryDetail");
|
List<Map<String, Object>> goodsList = this.findList(params, ".getClientInventoryDetail");
|
||||||
for (Map<String, Object> goodsMap : goodsList) {
|
for (Map<String, Object> goodsMap : goodsList) {
|
||||||
Map<String, Object> selMap = new HashMap<>(params);
|
Map<String, Object> selMap = new HashMap<>(params);
|
||||||
selMap.put("goodsNo", goodsMap.get("goodsNo"));
|
selMap.put("goodsNo", goodsMap.get("goodsNo"));
|
||||||
selMap.put("confirmStatus", "1");
|
selMap.put("confirmStatus", "1");
|
||||||
goodsMap.put("pdList", inventoryInfoService.findDetailList(selMap, ".findCrmInventoryDetailByCondition"));
|
List<CrmInventoryDetail> detailList = inventoryInfoService.findDetailList(selMap, ".findCrmInventoryDetail1");
|
||||||
|
List<Map<String, Object>> pdList = new ArrayList<>();
|
||||||
|
for (String date : dateList) {
|
||||||
|
// 根据日期去寻找集合中匹配的值
|
||||||
|
List<CrmInventoryDetail> inventoryDetails = detailList.stream()
|
||||||
|
.filter(a -> date.equals(a.getBillDate())).collect(Collectors.toList());
|
||||||
|
if (inventoryDetails.size() > 0) {
|
||||||
|
for (CrmInventoryDetail inventoryDetail : inventoryDetails) {
|
||||||
|
Map<String, Object> oneMap = new HashMap<>();
|
||||||
|
oneMap.put("billNo", inventoryDetail.getBillNo());
|
||||||
|
oneMap.put("billDate", inventoryDetail.getBillDate());
|
||||||
|
oneMap.put("prodDate", inventoryDetail.getProdDate());
|
||||||
|
oneMap.put("countNum", inventoryDetail.getCountNum());
|
||||||
|
pdList.add(oneMap);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Map<String, Object> oneMap = new HashMap<>();
|
||||||
|
oneMap.put("billNo", "");
|
||||||
|
oneMap.put("billDate", date);
|
||||||
|
oneMap.put("prodDate", "");
|
||||||
|
oneMap.put("countNum", "0");
|
||||||
|
pdList.add(oneMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
goodsMap.put("pdList", pdList);
|
||||||
list.add(goodsMap);
|
list.add(goodsMap);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue