Commit feebe36e by 杨伟程

子女端子女编辑接口

parent be687148
...@@ -4,11 +4,13 @@ package com.makeit.module.controller.children.elder; ...@@ -4,11 +4,13 @@ package com.makeit.module.controller.children.elder;
import com.makeit.common.response.ApiResponseEntity; import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils; import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.elder.PlatElderIdDTO; import com.makeit.dto.platform.elder.PlatElderIdDTO;
import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoWechatDTOVO;
import com.makeit.service.platform.elder.PlatElderChildrenInfoService; import com.makeit.service.platform.elder.PlatElderChildrenInfoService;
import com.makeit.vo.wechat.elder.PlatElderChildrenInfoWechatVO; import com.makeit.vo.wechat.elder.PlatElderChildrenInfoWechatVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -36,6 +38,13 @@ public class PlatElderChildrenInfoChildrenController { ...@@ -36,6 +38,13 @@ public class PlatElderChildrenInfoChildrenController {
return ApiResponseUtils.success(platElderChildrenInfoService.view()); return ApiResponseUtils.success(platElderChildrenInfoService.view());
} }
@ApiOperation("编辑")
@PostMapping("edit")
public ApiResponseEntity<?> edit(@Validated @RequestBody PlatElderChildrenInfoWechatDTOVO dto) {
platElderChildrenInfoService.wechatEdit(dto);
return ApiResponseUtils.success();
}
@ApiOperation("绑定") @ApiOperation("绑定")
@PostMapping("bind") @PostMapping("bind")
public ApiResponseEntity<?> bind(@RequestBody PlatElderIdDTO dto) { public ApiResponseEntity<?> bind(@RequestBody PlatElderIdDTO dto) {
......
...@@ -6,7 +6,7 @@ import com.makeit.common.page.PageReqDTO; ...@@ -6,7 +6,7 @@ import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; import com.makeit.common.page.PageVO;
import com.makeit.common.response.ApiResponseEntity; import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils; import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoEditVO; import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoDTOVO;
import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoQueryDTO; import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoQueryDTO;
import com.makeit.service.platform.elder.PlatElderChildrenInfoService; import com.makeit.service.platform.elder.PlatElderChildrenInfoService;
import com.makeit.vo.platform.elder.PlatElderChildrenInfoListVO; import com.makeit.vo.platform.elder.PlatElderChildrenInfoListVO;
...@@ -51,14 +51,14 @@ public class PlatElderChildrenInfoController { ...@@ -51,14 +51,14 @@ public class PlatElderChildrenInfoController {
@ApiOperation("编辑") @ApiOperation("编辑")
@PostMapping("edit") @PostMapping("edit")
public ApiResponseEntity<?> edit(@Validated @RequestBody PlatElderChildrenInfoEditVO dto) { public ApiResponseEntity<?> edit(@Validated @RequestBody PlatElderChildrenInfoDTOVO dto) {
platElderChildrenInfoService.edit(dto); platElderChildrenInfoService.edit(dto);
return ApiResponseUtils.success(); return ApiResponseUtils.success();
} }
@ApiOperation("详情") @ApiOperation("详情")
@PostMapping("view") @PostMapping("view")
public ApiResponseEntity<PlatElderChildrenInfoEditVO> view(@RequestBody BaseIdDTO baseIdDTO) { public ApiResponseEntity<PlatElderChildrenInfoDTOVO> view(@RequestBody BaseIdDTO baseIdDTO) {
return ApiResponseUtils.success(platElderChildrenInfoService.view(baseIdDTO.getId())); return ApiResponseUtils.success(platElderChildrenInfoService.view(baseIdDTO.getId()));
} }
......
...@@ -20,7 +20,7 @@ import javax.validation.constraints.Size; ...@@ -20,7 +20,7 @@ import javax.validation.constraints.Size;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "ElderChildrenInfo对象", description = "长者子女账号") @ApiModel(value = "ElderChildrenInfo对象", description = "长者子女账号")
public class PlatElderChildrenInfoEditVO extends BaseTenantDTO { public class PlatElderChildrenInfoDTOVO extends BaseTenantDTO {
@ApiModelProperty(value = "长者id") @ApiModelProperty(value = "长者id")
private String elderId; private String elderId;
......
package com.makeit.dto.platform.elder.children;
import com.makeit.common.dto.BaseTenantDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
* <p>
* 长者子女账号
* </p>
*
* @author eugene young
* @since 2023-08-29
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "ElderChildrenInfo对象", description = "长者子女账号")
public class PlatElderChildrenInfoWechatDTOVO extends BaseTenantDTO {
@NotBlank(message = "姓名不能为空")
@Size(max = 50, message = "姓名最长为50个字符")
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "手机号码")
private String phone;
@ApiModelProperty(value = "微信头像路径")
private String avatar;
}
...@@ -3,8 +3,9 @@ package com.makeit.service.platform.elder; ...@@ -3,8 +3,9 @@ package com.makeit.service.platform.elder;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.common.page.PageReqDTO; import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoEditVO; import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoDTOVO;
import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoQueryDTO; import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoQueryDTO;
import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoWechatDTOVO;
import com.makeit.entity.platform.elder.PlatElderChildrenInfo; import com.makeit.entity.platform.elder.PlatElderChildrenInfo;
import com.makeit.vo.platform.elder.PlatElderChildrenInfoListVO; import com.makeit.vo.platform.elder.PlatElderChildrenInfoListVO;
import com.makeit.vo.wechat.elder.PlatElderChildrenInfoWechatVO; import com.makeit.vo.wechat.elder.PlatElderChildrenInfoWechatVO;
...@@ -25,9 +26,11 @@ public interface PlatElderChildrenInfoService extends IService<PlatElderChildren ...@@ -25,9 +26,11 @@ public interface PlatElderChildrenInfoService extends IService<PlatElderChildren
List<PlatElderChildrenInfoListVO> list(PlatElderChildrenInfoQueryDTO dto); List<PlatElderChildrenInfoListVO> list(PlatElderChildrenInfoQueryDTO dto);
void edit(PlatElderChildrenInfoEditVO dto); void edit(PlatElderChildrenInfoDTOVO dto);
PlatElderChildrenInfoEditVO view(String id); void wechatEdit(PlatElderChildrenInfoWechatDTOVO dto);
PlatElderChildrenInfoDTOVO view(String id);
void del(String id); void del(String id);
......
...@@ -6,8 +6,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -6,8 +6,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.common.page.PageReqDTO; import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoEditVO; import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoDTOVO;
import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoQueryDTO; import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoQueryDTO;
import com.makeit.dto.platform.elder.children.PlatElderChildrenInfoWechatDTOVO;
import com.makeit.entity.platform.auth.PlatOrg; import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.elder.PlatElder; import com.makeit.entity.platform.elder.PlatElder;
import com.makeit.entity.platform.elder.PlatElderChildrenInfo; import com.makeit.entity.platform.elder.PlatElderChildrenInfo;
...@@ -25,11 +26,15 @@ import com.makeit.utils.sql.join.JoinUtil; ...@@ -25,11 +26,15 @@ import com.makeit.utils.sql.join.JoinUtil;
import com.makeit.utils.user.wechat.WechatUserUtil; import com.makeit.utils.user.wechat.WechatUserUtil;
import com.makeit.vo.platform.elder.PlatElderChildrenInfoListVO; import com.makeit.vo.platform.elder.PlatElderChildrenInfoListVO;
import com.makeit.vo.wechat.elder.PlatElderChildrenInfoWechatVO; import com.makeit.vo.wechat.elder.PlatElderChildrenInfoWechatVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.function.Function; import java.util.function.Function;
/** /**
...@@ -98,7 +103,7 @@ public class PlatElderChildrenInfoServiceImpl extends ServiceImpl<PlatElderChild ...@@ -98,7 +103,7 @@ public class PlatElderChildrenInfoServiceImpl extends ServiceImpl<PlatElderChild
return voList; return voList;
} }
private void check(PlatElderChildrenInfoEditVO dto) { private void check(PlatElderChildrenInfoDTOVO dto) {
if (true) { if (true) {
return; return;
...@@ -125,19 +130,35 @@ public class PlatElderChildrenInfoServiceImpl extends ServiceImpl<PlatElderChild ...@@ -125,19 +130,35 @@ public class PlatElderChildrenInfoServiceImpl extends ServiceImpl<PlatElderChild
@Transactional @Transactional
@Override @Override
public void edit(PlatElderChildrenInfoEditVO dto) { public void edit(PlatElderChildrenInfoDTOVO dto) {
check(BeanDtoVoUtils.convert(dto, PlatElderChildrenInfoEditVO.class)); check(BeanDtoVoUtils.convert(dto, PlatElderChildrenInfoDTOVO.class));
updateById(BeanDtoVoUtils.convert(dto, PlatElderChildrenInfo.class)); PlatElderChildrenInfo db = getById(dto.getId());
BeanUtils.copyProperties(dto, db);
updateById(db);
} }
@Transactional
@Override
public void wechatEdit(PlatElderChildrenInfoWechatDTOVO dto) {
check(BeanDtoVoUtils.convert(dto, PlatElderChildrenInfoDTOVO.class));
PlatElderChildrenInfo db = getById(dto.getId());
BeanUtils.copyProperties(dto, db);
updateById(db);
}
@Override @Override
public PlatElderChildrenInfoEditVO view(String id) { public PlatElderChildrenInfoDTOVO view(String id) {
PlatElderChildrenInfoEditVO vo = BeanDtoVoUtils.convert(getById(id), PlatElderChildrenInfoEditVO.class); PlatElderChildrenInfoDTOVO vo = BeanDtoVoUtils.convert(getById(id), PlatElderChildrenInfoDTOVO.class);
JoinUtil.joinSplit(Arrays.asList(vo), platElderService, PlatElderChildrenInfoEditVO::getElderId, PlatElder::getId, (c, e) -> { JoinUtil.joinSplit(Arrays.asList(vo), platElderService, PlatElderChildrenInfoDTOVO::getElderId, PlatElder::getId, (c, e) -> {
c.setElderName(StreamUtil.join(e, PlatElder::getName)); c.setElderName(StreamUtil.join(e, PlatElder::getName));
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment