给采购、销售、零售统计接口增加供应商、客户的查询条件

This commit is contained in:
季圣华
2023-04-10 23:37:49 +08:00
parent 654dd4f689
commit 711b0c309a
4 changed files with 50 additions and 31 deletions

View File

@@ -469,6 +469,7 @@ public class DepotItemController {
@RequestParam("pageSize") Integer pageSize,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam(value = "organId", required = false) Long organId,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam("materialParam") String materialParam,
@RequestParam("mpList") String mpList,
@@ -484,20 +485,20 @@ public class DepotItemController {
List<Long> depotList = depotService.parseDepotList(depotId);
Boolean forceFlag = systemConfigService.getForceApprovalFlag();
List<DepotItemVo4WithInfoEx> dataList = depotItemService.getListWithBugOrSale(StringUtil.toNull(materialParam),
"buy", beginTime, endTime, creatorArray, organArray, depotList, forceFlag, (currentPage-1)*pageSize, pageSize);
"buy", beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, (currentPage-1)*pageSize, pageSize);
String[] mpArr = mpList.split(",");
int total = depotItemService.getListWithBugOrSaleCount(StringUtil.toNull(materialParam),
"buy", beginTime, endTime, creatorArray, organArray, depotList, forceFlag);
"buy", beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag);
map.put("total", total);
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (DepotItemVo4WithInfoEx diEx : dataList) {
JSONObject item = new JSONObject();
BigDecimal InSum = depotItemService.buyOrSale("入库", "采购", diEx.getMId(), beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "number");
BigDecimal OutSum = depotItemService.buyOrSale("出库", "采购退货", diEx.getMId(), beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "number");
BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "采购", diEx.getMId(), beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "price");
BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "采购退货", diEx.getMId(), beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "price");
BigDecimal InSum = depotItemService.buyOrSale("入库", "采购", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number");
BigDecimal OutSum = depotItemService.buyOrSale("出库", "采购退货", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number");
BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "采购", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "采购退货", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal InOutSumPrice = InSumPrice.subtract(OutSumPrice);
item.put("barCode", diEx.getBarCode());
item.put("materialName", diEx.getMName());
@@ -517,8 +518,8 @@ public class DepotItemController {
dataArray.add(item);
}
}
BigDecimal inSumPriceTotal = depotItemService.buyOrSale("入库", "采购", null, beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "price");
BigDecimal outSumPriceTotal = depotItemService.buyOrSale("出库", "采购退货", null, beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "price");
BigDecimal inSumPriceTotal = depotItemService.buyOrSale("入库", "采购", null, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal outSumPriceTotal = depotItemService.buyOrSale("出库", "采购退货", null, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal realityPriceTotal = inSumPriceTotal.subtract(outSumPriceTotal);
map.put("rows", dataArray);
map.put("realityPriceTotal", realityPriceTotal);
@@ -549,6 +550,7 @@ public class DepotItemController {
@RequestParam("pageSize") Integer pageSize,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam(value = "organId", required = false) Long organId,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam("materialParam") String materialParam,
@RequestParam("mpList") String mpList,
@@ -564,20 +566,20 @@ public class DepotItemController {
List<Long> depotList = depotService.parseDepotList(depotId);
Boolean forceFlag = systemConfigService.getForceApprovalFlag();
List<DepotItemVo4WithInfoEx> dataList = depotItemService.getListWithBugOrSale(StringUtil.toNull(materialParam),
"sale", beginTime, endTime, creatorArray, organArray, depotList, forceFlag, (currentPage-1)*pageSize, pageSize);
"sale", beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, (currentPage-1)*pageSize, pageSize);
String[] mpArr = mpList.split(",");
int total = depotItemService.getListWithBugOrSaleCount(StringUtil.toNull(materialParam),
"sale", beginTime, endTime, creatorArray, organArray, depotList, forceFlag);
"sale", beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag);
map.put("total", total);
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (DepotItemVo4WithInfoEx diEx : dataList) {
JSONObject item = new JSONObject();
BigDecimal OutSumRetail = depotItemService.buyOrSale("出库", "零售", diEx.getMId(), beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "number");
BigDecimal InSumRetail = depotItemService.buyOrSale("入库", "零售退货", diEx.getMId(), beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "number");
BigDecimal OutSumRetailPrice = depotItemService.buyOrSale("出库", "零售", diEx.getMId(), beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "price");
BigDecimal InSumRetailPrice = depotItemService.buyOrSale("入库", "零售退货", diEx.getMId(), beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "price");
BigDecimal OutSumRetail = depotItemService.buyOrSale("出库", "零售", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number");
BigDecimal InSumRetail = depotItemService.buyOrSale("入库", "零售退货", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number");
BigDecimal OutSumRetailPrice = depotItemService.buyOrSale("出库", "零售", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal InSumRetailPrice = depotItemService.buyOrSale("入库", "零售退货", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal OutInSumPrice = OutSumRetailPrice.subtract(InSumRetailPrice);
item.put("barCode", diEx.getBarCode());
item.put("materialName", diEx.getMName());
@@ -597,8 +599,8 @@ public class DepotItemController {
dataArray.add(item);
}
}
BigDecimal outSumPriceTotal = depotItemService.buyOrSale("出库", "零售", null, beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "price");
BigDecimal inSumPriceTotal = depotItemService.buyOrSale("入库", "零售退货", null, beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "price");
BigDecimal outSumPriceTotal = depotItemService.buyOrSale("出库", "零售", null, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal inSumPriceTotal = depotItemService.buyOrSale("入库", "零售退货", null, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal realityPriceTotal = outSumPriceTotal.subtract(inSumPriceTotal);
map.put("rows", dataArray);
map.put("realityPriceTotal", realityPriceTotal);
@@ -630,6 +632,7 @@ public class DepotItemController {
@RequestParam("pageSize") Integer pageSize,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam(value = "organId", required = false) Long organId,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam("materialParam") String materialParam,
@RequestParam("mpList") String mpList,
@@ -645,20 +648,20 @@ public class DepotItemController {
List<Long> depotList = depotService.parseDepotList(depotId);
Boolean forceFlag = systemConfigService.getForceApprovalFlag();
List<DepotItemVo4WithInfoEx> dataList = depotItemService.getListWithBugOrSale(StringUtil.toNull(materialParam),
"sale", beginTime, endTime, creatorArray, organArray, depotList, forceFlag, (currentPage-1)*pageSize, pageSize);
"sale", beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, (currentPage-1)*pageSize, pageSize);
String[] mpArr = mpList.split(",");
int total = depotItemService.getListWithBugOrSaleCount(StringUtil.toNull(materialParam),
"sale", beginTime, endTime, creatorArray, organArray, depotList, forceFlag);
"sale", beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag);
map.put("total", total);
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (DepotItemVo4WithInfoEx diEx : dataList) {
JSONObject item = new JSONObject();
BigDecimal OutSum = depotItemService.buyOrSale("出库", "销售", diEx.getMId(), beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "number");
BigDecimal InSum = depotItemService.buyOrSale("入库", "销售退货", diEx.getMId(), beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "number");
BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "销售", diEx.getMId(), beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "price");
BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "销售退货", diEx.getMId(), beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "price");
BigDecimal OutSum = depotItemService.buyOrSale("出库", "销售", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number");
BigDecimal InSum = depotItemService.buyOrSale("入库", "销售退货", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "number");
BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "销售", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "销售退货", diEx.getMId(), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal OutInSumPrice = OutSumPrice.subtract(InSumPrice);
item.put("barCode", diEx.getBarCode());
item.put("materialName", diEx.getMName());
@@ -678,8 +681,8 @@ public class DepotItemController {
dataArray.add(item);
}
}
BigDecimal outSumPriceTotal = depotItemService.buyOrSale("出库", "销售", null, beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "price");
BigDecimal inSumPriceTotal = depotItemService.buyOrSale("入库", "销售退货", null, beginTime, endTime, creatorArray, organArray, depotList, forceFlag, "price");
BigDecimal outSumPriceTotal = depotItemService.buyOrSale("出库", "销售", null, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal inSumPriceTotal = depotItemService.buyOrSale("入库", "销售退货", null, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal realityPriceTotal = outSumPriceTotal.subtract(inSumPriceTotal);
map.put("rows", dataArray);
map.put("realityPriceTotal", realityPriceTotal);

View File

@@ -70,6 +70,7 @@ public interface DepotItemMapperEx {
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("creatorArray") String[] creatorArray,
@Param("organId") Long organId,
@Param("organArray") String [] organArray,
@Param("depotList") List<Long> depotList,
@Param("forceFlag") Boolean forceFlag,
@@ -82,6 +83,7 @@ public interface DepotItemMapperEx {
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("creatorArray") String[] creatorArray,
@Param("organId") Long organId,
@Param("organArray") String [] organArray,
@Param("depotList") List<Long> depotList,
@Param("forceFlag") Boolean forceFlag);
@@ -93,6 +95,7 @@ public interface DepotItemMapperEx {
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("creatorArray") String[] creatorArray,
@Param("organId") Long organId,
@Param("organArray") String [] organArray,
@Param("depotList") List<Long> depotList,
@Param("forceFlag") Boolean forceFlag,
@@ -105,6 +108,7 @@ public interface DepotItemMapperEx {
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("creatorArray") String[] creatorArray,
@Param("organId") Long organId,
@Param("organArray") String [] organArray,
@Param("depotList") List<Long> depotList,
@Param("forceFlag") Boolean forceFlag,

View File

@@ -321,10 +321,10 @@ public class DepotItemService {
}
public List<DepotItemVo4WithInfoEx> getListWithBugOrSale(String materialParam, String billType,
String beginTime, String endTime, String[] creatorArray, String [] organArray, List<Long> depotList, Boolean forceFlag, Integer offset, Integer rows)throws Exception {
String beginTime, String endTime, String[] creatorArray, Long organId, String [] organArray, List<Long> depotList, Boolean forceFlag, Integer offset, Integer rows)throws Exception {
List<DepotItemVo4WithInfoEx> list =null;
try{
list = depotItemMapperEx.getListWithBugOrSale(materialParam, billType, beginTime, endTime, creatorArray, organArray, depotList, forceFlag, offset, rows);
list = depotItemMapperEx.getListWithBugOrSale(materialParam, billType, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
@@ -332,10 +332,10 @@ public class DepotItemService {
}
public int getListWithBugOrSaleCount(String materialParam, String billType,
String beginTime, String endTime, String[] creatorArray, String [] organArray, List<Long> depotList, Boolean forceFlag)throws Exception {
String beginTime, String endTime, String[] creatorArray, Long organId, String [] organArray, List<Long> depotList, Boolean forceFlag)throws Exception {
int result=0;
try{
result = depotItemMapperEx.getListWithBugOrSaleCount(materialParam, billType, beginTime, endTime, creatorArray, organArray, depotList, forceFlag);
result = depotItemMapperEx.getListWithBugOrSaleCount(materialParam, billType, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag);
}catch(Exception e){
JshException.readFail(logger, e);
}
@@ -343,13 +343,13 @@ public class DepotItemService {
}
public BigDecimal buyOrSale(String type, String subType, Long MId, String beginTime, String endTime,
String[] creatorArray, String [] organArray, List<Long> depotList, Boolean forceFlag, String sumType) throws Exception{
String[] creatorArray, Long organId, String [] organArray, List<Long> depotList, Boolean forceFlag, String sumType) throws Exception{
BigDecimal result= BigDecimal.ZERO;
try{
if (SUM_TYPE.equals(sumType)) {
result= depotItemMapperEx.buyOrSaleNumber(type, subType, MId, beginTime, endTime, creatorArray, organArray, depotList, forceFlag, sumType);
result= depotItemMapperEx.buyOrSaleNumber(type, subType, MId, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, sumType);
} else {
result= depotItemMapperEx.buyOrSalePrice(type, subType, MId, beginTime, endTime, creatorArray, organArray, depotList, forceFlag, sumType);
result= depotItemMapperEx.buyOrSalePrice(type, subType, MId, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, sumType);
}
}catch(Exception e){
JshException.readFail(logger, e);

View File

@@ -390,6 +390,9 @@
</foreach>
)
</if>
<if test="organId != null">
and dh.organ_id = #{organId}
</if>
<if test="organArray != null and organArray !=''">
and dh.organ_id in (
<foreach collection="organArray" item="organId" separator=",">
@@ -444,6 +447,9 @@
</foreach>
)
</if>
<if test="organId != null">
and dh.organ_id = #{organId}
</if>
<if test="organArray != null and organArray !=''">
and dh.organ_id in (
<foreach collection="organArray" item="organId" separator=",">
@@ -478,6 +484,9 @@
</foreach>
)
</if>
<if test="organId != null">
and dh.organ_id = #{organId}
</if>
<if test="organArray != null and organArray !=''">
and dh.organ_id in (
<foreach collection="organArray" item="organId" separator=",">
@@ -514,6 +523,9 @@
</foreach>
)
</if>
<if test="organId != null">
and dh.organ_id = #{organId}
</if>
<if test="organArray != null and organArray !=''">
and dh.organ_id in (
<foreach collection="organArray" item="organId" separator=",">