|
|
|
@ -10,7 +10,10 @@ import com.gaotao.modules.api.service.IfsApiService; |
|
|
|
import com.gaotao.modules.base.entity.SOScheduledRoutingData; |
|
|
|
import com.gaotao.modules.notify.entity.vo.ShopOrderMaterialVo; |
|
|
|
import com.gaotao.modules.notify.entity.vo.ShopOrderVo; |
|
|
|
import com.gaotao.modules.sys.entity.SysUserEntity; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
import org.apache.shiro.SecurityUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@ -22,7 +25,8 @@ import java.util.Map; |
|
|
|
public class IfsApiServiceImpl implements IfsApiService { |
|
|
|
@Value("${custom.ifs-url}") |
|
|
|
private String ifsUrl; |
|
|
|
|
|
|
|
@Value("${ldap-control.control-flag:false}") |
|
|
|
private Boolean ldapFlag; |
|
|
|
@Value("${custom.ifs-ifsDBName}") |
|
|
|
private String ifsDBName; |
|
|
|
|
|
|
|
@ -32,7 +36,7 @@ public class IfsApiServiceImpl implements IfsApiService { |
|
|
|
public List<IfsShopOrder> getShopOrderFromIFSWithOrderNo(IfsShopOrder data)throws Exception { |
|
|
|
Map<String, Object> params = Map.of( |
|
|
|
"ifsDBName", ifsDBName, |
|
|
|
"domainUserID", domainUserID, |
|
|
|
"domainUserID", getCurrentDomainUserID(), |
|
|
|
"ifsSiteID", data.getSite(), |
|
|
|
"ifsOrderNo", data.getOrderNo(), |
|
|
|
"ifsReleaseNo", data.getReleaseNo(), |
|
|
|
@ -52,7 +56,7 @@ public class IfsApiServiceImpl implements IfsApiService { |
|
|
|
public List<ShopOrderMaterialVo> getSoBomWithOrderNo(IfsShopOrder data) throws JsonProcessingException { |
|
|
|
Map<String, Object> params = Map.of( |
|
|
|
"ifsDBName", ifsDBName, |
|
|
|
"domainUserID", domainUserID, |
|
|
|
"domainUserID", getCurrentDomainUserID(), |
|
|
|
"ifsSiteID", data.getSite(), |
|
|
|
"ifsOrderNo", data.getOrderNo(), |
|
|
|
"ifsReleaseNo", data.getReleaseNo(), |
|
|
|
@ -71,7 +75,7 @@ public class IfsApiServiceImpl implements IfsApiService { |
|
|
|
public List<IfsInventoryPart> getIfsInventoryPart(IfsInventoryPart data) throws JsonProcessingException{ |
|
|
|
Map<String, Object> params = Map.of( |
|
|
|
"ifsDBName", ifsDBName, |
|
|
|
"domainUserID", domainUserID, |
|
|
|
"domainUserID", getCurrentDomainUserID(), |
|
|
|
"ifsSiteID", data.getSite(), |
|
|
|
"ifsPartNo", data.getPartNo() |
|
|
|
); |
|
|
|
@ -83,4 +87,19 @@ public class IfsApiServiceImpl implements IfsApiService { |
|
|
|
return mapper.readValue(ifsResponse, new TypeReference<List<IfsInventoryPart>>() { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private String getCurrentDomainUserID() { |
|
|
|
if (ldapFlag) { |
|
|
|
try { |
|
|
|
SysUserEntity currentUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
if (currentUser != null && StringUtils.isNotBlank(currentUser.getDomainAccount())) { |
|
|
|
return currentUser.getDomainAccount(); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
// 如果获取当前用户失败,使用默认配置 |
|
|
|
} |
|
|
|
} |
|
|
|
return domainUserID; |
|
|
|
} |
|
|
|
|
|
|
|
} |