AppSafetyManagementController.java 4.9 KB

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