权限加条件

product
bawei 2 years ago
parent 97e9e4f3d4
commit aa03d67e3b

@ -36,7 +36,10 @@ public class UserProvider {
// UserInfo userInfo = this.get();
return getUserMapper.getDepartmentId(userId).get(0).get("F_DepartmentId");
}
public String getOrganizeId(String userId){
// UserInfo userInfo = this.get();
return getUserMapper.getOrganiId(userId).get(0).get("F_OrganizeId");
}
/**

@ -19,4 +19,6 @@ public interface GetUserMapper extends BaseMapper<UserGetUserEntity> {
@Select("SELECT * FROM base_user WHERE f_id=#{id}")
List<Map<String,String>> getDepartmentId(@Param("id")String id);
@Select("SELECT * FROM base_user WHERE f_id=#{id}")
List<Map<String,String>> getOrganiId(@Param("id")String id);
}

@ -69,6 +69,10 @@ public class ArinvoicesServiceImpl extends ServiceImpl<ArinvoicesMapper, Arinvoi
@Override
public List<ArinvoicesEntity> getList(ArinvoicesPagination arinvoicesPagination){
String userId=userProvider.get().getUserId();
String detpartment = null;
if (!userProvider.get().getIsAdministrator()) {
detpartment = userProvider.getDepartmentId(userId);
}
List<String> AllIdList =new ArrayList();
int total=0;
int arinvoicesNum =0;
@ -181,7 +185,11 @@ public class ArinvoicesServiceImpl extends ServiceImpl<ArinvoicesMapper, Arinvoi
String deId = firstElement.flatMap(list1 -> firstElement.filter(Objects::nonNull))
.map(ArinvoicesEntity::getDepartmentId)
.orElse(null);
if (deId==null){
arinvoicesPagination.setDepartmentId(detpartment);
}else {
arinvoicesPagination.setDepartmentId(deId);
}
IPage<ArinvoicesEntity> userIPage=arinvoicesMapper.queryArinvoices(page, arinvoicesPagination);
return arinvoicesPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}

@ -73,6 +73,14 @@ public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collect
@Override
public List<CollectionEntity> getList(CollectionPagination collectionPagination){
String userId=userProvider.get().getUserId();
// String orgnize = null;
// if (!userProvider.get().getIsAdministrator()) {
// orgnize = userProvider.getOrganizeId(userId);
// }
String detpartment = null;
if (!userProvider.get().getIsAdministrator()) {
detpartment = userProvider.getDepartmentId(userId);
}
List<String> AllIdList =new ArrayList();
int total=0;
int collectionNum =0;
@ -152,10 +160,15 @@ public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collect
IPage<CollectionEntity> IPage = this.page(page, collectionQueryWrapper);
List<CollectionEntity> list = IPage.getRecords();
Optional<CollectionEntity> firstElement = list.stream().findFirst();
String OrgnId = firstElement.flatMap(list1 -> firstElement.filter(Objects::nonNull))
.map(CollectionEntity::getOrgnizeId)
String department_id = firstElement.flatMap(list1 -> firstElement.filter(Objects::nonNull))
.map(CollectionEntity::getDepartmentId)
.orElse(null);
collectionPagination.setOrgnizeId(OrgnId);
// collectionPagination.setOrgnizeId(OrgnId);
if (department_id==null){
collectionPagination.setDepartmentId(detpartment);
}else {
collectionPagination.setDepartmentId(department_id);
}
IPage<CollectionEntity> userIPage=collectionMapper.queryCollection(page, collectionPagination);
return collectionPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}

@ -76,6 +76,10 @@ public class InvoicesServiceImpl extends ServiceImpl<InvoicesMapper, InvoicesEnt
@Override
public List<InvoicesEntity> getList(InvoicesPagination invoicesPagination){
String userId=userProvider.get().getUserId();
String detpartment = null;
if (!userProvider.get().getIsAdministrator()) {
detpartment = userProvider.getDepartmentId(userId);
}
List<String> AllIdList =new ArrayList();
int total=0;
int invoicesNum =0;
@ -173,7 +177,11 @@ public class InvoicesServiceImpl extends ServiceImpl<InvoicesMapper, InvoicesEnt
String deId = firstElement.flatMap(list1 -> firstElement.filter(Objects::nonNull))
.map(InvoicesEntity::getDepartmentId)
.orElse(null);
if (deId==null){
invoicesPagination.setDepartmentId(detpartment);
}else {
invoicesPagination.setDepartmentId(deId);
}
IPage<InvoicesEntity> userIPage=invoicesMapper.queryByKeyword(page, invoicesPagination);
return invoicesPagination.setData(userIPage.getRecords(),userIPage.getTotal());

@ -80,8 +80,10 @@ public class PoundlistServiceImpl extends ServiceImpl<PoundlistMapper, Poundlist
@Override
public List<PoundlistEntity> getList(PoundlistPagination poundlistPagination) {
String userId = userProvider.get().getUserId();
// String demid=null;
// demid =userProvider.getDepartmentId(userId);
String detpartment = null;
if (!userProvider.get().getIsAdministrator()) {
detpartment = userProvider.getDepartmentId(userId);
}
List<String> AllIdList = new ArrayList();
int total = 0;
int poundlistNum = 0;
@ -148,7 +150,11 @@ public class PoundlistServiceImpl extends ServiceImpl<PoundlistMapper, Poundlist
.map(PoundlistEntity::getDepartmentId)
.orElse(null);
if (department_id==null){
poundlistPagination.setDepartmentId(detpartment);
}else {
poundlistPagination.setDepartmentId(department_id);
}
/*************************************************************************/
IPage<PoundlistEntity> iPage = poundlistMapper.queryByKeyword(page, poundlistPagination);

@ -68,6 +68,10 @@ public class PurchasebackServiceImpl extends ServiceImpl<PurchasebackMapper, Pur
@Override
public List<PurchasebackEntity> getList(PurchasebackPagination purchasebackPagination){
String userId=userProvider.get().getUserId();
String detpartment = null;
if (!userProvider.get().getIsAdministrator()) {
detpartment = userProvider.getDepartmentId(userId);
}
List<String> AllIdList =new ArrayList();
int total=0;
int purchasebackNum =0;
@ -158,7 +162,11 @@ public class PurchasebackServiceImpl extends ServiceImpl<PurchasebackMapper, Pur
String deId = firstElement.flatMap(list1 -> firstElement.filter(Objects::nonNull))
.map(PurchasebackEntity::getDepartmentId)
.orElse(null);
if (deId==null){
purchasebackPagination.setDepartmentId(detpartment);
}else {
purchasebackPagination.setDepartmentId(deId);
}
IPage<PurchasebackEntity> userIPage = purchasebackMapper.queryByKeyword(page, purchasebackPagination);
return purchasebackPagination.setData(userIPage.getRecords(),userIPage.getTotal());
/*if(StringUtil.isNotEmpty(purchasebackPagination.getDocumentNo())){

@ -776,6 +776,10 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
@Override
public List<PurchaseorderitemEntity> getList(PurchaseorderPagination purchaseorderPagination) {
String userId = userProvider.get().getUserId();
String detpartment = null;
if (!userProvider.get().getIsAdministrator()) {
detpartment = userProvider.getDepartmentId(userId);
}
List<String> AllIdList = new ArrayList();
int total = 0;
int purchaseorderNum = 0;
@ -927,7 +931,11 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
String deId = firstElement.flatMap(list1 -> firstElement.filter(Objects::nonNull))
.map(PurchaseorderitemEntity::getDepartmentId)
.orElse(null);
if (deId==null){
purchaseorderPagination.setDepartmentId(detpartment);
}else {
purchaseorderPagination.setDepartmentId(deId);
}
IPage<PurchaseorderitemEntity> userIPage = purchaseorderitemMapper.queryByKeyword(page, purchaseorderPagination);
return purchaseorderPagination.setData(userIPage.getRecords(), userIPage.getTotal());

@ -68,6 +68,10 @@ public class ReceiptinServiceImpl extends ServiceImpl<ReceiptinMapper, Receiptin
@Override
public List<ReceiptinEntity> getList(ReceiptinPagination receiptinPagination){
String userId=userProvider.get().getUserId();
String detpartment = null;
if (!userProvider.get().getIsAdministrator()) {
detpartment = userProvider.getDepartmentId(userId);
}
List<String> AllIdList =new ArrayList();
int total=0;
int receiptinNum =0;
@ -147,7 +151,11 @@ public class ReceiptinServiceImpl extends ServiceImpl<ReceiptinMapper, Receiptin
String deId = firstElement.flatMap(list1 -> firstElement.filter(Objects::nonNull))
.map(ReceiptinEntity::getDepartmentId)
.orElse(null);
if (deId==null){
receiptinPagination.setDepartmentId(detpartment);
}else {
receiptinPagination.setDepartmentId(deId);
}
IPage<ReceiptinEntity> userIPage = receiptinMapper.queryByKeyword(page, receiptinPagination);
return receiptinPagination.setData(userIPage.getRecords(),userIPage.getTotal());
/*if(StringUtil.isNotEmpty(receiptinPagination.getDocumentno())){

@ -66,6 +66,10 @@ public class ReceiptoutServiceImpl extends ServiceImpl<ReceiptoutMapper, Receipt
@Override
public List<ReceiptoutEntity> getList(ReceiptoutPagination receiptoutPagination){
String userId=userProvider.get().getUserId();
String detpartment = null;
if (!userProvider.get().getIsAdministrator()) {
detpartment = userProvider.getDepartmentId(userId);
}
List<String> AllIdList =new ArrayList();
int total=0;
int receiptoutNum =0;
@ -160,7 +164,11 @@ public class ReceiptoutServiceImpl extends ServiceImpl<ReceiptoutMapper, Receipt
String deId = firstElement.flatMap(list1 -> firstElement.filter(Objects::nonNull))
.map(ReceiptoutEntity::getDepartmentId)
.orElse(null);
if (deId==null){
receiptoutPagination.setDepartmentId(detpartment);
}else {
receiptoutPagination.setDepartmentId(deId);
}
IPage<ReceiptoutEntity> userIPage=receiptoutMapper.queryReceiptout(page, receiptoutPagination);
return receiptoutPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}

@ -64,6 +64,10 @@ public class SalebackServiceImpl extends ServiceImpl<SalebackMapper, SalebackEnt
@Override
public List<SalebackEntity> getList(SalebackPagination salebackPagination){
String userId=userProvider.get().getUserId();
String detpartment = null;
if (!userProvider.get().getIsAdministrator()) {
detpartment = userProvider.getDepartmentId(userId);
}
List<String> AllIdList =new ArrayList();
int total=0;
int salebackNum =0;
@ -158,7 +162,11 @@ public class SalebackServiceImpl extends ServiceImpl<SalebackMapper, SalebackEnt
String deId = firstElement.flatMap(list1 -> firstElement.filter(Objects::nonNull))
.map(SalebackEntity::getDepartmentId)
.orElse(null);
if (deId==null){
salebackPagination.setDepartmentId(detpartment);
}else {
salebackPagination.setDepartmentId(deId);
}
IPage<SalebackEntity> userIPage=salebackMapper.querySaleBack(page, salebackPagination);
return salebackPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}

@ -3,6 +3,7 @@ package jnpf.saleorder.service.impl;
import jnpf.arinvoices.entity.ArinvoicesEntity;
import jnpf.poundlist.entity.PoundlistEntity;
import jnpf.poundlist.service.PoundlistService;
import jnpf.receiptin.entity.ReceiptinEntity;
import jnpf.receiptout.entity.ReceiptoutEntity;
import jnpf.receiptout.entity.Receiptout_item0Entity;
import jnpf.receiptout.service.Receiptout_item0Service;
@ -87,6 +88,10 @@ public class SaleorderitemServiceImpl extends ServiceImpl<SaleorderitemMapper, S
@Override
public List<SaleorderitemEntity> getList(SaleorderitemPagination saleorderitemPagination){
String userId=userProvider.get().getUserId();
String detpartment = null;
if (!userProvider.get().getIsAdministrator()) {
detpartment = userProvider.getDepartmentId(userId);
}
List<String> AllIdList =new ArrayList();
int total=0;
int saleorderitemNum =0;
@ -242,8 +247,8 @@ public class SaleorderitemServiceImpl extends ServiceImpl<SaleorderitemMapper, S
Long sec = Long.valueOf(creatorTime.get(1));
saleorderitemPagination.setStartDate(new Date(fir));
saleorderitemPagination.setEndDate(DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
// saleorderitemQueryWrapper.lambda().ge(SaleorderitemEntity::getCreatorTime, new Date(fir))
// .le(SaleorderitemEntity::getCreatorTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
saleorderitemQueryWrapper.lambda().ge(SaleorderitemEntity::getCreatorTime, new Date(fir))
.le(SaleorderitemEntity::getCreatorTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
@ -262,7 +267,7 @@ public class SaleorderitemServiceImpl extends ServiceImpl<SaleorderitemMapper, S
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
saleorderitemPagination.setSidx(value);
// saleorderitemQueryWrapper="asc".equals(saleorderitemPagination.getSort().toLowerCase())?saleorderitemQueryWrapper.orderByAsc(value):saleorderitemQueryWrapper.orderByDesc(value);
saleorderitemQueryWrapper="asc".equals(saleorderitemPagination.getSort().toLowerCase())?saleorderitemQueryWrapper.orderByAsc(value):saleorderitemQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
@ -275,7 +280,11 @@ public class SaleorderitemServiceImpl extends ServiceImpl<SaleorderitemMapper, S
String deId = firstElement.flatMap(list1 -> firstElement.filter(Objects::nonNull))
.map(SaleorderitemEntity::getDepartmentId)
.orElse(null);
if (deId==null){
saleorderitemPagination.setDepartmentId(detpartment);
}else {
saleorderitemPagination.setDepartmentId(deId);
}
IPage<SaleorderitemEntity> userIPage=saleorderitemMapper.querySalesOrder(page, saleorderitemPagination);
return saleorderitemPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}

Loading…
Cancel
Save