Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
fa300cc9
Commit
fa300cc9
authored
Oct 23, 2022
by
季圣华
Browse files
给首页的金额进行权限控制
parent
9cf74048
Changes
7
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotHeadController.java
View file @
fa300cc9
...
...
@@ -425,7 +425,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
,
roleType
);
yesterdayBegin
,
yesterdayEnd
,
yearBegin
,
yearEnd
,
roleType
,
request
);
res
.
code
=
200
;
res
.
data
=
map
;
}
catch
(
Exception
e
){
...
...
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotItemController.java
View file @
fa300cc9
...
...
@@ -14,6 +14,7 @@ import com.jsh.erp.service.materialExtend.MaterialExtendService;
import
com.jsh.erp.service.depotItem.DepotItemService
;
import
com.jsh.erp.service.material.MaterialService
;
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.utils.*
;
import
io.swagger.annotations.Api
;
...
...
@@ -58,6 +59,9 @@ public class DepotItemController {
@Resource
private
DepotService
depotService
;
@Resource
private
RoleService
roleService
;
/**
* 根据仓库和商品查询单据列表
* @param mId
...
...
@@ -670,7 +674,7 @@ public class DepotItemController {
BigDecimal
outPrice
=
depotItemService
.
inOrOutPrice
(
"入库"
,
"采购"
,
month
,
roleType
);
BigDecimal
inPrice
=
depotItemService
.
inOrOutPrice
(
"出库"
,
"采购退货"
,
month
,
roleType
);
obj
.
put
(
"x"
,
month
);
obj
.
put
(
"y"
,
outPrice
.
subtract
(
inPrice
));
obj
.
put
(
"y"
,
roleService
.
parsePriceByLimit
(
outPrice
.
subtract
(
inPrice
)
,
"buy"
,
request
)
);
buyPriceList
.
add
(
obj
);
}
map
.
put
(
"buyPriceList"
,
buyPriceList
);
...
...
@@ -680,7 +684,7 @@ public class DepotItemController {
BigDecimal
outPrice
=
depotItemService
.
inOrOutPrice
(
"出库"
,
"销售"
,
month
,
roleType
);
BigDecimal
inPrice
=
depotItemService
.
inOrOutPrice
(
"入库"
,
"销售退货"
,
month
,
roleType
);
obj
.
put
(
"x"
,
month
);
obj
.
put
(
"y"
,
outPrice
.
subtract
(
inPrice
));
obj
.
put
(
"y"
,
roleService
.
parsePriceByLimit
(
outPrice
.
subtract
(
inPrice
)
,
"sale"
,
request
)
);
salePriceList
.
add
(
obj
);
}
map
.
put
(
"salePriceList"
,
salePriceList
);
...
...
@@ -690,7 +694,7 @@ public class DepotItemController {
BigDecimal
outPrice
=
depotItemService
.
inOrOutRetailPrice
(
"出库"
,
"零售"
,
month
,
roleType
);
BigDecimal
inPrice
=
depotItemService
.
inOrOutRetailPrice
(
"入库"
,
"零售退货"
,
month
,
roleType
);
obj
.
put
(
"x"
,
month
);
obj
.
put
(
"y"
,
outPrice
.
subtract
(
inPrice
));
obj
.
put
(
"y"
,
roleService
.
parsePriceByLimit
(
outPrice
.
subtract
(
inPrice
)
,
"retail"
,
request
)
);
retailPriceList
.
add
(
obj
);
}
map
.
put
(
"retailPriceList"
,
retailPriceList
);
...
...
jshERP-boot/src/main/java/com/jsh/erp/controller/UserController.java
View file @
fa300cc9
...
...
@@ -140,7 +140,7 @@ public class UserController {
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
data
.
put
(
"msgTip"
,
msgTip
);
if
(
user
!=
null
){
String
roleType
=
userService
.
getRoleTypeByUserId
(
user
.
getId
());
//角色类型
String
roleType
=
userService
.
getRoleTypeByUserId
(
user
.
getId
())
.
getType
()
;
//角色类型
redisService
.
storageObjectBySession
(
token
,
"roleType"
,
roleType
);
redisService
.
storageObjectBySession
(
token
,
"clientIp"
,
Tools
.
getLocalIp
(
request
));
logService
.
insertLogWithUserId
(
user
.
getId
(),
user
.
getTenantId
(),
"用户"
,
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
fa300cc9
...
...
@@ -21,6 +21,7 @@ import com.jsh.erp.service.log.LogService;
import
com.jsh.erp.service.orgaUserRel.OrgaUserRelService
;
import
com.jsh.erp.service.person.PersonService
;
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.supplier.SupplierService
;
import
com.jsh.erp.service.systemConfig.SystemConfigService
;
...
...
@@ -56,6 +57,8 @@ public class DepotHeadService {
@Resource
private
UserService
userService
;
@Resource
private
RoleService
roleService
;
@Resource
private
DepotService
depotService
;
@Resource
DepotItemService
depotItemService
;
...
...
@@ -79,8 +82,6 @@ public class DepotHeadService {
DepotItemMapperEx
depotItemMapperEx
;
@Resource
private
LogService
logService
;
@Resource
private
RedisService
redisService
;
public
DepotHead
getDepotHead
(
long
id
)
throws
Exception
{
DepotHead
result
=
null
;
...
...
@@ -919,7 +920,7 @@ public class DepotHeadService {
}
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
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
//今日
...
...
@@ -974,18 +975,18 @@ public class DepotHeadService {
yearBegin
,
yearEnd
,
creatorArray
);
//今年零售出库
BigDecimal
yearRetailSaleBack
=
getBuyAndSaleRetailStatistics
(
"入库"
,
"零售退货"
,
yearBegin
,
yearEnd
,
creatorArray
);
//今年零售退货
map
.
put
(
"todayBuy"
,
todayBuy
.
subtract
(
todayBuyBack
));
map
.
put
(
"todaySale"
,
todaySale
.
subtract
(
todaySaleBack
));
map
.
put
(
"todayRetailSale"
,
todayRetailSale
.
subtract
(
todayRetailSaleBack
));
map
.
put
(
"monthBuy"
,
monthBuy
.
subtract
(
monthBuyBack
));
map
.
put
(
"monthSale"
,
monthSale
.
subtract
(
monthSaleBack
));
map
.
put
(
"monthRetailSale"
,
monthRetailSale
.
subtract
(
monthRetailSaleBack
));
map
.
put
(
"yesterdayBuy"
,
yesterdayBuy
.
subtract
(
yesterdayBuyBack
));
map
.
put
(
"yesterdaySale"
,
yesterdaySale
.
subtract
(
yesterdaySaleBack
));
map
.
put
(
"yesterdayRetailSale"
,
yesterdayRetailSale
.
subtract
(
yesterdayRetailSaleBack
));
map
.
put
(
"yearBuy"
,
yearBuy
.
subtract
(
yearBuyBack
));
map
.
put
(
"yearSale"
,
yearSale
.
subtract
(
yearSaleBack
));
map
.
put
(
"yearRetailSale"
,
yearRetailSale
.
subtract
(
yearRetailSaleBack
));
map
.
put
(
"todayBuy"
,
roleService
.
parsePriceByLimit
(
todayBuy
.
subtract
(
todayBuyBack
)
,
"buy"
,
request
)
);
map
.
put
(
"todaySale"
,
roleService
.
parsePriceByLimit
(
todaySale
.
subtract
(
todaySaleBack
)
,
"sale"
,
request
)
);
map
.
put
(
"todayRetailSale"
,
roleService
.
parsePriceByLimit
(
todayRetailSale
.
subtract
(
todayRetailSaleBack
)
,
"retail"
,
request
)
);
map
.
put
(
"monthBuy"
,
roleService
.
parsePriceByLimit
(
monthBuy
.
subtract
(
monthBuyBack
)
,
"buy"
,
request
)
);
map
.
put
(
"monthSale"
,
roleService
.
parsePriceByLimit
(
monthSale
.
subtract
(
monthSaleBack
)
,
"sale"
,
request
)
);
map
.
put
(
"monthRetailSale"
,
roleService
.
parsePriceByLimit
(
monthRetailSale
.
subtract
(
monthRetailSaleBack
)
,
"retail"
,
request
)
);
map
.
put
(
"yesterdayBuy"
,
roleService
.
parsePriceByLimit
(
yesterdayBuy
.
subtract
(
yesterdayBuyBack
)
,
"buy"
,
request
)
);
map
.
put
(
"yesterdaySale"
,
roleService
.
parsePriceByLimit
(
yesterdaySale
.
subtract
(
yesterdaySaleBack
)
,
"sale"
,
request
)
);
map
.
put
(
"yesterdayRetailSale"
,
roleService
.
parsePriceByLimit
(
yesterdayRetailSale
.
subtract
(
yesterdayRetailSaleBack
)
,
"retail"
,
request
)
);
map
.
put
(
"yearBuy"
,
roleService
.
parsePriceByLimit
(
yearBuy
.
subtract
(
yearBuyBack
)
,
"buy"
,
request
)
);
map
.
put
(
"yearSale"
,
roleService
.
parsePriceByLimit
(
yearSale
.
subtract
(
yearSaleBack
)
,
"sale"
,
request
)
);
map
.
put
(
"yearRetailSale"
,
roleService
.
parsePriceByLimit
(
yearRetailSale
.
subtract
(
yearRetailSaleBack
)
,
"retail"
,
request
)
);
return
map
;
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
fa300cc9
...
...
@@ -15,6 +15,7 @@ import com.jsh.erp.service.depotHead.DepotHeadService;
import
com.jsh.erp.service.materialExtend.MaterialExtendService
;
import
com.jsh.erp.service.log.LogService
;
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.systemConfig.SystemConfigService
;
import
com.jsh.erp.service.user.UserService
;
...
...
@@ -61,6 +62,8 @@ public class DepotItemService {
@Resource
private
SystemConfigService
systemConfigService
;
@Resource
private
RoleService
roleService
;
@Resource
private
MaterialCurrentStockMapper
materialCurrentStockMapper
;
@Resource
private
LogService
logService
;
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/role/RoleService.java
View file @
fa300cc9
...
...
@@ -21,6 +21,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -216,4 +217,27 @@ public class RoleService {
}
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
;
}
}
jshERP-boot/src/main/java/com/jsh/erp/service/user/UserService.java
View file @
fa300cc9
...
...
@@ -692,12 +692,13 @@ public class UserService {
}
/**
* 根据用户id查询角色
类型
* 根据用户id查询角色
信息
* @param userId
* @return
*/
@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"
);
UserBusiness
ub
=
null
;
if
(
list
.
size
()
>
0
)
{
...
...
@@ -711,15 +712,9 @@ public class UserService {
if
(
valueArray
.
length
>
0
)
{
roleId
=
valueArray
[
0
];
}
Role
role
=
roleService
.
getRoleWithoutTenant
(
Long
.
parseLong
(
roleId
));
if
(
role
!=
null
)
{
return
role
.
getType
();
}
else
{
return
null
;
}
}
else
{
return
null
;
role
=
roleService
.
getRoleWithoutTenant
(
Long
.
parseLong
(
roleId
));
}
return
role
;
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment