Commit 8a8f9c51 by 陶光胜

导航保存重复验证

parent 3cae87b6
......@@ -19,10 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
@RestController
public class CustomGuideController {
......@@ -35,9 +32,18 @@ public class CustomGuideController {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
JSONArray array = JSON.parseArray(param);
List<CustomGuideDTO> list = new ArrayList<>();
Map<Integer, Object> exist = new HashMap<>();
Map<String, Object> pagePathExist = new HashMap<>();
ServiceResponse<List<GuideTypeDTO>> response = this.customGuideApiService.listGuideType();
for(int i=0; i< array.size(); i++){
JSONObject json = array.getJSONObject(i);
int customLinkType = json.getIntValue("customLinkType");
if(customLinkType != 0 && customLinkType != 7){
if(exist.get(customLinkType) != null){
return RestResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "链接类型不能重复选择");
}
exist.put(customLinkType, customLinkType);
}
CustomGuideDTO guideDTO = new CustomGuideDTO();
guideDTO.setGuideId(json.getInteger("guideId"));
guideDTO.setIcon(json.getString("icon"));
......@@ -45,13 +51,17 @@ public class CustomGuideController {
guideDTO.setEntryCondition(json.getInteger("entryCondition"));
guideDTO.setEnterpriseId(enterpriseId);
guideDTO.setLink(json.getString("link"));
guideDTO.setCustomLinkType(json.getIntValue("customLinkType"));
guideDTO.setCustomLinkType(customLinkType);
guideDTO.setSort(json.getInteger("sort"));
guideDTO.setStatus(json.getInteger("status"));
guideDTO.setAppid(appId);
guideDTO.setIconPath(json.getString("iconPath"));
guideDTO.setSelectedIconPath(json.getString("selectedIconPath"));
this.getPath(guideDTO, list, response.getResult());
if(pagePathExist.get(guideDTO.getCustomPage()) != null){
return RestResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "链接路径不能重复选择");
}
pagePathExist.put(guideDTO.getCustomPage(), guideDTO.getCustomPage());
list.add(guideDTO);
}
if(!isNeedNewVersion && this.isNeedNewVersion(list, enterpriseId, appId)){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment