优化首页接口,限制超管用户的统计

This commit is contained in:
jishenghua
2024-10-16 22:34:50 +08:00
parent 9797478a4c
commit 6ff36c1ba7
2 changed files with 78 additions and 69 deletions

View File

@@ -12,8 +12,8 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4List;
import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount; import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
import com.jsh.erp.service.depot.DepotService; import com.jsh.erp.service.depot.DepotService;
import com.jsh.erp.service.depotHead.DepotHeadService; import com.jsh.erp.service.depotHead.DepotHeadService;
import com.jsh.erp.service.redis.RedisService;
import com.jsh.erp.service.systemConfig.SystemConfigService; import com.jsh.erp.service.systemConfig.SystemConfigService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.*; import com.jsh.erp.utils.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@@ -50,6 +50,9 @@ public class DepotHeadController {
@Resource @Resource
private SystemConfigService systemConfigService; private SystemConfigService systemConfigService;
@Resource
private UserService userService;
/** /**
* 批量设置状态-审核或者反审核 * 批量设置状态-审核或者反审核
* @param jsonObject * @param jsonObject
@@ -484,14 +487,17 @@ public class DepotHeadController {
public BaseResponseInfo getBuyAndSaleStatistics(HttpServletRequest request) { public BaseResponseInfo getBuyAndSaleStatistics(HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo(); BaseResponseInfo res = new BaseResponseInfo();
try { try {
Map<String, Object> map = new HashMap<>();
String loginName = userService.getCurrentUser().getLoginName();
if(!"admin".equals(loginName)) {
String today = Tools.getNow() + BusinessConstants.DAY_FIRST_TIME; String today = Tools.getNow() + BusinessConstants.DAY_FIRST_TIME;
String monthFirstDay = Tools.firstDayOfMonth(Tools.getCurrentMonth()) + BusinessConstants.DAY_FIRST_TIME; String monthFirstDay = Tools.firstDayOfMonth(Tools.getCurrentMonth()) + BusinessConstants.DAY_FIRST_TIME;
String yesterdayBegin = Tools.getYesterday() + BusinessConstants.DAY_FIRST_TIME; String yesterdayBegin = Tools.getYesterday() + BusinessConstants.DAY_FIRST_TIME;
String yesterdayEnd = Tools.getYesterday() + BusinessConstants.DAY_LAST_TIME; String yesterdayEnd = Tools.getYesterday() + BusinessConstants.DAY_LAST_TIME;
String yearBegin = Tools.getYearBegin() + BusinessConstants.DAY_FIRST_TIME; String yearBegin = Tools.getYearBegin() + BusinessConstants.DAY_FIRST_TIME;
String yearEnd = Tools.getYearEnd() + BusinessConstants.DAY_LAST_TIME; String yearEnd = Tools.getYearEnd() + BusinessConstants.DAY_LAST_TIME;
Map<String, Object> map = depotHeadService.getBuyAndSaleStatistics(today, monthFirstDay, map = depotHeadService.getBuyAndSaleStatistics(today, monthFirstDay, yesterdayBegin, yesterdayEnd, yearBegin, yearEnd, request);
yesterdayBegin, yesterdayEnd, yearBegin, yearEnd, request); }
res.code = 200; res.code = 200;
res.data = map; res.data = map;
} catch(Exception e){ } catch(Exception e){

View File

@@ -985,8 +985,10 @@ public class DepotItemController {
public BaseResponseInfo buyOrSalePrice(HttpServletRequest request, public BaseResponseInfo buyOrSalePrice(HttpServletRequest request,
HttpServletResponse response)throws Exception { HttpServletResponse response)throws Exception {
BaseResponseInfo res = new BaseResponseInfo(); BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try { try {
Map<String, Object> map = new HashMap<>();
String loginName = userService.getCurrentUser().getLoginName();
if(!"admin".equals(loginName)) {
Long userId = userService.getUserId(request); Long userId = userService.getUserId(request);
List<String> monthList = Tools.getLastMonths(6); List<String> monthList = Tools.getLastMonths(6);
String beginTime = Tools.firstDayOfMonth(monthList.get(0)) + BusinessConstants.DAY_FIRST_TIME; String beginTime = Tools.firstDayOfMonth(monthList.get(0)) + BusinessConstants.DAY_FIRST_TIME;
@@ -1056,6 +1058,7 @@ public class DepotItemController {
retailPriceList.add(obj); retailPriceList.add(obj);
} }
map.put("retailPriceList", retailPriceList); map.put("retailPriceList", retailPriceList);
}
res.code = 200; res.code = 200;
res.data = map; res.data = map;
} catch (Exception e) { } catch (Exception e) {