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.
133 lines
4.7 KiB
133 lines
4.7 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.UpdateGroup;
|
|
import com.epmet.commons.tools.validator.group.DefaultGroup;
|
|
import com.epmet.dto.GridLatestDTO;
|
|
import com.epmet.dto.form.CustomerUserFormDTO;
|
|
import com.epmet.dto.result.CustomerUser4PointResultDTO;
|
|
import com.epmet.dto.result.LatestGridInfoResultDTO;
|
|
import com.epmet.excel.GridLatestExcel;
|
|
import com.epmet.service.GridLatestService;
|
|
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("gridlatest")
|
|
public class GridLatestController {
|
|
|
|
@Autowired
|
|
private GridLatestService gridLatestService;
|
|
|
|
@GetMapping("page")
|
|
public Result<PageData<GridLatestDTO>> page(@RequestParam Map<String, Object> params){
|
|
PageData<GridLatestDTO> page = gridLatestService.page(params);
|
|
return new Result<PageData<GridLatestDTO>>().ok(page);
|
|
}
|
|
|
|
@GetMapping("{id}")
|
|
public Result<GridLatestDTO> get(@PathVariable("id") String id){
|
|
GridLatestDTO data = gridLatestService.get(id);
|
|
return new Result<GridLatestDTO>().ok(data);
|
|
}
|
|
|
|
@PostMapping
|
|
public Result save(@RequestBody GridLatestDTO dto){
|
|
//效验数据
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
|
gridLatestService.save(dto);
|
|
return new Result();
|
|
}
|
|
|
|
@PutMapping
|
|
public Result update(@RequestBody GridLatestDTO dto){
|
|
//效验数据
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
|
gridLatestService.update(dto);
|
|
return new Result();
|
|
}
|
|
|
|
@DeleteMapping
|
|
public Result delete(@RequestBody String[] ids){
|
|
//效验数据
|
|
AssertUtils.isArrayEmpty(ids, "id");
|
|
gridLatestService.delete(ids);
|
|
return new Result();
|
|
}
|
|
|
|
@GetMapping("export")
|
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
|
List<GridLatestDTO> list = gridLatestService.list(params);
|
|
ExcelUtils.exportExcelToTarget(response, null, list, GridLatestExcel.class);
|
|
}
|
|
|
|
/**
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.LatestGridInfoResultDTO>
|
|
* @param userId
|
|
* @Author yinzuomei
|
|
* @Description 根据居民id查询最后一次访问的网格信息
|
|
* @Date 2020/3/24 13:09
|
|
**/
|
|
@GetMapping("getLatestGridInfoByUserId/{userId}")
|
|
public Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(@PathVariable("userId") String userId){
|
|
return gridLatestService.getLatestGridInfoByUserId(userId);
|
|
}
|
|
|
|
/**
|
|
* @return
|
|
* @param userId
|
|
* @Description 根据用户Id查询用户访问过的网格列表Id集合
|
|
* @Author sun
|
|
**/
|
|
@PostMapping("getgridsbyuserid/{userId}")
|
|
public Result<List<String>> getGridsByUserId(@PathVariable("userId") String userId){
|
|
return gridLatestService.getGridsByUserId(userId);
|
|
}
|
|
|
|
|
|
/**
|
|
* @Description 查询客户下所有用户包括陌生人
|
|
* @param param
|
|
* @return
|
|
* @author wangc
|
|
* @date 2020.07.25 16:15
|
|
**/
|
|
@PostMapping("customeruserlist")
|
|
public Result<List<CustomerUser4PointResultDTO>> customerUserList(@RequestBody CustomerUserFormDTO param){
|
|
return new Result<List<CustomerUser4PointResultDTO>>().ok(gridLatestService.getCustomerUsers(param));
|
|
}
|
|
|
|
}
|
|
|