|
|
@ -20,9 +20,11 @@ import com.ccsens.ptos_tall.persist.dao.SysAuthDao; |
|
|
|
import com.ccsens.ptos_tall.persist.mapper.OpenBusinessMapper; |
|
|
|
import com.ccsens.ptos_tall.util.PtOsCodeError; |
|
|
|
import com.ccsens.ptos_tall.util.PtOsConstant; |
|
|
|
import com.ccsens.util.CodeEnum; |
|
|
|
import com.ccsens.util.JsonResponse; |
|
|
|
import com.ccsens.util.RestTemplateUtil; |
|
|
|
import com.ccsens.util.WebConstant; |
|
|
|
import com.ccsens.util.exception.BaseException; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
@ -223,18 +225,41 @@ public class ProjectService implements IProjectService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void moveProject(ProjectDto.MoveProject param) { |
|
|
|
public void moveProject(String token, ProjectDto.MoveProject param) { |
|
|
|
//TODO 当前版本不判断权限
|
|
|
|
//根据服务code查询服务
|
|
|
|
OpenBusiness openBusiness; |
|
|
|
OpenBusinessExample openBusinessExample = new OpenBusinessExample(); |
|
|
|
openBusinessExample.createCriteria().andCodeEqualTo(param.getBusinessCode()); |
|
|
|
List<OpenBusiness> openBusinesses = businessMapper.selectByExample(openBusinessExample); |
|
|
|
if(CollectionUtil.isEmpty(openBusinesses)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
openBusinesses.forEach(openBusiness -> { |
|
|
|
//TODO 调用服务内的接口修改项目顺序
|
|
|
|
|
|
|
|
}); |
|
|
|
openBusiness = openBusinesses.get(0); |
|
|
|
if(ObjectUtil.isNotNull(openBusiness)){ |
|
|
|
//调用服务内的接口
|
|
|
|
String url = openBusiness.getUrl() + "/tall/project/drag"; |
|
|
|
log.info("调用接口:{}--", url); |
|
|
|
String postBody; |
|
|
|
try{ |
|
|
|
Map<String,String> map = new HashMap<>(); |
|
|
|
map.put(WebConstant.HEADER_KEY_TOKEN, token); |
|
|
|
postBody = RestTemplateUtil.postBodySpecialHeader(url, param,map); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("移动项目列表接口失败--" + openBusiness.getName() + e); |
|
|
|
throw new BaseException(CodeEnum.THIRD_ERROR); |
|
|
|
} |
|
|
|
if(StrUtil.isBlank(postBody)) { |
|
|
|
throw new BaseException(CodeEnum.THIRD_ERROR); |
|
|
|
} |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(postBody); |
|
|
|
log.info("接口返回:{}", jsonObject); |
|
|
|
//请求正确返回则修改最后应答时间,否则无操作
|
|
|
|
Integer code = jsonObject.getInteger("code"); |
|
|
|
if (code == null || code != 200) { |
|
|
|
String msg = jsonObject.getString("msg"); |
|
|
|
throw new BaseException(code,StrUtil.isBlank(msg) ? null : msg); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|