完善首页数据统计接口的数据角色判断

This commit is contained in:
季圣华
2022-08-08 22:46:49 +08:00
parent c42c3b712a
commit 9a496ffa87
8 changed files with 93 additions and 54 deletions

View File

@@ -103,12 +103,12 @@ public class DepotHeadController {
public BaseResponseInfo findInDetail(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value = "organId", required = false) Integer oId,
@RequestParam("number") String number,
@RequestParam("number") String number,
@RequestParam("materialParam") String materialParam,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam(value = "roleType", required = false) String roleType,
@RequestParam(value = "roleType", required = false) String roleType,
@RequestParam("type") String type,
@RequestParam("remark") String remark,
HttpServletRequest request)throws Exception {
@@ -415,7 +415,8 @@ public class DepotHeadController {
*/
@GetMapping(value = "/getBuyAndSaleStatistics")
@ApiOperation(value = "统计今日采购额、昨日采购额、本月采购额、今年采购额|销售额|零售额")
public BaseResponseInfo getBuyAndSaleStatistics(HttpServletRequest request) {
public BaseResponseInfo getBuyAndSaleStatistics(@RequestParam(value = "roleType", required = false) String roleType,
HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
try {
String today = Tools.getNow() + BusinessConstants.DAY_FIRST_TIME;
@@ -425,7 +426,7 @@ public class DepotHeadController {
String yearBegin = Tools.getYearBegin() + BusinessConstants.DAY_FIRST_TIME;
String yearEnd = Tools.getYearEnd() + BusinessConstants.DAY_LAST_TIME;
Map<String, Object> map = depotHeadService.getBuyAndSaleStatistics(today, monthFirstDay,
yesterdayBegin, yesterdayEnd, yearBegin, yearEnd);
yesterdayBegin, yesterdayEnd, yearBegin, yearEnd, roleType);
res.code = 200;
res.data = map;
} catch(Exception e){

View File

@@ -633,17 +633,17 @@ public class DepotItemController {
*/
@GetMapping(value = "/buyOrSalePrice")
@ApiOperation(value = "统计采购、销售、零售的总金额")
public BaseResponseInfo buyOrSalePrice(HttpServletRequest request, HttpServletResponse response)throws Exception {
public BaseResponseInfo buyOrSalePrice(@RequestParam(value = "roleType", required = false) String roleType,
HttpServletRequest request, HttpServletResponse response)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
String message = "成功";
try {
List<String> list = Tools.getLastMonths(6);
JSONArray buyPriceList = new JSONArray();
for(String month: list) {
JSONObject obj = new JSONObject();
BigDecimal outPrice = depotItemService.inOrOutPrice("入库", "采购", month);
BigDecimal inPrice = depotItemService.inOrOutPrice("出库", "采购退货", month);
BigDecimal outPrice = depotItemService.inOrOutPrice("入库", "采购", month, roleType);
BigDecimal inPrice = depotItemService.inOrOutPrice("出库", "采购退货", month, roleType);
obj.put("x", month);
obj.put("y", outPrice.subtract(inPrice));
buyPriceList.add(obj);
@@ -652,8 +652,8 @@ public class DepotItemController {
JSONArray salePriceList = new JSONArray();
for(String month: list) {
JSONObject obj = new JSONObject();
BigDecimal outPrice = depotItemService.inOrOutPrice("出库", "销售", month);
BigDecimal inPrice = depotItemService.inOrOutPrice("入库", "销售退货", month);
BigDecimal outPrice = depotItemService.inOrOutPrice("出库", "销售", month, roleType);
BigDecimal inPrice = depotItemService.inOrOutPrice("入库", "销售退货", month, roleType);
obj.put("x", month);
obj.put("y", outPrice.subtract(inPrice));
salePriceList.add(obj);
@@ -662,8 +662,8 @@ public class DepotItemController {
JSONArray retailPriceList = new JSONArray();
for(String month: list) {
JSONObject obj = new JSONObject();
BigDecimal outPrice = depotItemService.inOrOutRetailPrice("出库", "零售", month);
BigDecimal inPrice = depotItemService.inOrOutRetailPrice("入库", "零售退货", month);
BigDecimal outPrice = depotItemService.inOrOutRetailPrice("出库", "零售", month, roleType);
BigDecimal inPrice = depotItemService.inOrOutRetailPrice("入库", "零售退货", month, roleType);
obj.put("x", month);
obj.put("y", outPrice.subtract(inPrice));
retailPriceList.add(obj);
@@ -673,8 +673,8 @@ public class DepotItemController {
res.data = map;
} catch (Exception e) {
e.printStackTrace();
message = "统计失败";
res.code = 500;
res.data = "统计失败";
}
return res;
}