给进销存统计报表增加商品类别的筛选参数
This commit is contained in:
@@ -324,6 +324,7 @@ public class DepotItemController {
|
|||||||
public BaseResponseInfo findByAll(@RequestParam("currentPage") Integer currentPage,
|
public BaseResponseInfo findByAll(@RequestParam("currentPage") Integer currentPage,
|
||||||
@RequestParam("pageSize") Integer pageSize,
|
@RequestParam("pageSize") Integer pageSize,
|
||||||
@RequestParam(value = "depotIds",required = false) String depotIds,
|
@RequestParam(value = "depotIds",required = false) String depotIds,
|
||||||
|
@RequestParam(value = "categoryId", required = false) Long categoryId,
|
||||||
@RequestParam("monthTime") String monthTime,
|
@RequestParam("monthTime") String monthTime,
|
||||||
@RequestParam("materialParam") String materialParam,
|
@RequestParam("materialParam") String materialParam,
|
||||||
@RequestParam("mpList") String mpList,
|
@RequestParam("mpList") String mpList,
|
||||||
@@ -331,13 +332,17 @@ public class DepotItemController {
|
|||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
|
List<Long> categoryIdList = new ArrayList<>();
|
||||||
|
if(categoryId != null){
|
||||||
|
categoryIdList = materialService.getListByParentId(categoryId);
|
||||||
|
}
|
||||||
String timeA = Tools.firstDayOfMonth(monthTime) + BusinessConstants.DAY_FIRST_TIME;
|
String timeA = Tools.firstDayOfMonth(monthTime) + BusinessConstants.DAY_FIRST_TIME;
|
||||||
String timeB = Tools.lastDayOfMonth(monthTime) + BusinessConstants.DAY_LAST_TIME;
|
String timeB = Tools.lastDayOfMonth(monthTime) + BusinessConstants.DAY_LAST_TIME;
|
||||||
List<Long> depotList = parseListByDepotIds(depotIds);
|
List<Long> depotList = parseListByDepotIds(depotIds);
|
||||||
List<DepotItemVo4WithInfoEx> dataList = depotItemService.findByAll(StringUtil.toNull(materialParam),
|
List<DepotItemVo4WithInfoEx> dataList = depotItemService.findByAll(StringUtil.toNull(materialParam),
|
||||||
timeB,(currentPage-1)*pageSize, pageSize);
|
categoryIdList, timeB,(currentPage-1)*pageSize, pageSize);
|
||||||
String[] mpArr = mpList.split(",");
|
String[] mpArr = mpList.split(",");
|
||||||
int total = depotItemService.findByAllCount(StringUtil.toNull(materialParam), timeB);
|
int total = depotItemService.findByAllCount(StringUtil.toNull(materialParam), categoryIdList, timeB);
|
||||||
map.put("total", total);
|
map.put("total", total);
|
||||||
//存放数据json数组
|
//存放数据json数组
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
@@ -396,21 +401,28 @@ public class DepotItemController {
|
|||||||
@GetMapping(value = "/totalCountMoney")
|
@GetMapping(value = "/totalCountMoney")
|
||||||
@ApiOperation(value = "统计总计金额")
|
@ApiOperation(value = "统计总计金额")
|
||||||
public BaseResponseInfo totalCountMoney(@RequestParam(value = "depotIds",required = false) String depotIds,
|
public BaseResponseInfo totalCountMoney(@RequestParam(value = "depotIds",required = false) String depotIds,
|
||||||
|
@RequestParam(value = "categoryId", required = false) Long categoryId,
|
||||||
@RequestParam("monthTime") String monthTime,
|
@RequestParam("monthTime") String monthTime,
|
||||||
@RequestParam("materialParam") String materialParam,
|
@RequestParam("materialParam") String materialParam,
|
||||||
HttpServletRequest request) throws Exception{
|
HttpServletRequest request) throws Exception{
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
|
List<Long> categoryIdList = new ArrayList<>();
|
||||||
|
if(categoryId != null){
|
||||||
|
categoryIdList = materialService.getListByParentId(categoryId);
|
||||||
|
}
|
||||||
String endTime = Tools.lastDayOfMonth(monthTime) + BusinessConstants.DAY_LAST_TIME;
|
String endTime = Tools.lastDayOfMonth(monthTime) + BusinessConstants.DAY_LAST_TIME;
|
||||||
List<Long> depotList = parseListByDepotIds(depotIds);
|
List<Long> depotList = parseListByDepotIds(depotIds);
|
||||||
List<DepotItemVo4WithInfoEx> dataList = depotItemService.findByAll(StringUtil.toNull(materialParam),
|
List<DepotItemVo4WithInfoEx> dataList = depotItemService.findByAll(StringUtil.toNull(materialParam),
|
||||||
endTime, null, null);
|
categoryIdList, endTime, null, null);
|
||||||
|
BigDecimal thisAllStock = BigDecimal.ZERO;
|
||||||
BigDecimal thisAllPrice = BigDecimal.ZERO;
|
BigDecimal thisAllPrice = BigDecimal.ZERO;
|
||||||
if (null != dataList) {
|
if (null != dataList) {
|
||||||
for (DepotItemVo4WithInfoEx diEx : dataList) {
|
for (DepotItemVo4WithInfoEx diEx : dataList) {
|
||||||
Long mId = diEx.getMId();
|
Long mId = diEx.getMId();
|
||||||
BigDecimal thisSum = depotItemService.getStockByParamWithDepotList(depotList,mId,null,endTime);
|
BigDecimal thisSum = depotItemService.getStockByParamWithDepotList(depotList,mId,null,endTime);
|
||||||
|
thisAllStock = thisAllStock.add(thisSum);
|
||||||
BigDecimal unitPrice = diEx.getPurchaseDecimal();
|
BigDecimal unitPrice = diEx.getPurchaseDecimal();
|
||||||
if(unitPrice == null) {
|
if(unitPrice == null) {
|
||||||
unitPrice = BigDecimal.ZERO;
|
unitPrice = BigDecimal.ZERO;
|
||||||
@@ -418,6 +430,7 @@ public class DepotItemController {
|
|||||||
thisAllPrice = thisAllPrice.add(thisSum.multiply(unitPrice));
|
thisAllPrice = thisAllPrice.add(thisSum.multiply(unitPrice));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
map.put("totalStock", thisAllStock);
|
||||||
map.put("totalCount", thisAllPrice);
|
map.put("totalCount", thisAllPrice);
|
||||||
res.code = 200;
|
res.code = 200;
|
||||||
res.data = map;
|
res.data = map;
|
||||||
|
|||||||
@@ -56,12 +56,14 @@ public interface DepotItemMapperEx {
|
|||||||
|
|
||||||
List<DepotItemVo4WithInfoEx> findByAll(
|
List<DepotItemVo4WithInfoEx> findByAll(
|
||||||
@Param("materialParam") String materialParam,
|
@Param("materialParam") String materialParam,
|
||||||
|
@Param("categoryIdList") List<Long> categoryIdList,
|
||||||
@Param("endTime") String endTime,
|
@Param("endTime") String endTime,
|
||||||
@Param("offset") Integer offset,
|
@Param("offset") Integer offset,
|
||||||
@Param("rows") Integer rows);
|
@Param("rows") Integer rows);
|
||||||
|
|
||||||
int findByAllCount(
|
int findByAllCount(
|
||||||
@Param("materialParam") String materialParam,
|
@Param("materialParam") String materialParam,
|
||||||
|
@Param("categoryIdList") List<Long> categoryIdList,
|
||||||
@Param("endTime") String endTime);
|
@Param("endTime") String endTime);
|
||||||
|
|
||||||
List<DepotItemVo4WithInfoEx> getListWithBugOrSale(
|
List<DepotItemVo4WithInfoEx> getListWithBugOrSale(
|
||||||
|
|||||||
@@ -299,20 +299,20 @@ public class DepotItemService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DepotItemVo4WithInfoEx> findByAll(String materialParam, String endTime, Integer offset, Integer rows)throws Exception {
|
public List<DepotItemVo4WithInfoEx> findByAll(String materialParam, List<Long> categoryIdList, String endTime, Integer offset, Integer rows)throws Exception {
|
||||||
List<DepotItemVo4WithInfoEx> list =null;
|
List<DepotItemVo4WithInfoEx> list =null;
|
||||||
try{
|
try{
|
||||||
list = depotItemMapperEx.findByAll(materialParam, endTime, offset, rows);
|
list = depotItemMapperEx.findByAll(materialParam, categoryIdList, endTime, offset, rows);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int findByAllCount(String materialParam, String endTime)throws Exception {
|
public int findByAllCount(String materialParam, List<Long> categoryIdList, String endTime)throws Exception {
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result = depotItemMapperEx.findByAllCount(materialParam, endTime);
|
result = depotItemMapperEx.findByAllCount(materialParam, categoryIdList, endTime);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,6 +328,12 @@
|
|||||||
<bind name="bindKey" value="'%'+materialParam+'%'"/>
|
<bind name="bindKey" value="'%'+materialParam+'%'"/>
|
||||||
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
|
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
|
||||||
</if>
|
</if>
|
||||||
|
<if test="categoryIdList.size()>0">
|
||||||
|
and m.category_id in
|
||||||
|
<foreach collection="categoryIdList" item="item" index="index" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="endTime != null">
|
<if test="endTime != null">
|
||||||
and dh.oper_time <= #{endTime}
|
and dh.oper_time <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
@@ -350,6 +356,12 @@
|
|||||||
<bind name="bindKey" value="'%'+materialParam+'%'"/>
|
<bind name="bindKey" value="'%'+materialParam+'%'"/>
|
||||||
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
|
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
|
||||||
</if>
|
</if>
|
||||||
|
<if test="categoryIdList.size()>0">
|
||||||
|
and m.category_id in
|
||||||
|
<foreach collection="categoryIdList" item="item" index="index" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="endTime != null">
|
<if test="endTime != null">
|
||||||
and dh.oper_time <= #{endTime}
|
and dh.oper_time <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user