forked from rongchao/epmet-cloud-rizhao
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.
201 lines
6.9 KiB
201 lines
6.9 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.UserResiInfoDTO;
|
|
import com.epmet.dto.form.*;
|
|
import com.epmet.dto.result.IssueInitiatorResultDTO;
|
|
import com.epmet.dto.result.UserResiInfoResultDTO;
|
|
import com.epmet.excel.UserResiInfoExcel;
|
|
import com.epmet.service.UserResiInfoService;
|
|
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("userresiinfo")
|
|
public class UserResiInfoController {
|
|
|
|
@Autowired
|
|
private UserResiInfoService userResiInfoService;
|
|
|
|
@GetMapping("page")
|
|
public Result<PageData<UserResiInfoDTO>> page(@RequestParam Map<String, Object> params) {
|
|
PageData<UserResiInfoDTO> page = userResiInfoService.page(params);
|
|
return new Result<PageData<UserResiInfoDTO>>().ok(page);
|
|
}
|
|
|
|
@GetMapping("{id}")
|
|
public Result<UserResiInfoDTO> get(@PathVariable("id") String id) {
|
|
UserResiInfoDTO data = userResiInfoService.get(id);
|
|
return new Result<UserResiInfoDTO>().ok(data);
|
|
}
|
|
|
|
@PostMapping
|
|
public Result save(@RequestBody UserResiInfoDTO dto) {
|
|
//效验数据
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
|
userResiInfoService.save(dto);
|
|
return new Result();
|
|
}
|
|
|
|
@PutMapping
|
|
public Result update(@RequestBody UserResiInfoDTO dto) {
|
|
//效验数据
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
|
userResiInfoService.update(dto);
|
|
return new Result();
|
|
}
|
|
|
|
@DeleteMapping
|
|
public Result delete(@RequestBody String[] ids) {
|
|
//效验数据
|
|
AssertUtils.isArrayEmpty(ids, "id");
|
|
userResiInfoService.delete(ids);
|
|
return new Result();
|
|
}
|
|
|
|
@GetMapping("export")
|
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
|
List<UserResiInfoDTO> list = userResiInfoService.list(params);
|
|
ExcelUtils.exportExcelToTarget(response, null, list, UserResiInfoExcel.class);
|
|
}
|
|
|
|
/**
|
|
* @param userResiInfoFormDTO
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.UserResiInfoDTO>
|
|
* @Author yinzuomei
|
|
* @Description 查询用户注册信息
|
|
* @Date 2020/3/30 10:49
|
|
**/
|
|
@PostMapping("getuserresiinfo")
|
|
public Result<UserResiInfoResultDTO> getUserResiInfoDTO(@RequestBody UserResiInfoFormDTO userResiInfoFormDTO) {
|
|
ValidatorUtils.validateEntity(userResiInfoFormDTO);
|
|
return userResiInfoService.getUserResiInfoDTO(userResiInfoFormDTO);
|
|
}
|
|
|
|
/**
|
|
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.UserResiInfoDTO>>
|
|
* @param userResiInfoListFormDTO
|
|
* @Author yinzuomei
|
|
* @Description 根据userId集合查询用户注册信息
|
|
* @Date 2020/4/7 18:24
|
|
**/
|
|
@PostMapping("getuserresiinfolist")
|
|
public Result<List<UserResiInfoResultDTO>> getUserResiInfoList(@RequestBody UserResiInfoListFormDTO userResiInfoListFormDTO){
|
|
return userResiInfoService.getUserResiInfoList(userResiInfoListFormDTO);
|
|
}
|
|
|
|
/**
|
|
* @param userResiInfoDTO
|
|
* @Author sun
|
|
* @Description 居民端-居民注册信息提交
|
|
**/
|
|
@PostMapping("submit")
|
|
public Result submit(@RequestBody UserResiInfoDTO userResiInfoDTO) {
|
|
return userResiInfoService.submit(userResiInfoDTO);
|
|
}
|
|
|
|
/**
|
|
* @param formDTO
|
|
* @Author sun
|
|
* @Description 居民端-居民注册根据手机号获取验证码
|
|
**/
|
|
@PostMapping("getverificationcode")
|
|
public Result getVerificationCode(@RequestBody VerificationCodeFormDTO formDTO) {
|
|
return userResiInfoService.getVerificationCode(formDTO);
|
|
}
|
|
|
|
/**
|
|
* 党员认证时,如果没有注册居民,则注册居民信息
|
|
* @param userResiInfoDTO
|
|
* @author zhaoqifeng
|
|
**/
|
|
@PostMapping("saveResiInfo")
|
|
public Result saveResiInfo (@RequestBody UserResiInfoDTO userResiInfoDTO) {
|
|
ValidatorUtils.validateEntity(userResiInfoDTO);
|
|
return userResiInfoService.saveResiInfo(userResiInfoDTO);
|
|
}
|
|
|
|
/**
|
|
* @Description 根据userId查询议题发起人 eg:山东路168号——刘女士
|
|
* @param formDTO
|
|
* @author zxc
|
|
*/
|
|
@PostMapping("selectissueinitiator")
|
|
public Result<IssueInitiatorResultDTO> selectIssueInitiator(@RequestBody IssueInitiatorFormDTO formDTO){
|
|
return new Result<IssueInitiatorResultDTO>().ok(userResiInfoService.selectIssueInitiator(formDTO));
|
|
}
|
|
|
|
/**
|
|
* 修改个人信息
|
|
* @author zhaoqifeng
|
|
* @date 2020/11/3 10:28
|
|
* @param formDTO
|
|
* @return com.epmet.commons.tools.utils.Result
|
|
*/
|
|
@PostMapping("edituserinfo")
|
|
public Result editUserInfo(@RequestBody EditInfoFormDTO formDTO) {
|
|
userResiInfoService.editUserInfo(formDTO);
|
|
return new Result();
|
|
}
|
|
|
|
/**
|
|
* 修改手机号-获取验证码
|
|
* @author zhaoqifeng
|
|
* @date 2020/11/10 10:51
|
|
* @param formDTO
|
|
* @return com.epmet.commons.tools.utils.Result
|
|
*/
|
|
@PostMapping("sendcode")
|
|
public Result sendCode(@RequestBody SendCodeFormDTO formDTO) {
|
|
userResiInfoService.sendCode(formDTO);
|
|
return new Result();
|
|
}
|
|
|
|
/**
|
|
* 修改手机号
|
|
* @author zhaoqifeng
|
|
* @date 2020/11/11 8:59
|
|
* @param formDTO
|
|
* @return com.epmet.commons.tools.utils.Result
|
|
*/
|
|
@PostMapping("editmobile")
|
|
public Result editMobile(@RequestBody EditMobileFormDTO formDTO) {
|
|
userResiInfoService.editMobile(formDTO);
|
|
return new Result();
|
|
}
|
|
}
|
|
|