123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- 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<String, Object> typeOfRegistration = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_TYPE_OF_REGISTRATION);
- Map<String, Object> holdingInertia = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_HOLDING_INERTIA);
- Map<String, Object> businessType = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_BUSINESS_TYPE);
- Map<String,Object> comprehensiveCityCode = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE);//籍贯、户籍地、所在地
- if (HttpStatus.SUCCESS == list.getCode()) {
- List<HashMap<String, Object>> rows = (List<HashMap<String, Object>>) list.getRows();
- for (HashMap<String, Object> 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<String>) 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<String,Object> data = (HashMap<String, Object>) edit.get("data");
- Map<String,Object> 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<String>) 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<String> id) {
- return safetyManagementService.del(id.toArray(new String[0]));
- }
- }
|