|
|
|
@ -17,6 +17,7 @@ import com.glxp.api.admin.req.purchase.FilterSupCertRequest;
|
|
|
|
|
import com.glxp.api.admin.req.purchase.FilterSupManufacturerRequest;
|
|
|
|
|
import com.glxp.api.admin.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.admin.service.auth.AuthAdminService;
|
|
|
|
|
import com.glxp.api.admin.service.info.CompanyService;
|
|
|
|
|
import com.glxp.api.admin.service.purchase.SupCertService;
|
|
|
|
|
import com.glxp.api.admin.service.purchase.SupCertSetService;
|
|
|
|
|
import com.glxp.api.admin.service.purchase.SupCompanyService;
|
|
|
|
@ -51,7 +52,8 @@ public class SupManufacturerController {
|
|
|
|
|
private SupCompanyService supCompanyService;
|
|
|
|
|
@Resource
|
|
|
|
|
SupCertSetService supCertSetService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private CompanyService companyService;
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("/sup/manufacturer/getCompanyInfo")
|
|
|
|
@ -91,9 +93,21 @@ public class SupManufacturerController {
|
|
|
|
|
@PostMapping("/sup/manufacturer/addCompany")
|
|
|
|
|
public BaseResponse addCompany(@RequestBody SupManufacturerEntity supManufacturerEntity) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断用户名和社会信用代码不能重复
|
|
|
|
|
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) {
|
|
|
|
|
//判断是否上级供应商是否审核通过
|
|
|
|
@ -109,27 +123,28 @@ public class SupManufacturerController {
|
|
|
|
|
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.isNeed()
|
|
|
|
|
||
|
|
|
|
|
(!supCertSetEntity.isNeed() &&
|
|
|
|
|
supCertSetEntity.getForeign() != null && supCertSetEntity.getForeign() == 2
|
|
|
|
|
&& StrUtil.trimToEmpty(supManufacturerEntity.getCompanyType()).equals("2"))
|
|
|
|
|
if (( 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"))
|
|
|
|
|
&& StrUtil.trimToEmpty(supManufacturerEntity.getCompanyType()).equals("2"))
|
|
|
|
|
||
|
|
|
|
|
(!supCertSetEntity.isNeed()
|
|
|
|
|
&& supCertSetEntity.getForeign() != null
|
|
|
|
|
( supCertSetEntity.getForeign() != null
|
|
|
|
|
&& supCertSetEntity.getForeign() == 1
|
|
|
|
|
&& supManufacturerEntity.getCompanyType().equals("1"))
|
|
|
|
|
||
|
|
|
|
|
(!supCertSetEntity.isNeed()
|
|
|
|
|
&& supCertSetEntity.getForeign() != null
|
|
|
|
|
( supCertSetEntity.getForeign() != null
|
|
|
|
|
&& supCertSetEntity.getForeign() == 3
|
|
|
|
|
&& supManufacturerEntity.getCompanyType().equals("1"))) {
|
|
|
|
|
for (SupCertEntity supCertEntity : supCertEntityList) {
|
|
|
|
@ -176,6 +191,23 @@ public class SupManufacturerController {
|
|
|
|
|
if (StrUtil.isEmpty(supManufacturerEntity.getManufacturerId()) || StrUtil.isEmpty(supManufacturerEntity.getCustomerId())) {
|
|
|
|
|
return ResultVOUtils.error(500, "参数错误!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//判断用户名和社会信用代码不能重复
|
|
|
|
|
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) {
|
|
|
|
|
//判断是否上级供应商是否审核通过
|
|
|
|
@ -191,27 +223,28 @@ public class SupManufacturerController {
|
|
|
|
|
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.isNeed()
|
|
|
|
|
||
|
|
|
|
|
(!supCertSetEntity.isNeed() &&
|
|
|
|
|
supCertSetEntity.getForeign() != null && supCertSetEntity.getForeign() == 2
|
|
|
|
|
&& StrUtil.trimToEmpty(supManufacturerEntity.getCompanyType()).equals("2"))
|
|
|
|
|
if (( 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"))
|
|
|
|
|
&& StrUtil.trimToEmpty(supManufacturerEntity.getCompanyType()).equals("2"))
|
|
|
|
|
||
|
|
|
|
|
(!supCertSetEntity.isNeed()
|
|
|
|
|
&& supCertSetEntity.getForeign() != null
|
|
|
|
|
( supCertSetEntity.getForeign() != null
|
|
|
|
|
&& supCertSetEntity.getForeign() == 1
|
|
|
|
|
&& supManufacturerEntity.getCompanyType().equals("1"))
|
|
|
|
|
||
|
|
|
|
|
(!supCertSetEntity.isNeed()
|
|
|
|
|
&& supCertSetEntity.getForeign() != null
|
|
|
|
|
( supCertSetEntity.getForeign() != null
|
|
|
|
|
&& supCertSetEntity.getForeign() == 3
|
|
|
|
|
&& supManufacturerEntity.getCompanyType().equals("1"))) {
|
|
|
|
|
for (SupCertEntity supCertEntity : supCertEntityList) {
|
|
|
|
@ -262,6 +295,59 @@ public class SupManufacturerController {
|
|
|
|
|
if (StrUtil.isEmpty(supManufacturerEntity.getManufacturerId()) || StrUtil.isEmpty(supManufacturerEntity.getCustomerId())) {
|
|
|
|
|
return ResultVOUtils.error(500, "参数错误!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(supManufacturerEntity.getAuditStatus()==2){
|
|
|
|
|
//查询上传的资质证书
|
|
|
|
|
FilterSupCertRequest filterSupCertRequest = new FilterSupCertRequest();
|
|
|
|
|
filterSupCertRequest.setCustomerId(supManufacturerEntity.getCustomerId());
|
|
|
|
|
filterSupCertRequest.setManufacturerIdFk(supManufacturerEntity.getManufacturerId());
|
|
|
|
|
filterSupCertRequest.setType(ConstantStatus.CERT_MANUFACTURER);
|
|
|
|
|
List<SupCertEntity> supCertEntityList = supCertService.filterCompanyCert(filterSupCertRequest);
|
|
|
|
|
//查询必须上传的资质证书
|
|
|
|
|
FilterCertSetsRequest filterCertSetsRequest = new FilterCertSetsRequest();
|
|
|
|
|
filterCertSetsRequest.setType(ConstantStatus.CERT_MANUFACTURER);
|
|
|
|
|
List<SupCertSetEntity> supCertSetEntities = supCertSetService.filterCertSets(filterCertSetsRequest);
|
|
|
|
|
//判断有没有存在必须上传而没有上传的证书
|
|
|
|
|
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) {
|
|
|
|
|
return ResultVOUtils.error(500, "必传证书不齐全!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询是否包含审核未通过的证书
|
|
|
|
|
if (supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_PASS ||
|
|
|
|
|
supManufacturerEntity.getAuditStatus() == ConstantStatus.AUDIT_CHANGE_PASS) {
|
|
|
|
|