给首页的金额进行权限控制
This commit is contained in:
@@ -425,7 +425,7 @@ public class DepotHeadController {
|
|||||||
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<String, Object> map = depotHeadService.getBuyAndSaleStatistics(today, monthFirstDay,
|
||||||
yesterdayBegin, yesterdayEnd, yearBegin, yearEnd, roleType);
|
yesterdayBegin, yesterdayEnd, yearBegin, yearEnd, roleType, request);
|
||||||
res.code = 200;
|
res.code = 200;
|
||||||
res.data = map;
|
res.data = map;
|
||||||
} catch(Exception e){
|
} catch(Exception e){
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.jsh.erp.service.materialExtend.MaterialExtendService;
|
|||||||
import com.jsh.erp.service.depotItem.DepotItemService;
|
import com.jsh.erp.service.depotItem.DepotItemService;
|
||||||
import com.jsh.erp.service.material.MaterialService;
|
import com.jsh.erp.service.material.MaterialService;
|
||||||
import com.jsh.erp.service.redis.RedisService;
|
import com.jsh.erp.service.redis.RedisService;
|
||||||
|
import com.jsh.erp.service.role.RoleService;
|
||||||
import com.jsh.erp.service.unit.UnitService;
|
import com.jsh.erp.service.unit.UnitService;
|
||||||
import com.jsh.erp.utils.*;
|
import com.jsh.erp.utils.*;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -58,6 +59,9 @@ public class DepotItemController {
|
|||||||
@Resource
|
@Resource
|
||||||
private DepotService depotService;
|
private DepotService depotService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RoleService roleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据仓库和商品查询单据列表
|
* 根据仓库和商品查询单据列表
|
||||||
* @param mId
|
* @param mId
|
||||||
@@ -670,7 +674,7 @@ public class DepotItemController {
|
|||||||
BigDecimal outPrice = depotItemService.inOrOutPrice("入库", "采购", month, roleType);
|
BigDecimal outPrice = depotItemService.inOrOutPrice("入库", "采购", month, roleType);
|
||||||
BigDecimal inPrice = depotItemService.inOrOutPrice("出库", "采购退货", month, roleType);
|
BigDecimal inPrice = depotItemService.inOrOutPrice("出库", "采购退货", month, roleType);
|
||||||
obj.put("x", month);
|
obj.put("x", month);
|
||||||
obj.put("y", outPrice.subtract(inPrice));
|
obj.put("y", roleService.parsePriceByLimit(outPrice.subtract(inPrice), "buy", request));
|
||||||
buyPriceList.add(obj);
|
buyPriceList.add(obj);
|
||||||
}
|
}
|
||||||
map.put("buyPriceList", buyPriceList);
|
map.put("buyPriceList", buyPriceList);
|
||||||
@@ -680,7 +684,7 @@ public class DepotItemController {
|
|||||||
BigDecimal outPrice = depotItemService.inOrOutPrice("出库", "销售", month, roleType);
|
BigDecimal outPrice = depotItemService.inOrOutPrice("出库", "销售", month, roleType);
|
||||||
BigDecimal inPrice = depotItemService.inOrOutPrice("入库", "销售退货", month, roleType);
|
BigDecimal inPrice = depotItemService.inOrOutPrice("入库", "销售退货", month, roleType);
|
||||||
obj.put("x", month);
|
obj.put("x", month);
|
||||||
obj.put("y", outPrice.subtract(inPrice));
|
obj.put("y", roleService.parsePriceByLimit(outPrice.subtract(inPrice), "sale", request));
|
||||||
salePriceList.add(obj);
|
salePriceList.add(obj);
|
||||||
}
|
}
|
||||||
map.put("salePriceList", salePriceList);
|
map.put("salePriceList", salePriceList);
|
||||||
@@ -690,7 +694,7 @@ public class DepotItemController {
|
|||||||
BigDecimal outPrice = depotItemService.inOrOutRetailPrice("出库", "零售", month, roleType);
|
BigDecimal outPrice = depotItemService.inOrOutRetailPrice("出库", "零售", month, roleType);
|
||||||
BigDecimal inPrice = depotItemService.inOrOutRetailPrice("入库", "零售退货", month, roleType);
|
BigDecimal inPrice = depotItemService.inOrOutRetailPrice("入库", "零售退货", month, roleType);
|
||||||
obj.put("x", month);
|
obj.put("x", month);
|
||||||
obj.put("y", outPrice.subtract(inPrice));
|
obj.put("y", roleService.parsePriceByLimit(outPrice.subtract(inPrice), "retail", request));
|
||||||
retailPriceList.add(obj);
|
retailPriceList.add(obj);
|
||||||
}
|
}
|
||||||
map.put("retailPriceList", retailPriceList);
|
map.put("retailPriceList", retailPriceList);
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class UserController {
|
|||||||
Map<String, Object> data = new HashMap<String, Object>();
|
Map<String, Object> data = new HashMap<String, Object>();
|
||||||
data.put("msgTip", msgTip);
|
data.put("msgTip", msgTip);
|
||||||
if(user!=null){
|
if(user!=null){
|
||||||
String roleType = userService.getRoleTypeByUserId(user.getId()); //角色类型
|
String roleType = userService.getRoleTypeByUserId(user.getId()).getType(); //角色类型
|
||||||
redisService.storageObjectBySession(token,"roleType",roleType);
|
redisService.storageObjectBySession(token,"roleType",roleType);
|
||||||
redisService.storageObjectBySession(token,"clientIp", Tools.getLocalIp(request));
|
redisService.storageObjectBySession(token,"clientIp", Tools.getLocalIp(request));
|
||||||
logService.insertLogWithUserId(user.getId(), user.getTenantId(), "用户",
|
logService.insertLogWithUserId(user.getId(), user.getTenantId(), "用户",
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.jsh.erp.service.log.LogService;
|
|||||||
import com.jsh.erp.service.orgaUserRel.OrgaUserRelService;
|
import com.jsh.erp.service.orgaUserRel.OrgaUserRelService;
|
||||||
import com.jsh.erp.service.person.PersonService;
|
import com.jsh.erp.service.person.PersonService;
|
||||||
import com.jsh.erp.service.redis.RedisService;
|
import com.jsh.erp.service.redis.RedisService;
|
||||||
|
import com.jsh.erp.service.role.RoleService;
|
||||||
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
||||||
import com.jsh.erp.service.supplier.SupplierService;
|
import com.jsh.erp.service.supplier.SupplierService;
|
||||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||||
@@ -56,6 +57,8 @@ public class DepotHeadService {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private RoleService roleService;
|
||||||
|
@Resource
|
||||||
private DepotService depotService;
|
private DepotService depotService;
|
||||||
@Resource
|
@Resource
|
||||||
DepotItemService depotItemService;
|
DepotItemService depotItemService;
|
||||||
@@ -79,8 +82,6 @@ public class DepotHeadService {
|
|||||||
DepotItemMapperEx depotItemMapperEx;
|
DepotItemMapperEx depotItemMapperEx;
|
||||||
@Resource
|
@Resource
|
||||||
private LogService logService;
|
private LogService logService;
|
||||||
@Resource
|
|
||||||
private RedisService redisService;
|
|
||||||
|
|
||||||
public DepotHead getDepotHead(long id)throws Exception {
|
public DepotHead getDepotHead(long id)throws Exception {
|
||||||
DepotHead result=null;
|
DepotHead result=null;
|
||||||
@@ -919,7 +920,7 @@ public class DepotHeadService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> getBuyAndSaleStatistics(String today, String monthFirstDay, String yesterdayBegin, String yesterdayEnd,
|
public Map<String, Object> getBuyAndSaleStatistics(String today, String monthFirstDay, String yesterdayBegin, String yesterdayEnd,
|
||||||
String yearBegin, String yearEnd, String roleType) throws Exception {
|
String yearBegin, String yearEnd, String roleType, HttpServletRequest request) throws Exception {
|
||||||
String [] creatorArray = getCreatorArray(roleType);
|
String [] creatorArray = getCreatorArray(roleType);
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
//今日
|
//今日
|
||||||
@@ -974,18 +975,18 @@ public class DepotHeadService {
|
|||||||
yearBegin, yearEnd, creatorArray); //今年零售出库
|
yearBegin, yearEnd, creatorArray); //今年零售出库
|
||||||
BigDecimal yearRetailSaleBack = getBuyAndSaleRetailStatistics("入库", "零售退货",
|
BigDecimal yearRetailSaleBack = getBuyAndSaleRetailStatistics("入库", "零售退货",
|
||||||
yearBegin, yearEnd, creatorArray); //今年零售退货
|
yearBegin, yearEnd, creatorArray); //今年零售退货
|
||||||
map.put("todayBuy", todayBuy.subtract(todayBuyBack));
|
map.put("todayBuy", roleService.parsePriceByLimit(todayBuy.subtract(todayBuyBack), "buy", request));
|
||||||
map.put("todaySale", todaySale.subtract(todaySaleBack));
|
map.put("todaySale", roleService.parsePriceByLimit(todaySale.subtract(todaySaleBack), "sale", request));
|
||||||
map.put("todayRetailSale", todayRetailSale.subtract(todayRetailSaleBack));
|
map.put("todayRetailSale", roleService.parsePriceByLimit(todayRetailSale.subtract(todayRetailSaleBack), "retail", request));
|
||||||
map.put("monthBuy", monthBuy.subtract(monthBuyBack));
|
map.put("monthBuy", roleService.parsePriceByLimit(monthBuy.subtract(monthBuyBack), "buy", request));
|
||||||
map.put("monthSale", monthSale.subtract(monthSaleBack));
|
map.put("monthSale", roleService.parsePriceByLimit(monthSale.subtract(monthSaleBack), "sale", request));
|
||||||
map.put("monthRetailSale", monthRetailSale.subtract(monthRetailSaleBack));
|
map.put("monthRetailSale", roleService.parsePriceByLimit(monthRetailSale.subtract(monthRetailSaleBack), "retail", request));
|
||||||
map.put("yesterdayBuy", yesterdayBuy.subtract(yesterdayBuyBack));
|
map.put("yesterdayBuy", roleService.parsePriceByLimit(yesterdayBuy.subtract(yesterdayBuyBack), "buy", request));
|
||||||
map.put("yesterdaySale", yesterdaySale.subtract(yesterdaySaleBack));
|
map.put("yesterdaySale", roleService.parsePriceByLimit(yesterdaySale.subtract(yesterdaySaleBack), "sale", request));
|
||||||
map.put("yesterdayRetailSale", yesterdayRetailSale.subtract(yesterdayRetailSaleBack));
|
map.put("yesterdayRetailSale", roleService.parsePriceByLimit(yesterdayRetailSale.subtract(yesterdayRetailSaleBack), "retail", request));
|
||||||
map.put("yearBuy", yearBuy.subtract(yearBuyBack));
|
map.put("yearBuy", roleService.parsePriceByLimit(yearBuy.subtract(yearBuyBack), "buy", request));
|
||||||
map.put("yearSale", yearSale.subtract(yearSaleBack));
|
map.put("yearSale", roleService.parsePriceByLimit(yearSale.subtract(yearSaleBack), "sale", request));
|
||||||
map.put("yearRetailSale", yearRetailSale.subtract(yearRetailSaleBack));
|
map.put("yearRetailSale", roleService.parsePriceByLimit(yearRetailSale.subtract(yearRetailSaleBack), "retail", request));
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.jsh.erp.service.depotHead.DepotHeadService;
|
|||||||
import com.jsh.erp.service.materialExtend.MaterialExtendService;
|
import com.jsh.erp.service.materialExtend.MaterialExtendService;
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.material.MaterialService;
|
import com.jsh.erp.service.material.MaterialService;
|
||||||
|
import com.jsh.erp.service.role.RoleService;
|
||||||
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
||||||
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.service.user.UserService;
|
||||||
@@ -61,6 +62,8 @@ public class DepotItemService {
|
|||||||
@Resource
|
@Resource
|
||||||
private SystemConfigService systemConfigService;
|
private SystemConfigService systemConfigService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private RoleService roleService;
|
||||||
|
@Resource
|
||||||
private MaterialCurrentStockMapper materialCurrentStockMapper;
|
private MaterialCurrentStockMapper materialCurrentStockMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private LogService logService;
|
private LogService logService;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -216,4 +217,27 @@ public class RoleService {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据权限进行屏蔽价格
|
||||||
|
* @param price
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Object parsePriceByLimit(BigDecimal price, String type, HttpServletRequest request) throws Exception {
|
||||||
|
Long userId = userService.getUserId(request);
|
||||||
|
String priceLimit = userService.getRoleTypeByUserId(userId).getPriceLimit();
|
||||||
|
if(StringUtil.isNotEmpty(priceLimit)) {
|
||||||
|
if("buy".equals(type) && priceLimit.contains("1")) {
|
||||||
|
return "***";
|
||||||
|
}
|
||||||
|
if("retail".equals(type) && priceLimit.contains("2")) {
|
||||||
|
return "***";
|
||||||
|
}
|
||||||
|
if("sale".equals(type) && priceLimit.contains("3")) {
|
||||||
|
return "***";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return price;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -692,12 +692,13 @@ public class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户id查询角色类型
|
* 根据用户id查询角色信息
|
||||||
* @param userId
|
* @param userId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public String getRoleTypeByUserId(long userId) throws Exception {
|
public Role getRoleTypeByUserId(long userId) throws Exception {
|
||||||
|
Role role = new Role();
|
||||||
List<UserBusiness> list = userBusinessService.getBasicData(String.valueOf(userId), "UserRole");
|
List<UserBusiness> list = userBusinessService.getBasicData(String.valueOf(userId), "UserRole");
|
||||||
UserBusiness ub = null;
|
UserBusiness ub = null;
|
||||||
if(list.size() > 0) {
|
if(list.size() > 0) {
|
||||||
@@ -711,15 +712,9 @@ public class UserService {
|
|||||||
if(valueArray.length>0) {
|
if(valueArray.length>0) {
|
||||||
roleId = valueArray[0];
|
roleId = valueArray[0];
|
||||||
}
|
}
|
||||||
Role role = roleService.getRoleWithoutTenant(Long.parseLong(roleId));
|
role = roleService.getRoleWithoutTenant(Long.parseLong(roleId));
|
||||||
if(role!=null) {
|
|
||||||
return role.getType();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return role;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user