AppSafetyManagementController.java 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. package com.sooka.sponest.mobile.comprehensive.socialPolicingController;
  2. import com.ruoyi.common.core.constant.HttpStatus;
  3. import com.ruoyi.common.core.web.domain.AjaxResult;
  4. import com.ruoyi.common.core.web.page.PageDomain;
  5. import com.ruoyi.common.core.web.page.TableDataInfo;
  6. import com.ruoyi.common.core.web.page.TableSupport;
  7. import com.ruoyi.common.security.utils.DictUtils;
  8. import com.sooka.sponest.comprehensive.api.comprehensiveSocialPolicing.domain.SafetyManagement;
  9. import com.sooka.sponest.comprehensive.api.comprehensiveSocialPolicing.service.RemoteSafetyManagementService;
  10. import com.ruoyi.common.core.domain.DictKeys;
  11. import org.apache.commons.collections4.MapUtils;
  12. import org.springframework.web.bind.annotation.*;
  13. import javax.annotation.Resource;
  14. import java.util.HashMap;
  15. import java.util.List;
  16. import java.util.Map;
  17. /**
  18. * @Author LG
  19. * @Date 2023/9/13 - 13:44
  20. */
  21. @RestController
  22. @RequestMapping("/AppSafetyManagementController")
  23. public class AppSafetyManagementController {
  24. @Resource
  25. private RemoteSafetyManagementService safetyManagementService;
  26. /**
  27. * 寄递物流安全管理列表
  28. */
  29. @GetMapping("/safetyManagement/list")
  30. public AjaxResult list(SafetyManagement safetyManagement) {
  31. PageDomain pageDomain = TableSupport.buildPageRequest();
  32. Integer pageNum = pageDomain.getPageNum();
  33. Integer pageSize = pageDomain.getPageSize();
  34. TableDataInfo list = safetyManagementService.getList(pageNum, pageSize);
  35. Map<String, Object> typeOfRegistration = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_TYPE_OF_REGISTRATION);
  36. Map<String, Object> holdingInertia = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_HOLDING_INERTIA);
  37. Map<String, Object> businessType = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_BUSINESS_TYPE);
  38. Map<String,Object> comprehensiveCityCode = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE);//籍贯、户籍地、所在地
  39. if (HttpStatus.SUCCESS == list.getCode()) {
  40. List<HashMap<String, Object>> rows = (List<HashMap<String, Object>>) list.getRows();
  41. for (HashMap<String, Object> row : rows) {
  42. row.put("registrationTypeLabel",typeOfRegistration.get(row.get("registrationType")));
  43. row.put("holdingStatusLabel",holdingInertia.get(row.get("holdingStatus")));
  44. row.put("enterpriseTypeLabel",businessType.get(row.get("enterpriseType")));
  45. row.put("businessScopeLabel",DictUtils.getDictDataListByValue(DictKeys.COMPREHENSIVE_BUSINESS_SCOPE, (List<String>) row.get("businessScope")));
  46. row.put("preClosingCheckLabel","1".equals(row.get("preClosingCheck").toString())? "是":"否");
  47. row.put("realNameRegistrationLabel","1".equals(row.get("realNameRegistration").toString())? "是":"否");
  48. row.put("xrayInspectionLabel","1".equals(row.get("xrayInspection").toString())? "是":"否");
  49. row.put("enterprisePlaceLabel", MapUtils.getString(comprehensiveCityCode,MapUtils.getString(row,"enterprisePlace")));
  50. }
  51. return AjaxResult.success(rows);
  52. } else {
  53. return AjaxResult.error(list.getCode(), list.getMsg());
  54. }
  55. }
  56. /**
  57. * 寄递物流安全管理详细信息
  58. */
  59. @GetMapping("/safetyManagement/edit")
  60. public AjaxResult getInfo(SafetyManagement safetyManagement) {
  61. AjaxResult edit = safetyManagementService.getEdit(safetyManagement.getId());
  62. if("200".equals(edit.get("code").toString())){
  63. HashMap<String,Object> data = (HashMap<String, Object>) edit.get("data");
  64. Map<String,Object> comprehensiveCityCode = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE);//籍贯、户籍地、所在地
  65. data.put("registrationTypeLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_TYPE_OF_REGISTRATION,data.get("registrationType").toString()));
  66. data.put("holdingStatusLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_HOLDING_INERTIA,data.get("holdingStatus").toString()));
  67. data.put("enterpriseTypeLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_BUSINESS_TYPE,data.get("enterpriseType").toString()));
  68. data.put("businessScopeLabel",DictUtils.getDictDataListByValue(DictKeys.COMPREHENSIVE_BUSINESS_SCOPE, (List<String>) data.get("businessScope")));
  69. data.put("preClosingCheckLabel","1".equals(data.get("preClosingCheck").toString())? "是":"否");
  70. data.put("realNameRegistrationLabel","1".equals(data.get("realNameRegistration").toString())? "是":"否");
  71. data.put("xrayInspectionLabel","1".equals(data.get("xrayInspection").toString())? "是":"否");
  72. data.put("enterprisePlaceLabel",MapUtils.getString(comprehensiveCityCode,MapUtils.getString(data,"enterprisePlace")));
  73. return AjaxResult.success(data);
  74. }else{
  75. return edit;
  76. }
  77. }
  78. /**
  79. * 新增寄递物流安全管理
  80. */
  81. @PostMapping("/safetyManagement")
  82. public AjaxResult add(@RequestBody String json) {
  83. return safetyManagementService.add(json);
  84. }
  85. /**
  86. * 修改寄递物流安全管理
  87. */
  88. @PostMapping("/safetyManagement/put")
  89. public AjaxResult edit(@RequestBody String json) {
  90. return safetyManagementService.edit(json);
  91. }
  92. /**
  93. * 删除寄递物流安全管理
  94. */
  95. @GetMapping("/safetyManagement/del")
  96. public AjaxResult remove(@RequestParam("id") List<String> id) {
  97. return safetyManagementService.del(id.toArray(new String[0]));
  98. }
  99. }