|
|
|
@ -59,51 +59,63 @@ public class CustomerJGServiceImpl extends ServiceImpl<CustomerJGMapper, Custome
|
|
|
|
|
String userId=userProvider.get().getUserId();
|
|
|
|
|
List<String> AllIdList =new ArrayList();
|
|
|
|
|
int total=0;
|
|
|
|
|
int customerNum =0;
|
|
|
|
|
int customerNum =0;
|
|
|
|
|
QueryWrapper<CustomerJGEntity> customerQueryWrapper=new QueryWrapper<>();
|
|
|
|
|
boolean pcPermission = false;
|
|
|
|
|
boolean appPermission = false;
|
|
|
|
|
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
|
|
|
|
|
if(isPc && pcPermission){
|
|
|
|
|
if (!userProvider.get().getIsAdministrator()){
|
|
|
|
|
Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer"));
|
|
|
|
|
if (ObjectUtil.isEmpty(customerObj)){
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
} else {
|
|
|
|
|
customerQueryWrapper = (QueryWrapper<CustomerJGEntity>)customerObj;
|
|
|
|
|
customerNum++;
|
|
|
|
|
boolean pcPermission = false;
|
|
|
|
|
boolean appPermission = false;
|
|
|
|
|
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
|
|
|
|
|
if(isPc && pcPermission){
|
|
|
|
|
if (!userProvider.get().getIsAdministrator()){
|
|
|
|
|
Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer"));
|
|
|
|
|
if (ObjectUtil.isEmpty(customerObj)){
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
} else {
|
|
|
|
|
customerQueryWrapper = (QueryWrapper<CustomerJGEntity>)customerObj;
|
|
|
|
|
customerNum++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!isPc && appPermission){
|
|
|
|
|
if (!userProvider.get().getIsAdministrator()){
|
|
|
|
|
Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer"));
|
|
|
|
|
if (ObjectUtil.isEmpty(customerObj)){
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
} else {
|
|
|
|
|
customerQueryWrapper = (QueryWrapper<CustomerJGEntity>)customerObj;
|
|
|
|
|
customerNum++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(StringUtil.isNotEmpty(customerPagination.getSupplierCd())){
|
|
|
|
|
if(!isPc && appPermission){
|
|
|
|
|
if (!userProvider.get().getIsAdministrator()){
|
|
|
|
|
Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer"));
|
|
|
|
|
if (ObjectUtil.isEmpty(customerObj)){
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
} else {
|
|
|
|
|
customerQueryWrapper = (QueryWrapper<CustomerJGEntity>)customerObj;
|
|
|
|
|
customerNum++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(StringUtil.isNotEmpty(customerPagination.getSupplierCd())){
|
|
|
|
|
customerNum++;
|
|
|
|
|
customerQueryWrapper.lambda().like(CustomerJGEntity::getSupplierCd,customerPagination.getSupplierCd());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(StringUtil.isNotEmpty(customerPagination.getSupplierNm())){
|
|
|
|
|
if(StringUtil.isNotEmpty(customerPagination.getSupplierNm())){
|
|
|
|
|
customerNum++;
|
|
|
|
|
customerQueryWrapper.lambda().like(CustomerJGEntity::getSupplierNm,customerPagination.getSupplierNm());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(StringUtil.isNotEmpty(customerPagination.getKeyword())){
|
|
|
|
|
customerNum++;
|
|
|
|
|
customerQueryWrapper.lambda().and(wq -> {
|
|
|
|
|
// 拼接sql
|
|
|
|
|
wq.like(CustomerJGEntity::getSupplierNm,customerPagination.getKeyword())
|
|
|
|
|
.or()
|
|
|
|
|
.like(CustomerJGEntity::getOrgName,customerPagination.getKeyword())
|
|
|
|
|
.or()
|
|
|
|
|
.like(CustomerJGEntity::getAddress,customerPagination.getKeyword());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(AllIdList.size()>0){
|
|
|
|
|
customerQueryWrapper.lambda().in(CustomerJGEntity::getId, AllIdList);
|
|
|
|
|
}
|
|
|
|
|
//排序
|
|
|
|
|
if(StringUtil.isEmpty(customerPagination.getSidx())){
|
|
|
|
|
customerQueryWrapper.lambda().orderByDesc(CustomerJGEntity::getSupplierCd);
|
|
|
|
|
customerQueryWrapper.lambda().orderByDesc(CustomerJGEntity::getSupplierCd);
|
|
|
|
|
}else{
|
|
|
|
|
try {
|
|
|
|
|
String sidx = customerPagination.getSidx();
|
|
|
|
@ -117,9 +129,9 @@ public class CustomerJGServiceImpl extends ServiceImpl<CustomerJGMapper, Custome
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if((total>0 && AllIdList.size()>0) || total==0){
|
|
|
|
|
Page<CustomerJGEntity> page=new Page<>(customerPagination.getCurrentPage(), customerPagination.getPageSize());
|
|
|
|
|
IPage<CustomerJGEntity> userIPage=this.page(page, customerQueryWrapper);
|
|
|
|
|
return customerPagination.setData(userIPage.getRecords(),userIPage.getTotal());
|
|
|
|
|
Page<CustomerJGEntity> page=new Page<>(customerPagination.getCurrentPage(), customerPagination.getPageSize());
|
|
|
|
|
IPage<CustomerJGEntity> userIPage=this.page(page, customerQueryWrapper);
|
|
|
|
|
return customerPagination.setData(userIPage.getRecords(),userIPage.getTotal());
|
|
|
|
|
}else{
|
|
|
|
|
List<CustomerJGEntity> list = new ArrayList();
|
|
|
|
|
return customerPagination.setData(list, list.size());
|
|
|
|
@ -129,60 +141,60 @@ public class CustomerJGServiceImpl extends ServiceImpl<CustomerJGMapper, Custome
|
|
|
|
|
public List<CustomerJGEntity> getTypeList(CustomerPagination customerPagination,String dataType){
|
|
|
|
|
String userId=userProvider.get().getUserId();
|
|
|
|
|
List<String> AllIdList =new ArrayList();
|
|
|
|
|
int total=0;
|
|
|
|
|
int customerNum =0;
|
|
|
|
|
int total=0;
|
|
|
|
|
int customerNum =0;
|
|
|
|
|
QueryWrapper<CustomerJGEntity> customerQueryWrapper=new QueryWrapper<>();
|
|
|
|
|
boolean pcPermission = false;
|
|
|
|
|
boolean appPermission = false;
|
|
|
|
|
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
|
|
|
|
|
if(isPc && pcPermission){
|
|
|
|
|
if (!userProvider.get().getIsAdministrator()){
|
|
|
|
|
Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer"));
|
|
|
|
|
if (ObjectUtil.isEmpty(customerObj)){
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
} else {
|
|
|
|
|
customerQueryWrapper = (QueryWrapper<CustomerJGEntity>)customerObj;
|
|
|
|
|
customerNum++;
|
|
|
|
|
boolean pcPermission = false;
|
|
|
|
|
boolean appPermission = false;
|
|
|
|
|
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
|
|
|
|
|
if(isPc && pcPermission){
|
|
|
|
|
if (!userProvider.get().getIsAdministrator()){
|
|
|
|
|
Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer"));
|
|
|
|
|
if (ObjectUtil.isEmpty(customerObj)){
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
} else {
|
|
|
|
|
customerQueryWrapper = (QueryWrapper<CustomerJGEntity>)customerObj;
|
|
|
|
|
customerNum++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!isPc && appPermission){
|
|
|
|
|
if (!userProvider.get().getIsAdministrator()){
|
|
|
|
|
Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer"));
|
|
|
|
|
if (ObjectUtil.isEmpty(customerObj)){
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
} else {
|
|
|
|
|
customerQueryWrapper = (QueryWrapper<CustomerJGEntity>)customerObj;
|
|
|
|
|
customerNum++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(StringUtil.isNotEmpty(customerPagination.getSupplierCd())){
|
|
|
|
|
if(!isPc && appPermission){
|
|
|
|
|
if (!userProvider.get().getIsAdministrator()){
|
|
|
|
|
Object customerObj=authorizeService.getCondition(new AuthorizeConditionModel(customerQueryWrapper,customerPagination.getMenuId(),"customer"));
|
|
|
|
|
if (ObjectUtil.isEmpty(customerObj)){
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
} else {
|
|
|
|
|
customerQueryWrapper = (QueryWrapper<CustomerJGEntity>)customerObj;
|
|
|
|
|
customerNum++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(StringUtil.isNotEmpty(customerPagination.getSupplierCd())){
|
|
|
|
|
customerNum++;
|
|
|
|
|
customerQueryWrapper.lambda().like(CustomerJGEntity::getSupplierCd,customerPagination.getSupplierCd());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(StringUtil.isNotEmpty(customerPagination.getSupplierNm())){
|
|
|
|
|
if(StringUtil.isNotEmpty(customerPagination.getSupplierNm())){
|
|
|
|
|
customerNum++;
|
|
|
|
|
customerQueryWrapper.lambda().like(CustomerJGEntity::getSupplierNm,customerPagination.getSupplierNm());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(AllIdList.size()>0){
|
|
|
|
|
customerQueryWrapper.lambda().in(CustomerJGEntity::getId, AllIdList);
|
|
|
|
|
}
|
|
|
|
|
if(AllIdList.size()>0){
|
|
|
|
|
customerQueryWrapper.lambda().in(CustomerJGEntity::getId, AllIdList);
|
|
|
|
|
}
|
|
|
|
|
//排序
|
|
|
|
|
if(StringUtil.isEmpty(customerPagination.getSidx())){
|
|
|
|
|
customerQueryWrapper.lambda().orderByDesc(CustomerJGEntity::getSupplierCd);
|
|
|
|
|
customerQueryWrapper.lambda().orderByDesc(CustomerJGEntity::getSupplierCd);
|
|
|
|
|
}else{
|
|
|
|
|
try {
|
|
|
|
|
String sidx = customerPagination.getSidx();
|
|
|
|
|
String sidx = customerPagination.getSidx();
|
|
|
|
|
CustomerJGEntity customerEntity = new CustomerJGEntity();
|
|
|
|
|
Field declaredField = customerEntity.getClass().getDeclaredField(sidx);
|
|
|
|
|
declaredField.setAccessible(true);
|
|
|
|
|
String value = declaredField.getAnnotation(TableField.class).value();
|
|
|
|
|
customerQueryWrapper="asc".equals(customerPagination.getSort().toLowerCase())?customerQueryWrapper.orderByAsc(value):customerQueryWrapper.orderByDesc(value);
|
|
|
|
|
Field declaredField = customerEntity.getClass().getDeclaredField(sidx);
|
|
|
|
|
declaredField.setAccessible(true);
|
|
|
|
|
String value = declaredField.getAnnotation(TableField.class).value();
|
|
|
|
|
customerQueryWrapper="asc".equals(customerPagination.getSort().toLowerCase())?customerQueryWrapper.orderByAsc(value):customerQueryWrapper.orderByDesc(value);
|
|
|
|
|
} catch (NoSuchFieldException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|