切换分支备份

dev_20240306
anthonywj 1 year ago
parent a0b6eb4b27
commit c30ba149f9

@ -38,7 +38,6 @@ import java.util.stream.Collectors;
/** /**
* *
*
*/ */
@Validated @Validated
@RequiredArgsConstructor @RequiredArgsConstructor
@ -128,7 +127,7 @@ public class SysCustomConfigController extends BaseController {
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@PostMapping("/getConfigs") @PostMapping("/getConfigs")
@Log(title = "界面配置管理") @Log(title = "界面配置管理")
public BaseResponse getConfigs(@RequestBody SysCustomConfigRequest request,BindingResult bindingResult) { public BaseResponse getConfigs(@RequestBody SysCustomConfigRequest request, BindingResult bindingResult) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
@ -143,40 +142,40 @@ public class SysCustomConfigController extends BaseController {
detailRequest.setIsShow("1"); detailRequest.setIsShow("1");
// detailRequest.setType(request.getType()); // detailRequest.setType(request.getType());
List<SysCustomConfigDetailEntity> detailList = sysCustomConfigDetailService.filterSysCustomConfigDetail(detailRequest); List<SysCustomConfigDetailEntity> detailList = sysCustomConfigDetailService.filterSysCustomConfigDetail(detailRequest);
Map<String,List<SysCustomConfigDetailEntity>> map = detailList.stream().collect( Map<String, List<SysCustomConfigDetailEntity>> map = detailList.stream().collect(
Collectors.groupingBy(SysCustomConfigDetailEntity::getType)); Collectors.groupingBy(SysCustomConfigDetailEntity::getType));
List<SysCustomConfigDetailEntity> tableList = map.get("1") == null? Lists.newArrayList():map.get("1"); List<SysCustomConfigDetailEntity> tableList = map.get("1") == null ? Lists.newArrayList() : map.get("1");
List<SysCustomConfigDetailEntity> queryList = map.get("2") == null? Lists.newArrayList():map.get("2"); List<SysCustomConfigDetailEntity> queryList = map.get("2") == null ? Lists.newArrayList() : map.get("2");
List<SysCustomConfigDetailEntity> fromList = map.get("3") == null? Lists.newArrayList():map.get("3"); List<SysCustomConfigDetailEntity> fromList = map.get("3") == null ? Lists.newArrayList() : map.get("3");
List<SysCustomConfigDetailEntity> fromSortList = fromList.stream().sorted(Comparator.comparing(SysCustomConfigDetailEntity::getLineNumber)).collect(Collectors.toList()); List<SysCustomConfigDetailEntity> fromSortList = fromList.stream().sorted(Comparator.comparing(SysCustomConfigDetailEntity::getLineNumber)).collect(Collectors.toList());
Map<Integer,List<SysCustomConfigDetailEntity>> fromMap = fromSortList.stream().collect( Map<Integer, List<SysCustomConfigDetailEntity>> fromMap = fromSortList.stream().collect(
Collectors.groupingBy(SysCustomConfigDetailEntity::getLineNumber,LinkedHashMap::new,Collectors.toList())); Collectors.groupingBy(SysCustomConfigDetailEntity::getLineNumber, LinkedHashMap::new, Collectors.toList()));
List<SysCustomConfigFromDetailResponse> fromDetailList = Lists.newArrayList(); List<SysCustomConfigFromDetailResponse> fromDetailList = Lists.newArrayList();
for (Map.Entry<Integer, List<SysCustomConfigDetailEntity>> entry : fromMap.entrySet()) { for (Map.Entry<Integer, List<SysCustomConfigDetailEntity>> entry : fromMap.entrySet()) {
SysCustomConfigFromDetailResponse sysCustomConfigFromDetailResponse = new SysCustomConfigFromDetailResponse(); SysCustomConfigFromDetailResponse sysCustomConfigFromDetailResponse = new SysCustomConfigFromDetailResponse();
sysCustomConfigFromDetailResponse.setNumber(entry.getKey()); sysCustomConfigFromDetailResponse.setNumber(entry.getKey());
List<SysCustomConfigDetailEntity> entities = entry.getValue(); List<SysCustomConfigDetailEntity> entities = entry.getValue();
entities.stream().forEach(s->{ entities.stream().forEach(s -> {
if(StringUtils.isNotEmpty(s.getCheckRules())){ if (StringUtils.isNotEmpty(s.getCheckRules())) {
String replacedJsonString = s.getCheckRules().replaceAll("(\\w+)(\\s*:\\s*)", "\"$1\"$2"); String replacedJsonString = s.getCheckRules().replaceAll("(\\w+)(\\s*:\\s*)", "\"$1\"$2");
JSONArray object = JSONArray.parseArray(replacedJsonString); JSONArray object = JSONArray.parseArray(replacedJsonString);
s.setCheckRulesObj(object); s.setCheckRulesObj(object);
} }
if(StringUtils.isNotEmpty(s.getLableRule())){ if (StringUtils.isNotEmpty(s.getLableRule())) {
JSONObject objectLaber = JSONObject.parseObject(s.getLableRule()); JSONObject objectLaber = JSONObject.parseObject(s.getLableRule());
List<Map> mapList = Lists.newArrayList(); List<Map> mapList = Lists.newArrayList();
Iterator<String> it = objectLaber.keySet().iterator(); Iterator<String> it = objectLaber.keySet().iterator();
String inputType = s.getInputType(); String inputType = s.getInputType();
while(it.hasNext()) { while (it.hasNext()) {
Map<String,Object> mapTemp = Maps.newHashMap(); Map<String, Object> mapTemp = Maps.newHashMap();
String key = (String) it.next(); String key = (String) it.next();
String value = objectLaber.getString(key); String value = objectLaber.getString(key);
mapTemp.put("label", value); mapTemp.put("label", value);
if("number".equals(inputType)){ if ("number".equals(inputType)) {
mapTemp.put("value", Integer.parseInt(key)); mapTemp.put("value", Integer.parseInt(key));
}else{ } else {
mapTemp.put("value", key); mapTemp.put("value", key);
} }
mapList.add(mapTemp); mapList.add(mapTemp);
@ -188,23 +187,23 @@ public class SysCustomConfigController extends BaseController {
fromDetailList.add(sysCustomConfigFromDetailResponse); fromDetailList.add(sysCustomConfigFromDetailResponse);
} }
tableList.stream().forEach(s->{ tableList.stream().forEach(s -> {
if(StringUtils.isNotEmpty(s.getLableRule())) { if (StringUtils.isNotEmpty(s.getLableRule())) {
JSONObject objectLaber = JSONObject.parseObject(s.getLableRule()); JSONObject objectLaber = JSONObject.parseObject(s.getLableRule());
s.setLableRuleObj(objectLaber); s.setLableRuleObj(objectLaber);
} }
if(StringUtils.isNotEmpty(s.getButtonRule())){ if (StringUtils.isNotEmpty(s.getButtonRule())) {
JSONArray objectButton = JSONArray.parseArray(s.getButtonRule()); JSONArray objectButton = JSONArray.parseArray(s.getButtonRule());
s.setButtonRulObj(objectButton); s.setButtonRulObj(objectButton);
} }
}); });
queryList.stream().forEach(s->{ queryList.stream().forEach(s -> {
if(StringUtils.isNotEmpty(s.getLableRule())){ if (StringUtils.isNotEmpty(s.getLableRule())) {
JSONObject objectLaber = JSONObject.parseObject(s.getLableRule()); JSONObject objectLaber = JSONObject.parseObject(s.getLableRule());
List<Map> mapList = Lists.newArrayList(); List<Map> mapList = Lists.newArrayList();
Iterator<String> it = objectLaber.keySet().iterator(); Iterator<String> it = objectLaber.keySet().iterator();
while(it.hasNext()) { while (it.hasNext()) {
Map<String,String> mapTemp = Maps.newHashMap(); Map<String, String> mapTemp = Maps.newHashMap();
String key = (String) it.next(); String key = (String) it.next();
String value = objectLaber.getString(key); String value = objectLaber.getString(key);
mapTemp.put("label", value); mapTemp.put("label", value);

Loading…
Cancel
Save