diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/paymentdoc/service/impl/PaymentdocServiceImpl.java b/SC-boot/linkage-scm/src/main/java/jnpf/paymentdoc/service/impl/PaymentdocServiceImpl.java index ee592bc4..e8e03f03 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/paymentdoc/service/impl/PaymentdocServiceImpl.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/paymentdoc/service/impl/PaymentdocServiceImpl.java @@ -55,7 +55,6 @@ import java.util.*; import java.util.stream.Collectors; /** - * * paymentdoc * 版本: V3.2.0 * 版权: LINKAGE-BOOT @@ -63,7 +62,7 @@ import java.util.stream.Collectors; * 日期: 2023-03-22 */ @Service -public class PaymentdocServiceImpl extends ServiceImpl implements PaymentdocService { +public class PaymentdocServiceImpl extends ServiceImpl implements PaymentdocService { @Autowired @@ -88,124 +87,123 @@ public class PaymentdocServiceImpl extends ServiceImpl getList(PaymentdocPagination paymentdocPagination){ - - String userId=userProvider.get().getUserId(); - List AllIdList =new ArrayList(); - int total=0; - int paymentdocNum =0; - QueryWrapper paymentdocQueryWrapper=new QueryWrapper<>(); - int paymentdocItem0Num =0; - QueryWrapper paymentdocItem0QueryWrapper=new QueryWrapper<>(); - int paymentdocItem1Num =0; - QueryWrapper paymentdocItem1QueryWrapper=new QueryWrapper<>(); - int paymentdocItem2Num =0; - QueryWrapper paymentdocItem2QueryWrapper=new QueryWrapper<>(); + public List getList(PaymentdocPagination paymentdocPagination) { + + String userId = userProvider.get().getUserId(); + List AllIdList = new ArrayList(); + int total = 0; + int paymentdocNum = 0; + QueryWrapper paymentdocQueryWrapper = new QueryWrapper<>(); + int paymentdocItem0Num = 0; + QueryWrapper paymentdocItem0QueryWrapper = new QueryWrapper<>(); + int paymentdocItem1Num = 0; + QueryWrapper paymentdocItem1QueryWrapper = new QueryWrapper<>(); + int paymentdocItem2Num = 0; + QueryWrapper paymentdocItem2QueryWrapper = new QueryWrapper<>(); boolean pcPermission = true; boolean appPermission = true; - boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); - if(isPc && pcPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object paymentdocObj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocQueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc")); - if (ObjectUtil.isEmpty(paymentdocObj)){ + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if (isPc && pcPermission) { + if (!userProvider.get().getIsAdministrator()) { + Object paymentdocObj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocQueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc")); + if (ObjectUtil.isEmpty(paymentdocObj)) { return new ArrayList<>(); } else { - paymentdocQueryWrapper = (QueryWrapper)paymentdocObj; + paymentdocQueryWrapper = (QueryWrapper) paymentdocObj; paymentdocNum++; } - Object paymentdocItem0Obj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem0QueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc_item0")); - if (ObjectUtil.isEmpty(paymentdocItem0Obj)){ + Object paymentdocItem0Obj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem0QueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc_item0")); + if (ObjectUtil.isEmpty(paymentdocItem0Obj)) { return new ArrayList<>(); } else { - paymentdocItem0QueryWrapper = (QueryWrapper)paymentdocItem0Obj; + paymentdocItem0QueryWrapper = (QueryWrapper) paymentdocItem0Obj; paymentdocItem0Num++; } - Object paymentdocItem1Obj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem1QueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc_item1")); - if (ObjectUtil.isEmpty(paymentdocItem1Obj)){ + Object paymentdocItem1Obj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem1QueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc_item1")); + if (ObjectUtil.isEmpty(paymentdocItem1Obj)) { return new ArrayList<>(); } else { - paymentdocItem1QueryWrapper = (QueryWrapper)paymentdocItem1Obj; + paymentdocItem1QueryWrapper = (QueryWrapper) paymentdocItem1Obj; paymentdocItem1Num++; } - Object paymentdocItem2Obj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem2QueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc_item2")); - if (ObjectUtil.isEmpty(paymentdocItem2Obj)){ + Object paymentdocItem2Obj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem2QueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc_item2")); + if (ObjectUtil.isEmpty(paymentdocItem2Obj)) { return new ArrayList<>(); } else { - paymentdocItem2QueryWrapper = (QueryWrapper)paymentdocItem2Obj; + paymentdocItem2QueryWrapper = (QueryWrapper) paymentdocItem2Obj; paymentdocItem2Num++; } } } - if(!isPc && appPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object paymentdocObj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocQueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc")); - if (ObjectUtil.isEmpty(paymentdocObj)){ + if (!isPc && appPermission) { + if (!userProvider.get().getIsAdministrator()) { + Object paymentdocObj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocQueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc")); + if (ObjectUtil.isEmpty(paymentdocObj)) { return new ArrayList<>(); } else { - paymentdocQueryWrapper = (QueryWrapper)paymentdocObj; + paymentdocQueryWrapper = (QueryWrapper) paymentdocObj; paymentdocNum++; } - Object paymentdocItem0Obj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem0QueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc_item0")); - if (ObjectUtil.isEmpty(paymentdocItem0Obj)){ + Object paymentdocItem0Obj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem0QueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc_item0")); + if (ObjectUtil.isEmpty(paymentdocItem0Obj)) { return new ArrayList<>(); } else { - paymentdocItem0QueryWrapper = (QueryWrapper)paymentdocItem0Obj; + paymentdocItem0QueryWrapper = (QueryWrapper) paymentdocItem0Obj; paymentdocItem0Num++; } - Object paymentdocItem1Obj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem1QueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc_item1")); - if (ObjectUtil.isEmpty(paymentdocItem1Obj)){ + Object paymentdocItem1Obj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem1QueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc_item1")); + if (ObjectUtil.isEmpty(paymentdocItem1Obj)) { return new ArrayList<>(); } else { - paymentdocItem1QueryWrapper = (QueryWrapper)paymentdocItem1Obj; + paymentdocItem1QueryWrapper = (QueryWrapper) paymentdocItem1Obj; paymentdocItem1Num++; } - Object paymentdocItem2Obj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem2QueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc_item2")); - if (ObjectUtil.isEmpty(paymentdocItem2Obj)){ + Object paymentdocItem2Obj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem2QueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc_item2")); + if (ObjectUtil.isEmpty(paymentdocItem2Obj)) { return new ArrayList<>(); } else { - paymentdocItem2QueryWrapper = (QueryWrapper)paymentdocItem2Obj; + paymentdocItem2QueryWrapper = (QueryWrapper) paymentdocItem2Obj; paymentdocItem2Num++; } } } - if(StringUtil.isNotEmpty(paymentdocPagination.getDocumentNo())){ + if (StringUtil.isNotEmpty(paymentdocPagination.getDocumentNo())) { paymentdocNum++; - paymentdocQueryWrapper.lambda().like(PaymentdocEntity::getDocumentNo,paymentdocPagination.getDocumentNo()); + paymentdocQueryWrapper.lambda().like(PaymentdocEntity::getDocumentNo, paymentdocPagination.getDocumentNo()); } - if(StringUtil.isNotEmpty(paymentdocPagination.getRamount())){ + if (StringUtil.isNotEmpty(paymentdocPagination.getRamount())) { paymentdocNum++; - paymentdocQueryWrapper.lambda().like(PaymentdocEntity::getRamount,paymentdocPagination.getRamount()); + paymentdocQueryWrapper.lambda().like(PaymentdocEntity::getRamount, paymentdocPagination.getRamount()); } - if(StringUtil.isNotEmpty(paymentdocPagination.getNum())){ + if (StringUtil.isNotEmpty(paymentdocPagination.getNum())) { paymentdocNum++; - paymentdocQueryWrapper.lambda().like(PaymentdocEntity::getNum,paymentdocPagination.getNum()); + paymentdocQueryWrapper.lambda().like(PaymentdocEntity::getNum, paymentdocPagination.getNum()); } - if(StringUtil.isNotEmpty(paymentdocPagination.getCreatorUserName())){ + if (StringUtil.isNotEmpty(paymentdocPagination.getCreatorUserName())) { paymentdocNum++; - paymentdocQueryWrapper.lambda().like(PaymentdocEntity::getCreatorUserName,paymentdocPagination.getCreatorUserName()); + paymentdocQueryWrapper.lambda().like(PaymentdocEntity::getCreatorUserName, paymentdocPagination.getCreatorUserName()); } - if(StringUtil.isNotEmpty(paymentdocPagination.getSupplierName())){ - QueryWrapper customerQueryWrapper =new QueryWrapper<>(); + if (StringUtil.isNotEmpty(paymentdocPagination.getSupplierName())) { + QueryWrapper customerQueryWrapper = new QueryWrapper<>(); customerQueryWrapper.lambda().like(SupplierEntity::getSupplierName, paymentdocPagination.getSupplierName()); customerQueryWrapper.lambda().select(SupplierEntity::getId); List customerIdList = supplierService.listObjs(customerQueryWrapper).stream().map(o -> (String) o).collect(Collectors.toList()); paymentdocNum++; - if(customerIdList.size() > 0){ - paymentdocQueryWrapper.lambda().in(PaymentdocEntity::getSupplierId,customerIdList); - }else{ + if (customerIdList.size() > 0) { + paymentdocQueryWrapper.lambda().in(PaymentdocEntity::getSupplierId, customerIdList); + } else { paymentdocQueryWrapper.lambda().eq(PaymentdocEntity::getSupplierId, paymentdocPagination.getSupplierName()); } } - if(AllIdList.size()>0){ + if (AllIdList.size() > 0) { paymentdocQueryWrapper.lambda().in(PaymentdocEntity::getId, AllIdList); } //排序 - if(StringUtil.isEmpty(paymentdocPagination.getSidx())){ + if (StringUtil.isEmpty(paymentdocPagination.getSidx())) { paymentdocQueryWrapper.lambda().orderByDesc(PaymentdocEntity::getId); - }else{ + } else { try { String sidx = paymentdocPagination.getSidx(); PaymentdocEntity paymentdocEntity = new PaymentdocEntity(); @@ -213,175 +211,180 @@ public class PaymentdocServiceImpl extends ServiceImpl0 && AllIdList.size()>0) || total==0){ - Page page=new Page<>(paymentdocPagination.getCurrentPage(), paymentdocPagination.getPageSize()); - IPage userIPage=this.page(page, paymentdocQueryWrapper); - return paymentdocPagination.setData(userIPage.getRecords(),userIPage.getTotal()); - }else{ + if ((total > 0 && AllIdList.size() > 0) || total == 0) { + Page page = new Page<>(paymentdocPagination.getCurrentPage(), paymentdocPagination.getPageSize()); + IPage userIPage = this.page(page, paymentdocQueryWrapper); + return paymentdocPagination.setData(userIPage.getRecords(), userIPage.getTotal()); + } else { List list = new ArrayList(); return paymentdocPagination.setData(list, list.size()); } } + @Override - public List getTypeList(PaymentdocPagination paymentdocPagination,String dataType){ - String userId=userProvider.get().getUserId(); - List AllIdList =new ArrayList(); - int total=0; - int paymentdocNum =0; - QueryWrapper paymentdocQueryWrapper=new QueryWrapper<>(); - int paymentdocItem0Num =0; - QueryWrapper paymentdocItem0QueryWrapper=new QueryWrapper<>(); - int paymentdocItem1Num =0; - QueryWrapper paymentdocItem1QueryWrapper=new QueryWrapper<>(); - int paymentdocItem2Num =0; - QueryWrapper paymentdocItem2QueryWrapper=new QueryWrapper<>(); + public List getTypeList(PaymentdocPagination paymentdocPagination, String dataType) { + String userId = userProvider.get().getUserId(); + List AllIdList = new ArrayList(); + int total = 0; + int paymentdocNum = 0; + QueryWrapper paymentdocQueryWrapper = new QueryWrapper<>(); + int paymentdocItem0Num = 0; + QueryWrapper paymentdocItem0QueryWrapper = new QueryWrapper<>(); + int paymentdocItem1Num = 0; + QueryWrapper paymentdocItem1QueryWrapper = new QueryWrapper<>(); + int paymentdocItem2Num = 0; + QueryWrapper paymentdocItem2QueryWrapper = new QueryWrapper<>(); boolean pcPermission = false; boolean appPermission = false; - boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); - if(isPc && pcPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object paymentdocObj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocQueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc")); - if (ObjectUtil.isEmpty(paymentdocObj)){ + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if (isPc && pcPermission) { + if (!userProvider.get().getIsAdministrator()) { + Object paymentdocObj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocQueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc")); + if (ObjectUtil.isEmpty(paymentdocObj)) { return new ArrayList<>(); } else { - paymentdocQueryWrapper = (QueryWrapper)paymentdocObj; + paymentdocQueryWrapper = (QueryWrapper) paymentdocObj; paymentdocNum++; } - Object paymentdocItem0Obj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem0QueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc_item0")); - if (ObjectUtil.isEmpty(paymentdocItem0Obj)){ + Object paymentdocItem0Obj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem0QueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc_item0")); + if (ObjectUtil.isEmpty(paymentdocItem0Obj)) { return new ArrayList<>(); } else { - paymentdocItem0QueryWrapper = (QueryWrapper)paymentdocItem0Obj; + paymentdocItem0QueryWrapper = (QueryWrapper) paymentdocItem0Obj; paymentdocItem0Num++; } - Object paymentdocItem1Obj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem1QueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc_item1")); - if (ObjectUtil.isEmpty(paymentdocItem1Obj)){ + Object paymentdocItem1Obj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem1QueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc_item1")); + if (ObjectUtil.isEmpty(paymentdocItem1Obj)) { return new ArrayList<>(); } else { - paymentdocItem1QueryWrapper = (QueryWrapper)paymentdocItem1Obj; + paymentdocItem1QueryWrapper = (QueryWrapper) paymentdocItem1Obj; paymentdocItem1Num++; } - Object paymentdocItem2Obj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem2QueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc_item2")); - if (ObjectUtil.isEmpty(paymentdocItem2Obj)){ + Object paymentdocItem2Obj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem2QueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc_item2")); + if (ObjectUtil.isEmpty(paymentdocItem2Obj)) { return new ArrayList<>(); } else { - paymentdocItem2QueryWrapper = (QueryWrapper)paymentdocItem2Obj; + paymentdocItem2QueryWrapper = (QueryWrapper) paymentdocItem2Obj; paymentdocItem2Num++; } } } - if(!isPc && appPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object paymentdocObj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocQueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc")); - if (ObjectUtil.isEmpty(paymentdocObj)){ + if (!isPc && appPermission) { + if (!userProvider.get().getIsAdministrator()) { + Object paymentdocObj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocQueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc")); + if (ObjectUtil.isEmpty(paymentdocObj)) { return new ArrayList<>(); } else { - paymentdocQueryWrapper = (QueryWrapper)paymentdocObj; + paymentdocQueryWrapper = (QueryWrapper) paymentdocObj; paymentdocNum++; } - Object paymentdocItem0Obj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem0QueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc_item0")); - if (ObjectUtil.isEmpty(paymentdocItem0Obj)){ + Object paymentdocItem0Obj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem0QueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc_item0")); + if (ObjectUtil.isEmpty(paymentdocItem0Obj)) { return new ArrayList<>(); } else { - paymentdocItem0QueryWrapper = (QueryWrapper)paymentdocItem0Obj; + paymentdocItem0QueryWrapper = (QueryWrapper) paymentdocItem0Obj; paymentdocItem0Num++; } - Object paymentdocItem1Obj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem1QueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc_item1")); - if (ObjectUtil.isEmpty(paymentdocItem1Obj)){ + Object paymentdocItem1Obj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem1QueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc_item1")); + if (ObjectUtil.isEmpty(paymentdocItem1Obj)) { return new ArrayList<>(); } else { - paymentdocItem1QueryWrapper = (QueryWrapper)paymentdocItem1Obj; + paymentdocItem1QueryWrapper = (QueryWrapper) paymentdocItem1Obj; paymentdocItem1Num++; } - Object paymentdocItem2Obj=authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem2QueryWrapper,paymentdocPagination.getMenuId(),"jg_paymentdoc_item2")); - if (ObjectUtil.isEmpty(paymentdocItem2Obj)){ + Object paymentdocItem2Obj = authorizeService.getCondition(new AuthorizeConditionModel(paymentdocItem2QueryWrapper, paymentdocPagination.getMenuId(), "jg_paymentdoc_item2")); + if (ObjectUtil.isEmpty(paymentdocItem2Obj)) { return new ArrayList<>(); } else { - paymentdocItem2QueryWrapper = (QueryWrapper)paymentdocItem2Obj; + paymentdocItem2QueryWrapper = (QueryWrapper) paymentdocItem2Obj; paymentdocItem2Num++; } } } - if(StringUtil.isNotEmpty(paymentdocPagination.getDocumentNo())){ + if (StringUtil.isNotEmpty(paymentdocPagination.getDocumentNo())) { paymentdocNum++; - paymentdocQueryWrapper.lambda().like(PaymentdocEntity::getDocumentNo,paymentdocPagination.getDocumentNo()); + paymentdocQueryWrapper.lambda().like(PaymentdocEntity::getDocumentNo, paymentdocPagination.getDocumentNo()); } - if(AllIdList.size()>0){ + if (AllIdList.size() > 0) { paymentdocQueryWrapper.lambda().in(PaymentdocEntity::getId, AllIdList); } //排序 - if(StringUtil.isEmpty(paymentdocPagination.getSidx())){ + if (StringUtil.isEmpty(paymentdocPagination.getSidx())) { paymentdocQueryWrapper.lambda().orderByDesc(PaymentdocEntity::getId); - }else{ + } else { try { String sidx = paymentdocPagination.getSidx(); PaymentdocEntity paymentdocEntity = new PaymentdocEntity(); Field declaredField = paymentdocEntity.getClass().getDeclaredField(sidx); declaredField.setAccessible(true); String value = declaredField.getAnnotation(TableField.class).value(); - paymentdocQueryWrapper="asc".equals(paymentdocPagination.getSort().toLowerCase())?paymentdocQueryWrapper.orderByAsc(value):paymentdocQueryWrapper.orderByDesc(value); + paymentdocQueryWrapper = "asc".equals(paymentdocPagination.getSort().toLowerCase()) ? paymentdocQueryWrapper.orderByAsc(value) : paymentdocQueryWrapper.orderByDesc(value); } catch (NoSuchFieldException e) { e.printStackTrace(); } } - if("0".equals(dataType)){ - if((total>0 && AllIdList.size()>0) || total==0){ - Page page=new Page<>(paymentdocPagination.getCurrentPage(), paymentdocPagination.getPageSize()); - IPage userIPage=this.page(page, paymentdocQueryWrapper); - return paymentdocPagination.setData(userIPage.getRecords(),userIPage.getTotal()); - }else{ + if ("0".equals(dataType)) { + if ((total > 0 && AllIdList.size() > 0) || total == 0) { + Page page = new Page<>(paymentdocPagination.getCurrentPage(), paymentdocPagination.getPageSize()); + IPage userIPage = this.page(page, paymentdocQueryWrapper); + return paymentdocPagination.setData(userIPage.getRecords(), userIPage.getTotal()); + } else { List list = new ArrayList(); return paymentdocPagination.setData(list, list.size()); } - }else{ + } else { return this.list(paymentdocQueryWrapper); } } @Override - public PaymentdocEntity getInfo(String id){ - QueryWrapper queryWrapper=new QueryWrapper<>(); - queryWrapper.lambda().eq(PaymentdocEntity::getId,id); + public PaymentdocEntity getInfo(String id) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(PaymentdocEntity::getId, id); return this.getOne(queryWrapper); } @Override - public void create(PaymentdocEntity entity){ + public void create(PaymentdocEntity entity) { this.save(entity); } @Override - public boolean update(String id, PaymentdocEntity entity){ + public boolean update(String id, PaymentdocEntity entity) { entity.setId(id); return this.updateById(entity); } + @Override - public void delete(PaymentdocEntity entity){ - if(entity!=null){ + public void delete(PaymentdocEntity entity) { + if (entity != null) { this.removeById(entity.getId()); } } + //子表方法 @Override - public List GetPaymentdocItem0List(String id){ + public List GetPaymentdocItem0List(String id) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(PaymentdocItem0Entity::getPaymentdocId, id); return paymentdocItem0Service.list(queryWrapper); } + @Override - public List GetPaymentdocItem1List(String id){ + public List GetPaymentdocItem1List(String id) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(PaymentdocItem1Entity::getPaymentdocId, id); return paymentdocItem1Service.list(queryWrapper); } + @Override - public List GetPaymentdocItem2List(String id){ + public List GetPaymentdocItem2List(String id) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(PaymentdocItem2Entity::getPaymentdocId, id); return paymentdocItem2Service.list(queryWrapper); @@ -399,12 +402,12 @@ public class PaymentdocServiceImpl extends ServiceImpl item2Entities = this.GetPaymentdocItem2List(id); List> paymentDocNodeInfo = paymentdocMapper.getPaymentDocNodeInfo(id); List paymentDocMessage = paymentdocMapper.getPaymentDocMessage(id); PaymentdocMessage paymentdocMessage = null; - if (paymentDocMessage!=null&&paymentDocMessage.size()>0){ + if (paymentDocMessage != null && paymentDocMessage.size() > 0) { paymentdocMessage = paymentDocMessage.get(0); } // String id1=userProvider.get().getUserId(); @@ -413,71 +416,82 @@ public class PaymentdocServiceImpl extends ServiceImpl userEntityQueryWrapper = new QueryWrapper<>(); - userEntityQueryWrapper.lambda().eq(UserEntity::getId,id1); + userEntityQueryWrapper.lambda().eq(UserEntity::getId, id1); List userEntities = userMapper.selectList(userEntityQueryWrapper); UserEntity userEntity = userEntities.get(0); paymentdocMessage.setRealName(userEntity.getRealName());//姓名 paymentdocMessage.setMobilePhone(userEntity.getMobilePhone());//手机号 paymentdocMessage.setNowTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));//时间 // 获取组织 - if(StringUtil.isNotNull(userEntity.getOrganizeId())){ + if (StringUtil.isNotNull(userEntity.getOrganizeId())) { // paymentdocMessage.setFullName(PermissionUtil.getLinkInfoByOrgId(userEntity.getOrganizeId(), organizeService, false)); - paymentdocMessage.setFullName(userRelationService.getObjectVoList(PermissionConst.ORGANIZE,userEntity).get(0).getFullName()); + paymentdocMessage.setFullName(userRelationService.getObjectVoList(PermissionConst.ORGANIZE, userEntity).get(0).getFullName()); } - log.warn("这是组织"+paymentdocMessage.getFullName()); + log.warn("这是组织" + paymentdocMessage.getFullName()); } String substring = null; String substring1 = null; - if (paymentdocMessage.getFullName()!=null){//拟稿单位不为空 + if (paymentdocMessage.getFullName() != null) {//拟稿单位不为空 String fullName = paymentdocMessage.getFullName(); - if (fullName.indexOf("/", fullName.indexOf("/")+1)!=-1){ - substring = fullName.substring(fullName.indexOf("/")+1, fullName.indexOf("/", fullName.indexOf("/")+1)); - if (fullName.length()>fullName.indexOf(substring)+2){ - substring1 = fullName.substring(fullName.indexOf(substring) + substring.length()+1, fullName.length()); + if (fullName.indexOf("/", fullName.indexOf("/") + 1) != -1) { + substring = fullName.substring(fullName.indexOf("/") + 1, fullName.indexOf("/", fullName.indexOf("/") + 1)); + if (fullName.length() > fullName.indexOf(substring) + 2) { + substring1 = fullName.substring(fullName.indexOf(substring) + substring.length() + 1, fullName.length()); } - while (substring1.contains("公司")){ - if (!substring1.contains("/")){ + while (substring1.contains("公司")) { + if (!substring1.contains("/")) { break; } - substring=substring1.substring(0,substring1.indexOf("/")); + substring = substring1.substring(0, substring1.indexOf("/")); - substring1=substring1.substring(substring1.indexOf("/")+1,substring1.length()); + substring1 = substring1.substring(substring1.indexOf("/") + 1, substring1.length()); } - while (true){ - int intNum = StringUtils.countMatches(paymentdocMessage.getFullName(), "公司"); - if (intNum>1){ - paymentdocMessage.setFullName(fullName.substring(fullName.indexOf("公司")+3,fullName.length())); - }else { - break; +// while (true){ +// int intNum = StringUtils.countMatches(paymentdocMessage.getFullName(), "公司"); +// if (intNum>1){ +// paymentdocMessage.setFullName(fullName.substring(fullName.IndexOf("公司")+3,fullName.length())); +// }else { +// break; +// } +// } + try { //pdf拟稿单位。截取后面的单位 + paymentdocMessage.setFullName(substring + "/" + substring1); //拼接后面的两个单位名称 + } catch (Exception e) { + while (true) { + int intNum = StringUtils.countMatches(paymentdocMessage.getFullName(), "公司"); + if (intNum > 1) { + paymentdocMessage.setFullName(fullName.substring(fullName.lastIndexOf("公司") + 3, fullName.length())); + } else { + break; + } } } - }else { - substring=fullName.substring(fullName.indexOf("/")+1,fullName.length()); - substring1="再生资源事业部"; + } else { + substring = fullName.substring(fullName.indexOf("/") + 1, fullName.length()); + substring1 = "再生资源事业部"; } } - StringBuilder payEnclosureStr = new StringBuilder(); - if (paymentdocMessage.getEnclosure()!=null){//附件不为空 + if (paymentdocMessage.getEnclosure() != null) {//附件不为空 String enclosure = paymentdocMessage.getEnclosure(); JSONArray jsonToJsonArray = JsonUtil.getJsonToJsonArray(enclosure); for (int i = 0; i < jsonToJsonArray.size(); i++) { - Map o = (Map)jsonToJsonArray.get(i); + Map o = (Map) jsonToJsonArray.get(i); Object name = o.get("name"); - if (i==0){ + if (i == 0) { payEnclosureStr.append(name); - }else { - payEnclosureStr.append("
"+name); + } else { + payEnclosureStr.append("
" + name); } } @@ -487,8 +501,8 @@ public class PaymentdocServiceImpl extends ServiceImpl map = JsonUtil.stringToMap(JSONUtil.toJsonStr(paymentDocMessage)); - map.put("substring",substring); - map.put("substring1",substring1); + map.put("substring", substring); + map.put("substring1", substring1); // map.put("reportList",paymentDocNodeInfo); FlowBeforeController bean = SpringContext.getBean(FlowBeforeController.class); ActionResult info = null; @@ -497,39 +511,39 @@ public class PaymentdocServiceImpl extends ServiceImpl recordList = data.getFlowTaskOperatorRecordList(); List> maps = new ArrayList<>(); for (int i = 0; i < recordList.size(); i++) { Map map1 = new HashMap(); FlowTaskOperatorRecordModel model = recordList.get(i); Map map2 = paymentDocNodeInfo.get(i); - map1.put("realName",model.getUserName()); - map1.put("nodeName",model.getNodeName()); - map1.put("handleOpinion",model.getHandleOpinion()); - map1.put("handleTime",DateUtil.daFormat(model.getHandleTime())); - map1.put("node",map2.get("node")); + map1.put("realName", model.getUserName()); + map1.put("nodeName", model.getNodeName()); + map1.put("handleOpinion", model.getHandleOpinion()); + map1.put("handleTime", DateUtil.daFormat(model.getHandleTime())); + map1.put("node", map2.get("node")); maps.add(map1); } ArrayList> maps1 = new ArrayList>(); - int num=6; + int num = 6; - if (maps.size()>num){ + if (maps.size() > num) { for (int i = 0; i < maps.size(); i++) { Map map1 = maps.get(i); - if (i>=num){ + if (i >= num) { maps1.add(map1); } } - while (maps.size()>num){ + while (maps.size() > num) { maps.remove(num); } } - map.put("reportList",maps); - map.put("reportList1",maps1); + map.put("reportList", maps); + map.put("reportList1", maps1); byte[] bytes = null; - ByteArrayOutputStream out = null; + ByteArrayOutputStream out = null; ExportPdf exportPdf = new ExportPdf(); // word模板 try { @@ -539,10 +553,10 @@ public class PaymentdocServiceImpl extends ServiceImpl~`$^+=|<>¥;::;. ]", "")); vehicleService.save(entity); return ActionResult.success("创建成功"); diff --git a/SC-boot/linkage-scm/src/main/resources/mapper/purchaseorder/PurchaseorderMapper.xml b/SC-boot/linkage-scm/src/main/resources/mapper/purchaseorder/PurchaseorderMapper.xml index ea2f0127..c15b3e29 100644 --- a/SC-boot/linkage-scm/src/main/resources/mapper/purchaseorder/PurchaseorderMapper.xml +++ b/SC-boot/linkage-scm/src/main/resources/mapper/purchaseorder/PurchaseorderMapper.xml @@ -192,15 +192,15 @@ FROM jg_purchaseorder AS a LEFT JOIN jg_purchaseorder_item0 d ON a.id = d.purchaseorder_id - AND d.delete_mark = '0' + LEFT JOIN jg_poundlist b ON b.id = d.poundlist_id - AND b.delete_mark = '0' + LEFT JOIN jg_material c ON b.material_id = c.id - AND c.delete_mark = '0' + LEFT JOIN jg_contract e ON a.contract_code = e.id - AND e.delete_mark = '0' + WHERE - a.delete_mark = '0' + a.delete_mark = '0' AND d.delete_mark = '0' AND b.delete_mark = '0' AND c.delete_mark = '0' AND e.delete_mark = '0' GROUP BY a.id, b.material_id, @@ -229,15 +229,15 @@ FROM jg_purchaseorder AS a LEFT JOIN jg_purchaseorder_item0 d ON a.id = d.purchaseorder_id - AND d.delete_mark = '0' + LEFT JOIN jg_poundlist b ON b.id = d.poundlist_id - AND b.delete_mark = '0' + LEFT JOIN jg_material c ON b.material_id = c.id - AND c.delete_mark = '0' + LEFT JOIN jg_contract e ON a.contract_code = e.id - AND e.delete_mark = '0' + WHERE - a.delete_mark = '0' + a.delete_mark = '0' AND d.delete_mark = '0' AND b.delete_mark = '0' AND c.delete_mark = '0' AND e.delete_mark = '0' GROUP BY a.id, a.rate,