数据权限,磅单列表模块修改!

product
巴卫 2 years ago
parent 7be9c7229c
commit d6228c3006

@ -41,6 +41,8 @@ public class PoundlistPagination extends Pagination {
private String purchaseOrderId;
private String salesOrderId;
private List<String> poundlistIds;
private String departmentId;
/**
* id
*/

@ -14,7 +14,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.supplier.entity.SupplierEntity;
import jnpf.supplier.service.SupplierService;
import jnpf.util.RandomUtil;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
@ -22,8 +24,11 @@ import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.poundlist.model.poundlist.PoundlistPagination;
import jnpf.permission.service.AuthorizeService;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.stream.Collectors;
@ -35,12 +40,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
/**
*
* poundlist
* V3.2.0
* LINKAGE-BOOT
@ -48,7 +55,7 @@ import java.util.*;
* 2023-02-21
*/
@Service
public class PoundlistServiceImpl extends ServiceImpl<PoundlistMapper, PoundlistEntity> implements PoundlistService{
public class PoundlistServiceImpl extends ServiceImpl<PoundlistMapper, PoundlistEntity> implements PoundlistService {
@Autowired
@ -70,51 +77,51 @@ public class PoundlistServiceImpl extends ServiceImpl<PoundlistMapper, Poundlist
private MaterialService materialService;
@Override
public List<PoundlistEntity> getList(PoundlistPagination poundlistPagination){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
int total=0;
int poundlistNum =0;
QueryWrapper<PoundlistEntity> poundlistQueryWrapper=new QueryWrapper<>();
poundlistQueryWrapper.lambda().eq(PoundlistEntity::getIsExamine,"1");
public List<PoundlistEntity> getList(PoundlistPagination poundlistPagination) {
String userId = userProvider.get().getUserId();
List<String> AllIdList = new ArrayList();
int total = 0;
int poundlistNum = 0;
QueryWrapper<PoundlistEntity> poundlistQueryWrapper = new QueryWrapper<>();
poundlistQueryWrapper.lambda().eq(PoundlistEntity::getIsExamine, "1");
boolean pcPermission = true;
boolean appPermission = true;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object poundlistObj=authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper,poundlistPagination.getMenuId(),"jg_poundlist"));
if (ObjectUtil.isEmpty(poundlistObj)){
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
if (isPc && pcPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object poundlistObj = authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper, poundlistPagination.getMenuId(), "jg_poundlist"));
if (ObjectUtil.isEmpty(poundlistObj)) {
return new ArrayList<>();
} else {
poundlistQueryWrapper = (QueryWrapper<PoundlistEntity>)poundlistObj;
poundlistQueryWrapper = (QueryWrapper<PoundlistEntity>) poundlistObj;
poundlistNum++;
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object poundlistObj=authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper,poundlistPagination.getMenuId(),"jg_poundlist"));
if (ObjectUtil.isEmpty(poundlistObj)){
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object poundlistObj = authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper, poundlistPagination.getMenuId(), "jg_poundlist"));
if (ObjectUtil.isEmpty(poundlistObj)) {
return new ArrayList<>();
} else {
poundlistQueryWrapper = (QueryWrapper<PoundlistEntity>)poundlistObj;
poundlistQueryWrapper = (QueryWrapper<PoundlistEntity>) poundlistObj;
poundlistNum++;
}
}
}
if(StringUtil.isNotEmpty(poundlistPagination.getPoundDate())){
List<String> PoundDateList = poundlistPagination.getPoundDate();
if (StringUtil.isNotEmpty(poundlistPagination.getPoundDate())) {
List<String> PoundDateList = poundlistPagination.getPoundDate();
Long fir = Long.valueOf(PoundDateList.get(0));
Long sec = Long.valueOf(PoundDateList.get(1));
poundlistPagination.setStartDate(new Date(fir));
poundlistPagination.setEndDate(DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if(StringUtil.isEmpty(poundlistPagination.getSidx())){
if (StringUtil.isEmpty(poundlistPagination.getSidx())) {
poundlistPagination.setSidx("CREATOR_TIME");
poundlistPagination.setSort("DESC");
}else{
} else {
try {
String sidx = poundlistPagination.getSidx();
PoundlistEntity poundlistEntity = new PoundlistEntity();
@ -126,47 +133,61 @@ public class PoundlistServiceImpl extends ServiceImpl<PoundlistMapper, Poundlist
e.printStackTrace();
}
}
Page<PoundlistEntity> page=new Page<>(poundlistPagination.getCurrentPage(), poundlistPagination.getPageSize());
Page<PoundlistEntity> page = new Page<>(poundlistPagination.getCurrentPage(), poundlistPagination.getPageSize());
/*************************************************************************/
IPage<PoundlistEntity> userIPage = this.page(page, poundlistQueryWrapper);
List<PoundlistEntity> list = userIPage.getRecords();
Optional<PoundlistEntity> firstElement = list.stream().findFirst();
String department_id = firstElement.flatMap(list1 -> list.stream().filter(Objects::nonNull).findFirst())
.map(PoundlistEntity::getDepartmentId)
.orElse(null);
poundlistPagination.setDepartmentId(department_id);
/*************************************************************************/
IPage<PoundlistEntity> iPage = poundlistMapper.queryByKeyword(page, poundlistPagination);
return poundlistPagination.setData(iPage.getRecords(),iPage.getTotal());
return poundlistPagination.setData(iPage.getRecords(), iPage.getTotal());
}
@Override
public List<PoundlistEntity> getTypeList(PoundlistPagination poundlistPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
int total=0;
int poundlistNum =0;
QueryWrapper<PoundlistEntity> poundlistQueryWrapper=new QueryWrapper<>();
public List<PoundlistEntity> getTypeList(PoundlistPagination poundlistPagination, String dataType) {
String userId = userProvider.get().getUserId();
List<String> AllIdList = new ArrayList();
int total = 0;
int poundlistNum = 0;
QueryWrapper<PoundlistEntity> poundlistQueryWrapper = new QueryWrapper<>();
boolean pcPermission = true;
boolean appPermission = true;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object poundlistObj=authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper,poundlistPagination.getMenuId(),"jg_poundlist"));
if (ObjectUtil.isEmpty(poundlistObj)){
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
if (isPc && pcPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object poundlistObj = authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper, poundlistPagination.getMenuId(), "jg_poundlist"));
if (ObjectUtil.isEmpty(poundlistObj)) {
return new ArrayList<>();
} else {
poundlistQueryWrapper = (QueryWrapper<PoundlistEntity>)poundlistObj;
poundlistQueryWrapper = (QueryWrapper<PoundlistEntity>) poundlistObj;
poundlistNum++;
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object poundlistObj=authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper,poundlistPagination.getMenuId(),"jg_poundlist"));
if (ObjectUtil.isEmpty(poundlistObj)){
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object poundlistObj = authorizeService.getCondition(new AuthorizeConditionModel(poundlistQueryWrapper, poundlistPagination.getMenuId(), "jg_poundlist"));
if (ObjectUtil.isEmpty(poundlistObj)) {
return new ArrayList<>();
} else {
poundlistQueryWrapper = (QueryWrapper<PoundlistEntity>)poundlistObj;
poundlistQueryWrapper = (QueryWrapper<PoundlistEntity>) poundlistObj;
poundlistNum++;
}
}
}
if(StringUtil.isNotEmpty(poundlistPagination.getPoundDate())){
if (StringUtil.isNotEmpty(poundlistPagination.getPoundDate())) {
poundlistNum++;
List<String> PoundDateList = poundlistPagination.getPoundDate();
List<String> PoundDateList = poundlistPagination.getPoundDate();
Long fir = Long.valueOf(PoundDateList.get(0));
Long sec = Long.valueOf(PoundDateList.get(1));
@ -175,57 +196,57 @@ public class PoundlistServiceImpl extends ServiceImpl<PoundlistMapper, Poundlist
}
if(StringUtil.isNotEmpty(poundlistPagination.getPoundlistNo())){
if (StringUtil.isNotEmpty(poundlistPagination.getPoundlistNo())) {
poundlistNum++;
poundlistQueryWrapper.lambda().like(PoundlistEntity::getPoundlistNo,poundlistPagination.getPoundlistNo());
poundlistQueryWrapper.lambda().like(PoundlistEntity::getPoundlistNo, poundlistPagination.getPoundlistNo());
}
if(AllIdList.size()>0){
if (AllIdList.size() > 0) {
poundlistQueryWrapper.lambda().in(PoundlistEntity::getId, AllIdList);
}
//排序
if(StringUtil.isEmpty(poundlistPagination.getSidx())){
if (StringUtil.isEmpty(poundlistPagination.getSidx())) {
poundlistQueryWrapper.lambda().orderByDesc(PoundlistEntity::getId);
}else{
} else {
try {
String sidx = poundlistPagination.getSidx();
PoundlistEntity poundlistEntity = new PoundlistEntity();
Field declaredField = poundlistEntity.getClass().getDeclaredField(sidx);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
poundlistQueryWrapper="asc".equals(poundlistPagination.getSort().toLowerCase())?poundlistQueryWrapper.orderByAsc(value):poundlistQueryWrapper.orderByDesc(value);
poundlistQueryWrapper = "asc".equals(poundlistPagination.getSort().toLowerCase()) ? poundlistQueryWrapper.orderByAsc(value) : poundlistQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<PoundlistEntity> page=new Page<>(poundlistPagination.getCurrentPage(), poundlistPagination.getPageSize());
IPage<PoundlistEntity> userIPage=this.page(page, poundlistQueryWrapper);
return poundlistPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<PoundlistEntity> page = new Page<>(poundlistPagination.getCurrentPage(), poundlistPagination.getPageSize());
IPage<PoundlistEntity> userIPage = this.page(page, poundlistQueryWrapper);
return poundlistPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<PoundlistEntity> list = new ArrayList();
return poundlistPagination.setData(list, list.size());
}
}else{
} else {
return this.list(poundlistQueryWrapper);
}
}
@Override
public PoundlistEntity getInfo(String id){
QueryWrapper<PoundlistEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(PoundlistEntity::getId,id);
public PoundlistEntity getInfo(String id) {
QueryWrapper<PoundlistEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(PoundlistEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(PoundlistEntity entity){
public void create(PoundlistEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, PoundlistEntity entity){
public boolean update(String id, PoundlistEntity entity) {
entity.setId(id);
return this.updateById(entity);
}
@ -233,13 +254,13 @@ public class PoundlistServiceImpl extends ServiceImpl<PoundlistMapper, Poundlist
//销售毛利表
@Override
public List<PoundlistSEntity> qureylist(PoundlistSEntity poundlistSEntity) {
List<PoundlistSEntity> list= poundlistMapper.qureylist(poundlistSEntity);
List<PoundlistSEntity> list = poundlistMapper.qureylist(poundlistSEntity);
return list;
}
@Override
public List<PoundlistTwoEntity> purchasesalesPricelist(PoundlistTwoEntity poundlistTwoEntity) {
List<PoundlistTwoEntity> list= poundlistMapper.qureylist2(poundlistTwoEntity);
List<PoundlistTwoEntity> list = poundlistMapper.qureylist2(poundlistTwoEntity);
return list;
}
@ -259,8 +280,8 @@ public class PoundlistServiceImpl extends ServiceImpl<PoundlistMapper, Poundlist
}
@Override
public void delete(PoundlistEntity entity){
if(entity!=null){
public void delete(PoundlistEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}

@ -69,7 +69,7 @@ WHERE a.delete_mark = 0 and b.delete_mark = 0 and c.delete_mark = 0 and d.delete
LEFT JOIN jg_natural i on a.natural_id = i.id
LEFT JOIN jg_purchaseorder_item0 j on a.id = j.poundlist_id
LEFT JOIN jg_salesorder_item0 k on a.id = k.poundlist_id
where a.is_examine = '1' and a.delete_mark = 0 and b.delete_mark = 0 and c.delete_mark = 0 and d.delete_mark = 0 and e.delete_mark = 0 and f.delete_mark = 0 and g.delete_mark = 0 and i.delete_mark = 0 and j.delete_mark = 0 and k.delete_mark = 0
where a.is_examine = '1'
<if test="poundlistPagination.keyword != null and poundlistPagination.keyword != ''">
AND (b.ticketno LIKE CONCAT('%',#{poundlistPagination.keyword},'%') OR c.supplier_name LIKE CONCAT('%',#{poundlistPagination.keyword},'%') OR d.supplier_nm LIKE CONCAT('%',#{poundlistPagination.keyword},'%'))
</if>
@ -85,6 +85,10 @@ WHERE a.delete_mark = 0 and b.delete_mark = 0 and c.delete_mark = 0 and d.delete
<if test="poundlistPagination.isPay != null and poundlistPagination.isPay != ''">
AND a.is_pay = #{poundlistPagination.isPay}
</if>
/*modified by 巴卫*/
<if test="poundlistPagination.departmentId != null and poundlistPagination.departmentId != ''">
AND a.department_id = #{poundlistPagination.departmentId}
</if>
<if test="poundlistPagination.isCollection != null and poundlistPagination.isCollection != ''">
AND a.is_collection = #{poundlistPagination.isCollection}
</if>

Loading…
Cancel
Save