|
@@ -46,23 +46,20 @@ public class AppPersonBasicInfoController {
|
|
|
@GetMapping("/PersonBasicInfo/edit")
|
|
|
public AjaxResult getInfo(EnvironmentBiggas biggas) {
|
|
|
AjaxResult ajaxResult = personBasicInfoService.getEdit(biggas.getId());
|
|
|
-
|
|
|
if ("200".equals(ajaxResult.get("code").toString())) {
|
|
|
- Map<String, Object> info = (Map<String, Object>) ajaxResult.get("data");
|
|
|
- HashMap<String, Object> basicInfo = (HashMap<String, Object>) info.get("basecInfo");
|
|
|
+ Map<String, Object> data = (Map<String, Object>) ajaxResult.get("data");
|
|
|
+ HashMap<String, Object> basicInfo = (HashMap<String, Object>) data.get("basecInfo");
|
|
|
setPersonBasicInfo(basicInfo);
|
|
|
List<HashMap<String, Object>> userBinds = (List<HashMap<String, Object>>) basicInfo.get("userBinds");
|
|
|
- ArrayList<HashMap<String, Object>> otherInfo = (ArrayList<HashMap<String, Object>>) info.get("otherInfo");
|
|
|
- for (HashMap<String, Object> bind : userBinds) {
|
|
|
- for (HashMap<String, Object> data : otherInfo) {
|
|
|
- if (data.get("id").equals(bind.get("otherPersonId"))) {//判断绑定的id与其他类型的id是否一致
|
|
|
- //id一致时,设置字典值
|
|
|
- setLabel(data, (Integer) bind.get("otherPersonType"));
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return AjaxResult.success(info);
|
|
|
+ ArrayList<HashMap<String, Object>> otherInfo = (ArrayList<HashMap<String, Object>>) data.get("otherInfo");
|
|
|
+
|
|
|
+ userBinds.forEach(bind -> {
|
|
|
+ otherInfo.stream()
|
|
|
+ .filter(info -> info.get("id").equals(bind.get("otherPersonId")))
|
|
|
+ .findFirst()
|
|
|
+ .ifPresent(info -> setLabel(info, (Integer) bind.get("otherPersonType")));
|
|
|
+ });
|
|
|
+ return AjaxResult.success(data);
|
|
|
} else {
|
|
|
return ajaxResult;
|
|
|
}
|
|
@@ -72,7 +69,6 @@ public class AppPersonBasicInfoController {
|
|
|
switch (type) {
|
|
|
case 1:
|
|
|
setRegisteredPopulation(json);
|
|
|
-
|
|
|
break;
|
|
|
case 2:
|
|
|
setFloatingPopulation(json);
|
|
@@ -88,27 +84,6 @@ public class AppPersonBasicInfoController {
|
|
|
break;
|
|
|
case 6:
|
|
|
setCommunityCorrectionStaff(json);
|
|
|
- /*JSONArray communityBinds = json.getJSONArray("communityBinds");
|
|
|
- List<String> comOneList = new ArrayList<>();
|
|
|
- List<String> comTwoList = new ArrayList<>();
|
|
|
- List<String> comThreeList = new ArrayList<>();
|
|
|
- for (Object communityBind : communityBinds) {
|
|
|
- JSONObject bind = (JSONObject) JSONObject.toJSON(communityBind);
|
|
|
- switch (bind.getString("bindType")){
|
|
|
- case "1":
|
|
|
- comOneList.add(bind.getString("bindValue"));
|
|
|
- break;
|
|
|
- case "2":
|
|
|
- comTwoList.add(bind.getString("bindValue"));
|
|
|
- break;
|
|
|
- case "3":
|
|
|
- comThreeList.add(bind.getString("bindValue"));
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- json.put("fourHistoriesListLabel",getDictDataList("comprehensive_four_histories_situation", comOneList));//“四史”情况
|
|
|
- json.put("threeStepListLabel",getDictDataList("comprehensive_three_involved_situation", comTwoList));//“三涉”情况
|
|
|
- json.put("correctionTeamCompositionListLabel",getDictDataList("comprehensive_corrections_team_composition_type", comThreeList));//矫正小组人员组成情况*/
|
|
|
break;
|
|
|
case 7:
|
|
|
setPsychosisPopulation(json);
|
|
@@ -131,7 +106,7 @@ public class AppPersonBasicInfoController {
|
|
|
*/
|
|
|
@PostMapping("/PersonBasicInfo")
|
|
|
public AjaxResult add(@RequestBody String json) {
|
|
|
- return personBasicInfoService.add(json);
|
|
|
+ return personBasicInfoService.add(dataToList(json));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -139,7 +114,19 @@ public class AppPersonBasicInfoController {
|
|
|
*/
|
|
|
@PostMapping("/PersonBasicInfo/put")
|
|
|
public AjaxResult edit(@RequestBody String json) {
|
|
|
- return personBasicInfoService.edit(json);
|
|
|
+ return personBasicInfoService.edit(dataToList(json));
|
|
|
+ }
|
|
|
+
|
|
|
+ private String dataToList(String json){
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(json);
|
|
|
+ Set<String> strings = jsonObject.keySet();
|
|
|
+ JSONArray list = new JSONArray();
|
|
|
+ list.add(jsonObject.getJSONObject("basicInfo"));
|
|
|
+ strings.remove("basicInfo");
|
|
|
+ for (String string : strings) {
|
|
|
+ list.add(jsonObject.getJSONObject(string));
|
|
|
+ }
|
|
|
+ return JSONArray.toJSONString(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -153,12 +140,9 @@ public class AppPersonBasicInfoController {
|
|
|
// private void setPersonBasicInfo(JSONObject basicInfo){
|
|
|
private void setPersonBasicInfo(HashMap<String, Object> basicInfo) {//0
|
|
|
basicInfo.put("genderLabel", getDictData("comprehensive_sex", String.valueOf(basicInfo.get("gender"))));//性别字典值
|
|
|
-// basicInfo.put("nativePlaceLabel", getDictData("",basicInfo.getString("nativePlace")));//籍贯字典值
|
|
|
basicInfo.put("nationLabel", getDictData("comprehensive_nation", String.valueOf(basicInfo.get("nation"))));//民族字典值
|
|
|
- basicInfo.put("maritalStatusLabel", getDictData("comprehensive_marital_status", String.valueOf(basicInfo.get("maritalStatus"))));//婚庆状况字典值
|
|
|
+ basicInfo.put("maritalStatusLabel", getDictData("comprehensive_marital_status", String.valueOf(basicInfo.get("maritalStatus"))));//婚姻状况字典值
|
|
|
basicInfo.put("educationLabel", getDictData("comprehensive_educational_background", String.valueOf(basicInfo.get("education"))));//学历字典值
|
|
|
-// basicInfo.put("householdRegistrationLabel", getDictData("",basicInfo.getString("householdRegistration")));//户籍地字典值
|
|
|
-// basicInfo.put("currentResidencePlaceLabel", getDictData("",basicInfo.getString("currentResidencePlace")));//现住地字典值
|
|
|
basicInfo.put("religiousBeliefLabel", null == basicInfo.get("religiousBelief") ? null : getDictData("comprehensive_religious_belief", String.valueOf(basicInfo.get("religiousBelief"))));//宗教信仰字典值
|
|
|
basicInfo.put("politicalOutlookLabel", getDictData("comprehensive_political_status", String.valueOf(basicInfo.get("politicalOutlook"))));//政治面貌字典值
|
|
|
basicInfo.put("occupationalCategoryLabel", getDictData("comprehensive_occupational_category", String.valueOf(basicInfo.get("occupationalCategory"))));//职业类别字典值
|
|
@@ -208,9 +192,9 @@ public class AppPersonBasicInfoController {
|
|
|
json.put("recidivismLabel", null == json.get("recidivism") ? null : "1".equals(json.get("recidivism")) ? "是" : "否");//是否累惯犯
|
|
|
json.put("establishCorrectionTeamLabel", "1".equals(json.get("establishCorrectionTeam")) ? "是" : "否");//是否建立矫正小组
|
|
|
json.put("reoffendLabel", "1".equals(json.get("reoffend")) ? "是" : "否");//是否重新犯罪
|
|
|
- json.put("fourHistoriesListLabel", getDictDataList("comprehensive_four_histories_situation", (List<String>) json.get("fourHistoriesList")));
|
|
|
- json.put("threeStepListLabel", getDictDataList("comprehensive_three_involved_situation", (List<String>) json.get("threeStepList")));
|
|
|
- json.put("correctionTeamCompositionListLabel", getDictDataList("comprehensive_corrections_team_composition_type", (List<String>) json.get("correctionTeamCompositionList")));
|
|
|
+ json.put("fourHistoriesListLabel", getDictDataList("comprehensive_four_histories_situation", (List<String>) json.get("fourHistoriesList")));//“四史”情况
|
|
|
+ json.put("threeStepListLabel", getDictDataList("comprehensive_three_involved_situation", (List<String>) json.get("threeStepList")));//“三涉”情况
|
|
|
+ json.put("correctionTeamCompositionListLabel", getDictDataList("comprehensive_corrections_team_composition_type", (List<String>) json.get("correctionTeamCompositionList")));//矫正小组人员组成情况
|
|
|
}
|
|
|
|
|
|
private void setPsychosisPopulation(HashMap<String, Object> json) {//7
|