|
|
|
@ -25,9 +25,11 @@ import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : 字典管理服务
|
|
|
|
@ -53,6 +55,7 @@ public class SysDictionaryController extends CoreBaseController{
|
|
|
|
|
ValidatorBean.beginValid(sysDictionary)
|
|
|
|
|
.notNull("id",sysDictionary.getId())
|
|
|
|
|
.notNull("name",sysDictionary.getName())
|
|
|
|
|
.notNull("softType",sysDictionary.getSoftType())
|
|
|
|
|
.notNull("dictionaryCode",sysDictionary.getDictionaryCode())
|
|
|
|
|
.notNull("dictionaryValue",sysDictionary.getDictionaryValue());
|
|
|
|
|
|
|
|
|
@ -78,6 +81,7 @@ public class SysDictionaryController extends CoreBaseController{
|
|
|
|
|
// 条件验证
|
|
|
|
|
ValidatorBean.beginValid(sysDictionary)
|
|
|
|
|
.notNull("name",sysDictionary.getName())
|
|
|
|
|
.notNull("softType",sysDictionary.getSoftType())
|
|
|
|
|
.notNull("dictionaryCode",sysDictionary.getDictionaryCode())
|
|
|
|
|
.notNull("dictionaryValue",sysDictionary.getDictionaryValue());
|
|
|
|
|
|
|
|
|
@ -159,11 +163,11 @@ public class SysDictionaryController extends CoreBaseController{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/find/{code}")
|
|
|
|
|
@ApiOperation(value = "根据父级code查询字典项", notes = "根据父级code查询字典项")
|
|
|
|
|
public ResultBean findSysDictionaryByParentCode(@PathVariable("code") String code) {
|
|
|
|
|
@GetMapping(value = "/find/{softType}/{code}")
|
|
|
|
|
@ApiOperation(value = "根据微服务与父级code查询字典项", notes = "根据微服务与父级code查询字典项")
|
|
|
|
|
public ResultBean findSysDictionaryByParentCode(@PathVariable("softType")Integer softType,@PathVariable("code") String code) {
|
|
|
|
|
try {
|
|
|
|
|
List<SysDictionary> sysDictionaryList = sysDictionaryService.findSysDictionaryByParentCode(code);
|
|
|
|
|
List<SysDictionary> sysDictionaryList = sysDictionaryService.findSysDictionaryBySoftTypeAndParentCode(softType,code);
|
|
|
|
|
return ResultBean.success("操作成功").setResultList(sysDictionaryList).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
@ -176,16 +180,25 @@ public class SysDictionaryController extends CoreBaseController{
|
|
|
|
|
@ApiOperation(value = "查询跟用户相关所有字典")
|
|
|
|
|
public ResultBean findSysDictionaryUserInfo() {
|
|
|
|
|
try {
|
|
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
|
|
|
resultMap.put("1",sysDictionaryService.findSysDictionaryByParentCode(BaseConstWords.DICTIONARY_SEX));
|
|
|
|
|
resultMap.put("2",sysDictionaryService.findSysDictionaryByParentCode(BaseConstWords.DICTIONARY_FILE_TYPE));
|
|
|
|
|
resultMap.put("3",sysDictionaryService.findSysDictionaryByParentCode(BaseConstWords.DICTIONARY_MARRIAGE));
|
|
|
|
|
resultMap.put("4",sysDictionaryService.findSysDictionaryByParentCode(BaseConstWords.DICTIONARY_EDUCATION));
|
|
|
|
|
resultMap.put("5",sysDictionaryService.findSysDictionaryByParentCode(BaseConstWords.DICTIONARY_NATIONALITY));
|
|
|
|
|
resultMap.put("6",sysDictionaryService.findSysDictionaryByParentCode(BaseConstWords.DICTIONARY_CERTIFICATE_TYPE));
|
|
|
|
|
resultMap.put("7",sysDictionaryService.findSysDictionaryByParentCode(BaseConstWords.DICTIONARY_EMPLOYEE_GRADE));
|
|
|
|
|
resultMap.put("8",sysDictionaryService.findSysDictionaryByParentCode(BaseConstWords.DICTIONARY_POLITICAL_STATUS));
|
|
|
|
|
resultMap.put("9",sysDictionaryService.findSysDictionaryByParentCode(BaseConstWords.DICTIONARY_EMPLOYEE_TYPE));
|
|
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
|
resultMap.put("1", sysDictionaryService.findSysDictionaryBySoftTypeAndParentCode(
|
|
|
|
|
CommonEnumUtil.SOFT_TYPE.CORE.getValue(), BaseConstWords.DICTIONARY_SEX));
|
|
|
|
|
resultMap.put("2", sysDictionaryService.findSysDictionaryBySoftTypeAndParentCode(
|
|
|
|
|
CommonEnumUtil.SOFT_TYPE.CORE.getValue(), BaseConstWords.DICTIONARY_FILE_TYPE));
|
|
|
|
|
resultMap.put("3", sysDictionaryService.findSysDictionaryBySoftTypeAndParentCode(
|
|
|
|
|
CommonEnumUtil.SOFT_TYPE.CORE.getValue(), BaseConstWords.DICTIONARY_MARRIAGE));
|
|
|
|
|
resultMap.put("4", sysDictionaryService.findSysDictionaryBySoftTypeAndParentCode(
|
|
|
|
|
CommonEnumUtil.SOFT_TYPE.CORE.getValue(), BaseConstWords.DICTIONARY_EDUCATION));
|
|
|
|
|
resultMap.put("5", sysDictionaryService.findSysDictionaryBySoftTypeAndParentCode(
|
|
|
|
|
CommonEnumUtil.SOFT_TYPE.CORE.getValue(), BaseConstWords.DICTIONARY_NATIONALITY));
|
|
|
|
|
resultMap.put("6", sysDictionaryService.findSysDictionaryBySoftTypeAndParentCode(
|
|
|
|
|
CommonEnumUtil.SOFT_TYPE.CORE.getValue(), BaseConstWords.DICTIONARY_CERTIFICATE_TYPE));
|
|
|
|
|
resultMap.put("7", sysDictionaryService.findSysDictionaryBySoftTypeAndParentCode(
|
|
|
|
|
CommonEnumUtil.SOFT_TYPE.CORE.getValue(), BaseConstWords.DICTIONARY_EMPLOYEE_GRADE));
|
|
|
|
|
resultMap.put("8", sysDictionaryService.findSysDictionaryBySoftTypeAndParentCode(
|
|
|
|
|
CommonEnumUtil.SOFT_TYPE.CORE.getValue(), BaseConstWords.DICTIONARY_POLITICAL_STATUS));
|
|
|
|
|
resultMap.put("9", sysDictionaryService.findSysDictionaryBySoftTypeAndParentCode(
|
|
|
|
|
CommonEnumUtil.SOFT_TYPE.CORE.getValue(), BaseConstWords.DICTIONARY_EMPLOYEE_TYPE));
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("操作成功").setResultMap(resultMap).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
@ -256,4 +269,30 @@ public class SysDictionaryController extends CoreBaseController{
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/tree")
|
|
|
|
|
@ApiOperation(value = "查询字典树",notes = "查询字典树")
|
|
|
|
|
public ResultBean findSysDictionaryTree(){
|
|
|
|
|
try {
|
|
|
|
|
// 根据软件类型分组
|
|
|
|
|
Map group = sysDictionaryService.findSysDictionaryByTop().stream().collect(Collectors.groupingBy(SysDictionary::getSoftType));
|
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> dictTree = new ArrayList<>();
|
|
|
|
|
Map child;
|
|
|
|
|
for (CommonEnumUtil.SOFT_TYPE softType :CommonEnumUtil.SOFT_TYPE.values()) {
|
|
|
|
|
if(group.containsKey(softType.getValue())){
|
|
|
|
|
child = new HashMap();
|
|
|
|
|
child.put("id",softType.getCode());
|
|
|
|
|
child.put("name",softType.getValue());
|
|
|
|
|
child.put("childList",group.get(softType.getValue()));
|
|
|
|
|
dictTree.add(child);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(dictTree);
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|