|
|
@@ -7,6 +7,7 @@ import com.platform2easy.genesis.domain.repository.AppUserRepository;
|
|
|
import com.platform2easy.genesis.domain.repository.CompanyRepository;
|
|
|
import com.platform2easy.genesis.domain.service.WalletService;
|
|
|
import com.platform2easy.genesis.web.dto.CompanyWithUserDTO;
|
|
|
+import com.platform2easy.genesis.web.dto.CompanyUserResponseDTO;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import com.platform2easy.genesis.lib.BashExecutor;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
@@ -31,7 +32,7 @@ public class CompanyService {
|
|
|
@Value("${easycli.path:}")
|
|
|
private String easycliPath;
|
|
|
|
|
|
- @Value("${chain.polygon.id:137}")
|
|
|
+ @Value("${chain.polygon.id:1}")
|
|
|
private Long defaultChainId;
|
|
|
|
|
|
@Value("${ROOT_DIR:}")
|
|
|
@@ -56,7 +57,7 @@ public class CompanyService {
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
- public Company registerCompanyWithUser(CompanyWithUserDTO dto) {
|
|
|
+ public CompanyUserResponseDTO registerCompanyWithUser(CompanyWithUserDTO dto) {
|
|
|
Company company = new Company();
|
|
|
company.setName(dto.getCompanyName());
|
|
|
company.setFlag("a");
|
|
|
@@ -96,9 +97,7 @@ public class CompanyService {
|
|
|
for (String line : result.getOutput().split("\\R")) {
|
|
|
int i = line.indexOf('=');
|
|
|
if (i > 0) {
|
|
|
- String k = line.substring(0, i).trim();
|
|
|
- String v = line.substring(i + 1).trim();
|
|
|
- kv.put(k, v);
|
|
|
+ kv.put(line.substring(0, i).trim(), line.substring(i + 1).trim());
|
|
|
}
|
|
|
}
|
|
|
String privateKey = kv.get("privateKey");
|
|
|
@@ -116,7 +115,10 @@ public class CompanyService {
|
|
|
wallet.setFlag("a");
|
|
|
wallet.setChainId(defaultChainId);
|
|
|
walletService.salvar(wallet);
|
|
|
-
|
|
|
- return company;
|
|
|
+
|
|
|
+ return new CompanyUserResponseDTO(
|
|
|
+ new CompanyUserResponseDTO.CompanyId(company.getId()),
|
|
|
+ new CompanyUserResponseDTO.UserId(user.getUserId())
|
|
|
+ );
|
|
|
}
|
|
|
}
|