修改对接接口

This commit is contained in:
梁琦涛
2024-01-25 17:51:53 +08:00
parent ce698cb30d
commit fba591ea38
3 changed files with 30 additions and 24 deletions
@@ -75,11 +75,11 @@ public class SrmsApiController {
@PostMapping("/getByLawsProductDesign") @PostMapping("/getByLawsProductDesign")
public JSONObject getByLawsProductDesign(@RequestBody JSONObject json, HttpServletRequest req){ public JSONObject getByLawsProductDesign(@RequestBody JSONObject json, HttpServletRequest req){
try { try {
Result<List<ProductDesign>> re = srmsApiService.getByLawsProductDesign(json,req); Result<List<JSONObject>> re = srmsApiService.getByLawsProductDesign(json,req);
if(!re.isSuccess()){ if(!re.isSuccess()){
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr(re.getMessage())); return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr(re.getMessage()));
} }
List<ProductDesign> list = re.getResult(); List<JSONObject> list = re.getResult();
JSONObject jsonResponses = ResponsesUtil.getJsonOk(); JSONObject jsonResponses = ResponsesUtil.getJsonOk();
jsonResponses.put("Rows",list); jsonResponses.put("Rows",list);
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses); return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
@@ -3,7 +3,6 @@ package com.jero.modules.docking.srms.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.modules.docking.srms.dto.ProductDesign;
import com.jero.modules.docking.srms.vo.ByFileRows; import com.jero.modules.docking.srms.vo.ByFileRows;
import com.jero.modules.docking.srms.vo.StandardPageVO; import com.jero.modules.docking.srms.vo.StandardPageVO;
import com.jero.modules.docking.srms.vo.StandardTree; import com.jero.modules.docking.srms.vo.StandardTree;
@@ -45,7 +44,7 @@ public interface SrmsApiService {
* @param req * @param req
* @return com.jero.common.api.vo.Result<com.alibaba.fastjson.JSONObject> * @return com.jero.common.api.vo.Result<com.alibaba.fastjson.JSONObject>
*/ */
Result<List<ProductDesign>> getByLawsProductDesign(JSONObject json, HttpServletRequest req); Result<List<JSONObject>> getByLawsProductDesign(JSONObject json, HttpServletRequest req);
/** /**
* 获取所有体系数据 * 获取所有体系数据
@@ -282,7 +282,7 @@ public class SrmsApiServiceImpl implements SrmsApiService {
} }
@Override @Override
public Result<List<ProductDesign>> getByLawsProductDesign(JSONObject json, HttpServletRequest req) { public Result<List<JSONObject>> getByLawsProductDesign(JSONObject json, HttpServletRequest req) {
// 验证token // 验证token
String token = req.getHeader(X_ACCESS_TOKEN); String token = req.getHeader(X_ACCESS_TOKEN);
if(StringUtils.isBlank(token) || !Objects.equals(TokenUtils.getTokenByRequest(req),token)){ if(StringUtils.isBlank(token) || !Objects.equals(TokenUtils.getTokenByRequest(req),token)){
@@ -311,11 +311,17 @@ public class SrmsApiServiceImpl implements SrmsApiService {
listProductDesign.add(productDesign); listProductDesign.add(productDesign);
} }
try { try {
List<JSONObject> listObj = new ArrayList<>();
for (ProductDesign productDesign : listProductDesign) { for (ProductDesign productDesign : listProductDesign) {
String str = lawsStandardMapper.getStandardByProductDesign(productDesign.getStandardNumber(),productDesign.getQueryLabels()); String str = lawsStandardMapper.getStandardByProductDesign(productDesign.getStandardNumber(),productDesign.getQueryLabels());
productDesign.setItemContent(str); JSONObject obj = new JSONObject();
obj.put("ID",productDesign.getId());
obj.put("queryLabels",productDesign.getQueryLabels());
obj.put("itemContent",str);
obj.put(STANDARD_NUMBER,productDesign.getStandardNumber());
listObj.add(obj);
} }
return Result.OK(listProductDesign); return Result.OK(listObj);
}catch (Exception e){ }catch (Exception e){
log.error("设计导航-产品设计条款查询异常:",e); log.error("设计导航-产品设计条款查询异常:",e);
return Result.error("操作失败" + e.getMessage()); return Result.error("操作失败" + e.getMessage());
@@ -353,7 +359,9 @@ public class SrmsApiServiceImpl implements SrmsApiService {
} }
private void getStandardTree(List<StandardTree> listStandardTreeAll, List<LawsTreeNodeModel> listEnterprise,String nodeName) { private void getStandardTree(List<StandardTree> listStandardTreeAll, List<LawsTreeNodeModel> listEnterprise,String nodeName) {
if (!CollectionUtils.isEmpty(listEnterprise)) { if (CollectionUtils.isEmpty(listEnterprise)) {
return;
}
Optional<LawsTreeNodeModel> op = listEnterprise.stream().filter(o -> StringUtils.isBlank(o.getParentId())).findFirst(); Optional<LawsTreeNodeModel> op = listEnterprise.stream().filter(o -> StringUtils.isBlank(o.getParentId())).findFirst();
if (op.isPresent()) { if (op.isPresent()) {
LawsTreeNodeModel lawsTreeNodeModel = op.get(); LawsTreeNodeModel lawsTreeNodeModel = op.get();
@@ -375,7 +383,6 @@ public class SrmsApiServiceImpl implements SrmsApiService {
} }
} }
} }
}
private List<StandardTree> getTree(List<LawsTreeNodeModel> listEnterprise){ private List<StandardTree> getTree(List<LawsTreeNodeModel> listEnterprise){
if(CollectionUtils.isEmpty(listEnterprise)){ if(CollectionUtils.isEmpty(listEnterprise)){