|
|
@@ -4,14 +4,20 @@ import com.usoft.b2b.access.entity.UserAccount;
|
|
|
import com.usoft.b2b.access.utils.AccessUtils;
|
|
|
import com.usoftchina.saas.account.api.AccountApi;
|
|
|
import com.usoftchina.saas.account.api.CompanyApi;
|
|
|
+import com.usoftchina.saas.account.dto.AccountDTO;
|
|
|
+import com.usoftchina.saas.account.dto.CompanyDTO;
|
|
|
+import com.usoftchina.saas.base.Result;
|
|
|
import com.usoftchina.saas.context.BaseContextHolder;
|
|
|
import com.usoftchina.saas.exception.BizException;
|
|
|
import com.usoftchina.saas.sale.dto.apcheck.SaveOperationData;
|
|
|
import com.usoftchina.saas.sale.service.ApCheckService;
|
|
|
+import com.usoftchina.saas.utils.JsonUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.util.LinkedMultiValueMap;
|
|
|
+import org.springframework.util.MultiValueMap;
|
|
|
|
|
|
/**
|
|
|
* @Author chenwei
|
|
|
@@ -22,11 +28,15 @@ public class ApCheckServiceImpl implements ApCheckService {
|
|
|
|
|
|
@Value("${b2b.baseUrl.common}")
|
|
|
private String b2bUrl;
|
|
|
+
|
|
|
+ private final static String SAVEAPCHECKURL = "/sale/apCheck/operation/save";
|
|
|
+
|
|
|
@Autowired
|
|
|
private AccountApi accountApi;
|
|
|
@Autowired
|
|
|
private CompanyApi companyApi;
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public String getCustApcheck(int count, int page, String searchFilter, String sorting) {
|
|
|
Long userUU = accountApi.getAccountById(BaseContextHolder.getUserId()).getData().getUu();
|
|
|
@@ -52,7 +62,26 @@ public class ApCheckServiceImpl implements ApCheckService {
|
|
|
|
|
|
@Override
|
|
|
public ModelMap operationSave(SaveOperationData saveOperationData) {
|
|
|
- return null;
|
|
|
+ Result<AccountDTO> accountResult = accountApi.getAccountById(BaseContextHolder.getUserId());
|
|
|
+ Result<CompanyDTO> companyResult = companyApi.getCompanyById(BaseContextHolder.getCompanyId());
|
|
|
+ if (accountResult.isSuccess() && companyResult.isSuccess()) {
|
|
|
+ Long userUU = accountResult.getData().getUu();
|
|
|
+ Long enUU = companyResult.getData().getUu();
|
|
|
+ UserAccount account = new UserAccount();
|
|
|
+ account.setAppId("SAAS");
|
|
|
+ account.setUserUU(userUU);
|
|
|
+ account.setSpaceUU(enUU);
|
|
|
+ MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
|
|
+ map.add("json", JsonUtils.toJsonString(saveOperationData));
|
|
|
+ String url = b2bUrl + SAVEAPCHECKURL;
|
|
|
+ String result = null;
|
|
|
+ try {
|
|
|
+ result = AccessUtils.postForObject(url, account, String.class, map);
|
|
|
+ } catch (Exception e){
|
|
|
+ throw new BizException(80000, e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new ModelMap("success");
|
|
|
}
|
|
|
|
|
|
@Override
|