日照智慧社区接口服务
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.
 
 
 
 
 

123 lines
4.5 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.RegisterRelationDTO;
import com.epmet.dto.form.AllResiByGridFormDTO;
import com.epmet.dto.form.EnterGridFormDTO;
import com.epmet.dto.result.UserInfoOnEnterGridResultDTO;
import com.epmet.excel.RegisterRelationExcel;
import com.epmet.service.RegisterRelationService;
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-30
*/
@RestController
@RequestMapping("registerrelation")
public class RegisterRelationController {
@Autowired
private RegisterRelationService registerRelationService;
@GetMapping("page")
public Result<PageData<RegisterRelationDTO>> page(@RequestParam Map<String, Object> params){
PageData<RegisterRelationDTO> page = registerRelationService.page(params);
return new Result<PageData<RegisterRelationDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<RegisterRelationDTO> get(@PathVariable("id") String id){
RegisterRelationDTO data = registerRelationService.get(id);
return new Result<RegisterRelationDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody RegisterRelationDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
registerRelationService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody RegisterRelationDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
registerRelationService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
registerRelationService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<RegisterRelationDTO> list = registerRelationService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, RegisterRelationExcel.class);
}
/**
* @Description 在用户进入网格时查询用户的注册信息(且统计)以及角色列表
* @Param enterGridFormDTO
* @return UserInfoOnEnterGridResultDTO
* @Author wangc
* @Date 2020.03.30 15:06
**/
@PostMapping("getuserinfoandroles")
public Result<UserInfoOnEnterGridResultDTO> getUserInfoAndRoles(@RequestBody EnterGridFormDTO enterGridFormDTO){
ValidatorUtils.validateEntity(enterGridFormDTO);
return registerRelationService.getUserInfoAndRoles(enterGridFormDTO);
}
/**
* Desc: 根据网格ID查询所有注册居民
* @param formDTO
* @author zxc
* @date 2022/10/8 10:41
*/
@PostMapping("getAllResiByGrid")
public Result<Integer> getAllResiByGrid(@RequestBody AllResiByGridFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, AllResiByGridFormDTO.AllResiByGridForm.class);
return new Result<Integer>().ok(registerRelationService.getAllResiByGrid(formDTO));
}
}