You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							107 lines
						
					
					
						
							3.8 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							107 lines
						
					
					
						
							3.8 KiB
						
					
					
				
								/**
							 | 
						|
								 * Copyright 2018 人人开源 https://www.renren.io
							 | 
						|
								 * <p>
							 | 
						|
								 * This program is free software: you can redistribute it and/or modify
							 | 
						|
								 * it under the terms of the GNU General Public License as published by
							 | 
						|
								 * the Free Software Foundation, either version 3 of the License, or
							 | 
						|
								 * (at your option) any later version.
							 | 
						|
								 * <p>
							 | 
						|
								 * This program is distributed in the hope that it will be useful,
							 | 
						|
								 * but WITHOUT ANY WARRANTY; without even the implied warranty of
							 | 
						|
								 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
							 | 
						|
								 * GNU General Public License for more details.
							 | 
						|
								 * <p>
							 | 
						|
								 * You should have received a copy of the GNU General Public License
							 | 
						|
								 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
							 | 
						|
								 */
							 | 
						|
								
							 | 
						|
								package com.epmet.controller;
							 | 
						|
								
							 | 
						|
								import com.epmet.commons.tools.page.PageData;
							 | 
						|
								import com.epmet.commons.tools.utils.ExcelUtils;
							 | 
						|
								import com.epmet.commons.tools.utils.Result;
							 | 
						|
								import com.epmet.commons.tools.validator.AssertUtils;
							 | 
						|
								import com.epmet.commons.tools.validator.ValidatorUtils;
							 | 
						|
								import com.epmet.commons.tools.validator.group.AddGroup;
							 | 
						|
								import com.epmet.commons.tools.validator.group.DefaultGroup;
							 | 
						|
								import com.epmet.commons.tools.validator.group.UpdateGroup;
							 | 
						|
								import com.epmet.dto.GridVisitedDTO;
							 | 
						|
								import com.epmet.dto.form.VisitedFormDTO;
							 | 
						|
								import com.epmet.excel.GridVisitedExcel;
							 | 
						|
								import com.epmet.service.GridVisitedService;
							 | 
						|
								import org.springframework.beans.factory.annotation.Autowired;
							 | 
						|
								import org.springframework.web.bind.annotation.*;
							 | 
						|
								
							 | 
						|
								import javax.servlet.http.HttpServletResponse;
							 | 
						|
								import java.util.List;
							 | 
						|
								import java.util.Map;
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								/**
							 | 
						|
								 * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录
							 | 
						|
								 *
							 | 
						|
								 * @author generator generator@elink-cn.com
							 | 
						|
								 * @since v1.0.0 2020-03-16
							 | 
						|
								 */
							 | 
						|
								@RestController
							 | 
						|
								@RequestMapping("gridvisited")
							 | 
						|
								public class GridVisitedController {
							 | 
						|
								
							 | 
						|
								    @Autowired
							 | 
						|
								    private GridVisitedService gridVisitedService;
							 | 
						|
								
							 | 
						|
								    @GetMapping("page")
							 | 
						|
								    public Result<PageData<GridVisitedDTO>> page(@RequestParam Map<String, Object> params) {
							 | 
						|
								        PageData<GridVisitedDTO> page = gridVisitedService.page(params);
							 | 
						|
								        return new Result<PageData<GridVisitedDTO>>().ok(page);
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    @GetMapping("{id}")
							 | 
						|
								    public Result<GridVisitedDTO> get(@PathVariable("id") String id) {
							 | 
						|
								        GridVisitedDTO data = gridVisitedService.get(id);
							 | 
						|
								        return new Result<GridVisitedDTO>().ok(data);
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    @PostMapping
							 | 
						|
								    public Result save(@RequestBody GridVisitedDTO dto) {
							 | 
						|
								        //效验数据
							 | 
						|
								        ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
							 | 
						|
								        gridVisitedService.save(dto);
							 | 
						|
								        return new Result();
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    @PutMapping
							 | 
						|
								    public Result update(@RequestBody GridVisitedDTO dto) {
							 | 
						|
								        //效验数据
							 | 
						|
								        ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
							 | 
						|
								        gridVisitedService.update(dto);
							 | 
						|
								        return new Result();
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    @DeleteMapping
							 | 
						|
								    public Result delete(@RequestBody String[] ids) {
							 | 
						|
								        //效验数据
							 | 
						|
								        AssertUtils.isArrayEmpty(ids, "id");
							 | 
						|
								        gridVisitedService.delete(ids);
							 | 
						|
								        return new Result();
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    @GetMapping("export")
							 | 
						|
								    public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
							 | 
						|
								        List<GridVisitedDTO> list = gridVisitedService.list(params);
							 | 
						|
								        ExcelUtils.exportExcelToTarget(response, null, list, GridVisitedExcel.class);
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 网格访问记录表、最近访问网格表新增数据
							 | 
						|
								     * 网格访问记录表新增数据(一天一条)
							 | 
						|
								     * 最近访问表更新访问时间字段
							 | 
						|
								     *
							 | 
						|
								     * @param visitedFormDTO
							 | 
						|
								     */
							 | 
						|
								    @PostMapping("savevisitedrecord")
							 | 
						|
								    public Result saveVisitedRecord(@RequestBody VisitedFormDTO visitedFormDTO) {
							 | 
						|
								        return gridVisitedService.saveVisitedRecord(visitedFormDTO);
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								}
							 |