1.优化
Showing
18 changed files
with
311 additions
and
49 deletions
| ... | @@ -89,13 +89,13 @@ public class MemberAddressBuilder { | ... | @@ -89,13 +89,13 @@ public class MemberAddressBuilder { |
| 89 | 89 | ||
| 90 | MemberAddress memberAddress = new MemberAddress(); | 90 | MemberAddress memberAddress = new MemberAddress(); |
| 91 | memberAddress.setId(Objects.nonNull(id)?null:id); | 91 | memberAddress.setId(Objects.nonNull(id)?null:id); |
| 92 | memberAddress.setMemberId(Objects.nonNull(memberId)?null:memberId); | 92 | memberAddress.setMemberId(Objects.isNull(memberId)?null:memberId); |
| 93 | memberAddress.setMemberCode(stringIsNull(memberCode)); | 93 | memberAddress.setMemberCode(stringIsNull(memberCode)); |
| 94 | 94 | ||
| 95 | memberAddress.setSequence(Objects.nonNull(sequence)?null:DEFAULT_VALUE_1); | 95 | memberAddress.setSequence(Objects.nonNull(sequence)?null:DEFAULT_VALUE_1); |
| 96 | memberAddress.setType(Objects.nonNull(type)?null:DEFAULT_VALUE_0); | 96 | memberAddress.setType(Objects.isNull(type)?null:DEFAULT_VALUE_0); |
| 97 | memberAddress.setIsDefault(Objects.nonNull(isDefault)?null:DEFAULT_VALUE_0); | 97 | memberAddress.setIsDefault(Objects.nonNull(isDefault)?null:DEFAULT_VALUE_0); |
| 98 | memberAddress.setStatus(Objects.nonNull(status)?null:DEFAULT_VALUE_1); | 98 | memberAddress.setStatus(Objects.isNull(status)?null:DEFAULT_VALUE_1); |
| 99 | 99 | ||
| 100 | memberAddress.setContactor(stringIsNull(contactor)); | 100 | memberAddress.setContactor(stringIsNull(contactor)); |
| 101 | memberAddress.setCellphone(stringIsNull(cellphone)); | 101 | memberAddress.setCellphone(stringIsNull(cellphone)); | ... | ... |
| 1 | package com.topdraw.business.module.member.address.rest; | 1 | package com.topdraw.business.module.member.address.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.annotation.AnonymousAccess; | ||
| 3 | import com.topdraw.aop.log.Log; | 4 | import com.topdraw.aop.log.Log; |
| 4 | import com.topdraw.business.module.common.validated.CreateGroup; | 5 | import com.topdraw.business.module.common.validated.CreateGroup; |
| 5 | import com.topdraw.business.module.common.validated.UpdateGroup; | 6 | import com.topdraw.business.module.common.validated.UpdateGroup; |
| ... | @@ -30,6 +31,7 @@ public class MemberAddressController { | ... | @@ -30,6 +31,7 @@ public class MemberAddressController { |
| 30 | @Log("新增会员地址") | 31 | @Log("新增会员地址") |
| 31 | @RequestMapping(value = "/create") | 32 | @RequestMapping(value = "/create") |
| 32 | @ApiOperation("新增会员地址") | 33 | @ApiOperation("新增会员地址") |
| 34 | @AnonymousAccess | ||
| 33 | public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberAddress resources) { | 35 | public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberAddress resources) { |
| 34 | log.info("memberAddress ==>> create ==> param ==>> [{}]",resources); | 36 | log.info("memberAddress ==>> create ==> param ==>> [{}]",resources); |
| 35 | this.memberAddressOperationService.create(resources); | 37 | this.memberAddressOperationService.create(resources); |
| ... | @@ -40,6 +42,7 @@ public class MemberAddressController { | ... | @@ -40,6 +42,7 @@ public class MemberAddressController { |
| 40 | @Log("修改会员地址") | 42 | @Log("修改会员地址") |
| 41 | @RequestMapping(value = "/update") | 43 | @RequestMapping(value = "/update") |
| 42 | @ApiOperation("修改会员地址") | 44 | @ApiOperation("修改会员地址") |
| 45 | @AnonymousAccess | ||
| 43 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberAddress resources) { | 46 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberAddress resources) { |
| 44 | log.info("memberAddress ==>> update ==> param ==>> [{}]",resources); | 47 | log.info("memberAddress ==>> update ==> param ==>> [{}]",resources); |
| 45 | this.memberAddressOperationService.update(resources); | 48 | this.memberAddressOperationService.update(resources); |
| ... | @@ -50,6 +53,7 @@ public class MemberAddressController { | ... | @@ -50,6 +53,7 @@ public class MemberAddressController { |
| 50 | @Log("删除会员地址") | 53 | @Log("删除会员地址") |
| 51 | @RequestMapping(value = "/delete/{id}") | 54 | @RequestMapping(value = "/delete/{id}") |
| 52 | @ApiOperation("删除会员地址") | 55 | @ApiOperation("删除会员地址") |
| 56 | @AnonymousAccess | ||
| 53 | public ResultInfo delete(@PathVariable Long resources) { | 57 | public ResultInfo delete(@PathVariable Long resources) { |
| 54 | log.info("memberAddress ==>> delete ==> param ==>> [{}]",resources); | 58 | log.info("memberAddress ==>> delete ==> param ==>> [{}]",resources); |
| 55 | this.memberAddressOperationService.delete(resources); | 59 | this.memberAddressOperationService.delete(resources); | ... | ... |
| 1 | package com.topdraw.business.module.member.profile.rest; | 1 | package com.topdraw.business.module.member.profile.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.annotation.AnonymousAccess; | ||
| 3 | import com.topdraw.aop.log.Log; | 4 | import com.topdraw.aop.log.Log; |
| 5 | import com.topdraw.business.module.common.validated.UpdateGroup; | ||
| 4 | import com.topdraw.business.process.service.member.MemberProfileOperationService; | 6 | import com.topdraw.business.process.service.member.MemberProfileOperationService; |
| 5 | import com.topdraw.common.ResultInfo; | 7 | import com.topdraw.common.ResultInfo; |
| 6 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | 8 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
| ... | @@ -28,8 +30,9 @@ public class MemberProfileController { | ... | @@ -28,8 +30,9 @@ public class MemberProfileController { |
| 28 | @Log("修改会员属性") | 30 | @Log("修改会员属性") |
| 29 | @RequestMapping(value = "/update") | 31 | @RequestMapping(value = "/update") |
| 30 | @ApiOperation("修改会员属性") | 32 | @ApiOperation("修改会员属性") |
| 33 | @AnonymousAccess | ||
| 31 | @Deprecated | 34 | @Deprecated |
| 32 | public ResultInfo update(@Validated @RequestBody MemberProfile resources) { | 35 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberProfile resources) { |
| 33 | 36 | ||
| 34 | log.info("memberProfile ==>> update ==>> resources ===>> [{}]",resources); | 37 | log.info("memberProfile ==>> update ==>> resources ===>> [{}]",resources); |
| 35 | this.memberProfileOperationService.update(resources); | 38 | this.memberProfileOperationService.update(resources); |
| ... | @@ -38,4 +41,12 @@ public class MemberProfileController { | ... | @@ -38,4 +41,12 @@ public class MemberProfileController { |
| 38 | return ResultInfo.success(); | 41 | return ResultInfo.success(); |
| 39 | } | 42 | } |
| 40 | 43 | ||
| 44 | @PutMapping | ||
| 45 | @ApiOperation("修改MemberProfile") | ||
| 46 | @AnonymousAccess | ||
| 47 | public ResultInfo updateMemberProfileAndMember(@Validated @RequestBody MemberProfile resources) { | ||
| 48 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); | ||
| 49 | this.memberProfileOperationService.updateMemberProfileAndMember(resources); | ||
| 50 | return ResultInfo.success(); | ||
| 51 | } | ||
| 41 | } | 52 | } | ... | ... |
| ... | @@ -4,6 +4,7 @@ import com.topdraw.business.module.member.domain.Member; | ... | @@ -4,6 +4,7 @@ import com.topdraw.business.module.member.domain.Member; |
| 4 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | 4 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
| 5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 6 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileQueryCriteria; | 6 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileQueryCriteria; |
| 7 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
| 7 | import org.springframework.data.domain.Pageable; | 8 | import org.springframework.data.domain.Pageable; |
| 8 | import java.util.Map; | 9 | import java.util.Map; |
| 9 | import java.util.List; | 10 | import java.util.List; |
| ... | @@ -79,5 +80,5 @@ public interface MemberProfileService { | ... | @@ -79,5 +80,5 @@ public interface MemberProfileService { |
| 79 | * 修改会员属性并同步会员信息 | 80 | * 修改会员属性并同步会员信息 |
| 80 | * @param resources | 81 | * @param resources |
| 81 | */ | 82 | */ |
| 82 | void updateMemberProfileAndMember(MemberProfile resources); | 83 | void updateMemberProfileAndMember(MemberProfile resources, MemberDTO memberDTO); |
| 83 | } | 84 | } | ... | ... |
| ... | @@ -123,8 +123,7 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -123,8 +123,7 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
| 123 | MemberProfile memberProfile = new MemberProfile(); | 123 | MemberProfile memberProfile = new MemberProfile(); |
| 124 | BeanUtils.copyProperties(resources,memberProfile); | 124 | BeanUtils.copyProperties(resources,memberProfile); |
| 125 | MemberProfile _memberProfile = this.memberProfileRepository.save(memberProfile); | 125 | MemberProfile _memberProfile = this.memberProfileRepository.save(memberProfile); |
| 126 | // 同步会员信息 | 126 | |
| 127 | this.synchronizedMemberData(resources); | ||
| 128 | 127 | ||
| 129 | MemberProfileDTO memberProfileDTO = new MemberProfileDTO(); | 128 | MemberProfileDTO memberProfileDTO = new MemberProfileDTO(); |
| 130 | BeanUtils.copyProperties(_memberProfile,memberProfileDTO); | 129 | BeanUtils.copyProperties(_memberProfile,memberProfileDTO); |
| ... | @@ -150,36 +149,27 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -150,36 +149,27 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
| 150 | 149 | ||
| 151 | @Override | 150 | @Override |
| 152 | @Transactional(rollbackFor = Exception.class) | 151 | @Transactional(rollbackFor = Exception.class) |
| 153 | public void updateMemberProfileAndMember(MemberProfile resources) { | 152 | public void updateMemberProfileAndMember(MemberProfile resources, MemberDTO memberDTO) { |
| 154 | log.info("MemberProfileServiceImpl ==>> updateMemberProfileAndMember ==>> resources ===>> [{}]",resources); | 153 | log.info("MemberProfileServiceImpl ==>> updateMemberProfileAndMember ==>> resources ===>> [{}]",resources); |
| 155 | this.update(resources); | 154 | this.update(resources); |
| 155 | // 同步会员信息 | ||
| 156 | this.synchronizedMemberData(resources, memberDTO); | ||
| 156 | } | 157 | } |
| 157 | 158 | ||
| 158 | private void synchronizedMemberData(String nickName , Integer gender , String birthday, | 159 | private void synchronizedMemberData(MemberProfile resources, MemberDTO memberDTO) { |
| 159 | String avatarUrl,Long memberId,String memberCode) { | ||
| 160 | MemberProfile memberProfile = new MemberProfile(); | ||
| 161 | memberProfile.setMemberId(memberId); | ||
| 162 | memberProfile.setMemberCode(memberCode); | ||
| 163 | memberProfile.setRealname(nickName); | ||
| 164 | memberProfile.setGender(gender); | ||
| 165 | memberProfile.setBirthday(birthday); | ||
| 166 | memberProfile.setAvatarUrl(avatarUrl); | ||
| 167 | this.synchronizedMemberData(memberProfile); | ||
| 168 | } | ||
| 169 | |||
| 170 | private void synchronizedMemberData(MemberProfile resources) { | ||
| 171 | 160 | ||
| 172 | log.info("updateMemberProfileAndMember ==>> resources ==>> [{}]",resources); | 161 | log.info("updateMemberProfileAndMember ==>> resources ==>> [{}]",resources); |
| 173 | 162 | ||
| 163 | memberDTO.setId(resources.getMemberId()); | ||
| 164 | memberDTO.setCode(resources.getMemberCode()); | ||
| 165 | memberDTO.setNickname(resources.getRealname()); | ||
| 166 | memberDTO.setGender(resources.getGender()); | ||
| 167 | memberDTO.setBirthday(resources.getBirthday()); | ||
| 168 | memberDTO.setAvatarUrl(resources.getAvatarUrl()); | ||
| 169 | |||
| 174 | Member member = new Member(); | 170 | Member member = new Member(); |
| 175 | member.setId(resources.getMemberId()); | 171 | BeanUtils.copyProperties(memberDTO,member); |
| 176 | member.setCode(resources.getMemberCode()); | ||
| 177 | member.setNickname(resources.getRealname()); | ||
| 178 | member.setGender(resources.getGender()); | ||
| 179 | member.setBirthday(resources.getBirthday()); | ||
| 180 | member.setAvatarUrl(resources.getAvatarUrl()); | ||
| 181 | 172 | ||
| 182 | this.memberService.update(member); | 173 | this.memberService.update(member); |
| 183 | } | 174 | } |
| 184 | |||
| 185 | } | 175 | } | ... | ... |
| ... | @@ -23,7 +23,7 @@ public class MemberRelatedInfoBuilder { | ... | @@ -23,7 +23,7 @@ public class MemberRelatedInfoBuilder { |
| 23 | private static final Integer DEFAULT_VALUE_0 = 0; | 23 | private static final Integer DEFAULT_VALUE_0 = 0; |
| 24 | 24 | ||
| 25 | public static MemberRelatedInfo build(MemberRelatedInfo memberRelatedInfo){ | 25 | public static MemberRelatedInfo build(MemberRelatedInfo memberRelatedInfo){ |
| 26 | return build(memberRelatedInfo.getId(),memberRelatedInfo.getMemberCode(),memberRelatedInfo.getId(),memberRelatedInfo.getName(),memberRelatedInfo.getSex(), | 26 | return build(memberRelatedInfo.getMemberId(),memberRelatedInfo.getMemberCode(),memberRelatedInfo.getId(),memberRelatedInfo.getName(),memberRelatedInfo.getSex(), |
| 27 | memberRelatedInfo.getCellphone(),memberRelatedInfo.getIdCard(),memberRelatedInfo.getBirthday(),memberRelatedInfo.getAvatarUrl(),memberRelatedInfo.getType()); | 27 | memberRelatedInfo.getCellphone(),memberRelatedInfo.getIdCard(),memberRelatedInfo.getBirthday(),memberRelatedInfo.getAvatarUrl(),memberRelatedInfo.getType()); |
| 28 | } | 28 | } |
| 29 | 29 | ... | ... |
| 1 | package com.topdraw.business.module.member.relatedinfo.rest; | 1 | package com.topdraw.business.module.member.relatedinfo.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.annotation.AnonymousAccess; | ||
| 3 | import com.topdraw.aop.log.Log; | 4 | import com.topdraw.aop.log.Log; |
| 4 | import com.topdraw.business.module.common.validated.CreateGroup; | 5 | import com.topdraw.business.module.common.validated.CreateGroup; |
| 5 | import com.topdraw.business.module.common.validated.UpdateGroup; | 6 | import com.topdraw.business.module.common.validated.UpdateGroup; |
| ... | @@ -37,6 +38,7 @@ public class MemberRelatedInfoController { | ... | @@ -37,6 +38,7 @@ public class MemberRelatedInfoController { |
| 37 | @Log("新增相关人员") | 38 | @Log("新增相关人员") |
| 38 | @RequestMapping(value = "/create") | 39 | @RequestMapping(value = "/create") |
| 39 | @ApiOperation("新增相关人员") | 40 | @ApiOperation("新增相关人员") |
| 41 | @AnonymousAccess | ||
| 40 | public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberRelatedInfo resources) { | 42 | public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberRelatedInfo resources) { |
| 41 | log.info("memberRelatedInfo ==>> create ==>> resources ===>> [{}]",resources); | 43 | log.info("memberRelatedInfo ==>> create ==>> resources ===>> [{}]",resources); |
| 42 | 44 | ||
| ... | @@ -48,6 +50,7 @@ public class MemberRelatedInfoController { | ... | @@ -48,6 +50,7 @@ public class MemberRelatedInfoController { |
| 48 | @Log("修改相关人员") | 50 | @Log("修改相关人员") |
| 49 | @RequestMapping(value = "/update") | 51 | @RequestMapping(value = "/update") |
| 50 | @ApiOperation("修改相关人员") | 52 | @ApiOperation("修改相关人员") |
| 53 | @AnonymousAccess | ||
| 51 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberRelatedInfo resources) { | 54 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberRelatedInfo resources) { |
| 52 | 55 | ||
| 53 | log.info("memberRelatedInfo ==>> update ==>> resources ===>> [{}]",resources); | 56 | log.info("memberRelatedInfo ==>> update ==>> resources ===>> [{}]",resources); |
| ... | @@ -73,6 +76,7 @@ public class MemberRelatedInfoController { | ... | @@ -73,6 +76,7 @@ public class MemberRelatedInfoController { |
| 73 | @Log("删除相关人员") | 76 | @Log("删除相关人员") |
| 74 | @RequestMapping(value = "/delete/{id}") | 77 | @RequestMapping(value = "/delete/{id}") |
| 75 | @ApiOperation("删除相关人员") | 78 | @ApiOperation("删除相关人员") |
| 79 | @AnonymousAccess | ||
| 76 | public ResultInfo delete(@PathVariable(value = "id") Long resources) { | 80 | public ResultInfo delete(@PathVariable(value = "id") Long resources) { |
| 77 | log.info("memberRelatedInfo ==>> delete ==>> resources ===>> [{}]",resources); | 81 | log.info("memberRelatedInfo ==>> delete ==>> resources ===>> [{}]",resources); |
| 78 | this.memberRelatedInfoOperationService.delete(resources); | 82 | this.memberRelatedInfoOperationService.delete(resources); | ... | ... |
| ... | @@ -15,13 +15,13 @@ import com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoS | ... | @@ -15,13 +15,13 @@ import com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoS |
| 15 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO; | 15 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO; |
| 16 | import com.topdraw.business.module.member.relatedinfo.service.mapper.MemberRelatedInfoMapper; | 16 | import com.topdraw.business.module.member.relatedinfo.service.mapper.MemberRelatedInfoMapper; |
| 17 | import lombok.extern.slf4j.Slf4j; | 17 | import lombok.extern.slf4j.Slf4j; |
| 18 | import org.apache.commons.lang3.StringUtils; | ||
| 18 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 19 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
| 20 | import org.springframework.transaction.annotation.Propagation; | 21 | import org.springframework.transaction.annotation.Propagation; |
| 21 | import org.springframework.transaction.annotation.Transactional; | 22 | import org.springframework.transaction.annotation.Transactional; |
| 22 | import org.springframework.dao.EmptyResultDataAccessException; | 23 | import org.springframework.dao.EmptyResultDataAccessException; |
| 23 | import org.springframework.util.Assert; | 24 | import org.springframework.util.Assert; |
| 24 | import org.springframework.util.StringUtils; | ||
| 25 | 25 | ||
| 26 | import java.util.Objects; | 26 | import java.util.Objects; |
| 27 | 27 | ||
| ... | @@ -61,7 +61,7 @@ public class MemberRelatedInfoServiceImpl implements MemberRelatedInfoService { | ... | @@ -61,7 +61,7 @@ public class MemberRelatedInfoServiceImpl implements MemberRelatedInfoService { |
| 61 | log.info("MemberRelatedInfoServiceImpl ==>> create ==>> param ==>> [{}]",resources); | 61 | log.info("MemberRelatedInfoServiceImpl ==>> create ==>> param ==>> [{}]",resources); |
| 62 | String idCard = resources.getIdCard(); | 62 | String idCard = resources.getIdCard(); |
| 63 | Long memberId = resources.getMemberId(); | 63 | Long memberId = resources.getMemberId(); |
| 64 | if (Objects.nonNull(memberId) && !StringUtils.hasText(idCard) && !idCard.equalsIgnoreCase(DEFAULT_IDCARD) ) { | 64 | if (Objects.nonNull(memberId) && StringUtils.isNotBlank(idCard) && !idCard.equalsIgnoreCase(DEFAULT_IDCARD) ) { |
| 65 | MemberRelatedInfo memberRelatedInfo = this.findByMemberIdAndIdCard(resources); | 65 | MemberRelatedInfo memberRelatedInfo = this.findByMemberIdAndIdCard(resources); |
| 66 | if (Objects.nonNull(memberRelatedInfo)) | 66 | if (Objects.nonNull(memberRelatedInfo)) |
| 67 | // 数据已存在 | 67 | // 数据已存在 |
| ... | @@ -95,7 +95,7 @@ public class MemberRelatedInfoServiceImpl implements MemberRelatedInfoService { | ... | @@ -95,7 +95,7 @@ public class MemberRelatedInfoServiceImpl implements MemberRelatedInfoService { |
| 95 | */ | 95 | */ |
| 96 | private void encodeRealname(MemberRelatedInfo resources){ | 96 | private void encodeRealname(MemberRelatedInfo resources){ |
| 97 | String name = resources.getName(); | 97 | String name = resources.getName(); |
| 98 | if (StringUtils.hasText(name)) { | 98 | if (StringUtils.isNotBlank(name)) { |
| 99 | String nickNameEncode = Base64Util.encode(name); | 99 | String nickNameEncode = Base64Util.encode(name); |
| 100 | if (!nickNameEncode.equalsIgnoreCase(name)) | 100 | if (!nickNameEncode.equalsIgnoreCase(name)) |
| 101 | resources.setName(nickNameEncode); | 101 | resources.setName(nickNameEncode); | ... | ... |
| 1 | package com.topdraw.business.module.member.rest; | 1 | package com.topdraw.business.module.member.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.annotation.AnonymousAccess; | ||
| 3 | import com.topdraw.aop.log.Log; | 4 | import com.topdraw.aop.log.Log; |
| 4 | import com.topdraw.business.module.common.validated.CreateGroup; | 5 | import com.topdraw.business.module.common.validated.CreateGroup; |
| 5 | import com.topdraw.business.module.common.validated.UpdateGroup; | 6 | import com.topdraw.business.module.common.validated.UpdateGroup; |
| 6 | import com.topdraw.business.module.member.domain.Member; | 7 | import com.topdraw.business.module.member.domain.Member; |
| 8 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
| 7 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 9 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 8 | import com.topdraw.business.process.service.member.MemberOperationService; | 10 | import com.topdraw.business.process.service.member.MemberOperationService; |
| 9 | import com.topdraw.business.process.service.UserOperationService; | 11 | import com.topdraw.business.process.service.UserOperationService; |
| ... | @@ -12,9 +14,12 @@ import io.swagger.annotations.Api; | ... | @@ -12,9 +14,12 @@ import io.swagger.annotations.Api; |
| 12 | import io.swagger.annotations.ApiOperation; | 14 | import io.swagger.annotations.ApiOperation; |
| 13 | import lombok.extern.slf4j.Slf4j; | 15 | import lombok.extern.slf4j.Slf4j; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | import org.springframework.util.Assert; | ||
| 15 | import org.springframework.validation.annotation.Validated; | 18 | import org.springframework.validation.annotation.Validated; |
| 16 | import org.springframework.web.bind.annotation.*; | 19 | import org.springframework.web.bind.annotation.*; |
| 17 | 20 | ||
| 21 | import java.util.Objects; | ||
| 22 | |||
| 18 | /** | 23 | /** |
| 19 | * @author XiangHan | 24 | * @author XiangHan |
| 20 | * @date 2021-10-22 | 25 | * @date 2021-10-22 |
| ... | @@ -33,7 +38,8 @@ public class MemberController { | ... | @@ -33,7 +38,8 @@ public class MemberController { |
| 33 | 38 | ||
| 34 | 39 | ||
| 35 | @Log("为大屏账户创建会员") | 40 | @Log("为大屏账户创建会员") |
| 36 | @RequestMapping(value = "/createMemberByUserTv") | 41 | @RequestMapping(value = "/createMemberByUs" + |
| 42 | "@AnonymousAccesserTv") | ||
| 37 | @ApiOperation("为大屏账户创建会员") | 43 | @ApiOperation("为大屏账户创建会员") |
| 38 | @Deprecated | 44 | @Deprecated |
| 39 | public ResultInfo createMemberByUserTv(@Validated(value = {CreateGroup.class}) @RequestBody UserTv resources) { | 45 | public ResultInfo createMemberByUserTv(@Validated(value = {CreateGroup.class}) @RequestBody UserTv resources) { |
| ... | @@ -45,6 +51,7 @@ public class MemberController { | ... | @@ -45,6 +51,7 @@ public class MemberController { |
| 45 | 51 | ||
| 46 | @Log("手动修改vip") | 52 | @Log("手动修改vip") |
| 47 | @RequestMapping(value = "/doUpdateVipByCode") | 53 | @RequestMapping(value = "/doUpdateVipByCode") |
| 54 | @AnonymousAccess | ||
| 48 | @ApiOperation("手动修改vip") | 55 | @ApiOperation("手动修改vip") |
| 49 | public ResultInfo doUpdateVipByCode(@Validated(value = {UpdateGroup.class}) @RequestBody Member resources) { | 56 | public ResultInfo doUpdateVipByCode(@Validated(value = {UpdateGroup.class}) @RequestBody Member resources) { |
| 50 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); | 57 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); |
| ... | @@ -52,4 +59,17 @@ public class MemberController { | ... | @@ -52,4 +59,17 @@ public class MemberController { |
| 52 | log.info("member ==>> doUpdateVipByCode ==>> result ==>> [{}]",resources); | 59 | log.info("member ==>> doUpdateVipByCode ==>> result ==>> [{}]",resources); |
| 53 | return ResultInfo.success(); | 60 | return ResultInfo.success(); |
| 54 | } | 61 | } |
| 62 | |||
| 63 | @Log("修改会员信息") | ||
| 64 | @PutMapping(value = "/update") | ||
| 65 | @ApiOperation("修改会员信息") | ||
| 66 | @AnonymousAccess | ||
| 67 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody Member resources) { | ||
| 68 | log.info("member ==>> update ==>> param ==>> [{}]",resources); | ||
| 69 | |||
| 70 | MemberDTO memberDTO = this.memberOperationService.update(resources); | ||
| 71 | log.info("member ==>> update ==>> result ==>> [{}]",resources); | ||
| 72 | return ResultInfo.success(memberDTO); | ||
| 73 | } | ||
| 74 | |||
| 55 | } | 75 | } | ... | ... |
| 1 | package com.topdraw.business.module.user.weixin.domain; | 1 | package com.topdraw.business.module.user.weixin.domain; |
| 2 | 2 | ||
| 3 | import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 3 | import com.topdraw.business.module.common.domain.AsyncMqModule; | 4 | import com.topdraw.business.module.common.domain.AsyncMqModule; |
| 4 | import com.topdraw.business.module.common.validated.CreateGroup; | 5 | import com.topdraw.business.module.common.validated.CreateGroup; |
| 5 | import lombok.Data; | 6 | import lombok.Data; |
| ... | @@ -135,6 +136,7 @@ public class UserWeixin extends AsyncMqModule implements Serializable { | ... | @@ -135,6 +136,7 @@ public class UserWeixin extends AsyncMqModule implements Serializable { |
| 135 | private String sourceEntity; | 136 | private String sourceEntity; |
| 136 | 137 | ||
| 137 | /** 授权时间 */ | 138 | /** 授权时间 */ |
| 139 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") | ||
| 138 | @Column(name = "auth_time") | 140 | @Column(name = "auth_time") |
| 139 | private Timestamp authTime; | 141 | private Timestamp authTime; |
| 140 | 142 | ... | ... |
| ... | @@ -41,6 +41,7 @@ public class UserWeixinBuilder { | ... | @@ -41,6 +41,7 @@ public class UserWeixinBuilder { |
| 41 | public static UserWeixin build(UserWeixin userWeixin){ | 41 | public static UserWeixin build(UserWeixin userWeixin){ |
| 42 | return build(userWeixin.getId(), | 42 | return build(userWeixin.getId(), |
| 43 | userWeixin.getMemberId(), | 43 | userWeixin.getMemberId(), |
| 44 | userWeixin.getMemberCode(), | ||
| 44 | userWeixin.getUnionid(),userWeixin.getAppid(),userWeixin.getOpenid(), | 45 | userWeixin.getUnionid(),userWeixin.getAppid(),userWeixin.getOpenid(), |
| 45 | userWeixin.getStatus(),userWeixin.getSyncStatus(), | 46 | userWeixin.getStatus(),userWeixin.getSyncStatus(), |
| 46 | userWeixin.getNickname(),userWeixin.getHeadimgurl(), | 47 | userWeixin.getNickname(),userWeixin.getHeadimgurl(), |
| ... | @@ -51,10 +52,24 @@ public class UserWeixinBuilder { | ... | @@ -51,10 +52,24 @@ public class UserWeixinBuilder { |
| 51 | userWeixin.getCity(),userWeixin.getSex()); | 52 | userWeixin.getCity(),userWeixin.getSex()); |
| 52 | } | 53 | } |
| 53 | 54 | ||
| 55 | public static UserWeixin build(Long memberId , String memberCode, UserWeixin userWeixin){ | ||
| 56 | return build(userWeixin.getId(), | ||
| 57 | memberId, | ||
| 58 | memberCode, | ||
| 59 | userWeixin.getUnionid(),userWeixin.getAppid(),userWeixin.getOpenid(), | ||
| 60 | userWeixin.getStatus(),userWeixin.getSyncStatus(), | ||
| 61 | userWeixin.getNickname(),userWeixin.getHeadimgurl(), | ||
| 62 | userWeixin.getPrivilege(), userWeixin.getRefreshToken(),userWeixin.getAccessToken(), | ||
| 63 | userWeixin.getExpiresIn(),userWeixin.getExpiresTime(),userWeixin.getDescription(), | ||
| 64 | userWeixin.getCreateBy(),userWeixin.getUpdateBy(),userWeixin.getSourceType(),userWeixin.getSourceId(), | ||
| 65 | userWeixin.getSourceDesc(),userWeixin.getSourceUser(),userWeixin.getSourceEntity(),userWeixin.getCountry(),userWeixin.getProvince(), | ||
| 66 | userWeixin.getCity(),userWeixin.getSex()); | ||
| 67 | } | ||
| 54 | 68 | ||
| 55 | public static UserWeixin build(Long memberId , UserWeixin userWeixin){ | 69 | public static UserWeixin build(Long memberId , UserWeixin userWeixin){ |
| 56 | return build(userWeixin.getId(), | 70 | return build(userWeixin.getId(), |
| 57 | memberId, | 71 | memberId, |
| 72 | userWeixin.getMemberCode(), | ||
| 58 | userWeixin.getUnionid(),userWeixin.getAppid(),userWeixin.getOpenid(), | 73 | userWeixin.getUnionid(),userWeixin.getAppid(),userWeixin.getOpenid(), |
| 59 | userWeixin.getStatus(),userWeixin.getSyncStatus(), | 74 | userWeixin.getStatus(),userWeixin.getSyncStatus(), |
| 60 | userWeixin.getNickname(),userWeixin.getHeadimgurl(), | 75 | userWeixin.getNickname(),userWeixin.getHeadimgurl(), |
| ... | @@ -68,6 +83,7 @@ public class UserWeixinBuilder { | ... | @@ -68,6 +83,7 @@ public class UserWeixinBuilder { |
| 68 | public static UserWeixin build(Member member , UserWeixin userWeixin) { | 83 | public static UserWeixin build(Member member , UserWeixin userWeixin) { |
| 69 | return build(userWeixin.getId(), | 84 | return build(userWeixin.getId(), |
| 70 | member.getId(), | 85 | member.getId(), |
| 86 | member.getCode(), | ||
| 71 | userWeixin.getUnionid(),userWeixin.getAppid(),userWeixin.getOpenid(), | 87 | userWeixin.getUnionid(),userWeixin.getAppid(),userWeixin.getOpenid(), |
| 72 | userWeixin.getStatus(),userWeixin.getSyncStatus(), | 88 | userWeixin.getStatus(),userWeixin.getSyncStatus(), |
| 73 | userWeixin.getNickname(),userWeixin.getHeadimgurl(), | 89 | userWeixin.getNickname(),userWeixin.getHeadimgurl(), |
| ... | @@ -81,6 +97,7 @@ public class UserWeixinBuilder { | ... | @@ -81,6 +97,7 @@ public class UserWeixinBuilder { |
| 81 | 97 | ||
| 82 | public static UserWeixin build(Long id , | 98 | public static UserWeixin build(Long id , |
| 83 | Long memberId, | 99 | Long memberId, |
| 100 | String memberCode, | ||
| 84 | String unionId, String appId,String openId, | 101 | String unionId, String appId,String openId, |
| 85 | Integer status, Integer syncStatus, | 102 | Integer status, Integer syncStatus, |
| 86 | String nickname,String headimgurl, | 103 | String nickname,String headimgurl, |
| ... | @@ -100,6 +117,7 @@ public class UserWeixinBuilder { | ... | @@ -100,6 +117,7 @@ public class UserWeixinBuilder { |
| 100 | UserWeixin userWeixin = new UserWeixin(); | 117 | UserWeixin userWeixin = new UserWeixin(); |
| 101 | userWeixin.setId(Objects.nonNull(id)?id:null); | 118 | userWeixin.setId(Objects.nonNull(id)?id:null); |
| 102 | userWeixin.setMemberId(memberId); | 119 | userWeixin.setMemberId(memberId); |
| 120 | userWeixin.setMemberCode(memberCode); | ||
| 103 | userWeixin.setUnionid(StringUtils.isNotBlank(unionId)?unionId:""); | 121 | userWeixin.setUnionid(StringUtils.isNotBlank(unionId)?unionId:""); |
| 104 | userWeixin.setAppid(StringUtils.isNotBlank(appId)?appId:""); | 122 | userWeixin.setAppid(StringUtils.isNotBlank(appId)?appId:""); |
| 105 | userWeixin.setOpenid(StringUtils.isNotBlank(openId)?openId:""); | 123 | userWeixin.setOpenid(StringUtils.isNotBlank(openId)?openId:""); | ... | ... |
| ... | @@ -20,6 +20,7 @@ import com.topdraw.business.process.service.UserOperationService; | ... | @@ -20,6 +20,7 @@ import com.topdraw.business.process.service.UserOperationService; |
| 20 | import com.topdraw.common.ResultInfo; | 20 | import com.topdraw.common.ResultInfo; |
| 21 | import com.topdraw.config.RedisKeyUtil; | 21 | import com.topdraw.config.RedisKeyUtil; |
| 22 | import com.topdraw.exception.BadRequestException; | 22 | import com.topdraw.exception.BadRequestException; |
| 23 | import com.topdraw.exception.EntityNotFoundException; | ||
| 23 | import com.topdraw.exception.GlobeExceptionMsg; | 24 | import com.topdraw.exception.GlobeExceptionMsg; |
| 24 | import com.topdraw.util.Base64Util; | 25 | import com.topdraw.util.Base64Util; |
| 25 | import com.topdraw.util.JSONUtil; | 26 | import com.topdraw.util.JSONUtil; |
| ... | @@ -205,8 +206,7 @@ public class UserOperationController { | ... | @@ -205,8 +206,7 @@ public class UserOperationController { |
| 205 | @AnonymousAccess | 206 | @AnonymousAccess |
| 206 | public ResultInfo saveUserInfo(@RequestBody String data) { | 207 | public ResultInfo saveUserInfo(@RequestBody String data) { |
| 207 | 208 | ||
| 208 | log.info("UserOperationController ==> saveUserInfo ==>> param ==> [{}]",data); | 209 | log.info("saveUserInfo ==> input ==> [{}]",data); |
| 209 | |||
| 210 | Assert.notNull(data, "用户数据不可为空"); | 210 | Assert.notNull(data, "用户数据不可为空"); |
| 211 | 211 | ||
| 212 | JSONObject json = JSONObject.parseObject(data); | 212 | JSONObject json = JSONObject.parseObject(data); |
| ... | @@ -214,23 +214,42 @@ public class UserOperationController { | ... | @@ -214,23 +214,42 @@ public class UserOperationController { |
| 214 | String unionid = json.getString("unionid"); | 214 | String unionid = json.getString("unionid"); |
| 215 | Assert.state(StrUtil.isNotBlank(unionid), "unionid不可为空"); | 215 | Assert.state(StrUtil.isNotBlank(unionid), "unionid不可为空"); |
| 216 | 216 | ||
| 217 | |||
| 218 | List<Object> resultList = new ArrayList<>(); | ||
| 217 | // 大屏侧通过返回值来展示对应的小程序页面 | 219 | // 大屏侧通过返回值来展示对应的小程序页面 |
| 218 | String result = SUBSCRIBE; | 220 | String result = SUBSCRIBE; |
| 221 | String platformAccount1 = ""; | ||
| 219 | 222 | ||
| 220 | // 保存大小屏信息到redis同时返回小屏信息 | 223 | // 保存大小屏信息到redis同时返回小屏信息 |
| 221 | UserWeixinDTO userWeixinDTO = this.userOperationService.saveUserInfo(data); | 224 | UserWeixinDTO userWeixinDTO = this.userOperationService.saveUserInfo(data); |
| 225 | // 小屏会员 | ||
| 226 | MemberDTO memberDTO = this.memberService.findById(userWeixinDTO.getMemberId()); | ||
| 222 | // 小屏用户不存在或者关注状态为未关注(0),返回未关注 | 227 | // 小屏用户不存在或者关注状态为未关注(0),返回未关注 |
| 223 | if (Objects.isNull(userWeixinDTO) || Objects.isNull(userWeixinDTO.getId()) || userWeixinDTO.getStatus() != SUBSCRIBE_STATUS) { | 228 | if (Objects.isNull(userWeixinDTO) || Objects.isNull(userWeixinDTO.getId()) || userWeixinDTO.getStatus() != SUBSCRIBE_STATUS) { |
| 224 | result = UNSUBSCRIBE; | 229 | result = UNSUBSCRIBE; |
| 225 | return ResultInfo.success(result); | 230 | |
| 231 | if (Objects.nonNull(memberDTO)) { | ||
| 232 | // 检查是否绑定,返回绑定的大屏账户 | ||
| 233 | UserTvDTO userTvDTO = this.userOperationService.checkBind(memberDTO); | ||
| 234 | if (Objects.nonNull(userTvDTO)) { | ||
| 235 | platformAccount1 = userTvDTO.getPlatformAccount(); | ||
| 236 | } | ||
| 237 | |||
| 238 | } else { | ||
| 239 | log.info("userWeixinDTO ==>> [{}]",userWeixinDTO); | ||
| 240 | throw new EntityNotFoundException(MemberDTO.class,"code","member is null !!"); | ||
| 241 | } | ||
| 242 | |||
| 243 | resultList.add(result); | ||
| 244 | resultList.add(platformAccount1); | ||
| 245 | log.info("saveUserInfo ==>> result ==>> [{}]",resultList); | ||
| 246 | return ResultInfo.success(resultList); | ||
| 226 | } | 247 | } |
| 227 | 248 | ||
| 228 | /***************************************************************************************/ | 249 | /***************************************************************************************/ |
| 229 | String platformAccount1 = ""; | 250 | |
| 230 | // 关注未绑定 | 251 | // 关注未绑定 |
| 231 | if (result.equalsIgnoreCase(SUBSCRIBE)) { | 252 | if (result.equalsIgnoreCase(SUBSCRIBE)) { |
| 232 | // 小屏会员 | ||
| 233 | MemberDTO memberDTO = this.memberService.findById(userWeixinDTO.getMemberId()); | ||
| 234 | 253 | ||
| 235 | // redis中的大小屏信息 | 254 | // redis中的大小屏信息 |
| 236 | String content = (String) this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionid)); | 255 | String content = (String) this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionid)); |
| ... | @@ -268,7 +287,7 @@ public class UserOperationController { | ... | @@ -268,7 +287,7 @@ public class UserOperationController { |
| 268 | 287 | ||
| 269 | } | 288 | } |
| 270 | /****************************************************************************************/ | 289 | /****************************************************************************************/ |
| 271 | List<Object> resultList = new ArrayList<>(); | 290 | |
| 272 | resultList.add(result); | 291 | resultList.add(result); |
| 273 | resultList.add(platformAccount1); | 292 | resultList.add(platformAccount1); |
| 274 | 293 | ... | ... |
| ... | @@ -7,7 +7,6 @@ import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ... | @@ -7,7 +7,6 @@ import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| 7 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 7 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
| 8 | import com.topdraw.business.process.domian.weixin.BindBean; | 8 | import com.topdraw.business.process.domian.weixin.BindBean; |
| 9 | import com.topdraw.business.process.domian.weixin.SubscribeBean; | 9 | import com.topdraw.business.process.domian.weixin.SubscribeBean; |
| 10 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | ||
| 11 | 10 | ||
| 12 | 11 | ||
| 13 | public interface UserOperationService { | 12 | public interface UserOperationService { |
| ... | @@ -52,8 +51,6 @@ public interface UserOperationService { | ... | @@ -52,8 +51,6 @@ public interface UserOperationService { |
| 52 | */ | 51 | */ |
| 53 | void changeMainAccount(UserTv userTv); | 52 | void changeMainAccount(UserTv userTv); |
| 54 | 53 | ||
| 55 | |||
| 56 | |||
| 57 | /** | 54 | /** |
| 58 | * 微信公众号关注 | 55 | * 微信公众号关注 |
| 59 | * 1.团粉,会员vip=0,则修改为vip=1 | 56 | * 1.团粉,会员vip=0,则修改为vip=1 |
| ... | @@ -128,4 +125,10 @@ public interface UserOperationService { | ... | @@ -128,4 +125,10 @@ public interface UserOperationService { |
| 128 | */ | 125 | */ |
| 129 | UserTvDTO bind(MemberDTO memberDTO, String platformAccount); | 126 | UserTvDTO bind(MemberDTO memberDTO, String platformAccount); |
| 130 | 127 | ||
| 128 | /** | ||
| 129 | * | ||
| 130 | * @param memberDTO | ||
| 131 | * @return | ||
| 132 | */ | ||
| 133 | UserTvDTO checkBind(MemberDTO memberDTO); | ||
| 131 | } | 134 | } | ... | ... |
| ... | @@ -179,7 +179,7 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -179,7 +179,7 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 179 | MemberDTO memberDTO = this.createMember(_member); | 179 | MemberDTO memberDTO = this.createMember(_member); |
| 180 | 180 | ||
| 181 | if (Objects.nonNull(memberDTO)) { | 181 | if (Objects.nonNull(memberDTO)) { |
| 182 | UserWeixin userWeixin = UserWeixinBuilder.build(resources); | 182 | UserWeixin userWeixin = UserWeixinBuilder.build(memberDTO.getId(), resources); |
| 183 | return this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode()); | 183 | return this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode()); |
| 184 | } | 184 | } |
| 185 | 185 | ||
| ... | @@ -1057,9 +1057,9 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1057,9 +1057,9 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 1057 | * @return | 1057 | * @return |
| 1058 | */ | 1058 | */ |
| 1059 | private UserWeixinDTO createWeixinUser(UserWeixin resource, Long memberId, String memberCode){ | 1059 | private UserWeixinDTO createWeixinUser(UserWeixin resource, Long memberId, String memberCode){ |
| 1060 | if (Objects.nonNull(memberId)) resource.setMemberId(memberId); | ||
| 1061 | if (StringUtils.isNotBlank(memberCode)) resource.setMemberCode(memberCode); | ||
| 1060 | 1062 | ||
| 1061 | resource.setMemberId(memberId); | ||
| 1062 | resource.setMemberCode(memberCode); | ||
| 1063 | UserWeixin userWeixin = this.userWeixinService.create(resource); | 1063 | UserWeixin userWeixin = this.userWeixinService.create(resource); |
| 1064 | 1064 | ||
| 1065 | UserWeixinDTO userWeixinDTO = new UserWeixinDTO(); | 1065 | UserWeixinDTO userWeixinDTO = new UserWeixinDTO(); |
| ... | @@ -1067,4 +1067,14 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1067,4 +1067,14 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 1067 | return userWeixinDTO; | 1067 | return userWeixinDTO; |
| 1068 | } | 1068 | } |
| 1069 | 1069 | ||
| 1070 | |||
| 1071 | @Override | ||
| 1072 | public UserTvDTO checkBind(MemberDTO memberDTO) { | ||
| 1073 | MemberDTO memberDTO1 = this.memberService.findByCode(memberDTO.getCode()); | ||
| 1074 | if (Objects.nonNull(memberDTO1.getUserIptvId())) { | ||
| 1075 | UserTvDTO userTvDTO = this.userTvService.findById(memberDTO1.getUserIptvId()); | ||
| 1076 | return userTvDTO; | ||
| 1077 | } | ||
| 1078 | return null; | ||
| 1079 | } | ||
| 1070 | } | 1080 | } | ... | ... |
| ... | @@ -100,8 +100,8 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -100,8 +100,8 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
| 100 | @CachePut(key = "#resources.id") | 100 | @CachePut(key = "#resources.id") |
| 101 | @Override | 101 | @Override |
| 102 | public MemberDTO update(Member resources) { | 102 | public MemberDTO update(Member resources) { |
| 103 | MemberDTO member = this.memberService.update(resources); | 103 | MemberDTO memberDTO = this.memberService.update(resources); |
| 104 | return member; | 104 | return memberDTO; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | @Override | 107 | @Override | ... | ... |
| ... | @@ -4,9 +4,14 @@ import com.topdraw.business.module.member.domain.Member; | ... | @@ -4,9 +4,14 @@ import com.topdraw.business.module.member.domain.Member; |
| 4 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | 4 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
| 5 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | 5 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
| 6 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 6 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 7 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
| 8 | import com.topdraw.business.process.service.member.MemberOperationService; | ||
| 7 | import com.topdraw.business.process.service.member.MemberProfileOperationService; | 9 | import com.topdraw.business.process.service.member.MemberProfileOperationService; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 12 | import org.springframework.util.StringUtils; | ||
| 13 | |||
| 14 | import javax.validation.constraints.NotNull; | ||
| 10 | 15 | ||
| 11 | /** | 16 | /** |
| 12 | * @author : | 17 | * @author : |
| ... | @@ -22,6 +27,8 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation | ... | @@ -22,6 +27,8 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation |
| 22 | 27 | ||
| 23 | @Autowired | 28 | @Autowired |
| 24 | private MemberProfileService memberProfileService; | 29 | private MemberProfileService memberProfileService; |
| 30 | @Autowired | ||
| 31 | private MemberOperationService memberOperationService; | ||
| 25 | 32 | ||
| 26 | @Override | 33 | @Override |
| 27 | public MemberProfileDTO findById(Long id) { | 34 | public MemberProfileDTO findById(Long id) { |
| ... | @@ -70,6 +77,14 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation | ... | @@ -70,6 +77,14 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation |
| 70 | 77 | ||
| 71 | @Override | 78 | @Override |
| 72 | public void updateMemberProfileAndMember(MemberProfile resources) { | 79 | public void updateMemberProfileAndMember(MemberProfile resources) { |
| 73 | this.memberProfileService.updateMemberProfileAndMember(resources); | 80 | String memberCode = resources.getMemberCode(); |
| 81 | MemberDTO memberDTO = null; | ||
| 82 | if (StringUtils.isEmpty(memberCode)) { | ||
| 83 | Long memberId = resources.getMemberId(); | ||
| 84 | memberDTO = this.memberOperationService.findById(memberId); | ||
| 85 | resources.setMemberCode(memberDTO.getCode()); | ||
| 86 | } | ||
| 87 | |||
| 88 | this.memberProfileService.updateMemberProfileAndMember(resources, memberDTO); | ||
| 74 | } | 89 | } |
| 75 | } | 90 | } | ... | ... |
| 1 | package com.topdraw.business.process.service.impl.user; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ||
| 4 | import com.topdraw.business.module.user.weixin.domain.UserWeixinBuilder; | ||
| 5 | import com.topdraw.business.module.user.weixin.repository.UserWeixinRepository; | ||
| 6 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | ||
| 7 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | ||
| 8 | import com.topdraw.business.module.user.weixin.service.mapper.UserWeixinMapper; | ||
| 9 | import com.topdraw.business.process.service.user.UserWeixinOperationService; | ||
| 10 | import com.topdraw.utils.ValidationUtil; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 13 | import org.springframework.stereotype.Service; | ||
| 14 | import org.springframework.transaction.annotation.Propagation; | ||
| 15 | import org.springframework.transaction.annotation.Transactional; | ||
| 16 | import org.springframework.util.Assert; | ||
| 17 | |||
| 18 | /** | ||
| 19 | * @author XiangHan | ||
| 20 | * @date 2021-12-16 | ||
| 21 | */ | ||
| 22 | @Service | ||
| 23 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 24 | public class UserWeixinOperationServiceImpl implements UserWeixinOperationService { | ||
| 25 | |||
| 26 | @Autowired | ||
| 27 | private UserWeixinService userWeixinService; | ||
| 28 | |||
| 29 | @Override | ||
| 30 | public UserWeixinDTO findById(Long id) { | ||
| 31 | return this.userWeixinService.findById(id); | ||
| 32 | } | ||
| 33 | |||
| 34 | @Override | ||
| 35 | @Transactional(rollbackFor = Exception.class) | ||
| 36 | public UserWeixin create(UserWeixin resources) { | ||
| 37 | return this.userWeixinService.create(resources); | ||
| 38 | } | ||
| 39 | |||
| 40 | @Override | ||
| 41 | @Transactional(rollbackFor = Exception.class) | ||
| 42 | public void update(UserWeixin resources) { | ||
| 43 | this.userWeixinService.update(resources); | ||
| 44 | } | ||
| 45 | |||
| 46 | @Override | ||
| 47 | public void updateTime(UserWeixin resources) { | ||
| 48 | this.userWeixinService.updateTime(resources); | ||
| 49 | } | ||
| 50 | |||
| 51 | @Override | ||
| 52 | @Transactional(rollbackFor = Exception.class) | ||
| 53 | public void delete(Long id) { | ||
| 54 | this.userWeixinService.delete(id); | ||
| 55 | } | ||
| 56 | |||
| 57 | @Override | ||
| 58 | public UserWeixinDTO findFirstByMemberIdAndAppid(Long memberId, String appid) { | ||
| 59 | return this.userWeixinService.findFirstByMemberIdAndAppid(memberId,appid); | ||
| 60 | } | ||
| 61 | |||
| 62 | @Override | ||
| 63 | public UserWeixinDTO findFirstByUnionIdAndAppIdAndOpenId(String unionId, String appId, String openId) { | ||
| 64 | return this.userWeixinService.findFirstByUnionIdAndAppIdAndOpenId(unionId,appId,openId); | ||
| 65 | } | ||
| 66 | |||
| 67 | @Override | ||
| 68 | public UserWeixinDTO findFirstByAppIdAndOpenId(String appId, String openId) { | ||
| 69 | return this.userWeixinService.findFirstByAppIdAndOpenId(appId,openId); | ||
| 70 | } | ||
| 71 | |||
| 72 | @Override | ||
| 73 | public UserWeixinDTO findFirstByUnionId(String unionid) { | ||
| 74 | return this.userWeixinService.findFirstByUnionId(unionid); | ||
| 75 | } | ||
| 76 | |||
| 77 | @Override | ||
| 78 | public UserWeixinDTO findFirstByUnionidAndAppid(String unionid, String appId) { | ||
| 79 | return this.userWeixinService.findFirstByUnionidAndAppid(unionid,appId); | ||
| 80 | } | ||
| 81 | |||
| 82 | } |
| 1 | package com.topdraw.business.process.service.user; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ||
| 4 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | ||
| 5 | |||
| 6 | /** | ||
| 7 | * @author XiangHan | ||
| 8 | * @date 2021-12-16 | ||
| 9 | */ | ||
| 10 | public interface UserWeixinOperationService { | ||
| 11 | |||
| 12 | /** | ||
| 13 | * 根据ID查询 | ||
| 14 | * @param id ID | ||
| 15 | * @return UserWeixinDTO | ||
| 16 | */ | ||
| 17 | UserWeixinDTO findById(Long id); | ||
| 18 | |||
| 19 | /** | ||
| 20 | * | ||
| 21 | * @param resources | ||
| 22 | * @return | ||
| 23 | */ | ||
| 24 | UserWeixin create(UserWeixin resources); | ||
| 25 | |||
| 26 | /** | ||
| 27 | * | ||
| 28 | * @param resources | ||
| 29 | */ | ||
| 30 | void update(UserWeixin resources); | ||
| 31 | |||
| 32 | /** | ||
| 33 | * | ||
| 34 | * @param resources | ||
| 35 | */ | ||
| 36 | void updateTime(UserWeixin resources); | ||
| 37 | |||
| 38 | /** | ||
| 39 | * | ||
| 40 | * @param id | ||
| 41 | */ | ||
| 42 | void delete(Long id); | ||
| 43 | |||
| 44 | /** | ||
| 45 | * | ||
| 46 | * @param memberId | ||
| 47 | * @param appid | ||
| 48 | * @return | ||
| 49 | */ | ||
| 50 | UserWeixinDTO findFirstByMemberIdAndAppid(Long memberId, String appid); | ||
| 51 | |||
| 52 | /** | ||
| 53 | * | ||
| 54 | * @param unionId | ||
| 55 | * @param appId | ||
| 56 | * @param openId | ||
| 57 | * @return | ||
| 58 | */ | ||
| 59 | UserWeixinDTO findFirstByUnionIdAndAppIdAndOpenId(String unionId, String appId, String openId); | ||
| 60 | |||
| 61 | /** | ||
| 62 | * | ||
| 63 | * @param appId | ||
| 64 | * @param openId | ||
| 65 | * @return | ||
| 66 | */ | ||
| 67 | UserWeixinDTO findFirstByAppIdAndOpenId(String appId, String openId); | ||
| 68 | |||
| 69 | /** | ||
| 70 | * | ||
| 71 | * @param unionid | ||
| 72 | * @return | ||
| 73 | */ | ||
| 74 | UserWeixinDTO findFirstByUnionId(String unionid); | ||
| 75 | |||
| 76 | /** | ||
| 77 | * | ||
| 78 | * @param unionid | ||
| 79 | * @param appId | ||
| 80 | * @return | ||
| 81 | */ | ||
| 82 | UserWeixinDTO findFirstByUnionidAndAppid(String unionid, String appId); | ||
| 83 | } |
-
Please register or sign in to post a comment