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

229 lines
7.7 KiB

package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.MaskResponse;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.enums.HomeMemberOperationEnum;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
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.dto.IcHouseDTO;
import com.epmet.dto.IcResiUserConfirmDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.service.IcResiUserConfirmService;
import com.epmet.service.IcResiUserService;
import com.epmet.service.MyHomeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/5/31 16:20
*/
@Slf4j
@RestController
@RequestMapping("myHome")
public class MyHomeController {
@Autowired
private MyHomeService myHomeService;
@Autowired
private IcResiUserConfirmService icResiUserConfirmService;
@Autowired
private IcResiUserService icResiUserService;
@MaskResponse(fieldNames = {"mobile"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE})
@PostMapping("memberList/{houseCode}")
public Result<List<HomeUserBriefResultDTO>> selectListHomeMember(@PathVariable("houseCode") String houseCode, @LoginUser TokenDto tokenDto) {
return new Result().ok(myHomeService.selectListHomeMember(houseCode, tokenDto.getCustomerId()));
}
/**
* @return com.epmet.commons.tools.utils.Result
* @describe: 删除家庭成员
* @author wangtong
* @date 2022/6/1 16:10
* @params [dto]
*/
@PostMapping("delMember")
public Result delMember(@RequestBody IcResiUserConfirmSubmitDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
dto.setSubmitType(HomeMemberOperationEnum.DELETE.getCode());
return icResiUserConfirmService.delMember(dto);
}
/**
* @return com.epmet.commons.tools.utils.Result
* @describe: 新增家庭成员
* @author wangtong
* @date 2022/6/1 15:50
* @params [dto]
*/
@PostMapping("addMember")
public Result addMember(@LoginUser TokenDto tokenDto,@RequestBody IcResiUserConfirmSubmitDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
return icResiUserService.addMember(tokenDto,dto);
}
/**
* @describe: 工作端-新增家庭成员
* @author wangtong
* @date 2022/6/1 15:50
* @params [dto]
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("addWorkMember")
public Result addWorkMember(@LoginUser TokenDto tokenDto,@RequestBody IcResiUserConfirmSubmitDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
dto.setCustomerId(tokenDto.getCustomerId());
dto.setStaffId(tokenDto.getUserId());
return icResiUserService.addWorkMember(dto);
}
/**
* @return com.epmet.commons.tools.utils.Result
* @describe: 修改家庭成员
* @author wangtong
* @date 2022/6/1 15:27
* @params [dto]
*/
@PostMapping("editMember")
public Result editMember(@RequestBody IcResiUserConfirmSubmitDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
return icResiUserService.editMember(dto);
}
/**
* @return com.epmet.commons.tools.utils.Result
* @describe: 查询家庭成员信息
* @author wangtong
* @date 2022/6/1 16:14
* @params [dto]
*/
@PostMapping("getMemberDetail")
public Result<IcResiUserConfirmDTO> getMemberDetail(@RequestBody IcResiUserConfirmGetDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
return icResiUserConfirmService.getMemberDetail(dto);
}
/**
* 注册绑定家庭信息
*
* @Param tokenDto
* @Param formDTO
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2022/6/1 10:26
*/
@PostMapping("registerAndBind")
public Result<RegisterAndBindResultDTO> registerAndBind(@LoginUser TokenDto tokenDto, @RequestBody RegisterAndBindFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
return new Result<RegisterAndBindResultDTO>().ok(myHomeService.registerAndBind(formDTO));
}
@PostMapping("homeInfo")
public Result<HomeInfoResultDTO> getHomeInfo(@LoginUser TokenDto tokenDto) {
HomeInfoResultDTO result = myHomeService.getHomeInfo(tokenDto);
return new Result<HomeInfoResultDTO>().ok(result);
}
/**
* 【我的家庭】迁出家庭成员
*
* @param form
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result
* @author LZN
* @date 2022/6/10 11:06
*/
@NoRepeatSubmit
@PostMapping("moveOutMember")
public Result moveOutMember(@RequestBody MoveOutMemberFormDTO form, @LoginUser TokenDto tokenDto) {
form.setCustomerId(tokenDto.getCustomerId());
icResiUserConfirmService.moveOutMember(form);
return new Result();
}
/**
* 迁出审核列表
*
* @Param tokenDto
* @Param form
* @Return {@link Result< PageData< ConfirmListResultDTO>>}
* @Author zhaoqifeng
* @Date 2022/6/22 16:13
*/
@PostMapping("confirmList")
public Result<PageData<ConfirmListResultDTO>> confirmList(@LoginUser TokenDto tokenDto, @RequestBody ConfirmListFormDTO form) {
form.setCustomerId(tokenDto.getCustomerId());
form.setStaffId(tokenDto.getUserId());
return new Result<PageData<ConfirmListResultDTO>>().ok(icResiUserConfirmService.confirmList(form));
}
@PostMapping("moveOutConfirmDetail")
public Result<MoveOutDetailResultDTO> moveOutConfirmDetail(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserConfirmDTO formDTO) {
return new Result<MoveOutDetailResultDTO>().ok(icResiUserConfirmService.moveOutConfirmDetail(tokenDto.getCustomerId(), formDTO.getId()));
}
/**
* 迁出审核
*
* @Param formDTO
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2022/6/22 16:46
*/
@PostMapping("moveOutConfirm")
public Result moveOutConfirm( @RequestBody IcResiUserConfirmDTO formDTO) {
icResiUserConfirmService.moveOutConfirm(formDTO);
return new Result();
}
/**
* 获取房主名下的房屋列表
*
* @Param tokenDto
* @Return {@link Result< HomeInfoResultDTO>}
* @Author zhaoqifeng
* @Date 2022/7/19 16:46
*/
@PostMapping("getOwnerHouseList")
public Result<List<HomeInfoResultDTO>> getOwnerHouseList(@LoginUser TokenDto tokenDto, @RequestBody IcHouseDTO formDTO) {
List<HomeInfoResultDTO> result = myHomeService.getOwnerHouseList(tokenDto, formDTO);
return new Result<List<HomeInfoResultDTO>>().ok(result);
}
/**
* 变更绑定的房屋
*
* @Param tokenDto
* @Param formDTO
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2022/7/20 17:28
*/
@PostMapping("changeHome")
public Result changeHome(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserConfirmSubmitDTO formDTO) {
myHomeService.changeHome(tokenDto, formDTO);
return new Result();
}
}