From 2fcae8d05fb2fc86112d41e6886a88237bdb9445 Mon Sep 17 00:00:00 2001 From: 1178634255 <1178634255@qq.com> Date: Tue, 4 Jul 2023 10:56:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchase/SupCertController.java | 5 ++++- .../purchase/SupManufacturerController.java | 20 ++++++++++++++++--- .../glxp/api/dao/purchase/SupCompanyDao.java | 3 ++- .../service/purchase/SupCompanyService.java | 15 +++++++++++++- .../purchase/impl/SupCompanyServiceImpl.java | 11 ++++++++++ .../mybatis/mapper/purchase/SupCompanyDao.xml | 9 +++++++++ .../mybatis/mapper/sup/UserCertMapper.xml | 2 +- 7 files changed, 58 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/purchase/SupCertController.java b/src/main/java/com/glxp/api/controller/purchase/SupCertController.java index 9a1cb40..6e74f50 100644 --- a/src/main/java/com/glxp/api/controller/purchase/SupCertController.java +++ b/src/main/java/com/glxp/api/controller/purchase/SupCertController.java @@ -16,6 +16,7 @@ import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.purchase.*; import com.glxp.api.entity.sup.UserCertEntity; import com.glxp.api.entity.sup.UserCertSetEntity; +import com.glxp.api.entity.sup.UserCompanyEntity; import com.glxp.api.entity.system.SysPdfTemplateRelevanceStatemenEntity; import com.glxp.api.entity.system.SystemPDFTemplateEntity; import com.glxp.api.exception.JsonException; @@ -189,9 +190,11 @@ public class SupCertController { @PostMapping("/directToCpt/sup/info/selectAllCert") @Log(title = "资质证书", businessType = BusinessType.INSERT) public BaseResponse selectAllCert(@RequestBody PostSelCertRequest postSelCertRequest) { + String customerId = null; + if (StrUtil.isEmpty(postSelCertRequest.getCustomerId())) - customerId = getCustomerId(); + customerId = getCompanyId(); else { customerId = postSelCertRequest.getCustomerId(); } diff --git a/src/main/java/com/glxp/api/controller/purchase/SupManufacturerController.java b/src/main/java/com/glxp/api/controller/purchase/SupManufacturerController.java index f4e4f29..882d97c 100644 --- a/src/main/java/com/glxp/api/controller/purchase/SupManufacturerController.java +++ b/src/main/java/com/glxp/api/controller/purchase/SupManufacturerController.java @@ -17,6 +17,7 @@ import com.glxp.api.entity.purchase.SupCertEntity; import com.glxp.api.entity.purchase.SupCertSetEntity; import com.glxp.api.entity.purchase.SupCompanyEntity; import com.glxp.api.entity.purchase.SupManufacturerEntity; +import com.glxp.api.entity.sup.UserCompanyEntity; import com.glxp.api.exception.JsonException; import com.glxp.api.req.basic.FilterUdiRelRequest; import com.glxp.api.req.purchase.FilterCertSetsRequest; @@ -236,6 +237,7 @@ public class SupManufacturerController { public BaseResponse directToCptAddCompany(@RequestBody SupManufacturerEntity supManufacturerEntity) { String customerId = getCustomerId(); +// String customerId = getCustomerId(); supManufacturerEntity.setCustomerId(customerId); //判断用户名和社会信用代码不能重复 FilterSupManufacturerRequest filterSupManufacturerRequest = new FilterSupManufacturerRequest(); @@ -256,6 +258,8 @@ public class SupManufacturerController { if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_CHANGE || supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN) { //判断是否上级供应商是否审核通过 SupCompanyEntity supCompanyEntity = supCompanyService.findCompany(supManufacturerEntity.getCustomerId()); + System.out.println(supCompanyEntity.toString()); + System.out.println(supCompanyEntity.getAuditStatus()+"zhi"); if (supCompanyEntity.getAuditStatus() == null || supCompanyEntity.getAuditStatus() != ConstantStatus.AUDIT_PASS ) { return ResultVOUtils.error(500, "所属配送企业资质未通过审核,暂时无法提交!"); @@ -643,15 +647,24 @@ public class SupManufacturerController { } +// public String getCustomerId() { +// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); +// if (attributes == null) { +// throw new JsonException(ResultEnum.NOT_NETWORK); +// } +// HttpServletRequest request = attributes.getRequest(); +// String userId = request.getHeader("ADMIN_ID"); +// AuthAdmin authAdmin = authAdminService.findById(Long.parseLong(userId)); +// return authAdmin.getCustomerId() + ""; +// } public String getCustomerId() { ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); if (attributes == null) { throw new JsonException(ResultEnum.NOT_NETWORK); } HttpServletRequest request = attributes.getRequest(); - String userId = request.getHeader("ADMIN_ID"); - AuthAdmin authAdmin = authAdminService.findById(Long.parseLong(userId)); - return authAdmin.getCustomerId() + ""; + String companyId = request.getHeader("companyId"); + return companyId; } public String getCompanyId() { @@ -663,4 +676,5 @@ public class SupManufacturerController { String companyId = request.getHeader("companyId"); return companyId; } + } diff --git a/src/main/java/com/glxp/api/dao/purchase/SupCompanyDao.java b/src/main/java/com/glxp/api/dao/purchase/SupCompanyDao.java index 3ae496a..a5ae0a1 100644 --- a/src/main/java/com/glxp/api/dao/purchase/SupCompanyDao.java +++ b/src/main/java/com/glxp/api/dao/purchase/SupCompanyDao.java @@ -2,6 +2,7 @@ package com.glxp.api.dao.purchase; import com.glxp.api.dao.BaseMapperPlus; +import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.purchase.SupCertEntity; import com.glxp.api.entity.purchase.SupCompanyEntity; import com.glxp.api.entity.sup.UserCompanyEntity; @@ -26,7 +27,7 @@ public interface SupCompanyDao extends BaseMapperPlus filterCompany(FilterSupCompanyRequest companyRequest); List filterUserCompany(FilterUserCompanyRequest companyRequest); - + UserCompanyEntity findById(Long id); boolean modifyCompany(SupCompanyEntity companyEntity); boolean insertCompany(SupCompanyEntity companyEntity); diff --git a/src/main/java/com/glxp/api/service/purchase/SupCompanyService.java b/src/main/java/com/glxp/api/service/purchase/SupCompanyService.java index cca04f4..7111c60 100644 --- a/src/main/java/com/glxp/api/service/purchase/SupCompanyService.java +++ b/src/main/java/com/glxp/api/service/purchase/SupCompanyService.java @@ -3,6 +3,7 @@ package com.glxp.api.service.purchase; import com.baomidou.mybatisplus.extension.service.IService; +import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.purchase.SupCompanyEntity; import com.glxp.api.entity.sup.UserCompanyEntity; import com.glxp.api.req.purchase.FilterSupCompanyRequest; @@ -11,9 +12,21 @@ import com.glxp.api.req.purchase.FilterUserCompanyRequest; import java.util.List; public interface SupCompanyService extends IService { - + UserCompanyEntity findByid(Long id); // SupCompanyEntity findCompanyByUnitFk(String unitFk); + // @Override +// public SupCompanyEntity findCompanyByUnitFk(String unitFk) { +// FilterSupCompanyRequest filterSupCompanyRequest = new FilterSupCompanyRequest(); +// filterSupCompanyRequest.setUnitIdFk(unitFk); +// List companyEntities = supCompanyDao.filterCompany(filterSupCompanyRequest); +// if (companyEntities != null && companyEntities.size() > 0) { +// return companyEntities.get(0); +// } +// return null; +// } + + List filterUserCompany(FilterUserCompanyRequest companyRequest); List filterCompany(FilterSupCompanyRequest companyRequest); diff --git a/src/main/java/com/glxp/api/service/purchase/impl/SupCompanyServiceImpl.java b/src/main/java/com/glxp/api/service/purchase/impl/SupCompanyServiceImpl.java index 559e334..a4c7167 100644 --- a/src/main/java/com/glxp/api/service/purchase/impl/SupCompanyServiceImpl.java +++ b/src/main/java/com/glxp/api/service/purchase/impl/SupCompanyServiceImpl.java @@ -22,6 +22,15 @@ public class SupCompanyServiceImpl extends ServiceImpl filterUserCompany(FilterUserCompanyRequest companyRequest) { if (companyRequest == null) { diff --git a/src/main/resources/mybatis/mapper/purchase/SupCompanyDao.xml b/src/main/resources/mybatis/mapper/purchase/SupCompanyDao.xml index 4cd0595..5d1146c 100644 --- a/src/main/resources/mybatis/mapper/purchase/SupCompanyDao.xml +++ b/src/main/resources/mybatis/mapper/purchase/SupCompanyDao.xml @@ -57,6 +57,15 @@ + +