From aa4fcfea24dcf3c7d09451c8f2a2c4465ec469b0 Mon Sep 17 00:00:00 2001 From: schry <2433098676@qq.com> Date: Fri, 30 Jun 2023 15:26:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E8=B4=A8=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchase/SupProductController.java | 102 ++++++++++++++++++ .../api/entity/purchase/SupCertEntity.java | 2 + .../mybatis/mapper/basic/UdiRelevanceDao.xml | 2 +- .../mapper/purchase/SupManufacturerDao.xml | 4 +- 4 files changed, 107 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/purchase/SupProductController.java b/src/main/java/com/glxp/api/controller/purchase/SupProductController.java index 507b569..873a662 100644 --- a/src/main/java/com/glxp/api/controller/purchase/SupProductController.java +++ b/src/main/java/com/glxp/api/controller/purchase/SupProductController.java @@ -159,6 +159,70 @@ public class SupProductController { } } + @AuthRuleAnnotation("") + @PostMapping("/directToCpt/sup/product/addRegistration") + @Log(title = "资质证书", businessType = BusinessType.INSERT) + public BaseResponse directToCptAddRegistration(@RequestBody SupProductEntity supProductEntity) { + + //提交审核 + if (supProductEntity.getAuditStatus() == ConstantStatus.AUDIT_UN) { + //判断是否上级供应商是否审核通过 + + SupManufacturerEntity supManufacturerEntity = supManufacturerService.findManufacturer(supProductEntity.getManufacturerIdFk()); + if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN + || supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_DRAFT) { + return ResultVOUtils.error(500, "所属生产企业资质未通过审核,暂时无法提交!"); + } + + //验证证书是否齐全 + FilterCertSetsRequest filterCertSetsRequest = new FilterCertSetsRequest(); + filterCertSetsRequest.setType(ConstantStatus.CERT_PRODUCT); + filterCertSetsRequest.setNeed(0); + List<SupCertSetEntity> supCertSetEntities = supCertSetService.filterCertSets(filterCertSetsRequest); + List<SupCertEntity> supCertEntityList = supCertService.findAll(supProductEntity.getCustomerId(), supProductEntity.getManufacturerIdFk(), supProductEntity.getProductId()); + ListIterator<SupCertSetEntity> iterable = supCertSetEntities.listIterator(); + while (iterable.hasNext()) { + SupCertSetEntity supCertSetEntity = iterable.next(); + if (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 1 || StrUtil.isNotEmpty(supCertSetEntity.getCplx()) && supCertSetEntity.getCplx().equals("全部") + || StrUtil.isNotEmpty(supCertSetEntity.getHchzsb()) && supCertSetEntity.getHchzsb().equals("全部") + || (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 2 + && StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进")) + || (supCertSetEntity.getImports() != null && supCertSetEntity.getImports() == 3 && !StrUtil.trimToEmpty(supProductEntity.getRecordCode()).contains("进")) + || (StrUtil.trimToEmpty(supProductEntity.getProductType()).equals(supCertSetEntity.getCplx())) + || (StrUtil.trimToEmpty(supProductEntity.getHchzsb()).equals(supCertSetEntity.getHchzsb())) + || StrUtil.isNotEmpty(supCertSetEntity.getFlbm()) && (supCertSetEntity.getFlbm().contains(StrUtil.trimToEmpty(supProductEntity.getProductDirectoryCode()))) + ) { + for (SupCertEntity supCertEntity : supCertEntityList) { + if (supCertEntity.getName().equals(supCertSetEntity.getName())) { + if (StrUtil.isNotEmpty(supCertEntity.getFilePath())) { + iterable.remove(); + break; + } + } + } + } else { + iterable.remove(); + } + } + String errMsg = ""; + if (supCertSetEntities.size() > 0) { + for (SupCertSetEntity supCertSetEntity : supCertSetEntities) { + errMsg = errMsg + "," + supCertSetEntity.getName(); + } + return ResultVOUtils.error(500, errMsg.substring(1) + "等证书未上传,无法提交审核!"); + } + } + supProductEntity.setCreateTime(new Date()); + supProductEntity.setUpdateTime(new Date()); + supProductEntity.setId(IdUtil.getSnowflakeNextId()); + boolean b = supProductService.insertRegistration(supProductEntity); + if (b) { + return ResultVOUtils.success("添加成功"); + } else { + return ResultVOUtils.error(ResultEnum.NOT_NETWORK); + } + } + @AuthRuleAnnotation("") @PostMapping("/sup/product/selectBind") @@ -198,6 +262,44 @@ public class SupProductController { // } } + @AuthRuleAnnotation("") + @PostMapping("/directToCpt/sup/product/selectBind") + public BaseResponse directToCptSelectBind(@RequestBody SelectProductBindRequest selectProductBindRequest) { + + UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectUdiId(Long.valueOf(selectProductBindRequest.getRelIdFk())); + SupProductEntity supProductEntity = supProductService.findByManufactury(udiRelevanceResponse.getCpmctymc(), udiRelevanceResponse.getManufactory(),selectProductBindRequest.getManufacturerId()); + if (supProductEntity != null) { + return ResultVOUtils.error(500, "该产品资质已存在,请勿重复添加!"); + }else{ + supProductEntity = new SupProductEntity(); + BeanUtils.copyProperties(udiRelevanceResponse, supProductEntity); + supProductEntity.setProductId(selectProductBindRequest.getProductId()); + supProductEntity.setRecordCode(udiRelevanceResponse.getZczbhhzbapzbh()); + supProductEntity.setRelIdFk(udiRelevanceResponse.getId() + ""); + supProductEntity.setRecordProductName(udiRelevanceResponse.getCpmctymc()); + supProductEntity.setProductType(udiRelevanceResponse.getQxlb()); + supProductEntity.setProductDirectoryCode(udiRelevanceResponse.getFlbm()); + supProductEntity.setRecordPeopleName(udiRelevanceResponse.getYlqxzcrbarmc()); + supProductEntity.setSpecification(udiRelevanceResponse.getGgxh()); + supProductEntity.setCreateTime(new Date()); + supProductEntity.setUpdateTime(new Date()); + supProductEntity.setManufacturerIdFk(selectProductBindRequest.getManufacturerId()); + supProductEntity.setCustomerId(selectProductBindRequest.getCustomerId()); + supProductEntity.setHchzsb(udiRelevanceResponse.getCplb()); + supProductEntity.setCompanyName(selectProductBindRequest.getCompanyName()); + supProductEntity.setAuditStatus(selectProductBindRequest.getAuditStatus()); + } + + + return ResultVOUtils.success(supProductEntity); +// boolean b = supProductService.insertRegistration(supProductEntity); +// if (b) { +// return ResultVOUtils.success(supProductEntity); +// } else { +// return ResultVOUtils.error(ResultEnum.NOT_NETWORK); +// } + } + @AuthRuleAnnotation("") @PostMapping("/directToCpt/sup/product/modifyRegistration") diff --git a/src/main/java/com/glxp/api/entity/purchase/SupCertEntity.java b/src/main/java/com/glxp/api/entity/purchase/SupCertEntity.java index a2d4e70..d8f0c17 100644 --- a/src/main/java/com/glxp/api/entity/purchase/SupCertEntity.java +++ b/src/main/java/com/glxp/api/entity/purchase/SupCertEntity.java @@ -114,6 +114,7 @@ public class SupCertEntity { * 创建时间 */ @TableField("createTime") + @JsonFormat(pattern = "yyyy-MM-dd") private Date createTime; /** @@ -126,6 +127,7 @@ public class SupCertEntity { * 更新时间 */ @TableField("updateTime") + @JsonFormat(pattern = "yyyy-MM-dd") private Date updateTime; } diff --git a/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml b/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml index fb988c1..07a483b 100644 --- a/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml +++ b/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml @@ -509,7 +509,7 @@ basic_products.sfwblztlcp, basic_products.cgzmraqxgxx, basic_products.sfbjwycxsy, - basic_products.zdcfsycs, + basic_products.sfwwjbz, basic_products.syqsfxyjxmj, basic_products.mjfs, diff --git a/src/main/resources/mybatis/mapper/purchase/SupManufacturerDao.xml b/src/main/resources/mybatis/mapper/purchase/SupManufacturerDao.xml index 1d7178c..f17884f 100644 --- a/src/main/resources/mybatis/mapper/purchase/SupManufacturerDao.xml +++ b/src/main/resources/mybatis/mapper/purchase/SupManufacturerDao.xml @@ -19,13 +19,13 @@ <select id="getCompany" parameterType="com.glxp.api.req.purchase.FilterSupManufacturerRequest" resultType="com.glxp.api.entity.purchase.SupManufacturerEntity"> - SELECT sup_manufacturer.* ,sup_company.companyName as supName + SELECT sup_manufacturer.* ,user_company.companyName as supName <if test="productStatus!=null"> ,(SELECT count(*) FROM sup_product WHERE sup_manufacturer.customerId=sup_product.customerId AND sup_product.auditStatus!=0 AND sup_product.auditStatus!=1 AND sup_product.auditStatus!=4 AND sup_manufacturer.manufacturerId=sup_product.manufacturerIdFk ) as failCout, (SELECT count(*) FROM sup_product WHERE sup_manufacturer.customerId=sup_product.customerId AND (sup_product.auditStatus=1 OR sup_product.auditStatus=4) AND sup_manufacturer.manufacturerId=sup_product.manufacturerIdFk ) as passCout </if> FROM sup_manufacturer - inner join sup_company on sup_manufacturer.customerId = sup_company.customerId + inner join user_company on sup_manufacturer.customerId = user_company.customerId <where> <if test="id != null and id != '' and type==null"> and id = #{id}