package com.sooka.sponest.mobile.comprehensive.socialPolicingController; import com.ruoyi.common.core.constant.HttpStatus; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageDomain; import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.core.web.page.TableSupport; import com.ruoyi.common.security.utils.DictUtils; import com.sooka.sponest.comprehensive.api.comprehensiveSocialPolicing.domain.SafetyManagement; import com.sooka.sponest.comprehensive.api.comprehensiveSocialPolicing.service.RemoteSafetyManagementService; import com.ruoyi.common.core.domain.DictKeys; import org.apache.commons.collections4.MapUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @Author LG * @Date 2023/9/13 - 13:44 */ @RestController @RequestMapping("/AppSafetyManagementController") public class AppSafetyManagementController { @Resource private RemoteSafetyManagementService safetyManagementService; /** * 寄递物流安全管理列表 */ @GetMapping("/safetyManagement/list") public AjaxResult list(SafetyManagement safetyManagement) { PageDomain pageDomain = TableSupport.buildPageRequest(); Integer pageNum = pageDomain.getPageNum(); Integer pageSize = pageDomain.getPageSize(); TableDataInfo list = safetyManagementService.getList(pageNum, pageSize); Map typeOfRegistration = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_TYPE_OF_REGISTRATION); Map holdingInertia = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_HOLDING_INERTIA); Map businessType = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_BUSINESS_TYPE); Map comprehensiveCityCode = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE);//籍贯、户籍地、所在地 if (HttpStatus.SUCCESS == list.getCode()) { List> rows = (List>) list.getRows(); for (HashMap row : rows) { row.put("registrationTypeLabel",typeOfRegistration.get(row.get("registrationType"))); row.put("holdingStatusLabel",holdingInertia.get(row.get("holdingStatus"))); row.put("enterpriseTypeLabel",businessType.get(row.get("enterpriseType"))); row.put("businessScopeLabel",DictUtils.getDictDataListByValue(DictKeys.COMPREHENSIVE_BUSINESS_SCOPE, (List) row.get("businessScope"))); row.put("preClosingCheckLabel","1".equals(row.get("preClosingCheck").toString())? "是":"否"); row.put("realNameRegistrationLabel","1".equals(row.get("realNameRegistration").toString())? "是":"否"); row.put("xrayInspectionLabel","1".equals(row.get("xrayInspection").toString())? "是":"否"); row.put("enterprisePlaceLabel", MapUtils.getString(comprehensiveCityCode,MapUtils.getString(row,"enterprisePlace"))); } return AjaxResult.success(rows); } else { return AjaxResult.error(list.getCode(), list.getMsg()); } } /** * 寄递物流安全管理详细信息 */ @GetMapping("/safetyManagement/edit") public AjaxResult getInfo(SafetyManagement safetyManagement) { AjaxResult edit = safetyManagementService.getEdit(safetyManagement.getId()); if("200".equals(edit.get("code").toString())){ HashMap data = (HashMap) edit.get("data"); Map comprehensiveCityCode = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE);//籍贯、户籍地、所在地 data.put("registrationTypeLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_TYPE_OF_REGISTRATION,data.get("registrationType").toString())); data.put("holdingStatusLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_HOLDING_INERTIA,data.get("holdingStatus").toString())); data.put("enterpriseTypeLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_BUSINESS_TYPE,data.get("enterpriseType").toString())); data.put("businessScopeLabel",DictUtils.getDictDataListByValue(DictKeys.COMPREHENSIVE_BUSINESS_SCOPE, (List) data.get("businessScope"))); data.put("preClosingCheckLabel","1".equals(data.get("preClosingCheck").toString())? "是":"否"); data.put("realNameRegistrationLabel","1".equals(data.get("realNameRegistration").toString())? "是":"否"); data.put("xrayInspectionLabel","1".equals(data.get("xrayInspection").toString())? "是":"否"); data.put("enterprisePlaceLabel",MapUtils.getString(comprehensiveCityCode,MapUtils.getString(data,"enterprisePlace"))); return AjaxResult.success(data); }else{ return edit; } } /** * 新增寄递物流安全管理 */ @PostMapping("/safetyManagement") public AjaxResult add(@RequestBody String json) { return safetyManagementService.add(json); } /** * 修改寄递物流安全管理 */ @PostMapping("/safetyManagement/put") public AjaxResult edit(@RequestBody String json) { return safetyManagementService.edit(json); } /** * 删除寄递物流安全管理 */ @GetMapping("/safetyManagement/del") public AjaxResult remove(@RequestParam("id") List id) { return safetyManagementService.del(id.toArray(new String[0])); } }