|
|
@@ -42,7 +42,7 @@ public class CompanyController { |
|
|
|
@Transactional |
|
|
|
public Result addCompany(@RequestBody CustomerCompanyVO company, String serviceProviderId) { |
|
|
|
company.setCustomerId(IdWorker.generactorId().toString()); |
|
|
|
Result result = new Result(), result1 = new Result(), result2 = new Result(); |
|
|
|
Result result = new Result(), result1 = new Result(), result2 = new Result("0"); |
|
|
|
result1 = customerCompanyService.insert(company); |
|
|
|
if (serviceProviderId != null) { |
|
|
|
CustomerServiceProviderEnterpriseVO temp = new CustomerServiceProviderEnterpriseVO(IdWorker.generactorId().toString(), serviceProviderId, company.getCustomerId()); |
|
|
@@ -85,7 +85,7 @@ public class CompanyController { |
|
|
|
@Transactional |
|
|
|
public Result updateCompany(@RequestBody CustomerCompanyVO company, String serviceProviderId) { |
|
|
|
boolean flag1 = true, flag2 = true; |
|
|
|
Result result = new Result(), result1 = new Result(), result2 = new Result(); |
|
|
|
Result result = new Result(), result1 = new Result(), result2 = new Result("0"); |
|
|
|
result1 = customerCompanyService.update(company); |
|
|
|
if (serviceProviderId != null) { |
|
|
|
DataResult temp = csService.queryCsByCompanyIdAndServiceProviderId(company.getCustomerId(), serviceProviderId); |
|
|
@@ -118,19 +118,20 @@ public class CompanyController { |
|
|
|
@ApiOperation(value = "删除企业/服务商", notes = "若删除企业,则需要填serviceProviderId") |
|
|
|
@GetMapping("/deleteCompanyByCompanyId") |
|
|
|
public Result deleteCompanyByCompanyId(@RequestParam String companyId, String serviceProviderId) { |
|
|
|
Result result = new Result(), result1 = new Result(), result2 = new Result(); |
|
|
|
Result result = new Result(), result1, result2; |
|
|
|
result1 = customerCompanyService.delete(companyId); |
|
|
|
if (serviceProviderId != null) { |
|
|
|
if (serviceProviderId != null) { // 删除企业 |
|
|
|
DataResult temp = csService.queryCsByCompanyIdAndServiceProviderId(companyId, serviceProviderId); |
|
|
|
if (temp.getCode().equals("0")) { |
|
|
|
CustomerServiceProviderEnterpriseVO cs = (CustomerServiceProviderEnterpriseVO) temp.getData(); |
|
|
|
cs.setServiceProviderId(serviceProviderId); |
|
|
|
result2 = csService.delete(cs.getId()); |
|
|
|
} else { |
|
|
|
result.setCode("-1"); |
|
|
|
result.setMessage(temp.getMessage()); |
|
|
|
return result; |
|
|
|
} |
|
|
|
}else{ // 删除服务商 |
|
|
|
result2=csService.deleteByServiceProviderId(companyId); |
|
|
|
} |
|
|
|
if (result1.getCode().equals("0") && result2.getCode().equals("0")) { |
|
|
|
result.setCode("0"); |
|
|
|