|
|
@ -36,6 +36,7 @@ import com.spring.modules.sampleManagement.entity.PlmTechnicalSpecificationSheet |
|
|
import com.spring.modules.sampleManagement.service.TechnicalSpecificationService; |
|
|
import com.spring.modules.sampleManagement.service.TechnicalSpecificationService; |
|
|
import com.spring.modules.sys.dao.SysUserDao; |
|
|
import com.spring.modules.sys.dao.SysUserDao; |
|
|
import com.spring.modules.sys.entity.SysUserEntity; |
|
|
import com.spring.modules.sys.entity.SysUserEntity; |
|
|
|
|
|
import com.spring.modules.sys.service.CheckLdapDirectory; |
|
|
import org.apache.ibatis.session.SqlSession; |
|
|
import org.apache.ibatis.session.SqlSession; |
|
|
import org.apache.shiro.SecurityUtils; |
|
|
import org.apache.shiro.SecurityUtils; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.Logger; |
|
|
@ -87,6 +88,9 @@ public class TechnicalSpecificationServiceImpl implements TechnicalSpecification |
|
|
@Autowired |
|
|
@Autowired |
|
|
private SqlSession sqlSession; |
|
|
private SqlSession sqlSession; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private CheckLdapDirectory checkLdapDirectory; |
|
|
|
|
|
|
|
|
//记录日志使用 |
|
|
//记录日志使用 |
|
|
private static final Logger logger = LoggerFactory.getLogger(TechnicalSpecificationServiceImpl.class); |
|
|
private static final Logger logger = LoggerFactory.getLogger(TechnicalSpecificationServiceImpl.class); |
|
|
|
|
|
|
|
|
@ -1128,34 +1132,40 @@ public class TechnicalSpecificationServiceImpl implements TechnicalSpecification |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public BmUrlData checkUrl(BmUrlData data){ |
|
|
public BmUrlData checkUrl(BmUrlData data){ |
|
|
|
|
|
String account = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getDomainControlAccount(); |
|
|
List<SysProxyAddress> addresses=technicalSpecificationMapper.getSysProxyAddress(); |
|
|
List<SysProxyAddress> addresses=technicalSpecificationMapper.getSysProxyAddress(); |
|
|
boolean falseFlag=true; |
|
|
boolean falseFlag=true; |
|
|
for (int i = 0; i <addresses.size() ; i++) { |
|
|
|
|
|
|
|
|
for (SysProxyAddress address : addresses) { |
|
|
// data.setUrl(data.getUrl().replaceAll(addresses.get(i).getPhysicalAddress(), addresses.get(i).getProxyAddress())); |
|
|
// data.setUrl(data.getUrl().replaceAll(addresses.get(i).getPhysicalAddress(), addresses.get(i).getProxyAddress())); |
|
|
String str = data.getUrl().trim(); |
|
|
String str = data.getUrl().trim(); |
|
|
String prefix = addresses.get(i).getPhysicalAddress().trim(); |
|
|
|
|
|
String st3=addresses.get(i).getProxyAddress().trim(); |
|
|
|
|
|
|
|
|
String prefix = address.getPhysicalAddress().trim(); |
|
|
|
|
|
String st3 = address.getProxyAddress().trim(); |
|
|
//用截取替换 避开特殊字符转义 |
|
|
//用截取替换 避开特殊字符转义 |
|
|
if(str.contains(prefix)){ |
|
|
|
|
|
|
|
|
if (str.contains(prefix)) { |
|
|
int index = str.indexOf(prefix); |
|
|
int index = str.indexOf(prefix); |
|
|
int startIndex = index + prefix.length(); |
|
|
int startIndex = index + prefix.length(); |
|
|
String result =st3+ str.substring(startIndex); |
|
|
|
|
|
|
|
|
String result = st3 + str.substring(startIndex); |
|
|
if (!result.endsWith("/")) { |
|
|
if (!result.endsWith("/")) { |
|
|
//判断 如果最后五个字符里面有. 说明地址是文件 如果没有. 说明是路径 后面增加一个斜杠 |
|
|
//判断 如果最后五个字符里面有. 说明地址是文件 如果没有. 说明是路径 后面增加一个斜杠 |
|
|
String lastFiveChars = result.length() > 5 ? result.substring(result.length() - 5) : result; |
|
|
String lastFiveChars = result.length() > 5 ? result.substring(result.length() - 5) : result; |
|
|
if(!lastFiveChars.contains(".")){ |
|
|
|
|
|
|
|
|
if (!lastFiveChars.contains(".")) { |
|
|
result += "/"; |
|
|
result += "/"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
falseFlag=false; |
|
|
|
|
|
|
|
|
falseFlag = false; |
|
|
data.setUrl(result); |
|
|
data.setUrl(result); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if(falseFlag){ |
|
|
if(falseFlag){ |
|
|
throw new RuntimeException("跳转路径未在系统维护,无法跳转!"); |
|
|
throw new RuntimeException("跳转路径未在系统维护,无法跳转!"); |
|
|
} |
|
|
} |
|
|
|
|
|
if (StringUtils.isEmpty(account)){ |
|
|
|
|
|
throw new RuntimeException("未绑定域控账号!"); |
|
|
|
|
|
} |
|
|
|
|
|
if (!checkLdapDirectory.checkUserLdapDirectory(account,data.getUrl().trim())) { |
|
|
|
|
|
throw new RuntimeException("文件服务权限不足!"); |
|
|
|
|
|
} |
|
|
return data; |
|
|
return data; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|