1.优化
Showing
3 changed files
with
28 additions
and
5 deletions
... | @@ -95,7 +95,15 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -95,7 +95,15 @@ public class MemberServiceImpl implements MemberService { |
95 | if(Objects.isNull(id) && StringUtils.isBlank(memberCode)) | 95 | if(Objects.isNull(id) && StringUtils.isBlank(memberCode)) |
96 | throw new BadRequestException(GlobeExceptionMsg.MEMBER_ID_AND_CODE_ARE_NULL); | 96 | throw new BadRequestException(GlobeExceptionMsg.MEMBER_ID_AND_CODE_ARE_NULL); |
97 | 97 | ||
98 | return this.findByIdOrCode(id, memberCode); | 98 | if (StringUtils.isNotBlank(memberCode)) { |
99 | MemberDTO memberDTO = this.findByCode(memberCode); | ||
100 | return memberDTO; | ||
101 | } else if (Objects.nonNull(id)) { | ||
102 | MemberDTO memberDTO = this.findById(id); | ||
103 | return memberDTO; | ||
104 | } | ||
105 | |||
106 | return null; | ||
99 | } | 107 | } |
100 | 108 | ||
101 | @Override | 109 | @Override | ... | ... |
1 | package com.topdraw.business.process.domian.member; | 1 | package com.topdraw.business.process.domian.member; |
2 | 2 | ||
3 | import com.fasterxml.jackson.annotation.JsonFormat; | ||
3 | import lombok.Data; | 4 | import lombok.Data; |
4 | 5 | ||
6 | import java.sql.Timestamp; | ||
7 | import java.time.LocalDateTime; | ||
8 | |||
5 | /** | 9 | /** |
6 | * @author : | 10 | * @author : |
7 | * @description: | 11 | * @description: |
... | @@ -18,4 +22,7 @@ public class MemberOperationBean { | ... | @@ -18,4 +22,7 @@ public class MemberOperationBean { |
18 | 22 | ||
19 | private Integer vip; | 23 | private Integer vip; |
20 | 24 | ||
25 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") | ||
26 | private LocalDateTime vipExpireTime; | ||
27 | |||
21 | } | 28 | } | ... | ... |
... | @@ -20,6 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired; | ... | @@ -20,6 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired; |
20 | import org.springframework.validation.annotation.Validated; | 20 | import org.springframework.validation.annotation.Validated; |
21 | import org.springframework.web.bind.annotation.*; | 21 | import org.springframework.web.bind.annotation.*; |
22 | 22 | ||
23 | import java.sql.Timestamp; | ||
24 | import java.time.LocalDateTime; | ||
23 | import java.util.Objects; | 25 | import java.util.Objects; |
24 | 26 | ||
25 | @Api("会员处理") | 27 | @Api("会员处理") |
... | @@ -33,19 +35,25 @@ public class MemberOperationController { | ... | @@ -33,19 +35,25 @@ public class MemberOperationController { |
33 | private MemberOperationService memberOperationService; | 35 | private MemberOperationService memberOperationService; |
34 | 36 | ||
35 | @Log("手动修改vip") | 37 | @Log("手动修改vip") |
36 | @RequestMapping(value = "/doUpdateVipByMemberId") | 38 | @RequestMapping(value = "/updateVipByMemberId") |
37 | @ApiOperation("手动修改vip") | 39 | @ApiOperation("手动修改vip") |
38 | @AnonymousAccess | 40 | @AnonymousAccess |
39 | public ResultInfo doUpdateVipByMemberId(@Validated(value = {UpdateGroup.class}) @RequestBody MemberOperationBean resources) { | 41 | public ResultInfo updateVipByMemberId(@Validated(value = {UpdateGroup.class}) @RequestBody MemberOperationBean resources) { |
40 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); | 42 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); |
41 | 43 | Integer vip = resources.getVip(); | |
44 | LocalDateTime vipExpireTime = resources.getVipExpireTime(); | ||
42 | Long memberId = resources.getMemberId(); | 45 | Long memberId = resources.getMemberId(); |
43 | MemberDTO memberDTO = this.memberOperationService.findById(memberId); | 46 | MemberDTO memberDTO = this.memberOperationService.findById(memberId); |
44 | 47 | ||
45 | Member member = new Member(); | 48 | Member member = new Member(); |
46 | BeanUtils.copyProperties(memberDTO, member); | 49 | BeanUtils.copyProperties(memberDTO, member); |
50 | if (Objects.nonNull(vip)) { | ||
51 | member.setVip(vip); | ||
52 | } | ||
53 | if (Objects.nonNull(vipExpireTime)) { | ||
54 | member.setVipExpireTime(vipExpireTime); | ||
55 | } | ||
47 | this.memberOperationService.update(member); | 56 | this.memberOperationService.update(member); |
48 | log.info("member ==>> doUpdateVipByCode ==>> result ==>> [{}]",resources); | ||
49 | return ResultInfo.success(); | 57 | return ResultInfo.success(); |
50 | } | 58 | } |
51 | 59 | ... | ... |
-
Please register or sign in to post a comment