|
|
|
@ -96,7 +96,7 @@ public class SupManufacturerController {
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("/directToCpt/sup/manufacturer/getCompanyList")
|
|
|
|
|
public BaseResponse getCompanyList(FilterSupManufacturerRequest filterSupManufacturerRequest) {
|
|
|
|
|
public BaseResponse directToCptGetCompanyList(FilterSupManufacturerRequest filterSupManufacturerRequest) {
|
|
|
|
|
List<SupManufacturerEntity> companyEntities = supManufacturerService.getCompany(filterSupManufacturerRequest);
|
|
|
|
|
PageInfo<SupManufacturerEntity> pageInfo = new PageInfo<>(companyEntities);
|
|
|
|
|
PageSimpleResponse<SupManufacturerEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
@ -105,6 +105,17 @@ public class SupManufacturerController {
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// @AuthRuleAnnotation("")
|
|
|
|
|
// @GetMapping("/sup/manufacturer/getCompanyList")
|
|
|
|
|
// public BaseResponse getCompanyList(FilterSupManufacturerRequest filterSupManufacturerRequest) {
|
|
|
|
|
// List<SupManufacturerEntity> companyEntities = supManufacturerService.getCompany(filterSupManufacturerRequest);
|
|
|
|
|
// PageInfo<SupManufacturerEntity> pageInfo = new PageInfo<>(companyEntities);
|
|
|
|
|
// PageSimpleResponse<SupManufacturerEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
// pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
// pageSimpleResponse.setList(companyEntities);
|
|
|
|
|
// return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("/directToCpt/sup/manufacturer/getCompanyBySup")
|
|
|
|
|
public BaseResponse getCompanyBySup(FilterSupManufacturerRequest filterSupManufacturerRequest) {
|
|
|
|
@ -221,8 +232,8 @@ public class SupManufacturerController {
|
|
|
|
|
@Log(title = "资质证书", businessType = BusinessType.INSERT)
|
|
|
|
|
public BaseResponse directToCptAddCompany(@RequestBody SupManufacturerEntity supManufacturerEntity) {
|
|
|
|
|
|
|
|
|
|
//String customerId = getCustomerId();
|
|
|
|
|
//supManufacturerEntity.setCustomerId(customerId);
|
|
|
|
|
String customerId = getCustomerId();
|
|
|
|
|
supManufacturerEntity.setCustomerId(customerId);
|
|
|
|
|
//判断用户名和社会信用代码不能重复
|
|
|
|
|
FilterSupManufacturerRequest filterSupManufacturerRequest = new FilterSupManufacturerRequest();
|
|
|
|
|
filterSupManufacturerRequest.setCompanyName(supManufacturerEntity.getCompanyName());
|
|
|
|
@ -419,6 +430,111 @@ public class SupManufacturerController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/directToCpt/sup/manufacturer/modifyCompany")
|
|
|
|
|
@Log(title = "资质证书", businessType = BusinessType.UPDATE)
|
|
|
|
|
public BaseResponse directToCptModifyCompany(@RequestBody SupManufacturerEntity supManufacturerEntity) {
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(supManufacturerEntity.getManufacturerId()) || StrUtil.isEmpty(supManufacturerEntity.getCustomerId())) {
|
|
|
|
|
return ResultVOUtils.error(500, "参数错误!");
|
|
|
|
|
}
|
|
|
|
|
if (supManufacturerEntity.getId() == 0) {//新增
|
|
|
|
|
//判断用户名和社会信用代码不能重复
|
|
|
|
|
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() == ConstantStatus.AUDIT_UN || supCompanyEntity.getAuditStatus() == ConstantStatus.AUDIT_CHANGE_REJECT
|
|
|
|
|
|| supCompanyEntity.getAuditStatus() == ConstantStatus.AUDIT_DRAFT || supCompanyEntity.getAuditStatus() == ConstantStatus.AUDIT_REJECT) {
|
|
|
|
|
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.setUpdateTime(new Date());
|
|
|
|
|
SupManufacturerEntity originEntity = supManufacturerService.findManufacturer(supManufacturerEntity.getManufacturerId());
|
|
|
|
|
boolean b = supManufacturerService.modifyCompany(supManufacturerEntity);
|
|
|
|
|
//修改证书对应的供应商ID,生产企业ID
|
|
|
|
|
supCertService.updateManufacturerId(originEntity.getCustomerId(), supManufacturerEntity.getCustomerId(), originEntity.getManufacturerId(), supManufacturerEntity.getManufacturerId());
|
|
|
|
|
|
|
|
|
|
if (b) {
|
|
|
|
|
return ResultVOUtils.success("修改成功");
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/sup/manufacturer/audit")
|
|
|
|
|