给报表增加默认有权限仓库的查询条件

This commit is contained in:
季圣华
2021-12-07 23:58:21 +08:00
parent f96f85952b
commit 9fac19502b
8 changed files with 171 additions and 60 deletions

View File

@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4List;
import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
import com.jsh.erp.exception.BusinessParamCheckingException;
import com.jsh.erp.service.accountHead.AccountHeadService;
import com.jsh.erp.service.depot.DepotService;
import com.jsh.erp.service.depotHead.DepotHeadService;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.redis.RedisService;
@@ -56,6 +57,9 @@ public class DepotHeadController {
@Resource
private SupplierService supplierService;
@Resource
private DepotService depotService;
@Resource
private RedisService redisService;
@@ -101,7 +105,7 @@ public class DepotHeadController {
@RequestParam(value = "organId", required = false) Integer oId,
@RequestParam("number") String number,
@RequestParam("materialParam") String materialParam,
@RequestParam(value = "depotId", required = false) Integer depotId,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam("type") String type,
@@ -109,11 +113,22 @@ public class DepotHeadController {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
List<Long> depotList = new ArrayList<>();
if(depotId != null) {
depotList.add(depotId);
} else {
//未选择仓库时默认为当前用户有权限的仓库
JSONArray depotArr = depotService.findDepotByCurrentUser();
for(Object obj: depotArr) {
JSONObject object = JSONObject.parseObject(obj.toString());
depotList.add(object.getLong("id"));
}
}
List<DepotHeadVo4InDetail> resList = new ArrayList<DepotHeadVo4InDetail>();
beginTime = Tools.parseDayToTime(beginTime, BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
List<DepotHeadVo4InDetail> list = depotHeadService.findByAll(beginTime, endTime, type, materialParam, depotId, oId, number, (currentPage-1)*pageSize, pageSize);
int total = depotHeadService.findByAllCount(beginTime, endTime, type, materialParam, depotId, oId, number);
List<DepotHeadVo4InDetail> list = depotHeadService.findByAll(beginTime, endTime, type, materialParam, depotList, oId, number, (currentPage-1)*pageSize, pageSize);
int total = depotHeadService.findByAllCount(beginTime, endTime, type, materialParam, depotList, oId, number);
map.put("total", total);
//存放数据json数组
if (null != list) {
@@ -151,7 +166,7 @@ public class DepotHeadController {
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value = "organId", required = false) Integer oId,
@RequestParam("materialParam") String materialParam,
@RequestParam(value = "depotId", required = false) Integer depotId,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam("type") String type,
@@ -159,11 +174,22 @@ public class DepotHeadController {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
List<Long> depotList = new ArrayList<>();
if(depotId != null) {
depotList.add(depotId);
} else {
//未选择仓库时默认为当前用户有权限的仓库
JSONArray depotArr = depotService.findDepotByCurrentUser();
for(Object obj: depotArr) {
JSONObject object = JSONObject.parseObject(obj.toString());
depotList.add(object.getLong("id"));
}
}
List<DepotHeadVo4InOutMCount> resList = new ArrayList<>();
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
List<DepotHeadVo4InOutMCount> list = depotHeadService.findInOutMaterialCount(beginTime, endTime, type, materialParam, depotId, oId, (currentPage-1)*pageSize, pageSize);
int total = depotHeadService.findInOutMaterialCountTotal(beginTime, endTime, type, materialParam, depotId, oId);
List<DepotHeadVo4InOutMCount> list = depotHeadService.findInOutMaterialCount(beginTime, endTime, type, materialParam, depotList, oId, (currentPage-1)*pageSize, pageSize);
int total = depotHeadService.findInOutMaterialCountTotal(beginTime, endTime, type, materialParam, depotList, oId);
map.put("total", total);
//存放数据json数组
if (null != list) {
@@ -202,8 +228,8 @@ public class DepotHeadController {
@RequestParam("pageSize") Integer pageSize,
@RequestParam("number") String number,
@RequestParam("materialParam") String materialParam,
@RequestParam(value = "depotId", required = false) Integer depotId,
@RequestParam(value = "depotIdF", required = false) Integer depotIdF,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam(value = "depotIdF", required = false) Long depotIdF,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam("subType") String subType,
@@ -211,10 +237,32 @@ public class DepotHeadController {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
List<Long> depotList = new ArrayList<>();
List<Long> depotFList = new ArrayList<>();
if(depotId != null) {
depotList.add(depotId);
} else {
//未选择仓库时默认为当前用户有权限的仓库
JSONArray depotArr = depotService.findDepotByCurrentUser();
for(Object obj: depotArr) {
JSONObject object = JSONObject.parseObject(obj.toString());
depotList.add(object.getLong("id"));
}
}
if(depotIdF != null) {
depotFList.add(depotIdF);
} else {
//未选择仓库时默认为当前用户有权限的仓库
JSONArray depotArr = depotService.findDepotByCurrentUser();
for(Object obj: depotArr) {
JSONObject object = JSONObject.parseObject(obj.toString());
depotFList.add(object.getLong("id"));
}
}
beginTime = Tools.parseDayToTime(beginTime, BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
List<DepotHeadVo4InDetail> list = depotHeadService.findAllocationDetail(beginTime, endTime, subType, number, materialParam, depotId, depotIdF, (currentPage-1)*pageSize, pageSize);
int total = depotHeadService.findAllocationDetailCount(beginTime, endTime, subType, number, materialParam, depotId, depotIdF);
List<DepotHeadVo4InDetail> list = depotHeadService.findAllocationDetail(beginTime, endTime, subType, number, materialParam, depotList, depotFList, (currentPage-1)*pageSize, pageSize);
int total = depotHeadService.findAllocationDetailCount(beginTime, endTime, subType, number, materialParam, depotList, depotFList);
map.put("rows", list);
map.put("total", total);
res.code = 200;

View File

@@ -559,8 +559,19 @@ public class DepotItemController {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
List<Long> depotList = new ArrayList<>();
if(depotId != null) {
depotList.add(depotId);
} else {
//未选择仓库时默认为当前用户有权限的仓库
JSONArray depotArr = depotService.findDepotByCurrentUser();
for(Object obj: depotArr) {
JSONObject object = JSONObject.parseObject(obj.toString());
depotList.add(object.getLong("id"));
}
}
String[] mpArr = mpList.split(",");
List<DepotItemStockWarningCount> list = depotItemService.findStockWarningCount((currentPage-1)*pageSize, pageSize,materialParam,depotId);
List<DepotItemStockWarningCount> list = depotItemService.findStockWarningCount((currentPage-1)*pageSize, pageSize, materialParam, depotList);
//存放数据json数组
if (null != list) {
for (DepotItemStockWarningCount disw : list) {
@@ -581,7 +592,7 @@ public class DepotItemController {
}
}
}
int total = depotItemService.findStockWarningCountTotal(materialParam,depotId);
int total = depotItemService.findStockWarningCountTotal(materialParam, depotList);
map.put("total", total);
map.put("rows", list);
res.code = 200;

View File

@@ -58,7 +58,7 @@ public interface DepotHeadMapperEx {
@Param("endTime") String endTime,
@Param("type") String type,
@Param("materialParam") String materialParam,
@Param("depotId") Integer depotId,
@Param("depotList") List<Long> depotList,
@Param("oId") Integer oId,
@Param("number") String number,
@Param("offset") Integer offset,
@@ -69,7 +69,7 @@ public interface DepotHeadMapperEx {
@Param("endTime") String endTime,
@Param("type") String type,
@Param("materialParam") String materialParam,
@Param("depotId") Integer depotId,
@Param("depotList") List<Long> depotList,
@Param("oId") Integer oId,
@Param("number") String number);
@@ -78,7 +78,7 @@ public interface DepotHeadMapperEx {
@Param("endTime") String endTime,
@Param("type") String type,
@Param("materialParam") String materialParam,
@Param("depotId") Integer depotId,
@Param("depotList") List<Long> depotList,
@Param("oId") Integer oId,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
@@ -88,7 +88,7 @@ public interface DepotHeadMapperEx {
@Param("endTime") String endTime,
@Param("type") String type,
@Param("materialParam") String materialParam,
@Param("depotId") Integer depotId,
@Param("depotList") List<Long> depotList,
@Param("oId") Integer oId);
List<DepotHeadVo4InDetail> findAllocationDetail(
@@ -97,8 +97,8 @@ public interface DepotHeadMapperEx {
@Param("subType") String subType,
@Param("number") String number,
@Param("materialParam") String materialParam,
@Param("depotId") Integer depotId,
@Param("depotIdF") Integer depotIdF,
@Param("depotList") List<Long> depotList,
@Param("depotFList") List<Long> depotFList,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
@@ -108,8 +108,8 @@ public interface DepotHeadMapperEx {
@Param("subType") String subType,
@Param("number") String number,
@Param("materialParam") String materialParam,
@Param("depotId") Integer depotId,
@Param("depotIdF") Integer depotIdF);
@Param("depotList") List<Long> depotList,
@Param("depotFList") List<Long> depotFList);
List<DepotHeadVo4StatementAccount> findStatementAccount(
@Param("beginTime") String beginTime,

View File

@@ -119,11 +119,11 @@ public interface DepotItemMapperEx {
@Param("offset") Integer offset,
@Param("rows") Integer rows,
@Param("materialParam") String materialParam,
@Param("depotId") Long depotId);
@Param("depotList") List<Long> depotList);
int findStockWarningCountTotal(
@Param("materialParam") String materialParam,
@Param("depotId") Long depotId);
@Param("depotList") List<Long> depotList);
BigDecimal getFinishNumber(
@Param("mId") Long mId,

View File

@@ -421,60 +421,62 @@ public class DepotHeadService {
}
public List<DepotHeadVo4InDetail> findByAll(String beginTime, String endTime, String type, String materialParam,
Integer depotId, Integer oId, String number,Integer offset, Integer rows) throws Exception{
List<Long> depotList, Integer oId, String number,Integer offset, Integer rows) throws Exception{
List<DepotHeadVo4InDetail> list = null;
try{
list =depotHeadMapperEx.findByAll(beginTime, endTime, type, materialParam, depotId, oId, number, offset, rows);
list =depotHeadMapperEx.findByAll(beginTime, endTime, type, materialParam, depotList, oId, number, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public int findByAllCount(String beginTime, String endTime, String type, String materialParam, Integer depotId, Integer oId, String number) throws Exception{
public int findByAllCount(String beginTime, String endTime, String type, String materialParam, List<Long> depotList, Integer oId, String number) throws Exception{
int result = 0;
try{
result =depotHeadMapperEx.findByAllCount(beginTime, endTime, type, materialParam, depotId, oId, number);
result =depotHeadMapperEx.findByAllCount(beginTime, endTime, type, materialParam, depotList, oId, number);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
public List<DepotHeadVo4InOutMCount> findInOutMaterialCount(String beginTime, String endTime, String type, String materialParam, Integer depotId, Integer oId, Integer offset, Integer rows)throws Exception {
public List<DepotHeadVo4InOutMCount> findInOutMaterialCount(String beginTime, String endTime, String type, String materialParam, List<Long> depotList, Integer oId, Integer offset, Integer rows)throws Exception {
List<DepotHeadVo4InOutMCount> list = null;
try{
list =depotHeadMapperEx.findInOutMaterialCount(beginTime, endTime, type, materialParam, depotId, oId, offset, rows);
list =depotHeadMapperEx.findInOutMaterialCount(beginTime, endTime, type, materialParam, depotList, oId, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public int findInOutMaterialCountTotal(String beginTime, String endTime, String type, String materialParam, Integer depotId, Integer oId)throws Exception {
public int findInOutMaterialCountTotal(String beginTime, String endTime, String type, String materialParam, List<Long> depotList, Integer oId)throws Exception {
int result = 0;
try{
result =depotHeadMapperEx.findInOutMaterialCountTotal(beginTime, endTime, type, materialParam, depotId, oId);
result =depotHeadMapperEx.findInOutMaterialCountTotal(beginTime, endTime, type, materialParam, depotList, oId);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
public List<DepotHeadVo4InDetail> findAllocationDetail(String beginTime, String endTime, String subType, String number, String materialParam, Integer depotId, Integer depotIdF, Integer offset, Integer rows) throws Exception{
public List<DepotHeadVo4InDetail> findAllocationDetail(String beginTime, String endTime, String subType, String number,
String materialParam, List<Long> depotList, List<Long> depotFList, Integer offset, Integer rows) throws Exception{
List<DepotHeadVo4InDetail> list = null;
try{
list =depotHeadMapperEx.findAllocationDetail(beginTime, endTime, subType, number, materialParam, depotId, depotIdF, offset, rows);
list =depotHeadMapperEx.findAllocationDetail(beginTime, endTime, subType, number, materialParam, depotList, depotFList, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public int findAllocationDetailCount(String beginTime, String endTime, String subType, String number, String materialParam, Integer depotId, Integer depotIdF) throws Exception{
public int findAllocationDetailCount(String beginTime, String endTime, String subType, String number,
String materialParam, List<Long> depotList, List<Long> depotFList) throws Exception{
int result = 0;
try{
result =depotHeadMapperEx.findAllocationDetailCount(beginTime, endTime, subType, number, materialParam, depotId,depotIdF);
result =depotHeadMapperEx.findAllocationDetailCount(beginTime, endTime, subType, number, materialParam, depotList, depotFList);
}catch(Exception e){
JshException.readFail(logger, e);
}

View File

@@ -532,20 +532,20 @@ public class DepotItemService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public List<DepotItemStockWarningCount> findStockWarningCount(Integer offset, Integer rows, String materialParam, Long depotId) {
public List<DepotItemStockWarningCount> findStockWarningCount(Integer offset, Integer rows, String materialParam, List<Long> depotList) {
List<DepotItemStockWarningCount> list = null;
try{
list =depotItemMapperEx.findStockWarningCount(offset, rows, materialParam, depotId);
list =depotItemMapperEx.findStockWarningCount(offset, rows, materialParam, depotList);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int findStockWarningCountTotal(String materialParam, Long depotId) {
public int findStockWarningCountTotal(String materialParam, List<Long> depotList) {
int result = 0;
try{
result =depotItemMapperEx.findStockWarningCountTotal(materialParam, depotId);
result =depotItemMapperEx.findStockWarningCountTotal(materialParam, depotList);
}catch(Exception e){
JshException.readFail(logger, e);
}