|
|
@ -90,8 +90,77 @@ public class SupManufacturerController {
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
@PostMapping("/sup/manufacturer/addCompany")
|
|
|
|
@PostMapping("/sup/manufacturer/addCompany")
|
|
|
|
public BaseResponse addCompany(@RequestBody SupManufacturerEntity supManufacturerEntity) {
|
|
|
|
public BaseResponse addCompany(@RequestBody SupManufacturerEntity supManufacturerEntity) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//提交审核
|
|
|
|
|
|
|
|
if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_CHANGE || supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN) {
|
|
|
|
|
|
|
|
//判断是否上级供应商是否审核通过
|
|
|
|
|
|
|
|
SupCompanyEntity supCompanyEntity = supCompanyService.findCompany(supManufacturerEntity.getCustomerId());
|
|
|
|
|
|
|
|
if (supCompanyEntity.getAuditStatus() == ConstantStatus.AUDIT_UN
|
|
|
|
|
|
|
|
|| supCompanyEntity.getAuditStatus() == ConstantStatus.AUDIT_DRAFT) {
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
|
|
|
ListIterator<SupCertSetEntity> iterable = supCertSetEntities.listIterator();
|
|
|
|
|
|
|
|
while (iterable.hasNext()) {
|
|
|
|
|
|
|
|
SupCertSetEntity supCertSetEntity = iterable.next();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (supCertSetEntity.isNeed()
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
(!supCertSetEntity.isNeed() &&
|
|
|
|
|
|
|
|
supCertSetEntity.getForeign() != null && supCertSetEntity.getForeign() == 2
|
|
|
|
|
|
|
|
&& StrUtil.trimToEmpty(supManufacturerEntity.getCompanyType()).equals("2"))
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
(!supCertSetEntity.isNeed() &&
|
|
|
|
|
|
|
|
supCertSetEntity.getForeign() != null && supCertSetEntity.getForeign() == 1
|
|
|
|
|
|
|
|
&& StrUtil.trimToEmpty(supManufacturerEntity.getCompanyType()).equals("2"))
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
(!supCertSetEntity.isNeed()
|
|
|
|
|
|
|
|
&& supCertSetEntity.getForeign() != null
|
|
|
|
|
|
|
|
&& supCertSetEntity.getForeign() == 1
|
|
|
|
|
|
|
|
&& supManufacturerEntity.getCompanyType().equals("1"))
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
(!supCertSetEntity.isNeed()
|
|
|
|
|
|
|
|
&& 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.setCreateTime(new Date());
|
|
|
|
supManufacturerEntity.setUpdateTime(new Date());
|
|
|
|
supManufacturerEntity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
|
|
|
|
boolean b = supManufacturerService.insertCompany(supManufacturerEntity);
|
|
|
|
boolean b = supManufacturerService.insertCompany(supManufacturerEntity);
|
|
|
|
if (b) {
|
|
|
|
if (b) {
|
|
|
|
return ResultVOUtils.success("添加成功");
|
|
|
|
return ResultVOUtils.success("添加成功");
|
|
|
@ -108,7 +177,7 @@ public class SupManufacturerController {
|
|
|
|
return ResultVOUtils.error(500, "参数错误!");
|
|
|
|
return ResultVOUtils.error(500, "参数错误!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//提交审核
|
|
|
|
//提交审核
|
|
|
|
if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN) {
|
|
|
|
if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_CHANGE || supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_UN) {
|
|
|
|
//判断是否上级供应商是否审核通过
|
|
|
|
//判断是否上级供应商是否审核通过
|
|
|
|
SupCompanyEntity supCompanyEntity = supCompanyService.findCompany(supManufacturerEntity.getCustomerId());
|
|
|
|
SupCompanyEntity supCompanyEntity = supCompanyService.findCompany(supManufacturerEntity.getCustomerId());
|
|
|
|
if (supCompanyEntity.getAuditStatus() == ConstantStatus.AUDIT_UN
|
|
|
|
if (supCompanyEntity.getAuditStatus() == ConstantStatus.AUDIT_UN
|
|
|
@ -119,6 +188,7 @@ public class SupManufacturerController {
|
|
|
|
//验证证书是否齐全
|
|
|
|
//验证证书是否齐全
|
|
|
|
FilterCertSetsRequest filterCertSetsRequest = new FilterCertSetsRequest();
|
|
|
|
FilterCertSetsRequest filterCertSetsRequest = new FilterCertSetsRequest();
|
|
|
|
filterCertSetsRequest.setType(ConstantStatus.CERT_MANUFACTURER);
|
|
|
|
filterCertSetsRequest.setType(ConstantStatus.CERT_MANUFACTURER);
|
|
|
|
|
|
|
|
filterCertSetsRequest.setNeed(0);
|
|
|
|
List<SupCertSetEntity> supCertSetEntities = supCertSetService.filterCertSets(filterCertSetsRequest);
|
|
|
|
List<SupCertSetEntity> supCertSetEntities = supCertSetService.filterCertSets(filterCertSetsRequest);
|
|
|
|
List<SupCertEntity> supCertEntityList = supCertService.findAll(supManufacturerEntity.getCustomerId(), supManufacturerEntity.getManufacturerId());
|
|
|
|
List<SupCertEntity> supCertEntityList = supCertService.findAll(supManufacturerEntity.getCustomerId(), supManufacturerEntity.getManufacturerId());
|
|
|
|
ListIterator<SupCertSetEntity> iterable = supCertSetEntities.listIterator();
|
|
|
|
ListIterator<SupCertSetEntity> iterable = supCertSetEntities.listIterator();
|
|
|
@ -130,11 +200,19 @@ public class SupManufacturerController {
|
|
|
|
(!supCertSetEntity.isNeed() &&
|
|
|
|
(!supCertSetEntity.isNeed() &&
|
|
|
|
supCertSetEntity.getForeign() != null && supCertSetEntity.getForeign() == 2
|
|
|
|
supCertSetEntity.getForeign() != null && supCertSetEntity.getForeign() == 2
|
|
|
|
&& StrUtil.trimToEmpty(supManufacturerEntity.getCompanyType()).equals("2"))
|
|
|
|
&& StrUtil.trimToEmpty(supManufacturerEntity.getCompanyType()).equals("2"))
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
(!supCertSetEntity.isNeed() &&
|
|
|
|
|
|
|
|
supCertSetEntity.getForeign() != null && supCertSetEntity.getForeign() == 1
|
|
|
|
|
|
|
|
&& StrUtil.trimToEmpty(supManufacturerEntity.getCompanyType()).equals("2"))
|
|
|
|
||
|
|
|
|
||
|
|
|
|
(!supCertSetEntity.isNeed()
|
|
|
|
(!supCertSetEntity.isNeed()
|
|
|
|
&& supCertSetEntity.getForeign() != null
|
|
|
|
&& supCertSetEntity.getForeign() != null
|
|
|
|
&& supCertSetEntity.getForeign() == 1
|
|
|
|
&& supCertSetEntity.getForeign() == 1
|
|
|
|
|
|
|
|
&& supManufacturerEntity.getCompanyType().equals("1"))
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
(!supCertSetEntity.isNeed()
|
|
|
|
|
|
|
|
&& supCertSetEntity.getForeign() != null
|
|
|
|
|
|
|
|
&& supCertSetEntity.getForeign() == 3
|
|
|
|
&& supManufacturerEntity.getCompanyType().equals("1"))) {
|
|
|
|
&& supManufacturerEntity.getCompanyType().equals("1"))) {
|
|
|
|
for (SupCertEntity supCertEntity : supCertEntityList) {
|
|
|
|
for (SupCertEntity supCertEntity : supCertEntityList) {
|
|
|
|
|
|
|
|
|
|
|
|