| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.moral.api.entity.MonitorPoint; |
| | | import com.moral.api.entity.Organization; |
| | | import com.moral.api.entity.SysArea; |
| | | import com.moral.api.mapper.MonitorPointMapper; |
| | | import com.moral.api.mapper.OrganizationMapper; |
| | | import com.moral.api.mapper.SysAreaMapper; |
| | | import com.moral.api.service.MonitorPointService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.moral.api.util.LogUtils; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Autowired(required = false) |
| | | private OrganizationMapper organizationMapper; |
| | | |
| | | @Autowired(required = false) |
| | | private SysAreaMapper sysAreaMapper; |
| | | |
| | | @Autowired |
| | | LogUtils logUtils; |
| | |
| | | monitorPointMap.put("createTime",createTime); |
| | | monitorPointMap.put("updateTime",updateTime); |
| | | monitorPointMap.put("key",monitorPoint.getId()); |
| | | monitorPointMap.put("provinceCode",getAreaArr(monitorPointMap.get("provinceCode").toString())); |
| | | monitorPointMap.put("cityCode",getAreaArr(monitorPointMap.get("cityCode").toString())); |
| | | monitorPointMap.put("areaCode",getAreaArr(monitorPointMap.get("areaCode").toString())); |
| | | Organization organization = organizationMapper.selectById(Integer.parseInt(monitorPointMap.get("organizationId").toString())); |
| | | if (!ObjectUtils.isEmpty(organization)) { |
| | | String[] organizationArr = {monitorPointMap.get("organizationId").toString(),organization.getName()}; |
| | | monitorPointMap.put("organizationId",organizationArr); |
| | | } |
| | | monitorPointtList.add(monitorPointMap); |
| | | } |
| | | resultMap.put("manageRoles",monitorPointtList); |
| | | resultMap.put("monitorPoints",monitorPointtList); |
| | | resultMap.put("totalNumber",totalNumber); |
| | | resultMap.put("current",current); |
| | | int totalPageNumber = totalNumber/size; |
| | |
| | | resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | return resultMap; |
| | | } |
| | | QueryWrapper<MonitorPoint> wapper_id = new QueryWrapper<>(); |
| | | wapper_id.eq("id",updateMap.get("id")); |
| | | wapper_id.eq("is_delete",Constants.NOT_DELETE); |
| | | MonitorPoint oldMonitorPoint = monitorPointMapper.selectOne(wapper_id); |
| | | if (oldMonitorPoint==null){ |
| | | resultMap.put("code",ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getMsg()); |
| | | return resultMap; |
| | | } |
| | | if (updateMap.get("name")==null||updateMap.get("name")==""){ |
| | | resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | |
| | | if(monitorPoint_name!=null&&!monitorPoint_name.getId().toString().equals(updateMap.get("id").toString())){ |
| | | resultMap.put("code",ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getMsg()); |
| | | return resultMap; |
| | | } |
| | | QueryWrapper<MonitorPoint> wapper_id = new QueryWrapper<>(); |
| | | wapper_id.eq("id",updateMap.get("id")); |
| | | wapper_id.eq("is_delete",Constants.NOT_DELETE); |
| | | MonitorPoint oldMonitorPoint = monitorPointMapper.selectOne(wapper_id); |
| | | if (oldMonitorPoint==null){ |
| | | resultMap.put("code",ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getMsg()); |
| | | return resultMap; |
| | | } |
| | | monitorPointMapper.updateMonitorPoint(updateMap); |
| | |
| | | monitorPointMap.put("createTime",createTime); |
| | | monitorPointMap.put("updateTime",updateTime); |
| | | monitorPointMap.put("key",monitorPoint.getId()); |
| | | Organization organization = organizationMapper.selectById(Integer.parseInt(monitorPointMap.get("organizationId").toString())); |
| | | if (!ObjectUtils.isEmpty(organization)) { |
| | | String[] organizationArr = {monitorPointMap.get("organizationId").toString(),organization.getName()}; |
| | | monitorPointMap.put("organizationId",organizationArr); |
| | | } |
| | | monitorPointtList.add(monitorPointMap); |
| | | } |
| | | resultMap.put("manageRoles",monitorPointtList); |
| | | resultMap.put("monitorPoints",monitorPointtList); |
| | | resultMap.put("totalNumber",totalNumber); |
| | | resultMap.put("current",current); |
| | | int totalPageNumber = totalNumber/size; |
| | |
| | | resultMap.put("totalPageNumber",totalPageNumber); |
| | | return resultMap; |
| | | } |
| | | |
| | | /** |
| | | * @Description: 获取地区名 |
| | | * @Param: [areaArr, menu]menuMap:key为menuid,value为menu |
| | | * @return: Array |
| | | * @Author: lizijie |
| | | * @Date: 2021/4/7 |
| | | */ |
| | | private String[] getAreaArr(String areaCode) { |
| | | QueryWrapper<SysArea> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("area_code",areaCode); |
| | | SysArea sysArea = sysAreaMapper.selectOne(wrapper); |
| | | String[] arr = {areaCode,sysArea.getAreaName()}; |
| | | return arr; |
| | | } |
| | | } |