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.
198 lines
6.5 KiB
198 lines
6.5 KiB
package com.epmet.controller;
|
|
|
|
import com.epmet.commons.tools.annotation.LoginUser;
|
|
import com.epmet.commons.tools.annotation.MaskResponse;
|
|
import com.epmet.commons.tools.enums.HomeMemberOperationEnum;
|
|
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.IcResiUserConfirmDTO;
|
|
import com.epmet.dto.form.IcResiUserConfirmGetDTO;
|
|
import com.epmet.dto.form.IcResiUserConfirmSubmitDTO;
|
|
import com.epmet.dto.form.MoveOutMemberFormDTO;
|
|
import com.epmet.dto.form.RegisterAndBindFormDTO;
|
|
import com.epmet.dto.result.HomeInfoResultDTO;
|
|
import com.epmet.dto.result.HomeUserBriefResultDTO;
|
|
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()));
|
|
}
|
|
|
|
|
|
// /**
|
|
// * @describe: 新增家庭成员
|
|
// * @author wangtong
|
|
// * @date 2022/6/1 15:50
|
|
// * @params [dto]
|
|
// * @return com.epmet.commons.tools.utils.Result
|
|
// */
|
|
// @PostMapping("addMember")
|
|
// public Result addMember(@RequestBody IcResiUserConfirmSubmitDTO dto){
|
|
// //效验数据
|
|
// ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
|
// dto.setSubmitType(HomeMemberOperationEnum.ADD.getCode());
|
|
// return icResiUserConfirmService.addMember(dto);
|
|
// }
|
|
//
|
|
// /**
|
|
// * @describe: 修改家庭成员
|
|
// * @author wangtong
|
|
// * @date 2022/6/1 15:27
|
|
// * @params [dto]
|
|
// * @return com.epmet.commons.tools.utils.Result
|
|
// */
|
|
// @PostMapping("editMember")
|
|
// public Result save(@RequestBody IcResiUserConfirmSubmitDTO dto){
|
|
// //效验数据
|
|
// ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
|
// dto.setSubmitType(HomeMemberOperationEnum.UPDATE.getCode());
|
|
// return icResiUserConfirmService.editMember(dto);
|
|
// }
|
|
//
|
|
|
|
/**
|
|
* @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(@RequestBody IcResiUserConfirmSubmitDTO dto) {
|
|
//效验数据
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
|
return icResiUserService.addMember(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 registerAndBind(@LoginUser TokenDto tokenDto, @RequestBody RegisterAndBindFormDTO formDTO) {
|
|
formDTO.setCustomerId(tokenDto.getCustomerId());
|
|
formDTO.setUserId(tokenDto.getUserId());
|
|
myHomeService.registerAndBind(formDTO);
|
|
return new Result();
|
|
}
|
|
|
|
@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
|
|
*/
|
|
@PostMapping("/moveOutMember")
|
|
public Result moveOutMember(@RequestBody MoveOutMemberFormDTO form, @LoginUser TokenDto tokenDto) {
|
|
form.setCustomerId(tokenDto.getCustomerId());
|
|
icResiUserConfirmService.moveOutMember(form);
|
|
return new Result();
|
|
}
|
|
|
|
}
|
|
|