|
|
|
@ -84,6 +84,63 @@ public class SupCertController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private BaseResponse insertCompanyCert(String customerId, PostSelCertRequest request) {
|
|
|
|
|
if (CollUtil.isEmpty(request.getSupCertSetEntities())) {
|
|
|
|
|
return ResultVOUtils.error(500, "请选入资质证书!");
|
|
|
|
|
}
|
|
|
|
|
if (request.getCertType() == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "参数错误!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int certType = request.getCertType();
|
|
|
|
|
String productIdFk = request.getProductIdFk();
|
|
|
|
|
String manufacturerIdFk = request.getManufacturerIdFk();
|
|
|
|
|
|
|
|
|
|
String errMsg = "";
|
|
|
|
|
ArrayList<String> list = new ArrayList<>();
|
|
|
|
|
int i = request.getSupCertSetEntities().size();
|
|
|
|
|
for (SupCertSetEntity supCertSetEntity : request.getSupCertSetEntities()) {
|
|
|
|
|
i--;
|
|
|
|
|
FilterSupCertRequest supCertRequest = new FilterSupCertRequest();
|
|
|
|
|
supCertRequest.setName(supCertSetEntity.getName());
|
|
|
|
|
supCertRequest.setCustomerId(customerId);
|
|
|
|
|
supCertRequest.setManufacturerIdFk(manufacturerIdFk);
|
|
|
|
|
if (productIdFk != null) {
|
|
|
|
|
supCertRequest.setProductIdFk(productIdFk);
|
|
|
|
|
supCertRequest.setType(3);
|
|
|
|
|
} else {
|
|
|
|
|
supCertRequest.setType(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<SupCertEntity> supCertEntities = supCertService.selectCompanyCert(supCertRequest);
|
|
|
|
|
if (!supCertEntities.isEmpty()) {
|
|
|
|
|
list.add(supCertEntities.get(0).getName());
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
errMsg = list.stream().map(s -> "," + s).collect(Collectors.joining());
|
|
|
|
|
return ResultVOUtils.error(999, errMsg.substring(1) + "已存在!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (SupCertSetEntity supCertSetEntity : request.getSupCertSetEntities()) {
|
|
|
|
|
SupCertEntity supCertEntity = new SupCertEntity();
|
|
|
|
|
supCertEntity.setName(supCertSetEntity.getName());
|
|
|
|
|
supCertEntity.setManufacturerIdFk(manufacturerIdFk);
|
|
|
|
|
supCertEntity.setProductIdFk(productIdFk);
|
|
|
|
|
supCertEntity.setCustomerId(customerId);
|
|
|
|
|
supCertEntity.setType(certType);
|
|
|
|
|
supCertEntity.setCreateTime(new Date());
|
|
|
|
|
supCertEntity.setStatus(0);
|
|
|
|
|
supCertEntity.setAuditStatus(ConstantStatus.AUDIT_DRAFT);
|
|
|
|
|
supCertEntity.setUpdateTime(new Date());
|
|
|
|
|
boolean b = supCertService.insertCompanyCert(supCertEntity);
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success("成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/sup/info/selectAllCert")
|
|
|
|
|
@Log(title = "资质证书", businessType = BusinessType.INSERT)
|
|
|
|
@ -100,76 +157,11 @@ public class SupCertController {
|
|
|
|
|
if (postSelCertRequest.getCertType() == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "参数错误!");
|
|
|
|
|
}
|
|
|
|
|
if (postSelCertRequest.getManufacturerIdFk() == null) {
|
|
|
|
|
String errMsg = "";
|
|
|
|
|
ArrayList<String> list = new ArrayList<>();
|
|
|
|
|
int i = postSelCertRequest.getSupCertSetEntities().size();
|
|
|
|
|
for (SupCertSetEntity supCertSetEntity : postSelCertRequest.getSupCertSetEntities()) {
|
|
|
|
|
i--;
|
|
|
|
|
FilterSupCertRequest supCertRequest = new FilterSupCertRequest();
|
|
|
|
|
supCertRequest.setName(supCertSetEntity.getName());
|
|
|
|
|
supCertRequest.setCustomerId(customerId);
|
|
|
|
|
List<SupCertEntity> supCertEntities = supCertService.selectCompanyCert(supCertRequest);
|
|
|
|
|
if (supCertEntities.size() != 0) {
|
|
|
|
|
list.add(supCertEntities.get(0).getName());
|
|
|
|
|
if (supCertEntities.size() != 0 && i == 0) {
|
|
|
|
|
for (String s : list) {
|
|
|
|
|
errMsg = errMsg + "," + s;
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.error(999, errMsg.substring(1) + "已存在!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if(postSelCertRequest.getProductIdFk()==null) {
|
|
|
|
|
String errMsg = "";
|
|
|
|
|
ArrayList<String> list = new ArrayList<>();
|
|
|
|
|
int i = postSelCertRequest.getSupCertSetEntities().size();
|
|
|
|
|
for (SupCertSetEntity supCertSetEntity : postSelCertRequest.getSupCertSetEntities()) {
|
|
|
|
|
i--;
|
|
|
|
|
FilterSupCertRequest supCertRequest = new FilterSupCertRequest();
|
|
|
|
|
supCertRequest.setName(supCertSetEntity.getName());
|
|
|
|
|
supCertRequest.setCustomerId(customerId);
|
|
|
|
|
supCertRequest.setManufacturerIdFk(postSelCertRequest.getManufacturerIdFk());
|
|
|
|
|
supCertRequest.setType(2);
|
|
|
|
|
List<SupCertEntity> supCertEntities = supCertService.selectCompanyCert(supCertRequest);
|
|
|
|
|
if (supCertEntities.size() != 0) {
|
|
|
|
|
list.add(supCertEntities.get(0).getName());
|
|
|
|
|
if (supCertEntities.size() != 0 && i == 0) {
|
|
|
|
|
for (String s : list) {
|
|
|
|
|
errMsg = errMsg + "," + s;
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.error(999, errMsg.substring(1) + "已存在!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
String errMsg = "";
|
|
|
|
|
ArrayList<String> list = new ArrayList<>();
|
|
|
|
|
int i = postSelCertRequest.getSupCertSetEntities().size();
|
|
|
|
|
for (SupCertSetEntity supCertSetEntity : postSelCertRequest.getSupCertSetEntities()) {
|
|
|
|
|
i--;
|
|
|
|
|
FilterSupCertRequest supCertRequest = new FilterSupCertRequest();
|
|
|
|
|
supCertRequest.setName(supCertSetEntity.getName());
|
|
|
|
|
supCertRequest.setCustomerId(customerId);
|
|
|
|
|
supCertRequest.setManufacturerIdFk(postSelCertRequest.getManufacturerIdFk());
|
|
|
|
|
supCertRequest.setProductIdFk(postSelCertRequest.getProductIdFk());
|
|
|
|
|
supCertRequest.setType(3);
|
|
|
|
|
List<SupCertEntity> supCertEntities = supCertService.selectCompanyCert(supCertRequest);
|
|
|
|
|
if (supCertEntities.size() != 0) {
|
|
|
|
|
list.add(supCertEntities.get(0).getName());
|
|
|
|
|
if (supCertEntities.size() != 0 && i == 0) {
|
|
|
|
|
for (String s : list) {
|
|
|
|
|
errMsg = errMsg + "," + s;
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.error(999, errMsg.substring(1) + "已存在!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String errMsg=checkCert(postSelCertRequest,customerId);
|
|
|
|
|
if(StrUtil.isNotEmpty(errMsg)){
|
|
|
|
|
return ResultVOUtils.error(999, errMsg.substring(1) + "已存在!");
|
|
|
|
|
}
|
|
|
|
|
for (SupCertSetEntity supCertSetEntity : postSelCertRequest.getSupCertSetEntities()) {
|
|
|
|
|
SupCertEntity supCertEntity = new SupCertEntity();
|
|
|
|
|
supCertEntity.setName(supCertSetEntity.getName());
|
|
|
|
@ -187,6 +179,48 @@ public class SupCertController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String checkCert(PostSelCertRequest postSelCertRequest,String customerId){
|
|
|
|
|
|
|
|
|
|
String errMsg = "";
|
|
|
|
|
ArrayList<String> list = new ArrayList<>();
|
|
|
|
|
int i = postSelCertRequest.getSupCertSetEntities().size();
|
|
|
|
|
for (SupCertSetEntity supCertSetEntity : postSelCertRequest.getSupCertSetEntities()) {
|
|
|
|
|
i--;
|
|
|
|
|
FilterSupCertRequest supCertRequest = new FilterSupCertRequest();
|
|
|
|
|
supCertRequest.setName(supCertSetEntity.getName());
|
|
|
|
|
supCertRequest.setCustomerId(customerId);
|
|
|
|
|
if(StrUtil.isEmpty(postSelCertRequest.getProductIdFk()) && StrUtil.isNotEmpty(postSelCertRequest.getManufacturerIdFk())) {
|
|
|
|
|
supCertRequest.setManufacturerIdFk(postSelCertRequest.getManufacturerIdFk());
|
|
|
|
|
supCertRequest.setType(2);
|
|
|
|
|
}
|
|
|
|
|
if(StrUtil.isNotEmpty(postSelCertRequest.getProductIdFk()) && StrUtil.isNotEmpty(postSelCertRequest.getManufacturerIdFk())) {
|
|
|
|
|
supCertRequest.setManufacturerIdFk(postSelCertRequest.getManufacturerIdFk());
|
|
|
|
|
supCertRequest.setProductIdFk(postSelCertRequest.getProductIdFk());
|
|
|
|
|
supCertRequest.setType(3);
|
|
|
|
|
}
|
|
|
|
|
List<SupCertEntity> supCertEntities = supCertService.selectCompanyCert(supCertRequest);
|
|
|
|
|
if (supCertEntities.size() != 0) {
|
|
|
|
|
list.add(supCertEntities.get(0).getName());
|
|
|
|
|
if (supCertEntities.size() != 0 && i == 0) {
|
|
|
|
|
for (String s : list) {
|
|
|
|
|
errMsg = errMsg + "," + s;
|
|
|
|
|
}
|
|
|
|
|
return errMsg;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if(i == 0 && list.size()>0){
|
|
|
|
|
for (String s : list) {
|
|
|
|
|
errMsg = errMsg + "," + s;
|
|
|
|
|
}
|
|
|
|
|
return errMsg;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return errMsg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("/sale/info/getCompanyCert")
|
|
|
|
|
public BaseResponse getCompanyCert(FilterSupCertRequest filterSupCertRequest) {
|
|
|
|
|