From e8cabaa1e2933ad28cd948f1367e1cdc5a0463f6 Mon Sep 17 00:00:00 2001 From: bawei <95887577@qq.com> Date: Thu, 8 Jun 2023 16:07:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=B8=AD=E7=9A=84=E5=90=88?= =?UTF-8?q?=E5=90=8C=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ContractMobileController.java | 15 +++ .../mapper/ContractMobileMapper.java | 6 + .../ContractMobilePagination.java | 2 + .../service/ContractMobileService.java | 2 + .../impl/ContractMobileServiceImpl.java | 104 ++++++++++++++++++ .../contractMobile/ContractMobileMapper.xml | 74 +++++++++++++ .../admin/components/ContractList.vue | 4 +- 7 files changed, 205 insertions(+), 2 deletions(-) diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/controller/ContractMobileController.java b/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/controller/ContractMobileController.java index 2fb25e73..d5f629d4 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/controller/ContractMobileController.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/controller/ContractMobileController.java @@ -97,4 +97,19 @@ public class ContractMobileController { return ActionResult.success(vo); } + + + + @PostMapping("/getContractList") + @ApiOperation("首页进行中的合同") + public ActionResult getContractList(@RequestBody ContractMobilePagination contractMobilePagination) throws IOException { + + List list = contractMobileService.getContract(contractMobilePagination); +// List listVO = JsonUtil.getJsonToList(list, ContractMobileListVO.class); + PageListVO vo = new PageListVO(); + vo.setList(list); + PaginationVO page = JsonUtil.getJsonToBean(contractMobilePagination, PaginationVO.class); + vo.setPagination(page); + return ActionResult.success(vo); + } } diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/mapper/ContractMobileMapper.java b/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/mapper/ContractMobileMapper.java index 810592ab..f7c729e5 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/mapper/ContractMobileMapper.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/mapper/ContractMobileMapper.java @@ -2,10 +2,13 @@ package jnpf.contractMobile.mapper; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import jnpf.contractMobile.entity.ContractMobileEntity; import jnpf.contractMobile.model.contractMobile.*; +import jnpf.contractfile.entity.ContractFileEntity; import jnpf.purchaseback.entity.PurchaseorderEntity; import jnpf.saleorder.entity.SaleorderitemEntity; import org.apache.ibatis.annotations.Param; @@ -29,4 +32,7 @@ public interface ContractMobileMapper extends BaseMapper { @Param("ew") LambdaQueryWrapper queryWrapper); List getContractDetailDataList1Material(@Param("ew") LambdaQueryWrapper queryWrapper); + + //进行中的合同 + IPage getContractlist(Page page, ContractMobilePagination contractMobilePagination, QueryWrapper contractMobileQueryWrapper); } diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/model/contractMobile/ContractMobilePagination.java b/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/model/contractMobile/ContractMobilePagination.java index 9f8c1632..3560997b 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/model/contractMobile/ContractMobilePagination.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/model/contractMobile/ContractMobilePagination.java @@ -21,4 +21,6 @@ public class ContractMobilePagination extends Pagination { private Boolean nonZero; + private String departmentId; + } diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/service/ContractMobileService.java b/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/service/ContractMobileService.java index d294d586..a017d7ac 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/service/ContractMobileService.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/service/ContractMobileService.java @@ -26,4 +26,6 @@ public interface ContractMobileService extends IService { MobileContractDetailsVO getMobileListData(String id); List getListMessage(String id); + + List getContract(ContractMobilePagination contractMobilePagination); } diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/service/impl/ContractMobileServiceImpl.java b/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/service/impl/ContractMobileServiceImpl.java index b25036f1..f44cb474 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/service/impl/ContractMobileServiceImpl.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/contractMobile/service/impl/ContractMobileServiceImpl.java @@ -1,5 +1,6 @@ package jnpf.contractMobile.service.impl; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -14,6 +15,11 @@ import jnpf.contractMobile.model.contractMobile.*; import jnpf.contractMobile.service.ContractItem0MobileService; import jnpf.contractMobile.service.ContractItem1MobileService; import jnpf.contractMobile.service.ContractMobileService; +import jnpf.contractfile.entity.ContractFileEntity; +import jnpf.contractfile.entity.Contract_item0Entity; +import jnpf.contractfile.entity.Contract_item1Entity; +import jnpf.permission.model.authorize.AuthorizeConditionModel; +import jnpf.permission.service.AuthorizeService; import jnpf.purchaseback.entity.PurchaseorderEntity; import jnpf.saleorder.entity.SaleorderitemEntity; import jnpf.util.ServletUtil; @@ -32,6 +38,8 @@ public class ContractMobileServiceImpl extends ServiceImpl userIPage = this.page(page, contractMobileQueryWrapper); return userIPage.getRecords(); } + + + @Override + public List getContract(ContractMobilePagination contractMobilePagination) { + + String userId = userProvider.get().getUserId(); + List AllIdList = new ArrayList(); + int total = 0; + int contractMNum = 0; + QueryWrapper contractMobileQueryWrapper = new QueryWrapper<>(); + boolean pcPermission = true; + boolean appPermission = true; + boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); + if (isPc && pcPermission) { + if (!userProvider.get().getIsAdministrator()) { + Object contractFileObj = authorizeService.getCondition(new AuthorizeConditionModel(contractMobileQueryWrapper, contractMobilePagination.getMenuId(), "jg_contract")); + if (ObjectUtil.isEmpty(contractFileObj)) { +// return new ArrayList<>(); + } else { + contractMobileQueryWrapper = (QueryWrapper) contractFileObj; + contractMNum++; + } + + + } + } + if (!isPc && appPermission) { + if (!userProvider.get().getIsAdministrator()) { + return new ArrayList<>(); + } + } + if (StringUtil.isNotEmpty(contractMobilePagination.getContractCode())) { + contractMNum++; + contractMobileQueryWrapper.lambda().like(ContractMobileEntity::getContractCode, contractMobilePagination.getContractCode()); + } + if (StringUtil.isNotEmpty(contractMobilePagination.getContractName())) { + contractMNum++; + contractMobileQueryWrapper.lambda().like(ContractMobileEntity::getContractName, contractMobilePagination.getContractName()); + } + if (StringUtil.isNotEmpty(contractMobilePagination.getSupperName())) { + contractMNum++; + contractMobileQueryWrapper.lambda().like(ContractMobileEntity::getName, contractMobilePagination.getSupperName()); + } + if (StringUtil.isNotEmpty(contractMobilePagination.getName())) { + contractMNum++; + contractMobileQueryWrapper.lambda().like(ContractMobileEntity::getName, contractMobilePagination.getName()); + } + Boolean nonZero = contractMobilePagination.getNonZero(); + if (nonZero!=null&&nonZero) { + contractMNum++; + contractMobileQueryWrapper.ne("SCHEDULE","0.00"); + } + + if(AllIdList.size()>0){ + contractMobileQueryWrapper.lambda().in(ContractMobileEntity::getId, AllIdList); + } + //排序 + if(StringUtil.isEmpty(contractMobilePagination.getSidx())){ + contractMobileQueryWrapper.lambda().orderByDesc(ContractMobileEntity::getCreatorTime); + }else{ + try { + String sidx = contractMobilePagination.getSidx(); + MobileContractDetailsVO mobileContractDetailsVO = new MobileContractDetailsVO(); + Field declaredField = mobileContractDetailsVO.getClass().getDeclaredField(sidx); + declaredField.setAccessible(true); + String value = declaredField.getAnnotation(TableField.class).value(); + contractMobilePagination.setSidx(value); +// contractMobileQueryWrapper="asc".equals(contractMobilePagination.getSort().toLowerCase())?contractMobileQueryWrapper.orderByAsc(value):contractMobileQueryWrapper.orderByDesc(value); + } catch (Exception e) { + e.printStackTrace(); + } + } + Page page = new Page<>(contractMobilePagination.getCurrentPage(), contractMobilePagination.getPageSize()); + String detpartment=null; + if (!userProvider.get().getIsAdministrator()) { + detpartment = userProvider.getDepartmentId(userId); + } + if (StringUtil.isNotNull(detpartment)) { + contractMobilePagination.setDepartmentId(detpartment); + } + IPage userIPage = contractMobileMapper.getContractlist(page,contractMobilePagination, contractMobileQueryWrapper); + return contractMobilePagination.setData(userIPage.getRecords(), userIPage.getTotal()); + } + +// if ((total > 0 && AllIdList.size() > 0) || total == 0) { +// Page page = new Page<>(contractMobilePagination.getCurrentPage(), contractMobilePagination.getPageSize()); +// IPage userIPage = contractMobileMapper.getContractDetailData(page, contractMobileQueryWrapper); +//// IPage userIPage = this.page(page, contractMobileQueryWrapper); +// List records = userIPage.getRecords(); +// +// return contractMobilePagination.setData(records, userIPage.getTotal()); +// } else { +// List list = new ArrayList(); +// return contractMobilePagination.setData(list, list.size()); +// } + } diff --git a/SC-boot/linkage-scm/src/main/resources/mapper/contractMobile/ContractMobileMapper.xml b/SC-boot/linkage-scm/src/main/resources/mapper/contractMobile/ContractMobileMapper.xml index 2ebc164b..acfd14eb 100644 --- a/SC-boot/linkage-scm/src/main/resources/mapper/contractMobile/ContractMobileMapper.xml +++ b/SC-boot/linkage-scm/src/main/resources/mapper/contractMobile/ContractMobileMapper.xml @@ -903,4 +903,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SC-web/src/views/dashboard/admin/components/ContractList.vue b/SC-web/src/views/dashboard/admin/components/ContractList.vue index 9346b836..70dab395 100644 --- a/SC-web/src/views/dashboard/admin/components/ContractList.vue +++ b/SC-web/src/views/dashboard/admin/components/ContractList.vue @@ -52,7 +52,7 @@ export default { methods: { getContractList: function () { request({ - url: "/api/contractMobile/ContractMobile/getMobileList", + url: "/api/contractMobile/ContractMobile/getContractList", method: "post", data: { currentPage: this.currentPage, @@ -183,4 +183,4 @@ export default { } } } - \ No newline at end of file +