|  |  |  | @ -186,6 +186,104 @@ public class SupManufacturerController { | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @AuthRuleAnnotation("") | 
			
		
	
		
			
				
					|  |  |  |  |     @PostMapping("/directToCpt/sup/manufacturer/addCompany") | 
			
		
	
		
			
				
					|  |  |  |  |     @Log(title = "资质证书", businessType = BusinessType.INSERT) | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse directToCptAddCompany(@RequestBody SupManufacturerEntity supManufacturerEntity) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         //String customerId = getCustomerId();
 | 
			
		
	
		
			
				
					|  |  |  |  |         //supManufacturerEntity.setCustomerId(customerId);
 | 
			
		
	
		
			
				
					|  |  |  |  |         //判断用户名和社会信用代码不能重复
 | 
			
		
	
		
			
				
					|  |  |  |  |         FilterSupManufacturerRequest filterSupManufacturerRequest = new FilterSupManufacturerRequest(); | 
			
		
	
		
			
				
					|  |  |  |  |         filterSupManufacturerRequest.setCompanyName(supManufacturerEntity.getCompanyName()); | 
			
		
	
		
			
				
					|  |  |  |  |         filterSupManufacturerRequest.setCustomerId(getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |  |         List<SupManufacturerEntity> companyEntities = supManufacturerService.getCompanyByNameAndCode(filterSupManufacturerRequest); | 
			
		
	
		
			
				
					|  |  |  |  |         if (companyEntities.size() > 0) { | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(999, "企业名称不能重复!"); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         filterSupManufacturerRequest = new FilterSupManufacturerRequest(); | 
			
		
	
		
			
				
					|  |  |  |  |         filterSupManufacturerRequest.setCustomerId(getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |  |         filterSupManufacturerRequest.setCreditCode(supManufacturerEntity.getCreditCode()); | 
			
		
	
		
			
				
					|  |  |  |  |         companyEntities = supManufacturerService.getCompanyByNameAndCode(filterSupManufacturerRequest); | 
			
		
	
		
			
				
					|  |  |  |  |         if (companyEntities.size() > 0) { | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(999, "统一社会信用代码不能重复!"); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         //提交审核
 | 
			
		
	
		
			
				
					|  |  |  |  |         if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_CHANGE || supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN) { | 
			
		
	
		
			
				
					|  |  |  |  |             //判断是否上级供应商是否审核通过
 | 
			
		
	
		
			
				
					|  |  |  |  |             SupCompanyEntity supCompanyEntity = supCompanyService.findCompany(supManufacturerEntity.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |  |             if (supCompanyEntity.getAuditStatus() == null || supCompanyEntity.getAuditStatus() != ConstantStatus.AUDIT_PASS | 
			
		
	
		
			
				
					|  |  |  |  |             ) { | 
			
		
	
		
			
				
					|  |  |  |  |                 return ResultVOUtils.error(500, "所属配送企业资质未通过审核,暂时无法提交!"); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             //验证证书是否齐全
 | 
			
		
	
		
			
				
					|  |  |  |  |             FilterCertSetsRequest filterCertSetsRequest = new FilterCertSetsRequest(); | 
			
		
	
		
			
				
					|  |  |  |  |             filterCertSetsRequest.setType(ConstantStatus.CERT_MANUFACTURER); | 
			
		
	
		
			
				
					|  |  |  |  |             filterCertSetsRequest.setNeed(0); | 
			
		
	
		
			
				
					|  |  |  |  |             List<SupCertSetEntity> supCertSetEntities = supCertSetService.filterCertSets(filterCertSetsRequest); | 
			
		
	
		
			
				
					|  |  |  |  |             List<SupCertEntity> supCertEntityList = supCertService.findAll(supManufacturerEntity.getCustomerId(), supManufacturerEntity.getManufacturerId()); | 
			
		
	
		
			
				
					|  |  |  |  |             //判断存在有草稿的未提交的就不能通过
 | 
			
		
	
		
			
				
					|  |  |  |  |             for (SupCertEntity obj : supCertEntityList) { | 
			
		
	
		
			
				
					|  |  |  |  |                 if (obj.getAuditStatus() == 0.) { | 
			
		
	
		
			
				
					|  |  |  |  |                     return ResultVOUtils.error(999, "资质证书存在草稿不能提交!"); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |             ListIterator<SupCertSetEntity> iterable = supCertSetEntities.listIterator(); | 
			
		
	
		
			
				
					|  |  |  |  |             while (iterable.hasNext()) { | 
			
		
	
		
			
				
					|  |  |  |  |                 SupCertSetEntity supCertSetEntity = iterable.next(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 if ((supCertSetEntity.getForeign() != null && supCertSetEntity.getForeign() == 2 | 
			
		
	
		
			
				
					|  |  |  |  |                         && StrUtil.trimToEmpty(supManufacturerEntity.getCompanyType()).equals("2")) | 
			
		
	
		
			
				
					|  |  |  |  |                         || | 
			
		
	
		
			
				
					|  |  |  |  |                         ( | 
			
		
	
		
			
				
					|  |  |  |  |                                 supCertSetEntity.getForeign() != null && supCertSetEntity.getForeign() == 1 | 
			
		
	
		
			
				
					|  |  |  |  |                                         && StrUtil.trimToEmpty(supManufacturerEntity.getCompanyType()).equals("2")) | 
			
		
	
		
			
				
					|  |  |  |  |                         || | 
			
		
	
		
			
				
					|  |  |  |  |                         (supCertSetEntity.getForeign() != null | 
			
		
	
		
			
				
					|  |  |  |  |                                 && supCertSetEntity.getForeign() == 1 | 
			
		
	
		
			
				
					|  |  |  |  |                                 && supManufacturerEntity.getCompanyType().equals("1")) | 
			
		
	
		
			
				
					|  |  |  |  |                         || | 
			
		
	
		
			
				
					|  |  |  |  |                         (supCertSetEntity.getForeign() != null | 
			
		
	
		
			
				
					|  |  |  |  |                                 && supCertSetEntity.getForeign() == 3 | 
			
		
	
		
			
				
					|  |  |  |  |                                 && supManufacturerEntity.getCompanyType().equals("1"))) { | 
			
		
	
		
			
				
					|  |  |  |  |                     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) + "等证书未上传,无法提交审核!"); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         supManufacturerEntity.setCreateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |         supManufacturerEntity.setUpdateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |         supManufacturerEntity.setId(IdUtil.getSnowflakeNextId()); | 
			
		
	
		
			
				
					|  |  |  |  |         boolean b = supManufacturerService.insertCompany(supManufacturerEntity); | 
			
		
	
		
			
				
					|  |  |  |  |         if (b) { | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.success("添加成功"); | 
			
		
	
		
			
				
					|  |  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(ResultEnum.NOT_NETWORK); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @AuthRuleAnnotation("") | 
			
		
	
		
			
				
					|  |  |  |  |     @PostMapping("/sup/manufacturer/modifyCompany") | 
			
		
	
		
			
				
					|  |  |  |  |     @Log(title = "资质证书", businessType = BusinessType.UPDATE) | 
			
		
	
	
		
			
				
					|  |  |  | 
 |