Commit 2cca5ac9 2cca5ac9d3681996b9c47eb0b5e2f0522bb39e64 by xianghan

1.优化

1 parent f2560343
Showing 41 changed files with 843 additions and 456 deletions
ALTER TABLE `uc_user_tv`
ADD COLUMN `vis_user_id` bigint(20) NULL DEFAULT NULL COMMENT 'vis_user表主键' AFTER `platform_account`;
\ No newline at end of file
MODIFY COLUMN `platform_account` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '运营商平台账号' AFTER `id`,
MODIFY COLUMN `member_id` bigint(20) NULL DEFAULT NULL COMMENT '会员id' AFTER `platform_account`,
ADD COLUMN `vis_user_id` bigint(0) UNSIGNED NULL COMMENT 'vis_user表主键' AFTER `member_id`,
MODIFY COLUMN `priority_member_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '主会员编码' AFTER `member_id`,
MODIFY COLUMN `platform` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '运营商平台' AFTER `image`,
MODIFY COLUMN `person_id` bigint(20) NULL DEFAULT NULL COMMENT '人ID' AFTER `update_time`,
ADD UNIQUE INDEX `unique_vis_user_id`(`vis_user_id`) USING BTREE;
\ No newline at end of file
......
......@@ -22,7 +22,7 @@ import javax.validation.constraints.NotNull;
public class AsyncMqModule {
@Transient
@NotNull(message = "memberCode can't be null" , groups = {CreateGroup.class, UpdateGroup.class})
@NotNull(message = "memberCode can't be null" , groups = {UpdateGroup.class})
private String memberCode;
/** 运营商平台账号 */
......
......@@ -3,6 +3,7 @@ package com.topdraw.business.module.member.address.rest;
import com.topdraw.aop.log.Log;
import com.topdraw.business.module.common.validated.CreateGroup;
import com.topdraw.business.module.common.validated.UpdateGroup;
import com.topdraw.business.process.service.member.MemberAddressOperationService;
import com.topdraw.common.ResultInfo;
import com.topdraw.business.module.member.address.domain.MemberAddress;
import com.topdraw.business.module.member.address.service.MemberAddressService;
......@@ -24,14 +25,14 @@ import io.swagger.annotations.*;
public class MemberAddressController {
@Autowired
private MemberAddressService memberAddressService;
private MemberAddressOperationService memberAddressOperationService;
@Log("新增会员地址")
@RequestMapping(value = "/create")
@ApiOperation("新增会员地址")
public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberAddress resources) {
log.info("memberAddress ==>> create ==> param ==>> [{}]",resources);
this.memberAddressService.create(resources);
this.memberAddressOperationService.create(resources);
log.info("memberAddress ==>> create ==> result ==>> [{}]",resources);
return ResultInfo.success();
}
......@@ -41,7 +42,7 @@ public class MemberAddressController {
@ApiOperation("修改会员地址")
public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberAddress resources) {
log.info("memberAddress ==>> update ==> param ==>> [{}]",resources);
this.memberAddressService.update(resources);
this.memberAddressOperationService.update(resources);
log.info("memberAddress ==>> update ==> result ==>> [{}]",resources);
return ResultInfo.success();
}
......@@ -51,7 +52,7 @@ public class MemberAddressController {
@ApiOperation("删除会员地址")
public ResultInfo delete(@PathVariable Long resources) {
log.info("memberAddress ==>> delete ==> param ==>> [{}]",resources);
this.memberAddressService.delete(resources);
this.memberAddressOperationService.delete(resources);
return ResultInfo.success();
}
......
......@@ -20,13 +20,13 @@ public interface MemberAddressService {
* 保存会员地址
* @param resources
*/
void create(MemberAddress resources);
MemberAddressDTO create(MemberAddress resources);
/**
* 修改会员地址
* @param resources
*/
void update(MemberAddress resources);
MemberAddressDTO update(MemberAddress resources);
/**
* 通过id删除
......
......@@ -11,6 +11,7 @@ import com.topdraw.business.module.member.address.service.MemberAddressService;
import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO;
import com.topdraw.business.module.member.address.service.mapper.MemberAddressMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......@@ -47,36 +48,41 @@ public class MemberAddressServiceImpl implements MemberAddressService {
@Override
@Transactional(rollbackFor = Exception.class)
public void create(MemberAddress resources) {
public MemberAddressDTO create(MemberAddress resources) {
log.info("MemberAddressServiceImpl ==>> create ==>> param ==>> [{}]",resources);
MemberDTO memberDTO = this.checkMember(resources);
MemberAddress memberAddress = MemberAddressBuilder.build(resources, memberDTO.getId(), memberDTO.getCode());
this.memberAddressRepository.save(memberAddress);
MemberAddress _memberAddress = MemberAddressBuilder.build(resources, memberDTO.getId(), memberDTO.getCode());
MemberAddress memberAddress = this.memberAddressRepository.save(_memberAddress);
log.info("MemberAddressServiceImpl ==>> create ==>> result ==>> [{}]",resources);
MemberAddressDTO memberAddressDTO = new MemberAddressDTO();
BeanUtils.copyProperties(memberAddress, memberAddressDTO);
return memberAddressDTO;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(MemberAddress resources) {
public MemberAddressDTO update(MemberAddress resources) {
log.info("MemberAddressServiceImpl ==>> update ==>> param ==>> [{}]",resources);
Assert.notNull(resources.getId(),"id can't be null");
// RLock rLock = this.redissonClient.getLock("MemberAddress::update::code" + resources.getId());
try {
// RedissonUtil.lock(rLock);
this.redisUtils.doLock("MemberAddress::update::code" + resources.getId());
MemberDTO memberDTO = this.checkMember(resources);
resources.setMemberCode(memberDTO.getCode());
MemberAddress MemberAddress = this.memberAddressRepository.findById(resources.getId()).orElseGet(MemberAddress::new);
ValidationUtil.isNull( MemberAddress.getId(),"MemberAddress","id",resources.getId());
MemberAddress.copy(resources);
this.memberAddressRepository.save(MemberAddress);
MemberAddress _memberAddress = this.memberAddressRepository.findById(resources.getId()).orElseGet(MemberAddress::new);
ValidationUtil.isNull( _memberAddress.getId(),"MemberAddress","id",resources.getId());
_memberAddress.copy(resources);
MemberAddress memberAddress = this.memberAddressRepository.save(_memberAddress);
MemberAddressDTO memberAddressDTO = new MemberAddressDTO();
BeanUtils.copyProperties(memberAddress, memberAddressDTO);
return memberAddressDTO;
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
// RedissonUtil.unlock(rLock);
this.redisUtils.doUnLock("MemberAddress::update::code" + resources.getId());
}
}
......
......@@ -27,23 +27,24 @@ public class MemberBuilder {
String code = member.getCode();
member.setCode(StringUtils.isEmpty(code)?String.valueOf(IdWorker.generator()):code);
Integer gender = member.getGender();
member.setGender(Objects.nonNull(gender) ? gender : 0);
member.setGender(Objects.nonNull(gender) ? gender : DEFAULT_VALUE_);
Integer type = member.getType();
member.setType(Objects.nonNull(type) ? type:-1);
member.setType(Objects.nonNull(type) ? type:DEFAULT_VALUE_);
Integer status = member.getStatus();
member.setStatus(Objects.nonNull(status) ? status:1);
member.setStatus(Objects.nonNull(status) ? status:DEFAULT_VALUE_1);
Integer vip = member.getVip();
member.setVip(Objects.nonNull(vip) ? vip:0);
Integer level = member.getLevel();
member.setLevel(Objects.nonNull(level) ? level:1);
member.setLevel(Objects.nonNull(level) ? level:DEFAULT_VALUE_1);
member.setExp(DEFAULT_VALUE);
member.setPoints(DEFAULT_VALUE);
member.setDuePoints(DEFAULT_VALUE);
member.setCouponAmount(DEFAULT_VALUE);
member.setDueCouponAmount(DEFAULT_VALUE);
member.setBlackStatus(DEFAULT_VALUE);
member.setBirthday(StringUtils.isBlank(member.getBirthday())?"1900-01-01":member.getBirthday());
String nickname = member.getNickname();
if (com.topdraw.utils.StringUtils.isNotEmpty(nickname)) {
if (StringUtils.isNotEmpty(nickname)) {
String base64Nickname = new String(Base64.getEncoder().encode(nickname.getBytes(StandardCharsets.UTF_8)));
member.setNickname(base64Nickname);
}
......@@ -52,21 +53,12 @@ public class MemberBuilder {
public static Member build(Integer type,String avatarUrl,String nickname,int vip){
// todo 原型模式
Member member = new Member();
member.setType(type);
member.setBlackStatus(DEFAULT_VALUE);
member.setGender(DEFAULT_VALUE_);
member.setVip(vip);
member.setLevel(DEFAULT_VALUE_1);
member.setStatus(DEFAULT_VALUE_1);
member.setPoints(DEFAULT_VALUE);
member.setDuePoints(DEFAULT_VALUE);
member.setExp(DEFAULT_VALUE);
member.setCouponAmount(DEFAULT_VALUE);
member.setDueCouponAmount(DEFAULT_VALUE);
member.setAvatarUrl(StringUtils.isBlank(avatarUrl)?"":avatarUrl);
member.setCode(IdWorker.generator() + "");
member.setNickname(StringUtils.isBlank(nickname)?"":nickname);
return member;
Member member = new Member();
member.setType(type);
member.setAvatarUrl(avatarUrl);
member.setNickname(nickname);
member.setVip(vip);
Member _member = checkMemberData(member);
return _member;
}
}
......
......@@ -10,30 +10,24 @@ import java.util.Objects;
public class MemberProfileBuilder {
public static MemberProfile build(Member member){
MemberProfile memberProfile = build(member.getId(),member.getNickname(),member.getGender(),"","","","","","",
MemberProfile memberProfile = build(member.getId(),member.getCode(),member.getNickname(),member.getGender(),"","","","","","",
"","","",member.getBirthday());
return memberProfile;
}
public static MemberProfile build(Long memberId){
MemberProfile memberProfile = build(memberId,"",-1,"","","","","","",
MemberProfile memberProfile = build(memberId,"","",-1,"","","","","","",
"","","","");
return memberProfile;
}
public static MemberProfile build(Long memberId , String realname , Integer gender, String birthday){
MemberProfile memberProfile = build(memberId,realname,gender,"","","","","","",
public static MemberProfile build(Long memberId ,String memberCode, String realname , Integer gender, String birthday){
MemberProfile memberProfile = build(memberId,memberCode,realname,gender,"","","","","","",
"","","",birthday);
return memberProfile;
}
public static MemberProfile build(){
MemberProfile memberProfile = build(null,"",null,"","","","","","",
"","","",null);
return memberProfile;
}
public static MemberProfile build(Long memberId, String realName, Integer sex,
public static MemberProfile build(Long memberId,String memberCode, String realName, Integer sex,
String country, String district, String city, String idCard, String province,
String email, String description, String phone, String constellation,
String birthday) {
......@@ -42,9 +36,10 @@ public class MemberProfileBuilder {
MemberProfile memberProfile = new MemberProfile();
memberProfile.setMemberId(memberId);
memberProfile.setMemberCode(memberCode);
memberProfile.setRealname(stringIsNull(realName));
memberProfile.setGender(sex == null ? 0 : sex);
memberProfile.setCountry(stringIsNull(country));
memberProfile.setCountry(StringUtils.isBlank(country)?"中国":birthday);
memberProfile.setDistrict(stringIsNull(district));
memberProfile.setCity(stringIsNull(city));
memberProfile.setIdCard(StringUtils.isBlank(idCard)?"000000000000000000":idCard);
......@@ -53,7 +48,7 @@ public class MemberProfileBuilder {
memberProfile.setDescription(stringIsNull(description));
memberProfile.setPhone(stringIsNull(phone));
memberProfile.setConstellation(stringIsNull(constellation));
memberProfile.setBirthday(stringIsNull(birthday));
memberProfile.setBirthday(StringUtils.isBlank(birthday)?"1900-01-01":birthday);
return memberProfile;
}
......
package com.topdraw.business.module.member.profile.rest;
import com.topdraw.aop.log.Log;
import com.topdraw.business.process.service.member.MemberProfileOperationService;
import com.topdraw.common.ResultInfo;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
import com.topdraw.business.module.member.profile.service.MemberProfileService;
......@@ -22,15 +23,16 @@ import io.swagger.annotations.*;
public class MemberProfileController {
@Autowired
private MemberProfileService memberProfileService;
private MemberProfileOperationService memberProfileOperationService;
@Log("修改会员属性")
@RequestMapping(value = "/update")
@ApiOperation("修改会员属性")
@Deprecated
public ResultInfo update(@Validated @RequestBody MemberProfile resources) {
log.info("memberProfile ==>> update ==>> resources ===>> [{}]",resources);
this.memberProfileService.update(resources);
this.memberProfileOperationService.update(resources);
log.info("memberProfile ==>> update ==>> result ===>> [{}]",resources);
return ResultInfo.success();
......
......@@ -53,7 +53,7 @@ public interface MemberProfileService {
* 修改
* @param resources
*/
void update(MemberProfile resources);
MemberProfileDTO update(MemberProfile resources);
/**
* 删除
......
......@@ -81,7 +81,7 @@ public class MemberProfileServiceImpl implements MemberProfileService {
@Override
@Transactional(rollbackFor = Exception.class)
public MemberProfile createDefault(MemberProfile resources) {
MemberProfile memberProfile = MemberProfileBuilder.build();
MemberProfile memberProfile = MemberProfileBuilder.build(resources);
return this.create(memberProfile);
}
......@@ -107,7 +107,7 @@ public class MemberProfileServiceImpl implements MemberProfileService {
@Override
@Transactional(rollbackFor = Exception.class)
public void update(MemberProfile resources) {
public MemberProfileDTO update(MemberProfile resources) {
log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources);
this.redisUtils.doLock("memberProfile::update::id" + resources.getId());
......@@ -122,9 +122,14 @@ public class MemberProfileServiceImpl implements MemberProfileService {
MemberProfile memberProfile = new MemberProfile();
BeanUtils.copyProperties(resources,memberProfile);
this.memberProfileRepository.save(memberProfile);
MemberProfile _memberProfile = this.memberProfileRepository.save(memberProfile);
// 同步会员信息
this.synchronizedMemberData(resources);
MemberProfileDTO memberProfileDTO = new MemberProfileDTO();
BeanUtils.copyProperties(_memberProfile,memberProfileDTO);
return memberProfileDTO;
} catch (Exception e) {
e.printStackTrace();
throw e;
......
......@@ -6,9 +6,9 @@ import com.topdraw.business.module.common.validated.UpdateGroup;
import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.process.service.member.MemberRelatedInfoOperationService;
import com.topdraw.common.ResultInfo;
import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
......@@ -32,7 +32,7 @@ public class MemberRelatedInfoController {
@Autowired
private MemberService memberService;
@Autowired
private MemberRelatedInfoService memberRelatedInfoService;
private MemberRelatedInfoOperationService memberRelatedInfoOperationService;
@Log("新增相关人员")
@RequestMapping(value = "/create")
......@@ -40,7 +40,7 @@ public class MemberRelatedInfoController {
public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberRelatedInfo resources) {
log.info("memberRelatedInfo ==>> create ==>> resources ===>> [{}]",resources);
this.memberRelatedInfoService.create(resources);
this.memberRelatedInfoOperationService.create(resources);
return ResultInfo.success();
}
......@@ -53,15 +53,16 @@ public class MemberRelatedInfoController {
log.info("memberRelatedInfo ==>> update ==>> resources ===>> [{}]",resources);
Long id = resources.getId();
MemberRelatedInfoDTO memberRelatedInfoDTO = this.memberRelatedInfoService.findById(id);
MemberRelatedInfoDTO memberRelatedInfoDTO = this.memberRelatedInfoOperationService.findById(id);
if (memberRelatedInfoDTO.getId() != null) {
Long memberId = memberRelatedInfoDTO.getMemberId();
MemberDTO memberDTO = this.memberService.findById(memberId);
if (Objects.nonNull(memberDTO)) {
String code = memberDTO.getCode();
Assert.notNull(code,"code can't be null");
resources.setMemberCode(code);
this.memberRelatedInfoService.update(resources);
this.memberRelatedInfoOperationService.update(resources);
}
}
......@@ -74,7 +75,7 @@ public class MemberRelatedInfoController {
@ApiOperation("删除相关人员")
public ResultInfo delete(@PathVariable(value = "id") Long resources) {
log.info("memberRelatedInfo ==>> delete ==>> resources ===>> [{}]",resources);
this.memberRelatedInfoService.delete(resources);
this.memberRelatedInfoOperationService.delete(resources);
log.info("memberRelatedInfo ==>> delete ==>> result ===>> [{}]",resources);
return ResultInfo.success();
}
......
package com.topdraw.business.module.member.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.aop.log.Log;
import com.topdraw.business.module.common.validated.CreateGroup;
import com.topdraw.business.module.common.validated.UpdateGroup;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.process.service.MemberOperationService;
import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.business.process.service.UserOperationService;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
......@@ -42,9 +39,8 @@ public class MemberController {
public ResultInfo createMemberByUserTv(@Validated(value = {CreateGroup.class}) @RequestBody UserTv resources) {
// todo 此接口废弃,将移动至UserTvController中,AppEngine也要同步修改
log.info("member ==>> createMemberByUserTv ==>> param ==>> [{}]",resources);
boolean result = this.userTvOperationService.createTvUserAndMember(resources);
log.info("member ==>> createMemberByUserTv ==>> result ==>> [{}]",result);
return ResultInfo.success(result);
this.userTvOperationService.createTvUserAndMember(resources);
return ResultInfo.success();
}
@Log("手动修改vip")
......
......@@ -2,6 +2,8 @@ package com.topdraw.business.module.member.service.impl;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.domain.MemberBuilder;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
import com.topdraw.business.module.member.profile.domain.MemberProfileBuilder;
import com.topdraw.business.module.member.profile.service.MemberProfileService;
import com.topdraw.business.module.member.repository.MemberRepository;
import com.topdraw.business.module.member.service.MemberService;
......@@ -107,9 +109,11 @@ public class MemberServiceImpl implements MemberService {
Member member = MemberBuilder.build(resources);
Long memberId = this.save(member);
if (Objects.nonNull(memberId))
if (Objects.nonNull(memberId)) {
MemberProfile memberProfile = MemberProfileBuilder.build(member);
// 保存会员属性
this.memberProfileService.createDefault(member);
this.memberProfileService.create(memberProfile);
}
return this.memberMapper.toDto(member);
......
......@@ -27,6 +27,10 @@ import java.io.Serializable;
@Table(name="uc_user_tv")
public class UserTv extends AsyncMqModule implements Serializable {
@NotNull(message = "visUserId can't be null !",groups = {CreateGroup.class})
@Column(name = "vis_user_id")
private Long visUserId;
/** 绑定的小屏账户会员编码 */
@Column(name = "priority_member_code")
private String priorityMemberCode;
......
......@@ -5,6 +5,9 @@ import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.GlobeExceptionMsg;
import com.topdraw.util.TimestampUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.Assert;
import java.util.Objects;
/**
* @author :
......@@ -17,41 +20,53 @@ import org.apache.commons.lang3.StringUtils;
*/
public class UserTvBuilder {
private static final Integer DEFAULT_VALUE = 1;
private static final String DEFAULT_CREATE_BY = "system";
private static final String DEFAULT_UPDATE_BY = "system";
public static UserTv build(UserTv userTv){
return build(userTv.getMemberCode(),userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(),
userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy());
return build(userTv.getMemberId(),userTv.getMemberCode(),userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(),
userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy(), userTv.getVisUserId());
}
public static UserTv build(String memberCode , UserTv userTv){
return build(memberCode,userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(),
userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy());
public static UserTv build(Long memberId, String memberCode , UserTv userTv){
return build(memberId,memberCode,userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(),
userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy(), userTv.getVisUserId());
}
public static UserTv build(Member member ,UserTv userTv){
return build(member.getCode(),userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(),
userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy());
public static UserTv build(String memberCode, UserTv userTv){
return build(null,memberCode,userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(),
userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy(), userTv.getVisUserId());
}
public static UserTv build(String memberCode , Long id , String platformAccount , String nickname , String username,
int loginDays , int status ,int continueDays , String createBy , String updateBy){
public static UserTv build(Member member, UserTv userTv){
return build(member.getId() , member.getCode(),userTv.getId(),userTv.getPlatformAccount(),userTv.getNickname(),userTv.getUsername(),
userTv.getLoginDays(),userTv.getStatus(),userTv.getContinueDays(),userTv.getCreateBy(),userTv.getUpdateBy(), userTv.getVisUserId());
}
if (StringUtils.isBlank(platformAccount))
throw new BadRequestException(GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL);
public static UserTv build(Long memberId , String memberCode , Long id , String platformAccount , String nickname , String username,
Integer loginDays , Integer status ,Integer continueDays , String createBy , String updateBy,Long visUserId){
Assert.notNull(memberId,GlobeExceptionMsg.MEMBER_ID_IS_NULL);
Assert.notNull(memberCode,GlobeExceptionMsg.MEMBER_CODE_IS_NULL);
Assert.notNull(platformAccount,GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL);
Assert.notNull(platformAccount,GlobeExceptionMsg.VIS_USER_ID_IS_NULL);
// todo 原型模式
UserTv userTv = new UserTv();
userTv.setId(id);
userTv.setPlatformAccount(platformAccount);
userTv.setMemberCode(memberCode);
userTv.setMemberId(memberId);
userTv.setNickname(StringUtils.isBlank(nickname)?platformAccount:nickname);
userTv.setUsername(StringUtils.isBlank(username)?platformAccount:username);
userTv.setLoginDays(loginDays);
userTv.setStatus(status);
userTv.setLoginDays(Objects.nonNull(loginDays)?loginDays:DEFAULT_VALUE);
userTv.setLoginType(DEFAULT_VALUE);
userTv.setStatus(Objects.nonNull(status)?status:DEFAULT_VALUE);
userTv.setActiveTime(TimestampUtil.now());
userTv.setContinueDays(continueDays);
userTv.setCreateBy(StringUtils.isBlank(createBy)?"system":createBy);
userTv.setUpdateBy(StringUtils.isBlank(updateBy)?"system":updateBy);
userTv.setContinueDays(Objects.nonNull(continueDays)?loginDays:DEFAULT_VALUE);
userTv.setCreateBy(StringUtils.isBlank(createBy)?DEFAULT_CREATE_BY:createBy);
userTv.setUpdateBy(StringUtils.isBlank(updateBy)?DEFAULT_UPDATE_BY:updateBy);
userTv.setVisUserId(visUserId);
return userTv;
}
......
......@@ -12,6 +12,8 @@ import java.io.Serializable;
@Data
public class UserTvDTO implements Serializable {
private Long visUserId;
private String memberCode;
/** 绑定的小屏账户会员编码 */
......
......@@ -2,10 +2,13 @@ package com.topdraw.business.process.domian.weixin;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
public class BindBean extends WeiXinUserBean {
private Long platformUserId;
@NotNull(message = "platformAccount can't be null" , groups = {BindGroup.class})
private String platformAccount;
}
......
package com.topdraw.business.process.domian.weixin;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/3/20 16:43
* @version: :
* @modified By:
* @since : modified in 2022/3/20 16:43
*/
public interface BindGroup {
}
......@@ -25,7 +25,6 @@ public class SubscribeBean extends WeiXinUserBean {
/** */
private String eventKey;
private String unionid;
private String nickname;
private String headimgurl;
......
......@@ -3,6 +3,8 @@ package com.topdraw.business.process.domian.weixin;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 微信账户信息
* @author XiangHan
......@@ -13,6 +15,7 @@ public class WeiXinUserBean {
private Long id;
@NotNull(message = "unionid can't be null" , groups = {BindGroup.class})
private String unionid;
/** */
......
......@@ -3,19 +3,16 @@ package com.topdraw.business.process.rest;
import cn.hutool.core.util.ObjectUtil;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.aop.log.Log;
import com.topdraw.business.module.common.validated.CreateGroup;
import com.topdraw.business.module.common.validated.UpdateGroup;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.module.user.weixin.service.UserWeixinService;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO;
import com.topdraw.business.process.domian.weixin.BuyVipBean;
import com.topdraw.business.process.service.MemberOperationService;
import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.common.IResultInfo;
import com.topdraw.common.ResultInfo;
import com.topdraw.exception.BadRequestException;
......@@ -42,19 +39,6 @@ public class MemberOperationController {
private MemberVipHistoryService memberVipHistoryService;
@Autowired
private UserWeixinService userWeixinService;
@Autowired
private MemberService memberService;
@Log("查询会员")
@GetMapping(value = "/findById/{id}")
@ApiOperation("查询会员")
@AnonymousAccess
public ResultInfo findById(@PathVariable(value = "id") Long id) {
log.info("memberOperation ==>> findById ==>> param ==>> [{}]",id);
MemberDTO memberDTO = this.memberOperationService.findById(id);
log.info("memberOperation ==>> findById ==>> result ==>> [{}]",memberDTO);
return ResultInfo.success(memberDTO);
}
@Log("手动修改vip")
@RequestMapping(value = "/doUpdateVipByCode")
......@@ -63,7 +47,7 @@ public class MemberOperationController {
public ResultInfo doUpdateVipByCode(@Validated(value = {UpdateGroup.class}) @RequestBody Member resources) {
log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources);
MemberDTO memberDTO = this.memberService.findByCode(resources.getCode());
MemberDTO memberDTO = this.memberOperationService.findByCode(resources.getCode());
resources.setId(memberDTO.getId());
this.memberOperationService.update(resources);
log.info("member ==>> doUpdateVipByCode ==>> result ==>> [{}]",resources);
......@@ -105,7 +89,7 @@ public class MemberOperationController {
UserWeixinDTO userWeixinDTO = this.userWeixinService.findById(id);
Long memberId = userWeixinDTO.getMemberId();
MemberDTO member = this.memberService.findById(memberId);
MemberDTO member = this.memberOperationService.findById(memberId);
LocalDateTime now = LocalDateTime.now();
......
......@@ -13,15 +13,14 @@ import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.module.user.iptv.service.UserTvService;
import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO;
import com.topdraw.business.process.domian.weixin.BindBean;
import com.topdraw.business.process.domian.weixin.SubscribeBean;
import com.topdraw.business.process.domian.weixin.SubscribeBeanEvent;
import com.topdraw.business.process.domian.weixin.WeiXinUserBean;
import com.topdraw.business.process.domian.weixin.*;
import com.topdraw.business.process.service.UserOperationService;
import com.topdraw.common.ResultInfo;
import com.topdraw.config.RedisKeyUtil;
import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.GlobeExceptionMsg;
import com.topdraw.util.Base64Util;
import com.topdraw.util.JSONUtil;
import com.topdraw.utils.RedisUtils;
......@@ -47,13 +46,9 @@ import java.util.*;
public class UserOperationController {
@Autowired
private UserTvService userTvService;
@Autowired
private MemberService memberService;
@Autowired
private UserOperationService userOperationService;
@Autowired
private UserOperationService userTvOperationService;
@Autowired
private RedisUtils redisUtils;
......@@ -62,81 +57,36 @@ public class UserOperationController {
private static final String UNSUBSCRIBE = "unsubscribe";
private static final Integer SUBSCRIBE_STATUS = 1;
@Log("保存大屏账户同时创建会员")
@PostMapping(value = "/createTvUserAndMember")
@ApiOperation("保存大屏账户同时创建会员信息")
@Log("新增小屏账户同时创建会员信息")
@PostMapping(value = "/createWeixinUserAndCreateMember")
@ApiOperation("新增小屏账户同时创建会员信息")
@AnonymousAccess
public ResultInfo createTvUserAndMember(@Validated(value = {CreateGroup.class}) @RequestBody UserTv resources) {
log.info("UserOperationController ==> createUserAndCreateMember ==>> param ==> [{}]",resources);
public ResultInfo createWeixinUserAndMember(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) {
log.info("UserOperationController ==> createWeixinUserAndMember ==> param ==> [{}]",resources);
boolean result = this.userTvOperationService.createTvUserAndMember(resources);
UserWeixinDTO result = this.userOperationService.createWeixinUserAndMember(resources);
return ResultInfo.success(result);
}
@Log("大屏用户解绑")
@RequestMapping(value = "/unbind")
@ApiOperation("大屏用户解绑")
@AnonymousAccess
public ResultInfo unbind(@Validated(value = {UpdateGroup.class}) @RequestBody UserTv resources) {
log.info("UserOperationController ==> unbind ==>> param ==> [{}]",resources);
this.userTvOperationService.unbind(resources);
return ResultInfo.success();
}
@Log("大屏更换主账号")
@RequestMapping(value = "/changeMainAccount")
@ApiOperation("大屏更换主账号")
@AnonymousAccess
public ResultInfo changeMainAccount(@Validated @RequestBody UserTv resources) {
log.info("UserOperationController ==> changeMainAccount ==>> param ==> [{}]",resources);
this.userTvOperationService.changeMainAccount(resources);
return ResultInfo.success();
}
@Log("微信服务号(H5)登录")
@PostMapping("/serviceLogin")
@ApiOperation("微信服务号(H5)登录")
@AnonymousAccess
public ResultInfo serviceLogin(@Validated @RequestBody WeiXinUserBean resources) {
public ResultInfo serviceLogin(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) {
log.info("UserOperationController ==> serviceLogin ==>> param ==> [{}]",resources);
Object o = this.userTvOperationService.serviceLogin(resources);
return ResultInfo.success(o);
UserWeixinDTO result = this.userOperationService.serviceLogin(resources);
return ResultInfo.success(result);
}
@Log("微信小程序登录")
@PostMapping("/appletLogin")
@ApiOperation("微信小程序登录")
@AnonymousAccess
public ResultInfo appletLogin(@Validated @RequestBody WeiXinUserBean resources) {
public ResultInfo appletLogin(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) {
log.info("UserOperationController ==> appletLogin ==>> param ==> [{}]",resources);
UserWeixinDTO result = this.userTvOperationService.appletLogin(resources);
return ResultInfo.success(result);
}
@Log("微信小程序绑定大屏")
@PostMapping("/appletBind")
@ApiOperation("微信小程序绑定大屏")
@AnonymousAccess
public ResultInfo appletBind(@Validated @RequestBody BindBean resources) {
log.info("UserOperationController ==> appletBind ==>> param ==> [{}]",resources);
String unionId = resources.getUnionid();
if (StringUtils.isBlank(unionId))
Assert.state(StrUtil.isNotBlank(unionId), "跨屏绑定,请先进行授权");
String platformAccount = resources.getPlatformAccount();
if (Objects.isNull(platformAccount))
Assert.state(StrUtil.isNotBlank(platformAccount), "大屏账户不得为空");
UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
resources.setPlatformUserId(userTvDTO.getId());
resources.setPlatformAccount(platformAccount);
boolean result = this.userTvOperationService.appletBind(resources);
UserWeixinDTO result = this.userOperationService.appletLogin(resources);
return ResultInfo.success(result);
}
......@@ -148,8 +98,9 @@ public class UserOperationController {
log.info("UserOperationController ==> subscribe ==>> param ==> [{}]",data);
SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(data.getContent(), SubscribeBean.class);
// 解析参数
this.parseSubscribe(subscribeBean);
boolean result = this.userTvOperationService.subscribe(subscribeBean);
boolean result = this.userOperationService.subscribe(subscribeBean);
return ResultInfo.success(result);
}
......@@ -159,74 +110,57 @@ public class UserOperationController {
* @throws IOException
*/
private void parseSubscribe(SubscribeBean subscribeBean) throws IOException {
if (Objects.nonNull(subscribeBean)) {
String appId = subscribeBean.getAppId();
// appId不得为空
if (StringUtils.isBlank(appId))
throw new BadRequestException("appId 不存在!");
// openId
String openId = subscribeBean.getOpenId();
if (StringUtils.isBlank(openId))
throw new BadRequestException("openId 不存在!");
// unionId
String unionId = subscribeBean.getUnionid();
if (StringUtils.isBlank(unionId))
throw new BadRequestException("unionId 不存在!");
// 匹配配置文件中的微信列表信息
Map<String, String> wxInfoMap = WeixinUtil.getWeixinInfoByAppid(appId);
if (Objects.nonNull(wxInfoMap)) {
// 程序类型
String appType = wxInfoMap.get("appType");
// 非订阅号,暂不处理。返回暂不支持
if (ObjectUtil.notEqual(appType, WeChatConstants.WX_SUBSCRIPTION))
throw new BadRequestException("非订阅号");
}
// 大屏账户信息
JSONObject iptvUserInfo = null;
// 缓存的大屏信息,使用unionid即可
String content = (String) this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionId));
if (StringUtils.isNotBlank(content)) {
// 大屏信息
iptvUserInfo = JSONObject.parseObject(content);
} else {
String eventKey = subscribeBean.getEventKey();
log.info(" eventKey ==> [{}] ", eventKey);
String appId = subscribeBean.getAppId();
Assert.notNull(appId, GlobeExceptionMsg.APP_ID_IS_NULL);
// openId
String openId = subscribeBean.getOpenId();
Assert.notNull(openId, GlobeExceptionMsg.OPEN_ID_IS_NULL);
// unionId
String unionId = subscribeBean.getUnionid();
Assert.notNull(openId, GlobeExceptionMsg.UNION_ID_IS_NULL);
subscribeBean.setAppid(appId);
subscribeBean.setOpenid(openId);
subscribeBean.setUnionid(unionId);
// 匹配配置文件中的微信列表信息
Map<String, String> wxInfoMap = WeixinUtil.getWeixinInfoByAppid(appId);
if (Objects.nonNull(wxInfoMap)) {
// 程序类型
String appType = wxInfoMap.get("appType");
// 非订阅号,暂不处理。返回暂不支持
if (ObjectUtil.notEqual(appType, WeChatConstants.WX_SUBSCRIPTION))
throw new BadRequestException("非订阅号");
}
if (StringUtils.isNotBlank(eventKey)) {
// 用户扫描带参二维码关注。发消息
// 去除固定前缀,获取二维码参数
eventKey = eventKey.substring(8);
iptvUserInfo = JSONObject.parseObject(eventKey);
}
// 大屏账户信息
JSONObject iptvUserInfo = null;
// 缓存的大屏信息,使用unionid即可
String content = (String) this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionId));
if (StringUtils.isNotBlank(content)) {
// 大屏信息
iptvUserInfo = JSONObject.parseObject(content);
}
}
// 用户自己搜索关注就没有大屏信息,否则表示扫码关注
if (Objects.nonNull(iptvUserInfo)) {
// 用户自己搜索关注就没有大屏信息,否则表示扫码关注
if (Objects.nonNull(iptvUserInfo)) {
subscribeBean.setIptvUserInfo(iptvUserInfo);
subscribeBean.setIptvUserInfo(iptvUserInfo);
String headimgurl = iptvUserInfo.get("headimgurl").toString();
String nickname = iptvUserInfo.get("nickname").toString();
if (StringUtils.isNotBlank(nickname)) {
String nicknameDecode = URLDecoder.decode(nickname, "UTF-8");
String nicknameEncode = Base64Util.encode(nicknameDecode);
subscribeBean.setNickname(nicknameEncode);
}
if (StringUtils.isNotBlank(headimgurl)) {
String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8");
subscribeBean.setHeadimgurl(headimgurlDecode);
}
String headimgurl = iptvUserInfo.get("headimgurl").toString();
String nickname = iptvUserInfo.get("nickname").toString();
if (StringUtils.isNotBlank(nickname)) {
String nicknameDecode = URLDecoder.decode(nickname, "UTF-8");
String nicknameEncode = Base64Util.encode(nicknameDecode);
subscribeBean.setNickname(nicknameEncode);
}
if (StringUtils.isNotBlank(headimgurl)) {
String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8");
subscribeBean.setHeadimgurl(headimgurlDecode);
}
}
......@@ -240,7 +174,28 @@ public class UserOperationController {
log.info("UserOperationController ==> unsubscribe ==>> param ==> [{}]",data);
SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(data.getContent(), SubscribeBean.class);
boolean result = this.userTvOperationService.unsubscribe(subscribeBean);
String appId = subscribeBean.getAppId();
Assert.notNull(appId, GlobeExceptionMsg.APP_ID_IS_NULL);
// openId
String openId = subscribeBean.getOpenId();
Assert.notNull(openId, GlobeExceptionMsg.OPEN_ID_IS_NULL);
subscribeBean.setAppid(appId);
subscribeBean.setOpenid(openId);
boolean result = this.userOperationService.unsubscribe(subscribeBean);
return ResultInfo.success(result);
}
@Log("微信小程序绑定大屏")
@PostMapping("/appletBind")
@ApiOperation("微信小程序绑定大屏")
@AnonymousAccess
public ResultInfo appletBind(@Validated(value = {BindGroup.class}) @RequestBody BindBean resources) {
log.info("UserOperationController ==> appletBind ==>> param ==> [{}]",resources);
boolean result = this.userOperationService.appletBind(resources);
return ResultInfo.success(result);
}
......@@ -263,7 +218,7 @@ public class UserOperationController {
String result = SUBSCRIBE;
// 保存大小屏信息到redis同时返回小屏信息
UserWeixinDTO userWeixinDTO = this.userTvOperationService.saveUserInfo(data);
UserWeixinDTO userWeixinDTO = this.userOperationService.saveUserInfo(data);
// 小屏用户不存在或者关注状态为未关注(0),返回未关注
if (Objects.isNull(userWeixinDTO) || Objects.isNull(userWeixinDTO.getId()) || userWeixinDTO.getStatus() != SUBSCRIBE_STATUS) {
result = UNSUBSCRIBE;
......@@ -325,6 +280,41 @@ public class UserOperationController {
}
/******************************************************* IPTV ************************************/
@Log("保存大屏账户同时创建会员")
@PostMapping(value = "/createTvUserAndMember")
@ApiOperation("保存大屏账户同时创建会员信息")
@AnonymousAccess
public ResultInfo createTvUserAndMember(@Validated(value = {CreateGroup.class}) @RequestBody UserTv resources) {
log.info("UserOperationController ==> createUserAndCreateMember ==>> param ==> [{}]",resources);
UserTvDTO result = this.userOperationService.createTvUserAndMember(resources);
return ResultInfo.success(result);
}
@Log("大屏用户解绑")
@RequestMapping(value = "/unbind")
@ApiOperation("大屏用户解绑")
@AnonymousAccess
public ResultInfo unbind(@Validated(value = {UpdateGroup.class}) @RequestBody UserTv resources) {
log.info("UserOperationController ==> unbind ==>> param ==> [{}]",resources);
this.userOperationService.unbind(resources);
return ResultInfo.success();
}
@Log("大屏更换主账号")
@RequestMapping(value = "/changeMainAccount")
@ApiOperation("大屏更换主账号")
@AnonymousAccess
public ResultInfo changeMainAccount(@Validated @RequestBody UserTv resources) {
log.info("UserOperationController ==> changeMainAccount ==>> param ==> [{}]",resources);
this.userOperationService.changeMainAccount(resources);
return ResultInfo.success();
}
@Log("删除全部收藏")
@PostMapping(value = "/deleteAllCollection")
@ApiOperation("删除全部收藏")
......@@ -332,7 +322,7 @@ public class UserOperationController {
public ResultInfo deleteAllCollection(@RequestBody String content) {
log.info("UserOperationController ==> deleteAllCollection ==> param ==> [{}]",content);
boolean result = this.userTvOperationService.deleteAllCollection(content);
boolean result = this.userOperationService.deleteAllCollection(content);
return ResultInfo.success(result);
}
......@@ -343,7 +333,7 @@ public class UserOperationController {
public ResultInfo deleteCollection(@RequestBody String content) {
log.info("UserOperationController ==> deleteCollection ==> param ==> [{}]",content);
boolean result = this.userTvOperationService.deleteCollection(content);
boolean result = this.userOperationService.deleteCollection(content);
return ResultInfo.success(result);
}
......@@ -354,7 +344,7 @@ public class UserOperationController {
public ResultInfo addCollection(@RequestBody String content) {
log.info("UserOperationController ==> addCollection ==>> param ==> [{}]",content);
boolean result = this.userTvOperationService.addCollection(content);
boolean result = this.userOperationService.addCollection(content);
return ResultInfo.success(result);
}
......
......@@ -17,14 +17,28 @@ public interface UserOperationService {
* @param resources
* @return
*/
boolean createTvUserAndMember(UserTv resources);
UserTvDTO createTvUserAndMember(UserTv resources);
/**
* 保存小屏账户并创建会员
* @param resources
* @return
*/
UserWeixinDTO createWeixinUserAndCreateMember(UserWeixin resources);
UserWeixinDTO createWeixinUserAndMember(UserWeixin resources);
/**
* 服务号(H5)登录
* @param resources
* @return
*/
UserWeixinDTO serviceLogin(UserWeixin resources);
/**
* 微信小程序登录
* @param resources
* @return
*/
UserWeixinDTO appletLogin(UserWeixin resources);
/**
* 大屏解绑
......@@ -38,12 +52,7 @@ public interface UserOperationService {
*/
void changeMainAccount(UserTv userTv);
/**
* 微信小程序登录
* @param resources
* @return
*/
UserWeixinDTO appletLogin(WeiXinUserBean resources);
/**
* 微信公众号关注
......@@ -91,21 +100,12 @@ public interface UserOperationService {
boolean addCollection(String content);
/**
* 服务号(H5)登录
* @param resources
* @return
*/
Object serviceLogin(WeiXinUserBean resources);
/**
* 小程序绑定大屏
* @param resources
* @return
*/
boolean appletBind(BindBean resources);
/**
*
* @param memberCode
......
......@@ -8,7 +8,7 @@ import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.process.service.CouponOperationService;
import com.topdraw.business.process.service.MemberOperationService;
import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.business.process.domian.TempCoupon;
import com.topdraw.business.process.service.RightsOperationService;
import com.topdraw.utils.RedisUtils;
......
......@@ -9,7 +9,7 @@ import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.process.service.ExpOperationService;
import com.topdraw.business.process.service.MemberOperationService;
import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.business.process.domian.TempExp;
import com.topdraw.util.IdWorker;
import com.topdraw.utils.RedisUtils;
......
......@@ -13,7 +13,7 @@ import com.topdraw.business.module.points.detail.domain.PointsDetail;
import com.topdraw.business.module.points.detail.service.PointsDetailService;
import com.topdraw.business.module.points.service.PointsService;
import com.topdraw.business.process.service.dto.CustomPointsResult;
import com.topdraw.business.process.service.MemberOperationService;
import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.business.process.service.PointsOperationService;
import com.topdraw.business.process.domian.TempPoints;
import com.topdraw.util.IdWorker;
......
......@@ -12,6 +12,7 @@ import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.user.iptv.domain.UserConstant;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.module.user.iptv.domain.UserTvBuilder;
import com.topdraw.business.module.user.iptv.service.UserTvService;
import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
import com.topdraw.business.module.user.weixin.collection.domain.UserCollection;
......@@ -20,6 +21,7 @@ import com.topdraw.business.module.user.weixin.collection.repository.UserCollect
import com.topdraw.business.module.user.weixin.collection.service.UserCollectionDetailService;
import com.topdraw.business.module.user.weixin.collection.service.UserCollectionService;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
import com.topdraw.business.module.user.weixin.domain.UserWeixinBuilder;
import com.topdraw.business.module.user.weixin.repository.UserWeixinRepository;
import com.topdraw.business.module.user.weixin.service.UserWeixinService;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO;
......@@ -45,6 +47,7 @@ import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
......@@ -91,15 +94,15 @@ public class UserOperationServiceImpl implements UserOperationService {
private String appletAppid;
/**
* 保存大屏账户同时创建会员
* 创建大屏账户同时创建会员
*
* @param resources 大屏账户
* @return boolean
* @return UserTvDTO
*/
@Override
@Transactional
@AsyncMqSend
public boolean createTvUserAndMember(UserTv resources) {
public UserTvDTO createTvUserAndMember(UserTv resources) {
// 大屏账户
String platformAccount = resources.getPlatformAccount();
......@@ -111,14 +114,19 @@ public class UserOperationServiceImpl implements UserOperationService {
Member member =
MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_VIS,
null, platformAccount, 0);
MemberDTO memberDTO = this.createMember(member);
UserTvDTO _userTvDTO = new UserTvDTO();
BeanUtils.copyProperties(resources, _userTvDTO);
if (Objects.nonNull(memberDTO)) {
// 创建大屏账户
this.createTvUser(_userTvDTO, member);
UserTv userTv = UserTvBuilder.build(memberDTO.getId(), memberDTO.getCode(), resources);
// 创建大屏账户
UserTvDTO tvUser = this.createTvUser(userTv, memberDTO.getId(), memberDTO.getCode());
return tvUser;
}
throw new EntityNotFoundException(MemberDTO.class,"code",GlobeExceptionMsg.MEMBER_ID_IS_NULL);
return true;
}
throw new BadRequestException(GlobeExceptionMsg.ENTITY_ALREADY_EXISTS);
......@@ -126,14 +134,14 @@ public class UserOperationServiceImpl implements UserOperationService {
}
/**
*
* 创建小屏账户同时创建会员
* @param resources
* @return
* @return UserWeixinDTO
*/
@Override
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
@AsyncMqSend
public UserWeixinDTO createWeixinUserAndCreateMember(UserWeixin resources) {
public UserWeixinDTO createWeixinUserAndMember(UserWeixin resources) {
String appId = resources.getAppid();
String openId = resources.getOpenid();
......@@ -141,59 +149,56 @@ public class UserOperationServiceImpl implements UserOperationService {
// 检查小屏账户是否存在
UserWeixinDTO userWeixinDTO = this.findFirstByUnionIdAndAppIdAndOpenId(unionId,appId, openId);
if (Objects.nonNull(userWeixinDTO.getId()))
return userWeixinDTO;
if (Objects.nonNull(userWeixinDTO.getId())) {
log.error("createWeixinUserAndMember ==>> result ==>> [{}]", userWeixinDTO);
throw new BadRequestException(GlobeExceptionMsg.OPERATION_FORBID + "==>> " + GlobeExceptionMsg.ENTITY_ALREADY_EXISTS);
}
// 当前用户的任意微信app,因为同一unionId的会员是唯一的
UserWeixinDTO userWeixinDTO1 = this.findFirstByUnionId(unionId);
UserWeixinDTO _userWeixinDTO = this.findFirstByUnionId(unionId);
if (Objects.nonNull(_userWeixinDTO.getId())) {
UserWeixinDTO _userWeixinDTO = new UserWeixinDTO();
Member member = null;
Assert.notNull(_userWeixinDTO.getMemberId(),GlobeExceptionMsg.MEMBER_ID_IS_NULL);
if (Objects.nonNull(userWeixinDTO1.getId())) {
// 小屏会员
MemberDTO memberDTO = this.findMemberById(_userWeixinDTO.getMemberId());
if (Objects.nonNull(memberDTO)) {
resources.setMemberId(_userWeixinDTO.getMemberId());
UserWeixin userWeixin = UserWeixinBuilder.build(resources);
return this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode());
}
Long memberId = userWeixinDTO1.getMemberId();
resources.setMemberId(memberId);
BeanUtils.copyProperties(resources,_userWeixinDTO);
throw new EntityNotFoundException(MemberDTO.class,"code",GlobeExceptionMsg.MEMBER_CODE_IS_NULL);
} else {
// x_member
member =
// 新建会员
Member _member =
MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
null, "", 0);
MemberDTO memberDTO = this.createMember(_member);
BeanUtils.copyProperties(resources,_userWeixinDTO);
}
if (Objects.nonNull(memberDTO)) {
UserWeixin userWeixin = UserWeixinBuilder.build(resources);
return this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode());
}
this.createWeixinUser(_userWeixinDTO,member);
throw new EntityNotFoundException(MemberDTO.class,"code",GlobeExceptionMsg.MEMBER_CODE_IS_NULL);
return null;
}
}
}
/**
* 服务号登录
* @param resources
* @return
*/
@Override
public Object serviceLogin(WeiXinUserBean resources) {
String unionId = resources.getUnionid();
String appId = resources.getAppid();
String openId = resources.getOpenid();
public UserWeixinDTO serviceLogin(UserWeixin resources) {
// 小屏账户
UserWeixinDTO userWeixinDTO = this.findFirstByUnionIdAndAppIdAndOpenId(unionId,appId, openId);
if (Objects.isNull(userWeixinDTO.getId())) {
// member
Member member =
MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
resources.getHeadimgurl(), resources.getNikename(), 0);
userWeixinDTO = new UserWeixinDTO();
BeanUtils.copyProperties(resources,userWeixinDTO);
UserWeixin weixinUser = this.createWeixinUser(userWeixinDTO, member);
userWeixinDTO.setId(weixinUser.getId());
}
// 创建小屏账户同时创建会员
UserWeixinDTO userWeixinDTO = this.createWeixinUserAndMember(resources);
// 为了保证返回的同一用户
UserWeixinDTO userWeixinDTO_0 = this.getFirstId(userWeixinDTO);
......@@ -207,28 +212,14 @@ public class UserOperationServiceImpl implements UserOperationService {
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false, rollbackFor = Exception.class)
public UserWeixinDTO appletLogin(WeiXinUserBean resources) {
String unionId = resources.getUnionid();
String appId = resources.getAppid();
String openId = resources.getOpenid();
public UserWeixinDTO appletLogin(UserWeixin resources) {
// 小屏账户
UserWeixinDTO userWeixinDTO = this.findFirstByUnionIdAndAppIdAndOpenId(unionId,appId, openId);
// 创建小屏账户同时创建会员
UserWeixinDTO userWeixinDTO = this.createWeixinUserAndMember(resources);
if (Objects.isNull(userWeixinDTO.getId())) {
// member
Member member =
MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
resources.getHeadimgurl(), resources.getNikename(), 0);
userWeixinDTO = new UserWeixinDTO();
BeanUtils.copyProperties(resources, userWeixinDTO);
UserWeixin weixinUser = this.createWeixinUser(userWeixinDTO, member);
userWeixinDTO.setId(weixinUser.getId());
}
return this.getFirstId(userWeixinDTO);
// 为了保证返回的同一用户
UserWeixinDTO userWeixinDTO_0 = this.getFirstId(userWeixinDTO);
return userWeixinDTO_0;
}
/**
......@@ -246,8 +237,8 @@ public class UserOperationServiceImpl implements UserOperationService {
@Override
public boolean subscribe(SubscribeBean resources) {
String unionId = resources.getUnionid();
String appId = resources.getAppId();
String openId = resources.getOpenId();
String appId = resources.getAppid();
String openId = resources.getOpenid();
String nickname = resources.getNickname();
String headImgUrl = resources.getHeadimgurl();
......@@ -256,20 +247,15 @@ public class UserOperationServiceImpl implements UserOperationService {
if (Objects.isNull(userWeixinDTO.getId())) {
// member
Member member =
MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
resources.getHeadimgurl(), resources.getNikename(), 1);
UserWeixinDTO _userWeixinDTO = new UserWeixinDTO();
BeanUtils.copyProperties(resources,_userWeixinDTO);
this.createWeixinUser(_userWeixinDTO,member);
UserWeixin userWeixin = new UserWeixin();
BeanUtils.copyProperties(resources,userWeixin);
// 创建小屏账户同时创建会员
this.createWeixinUserAndMember(userWeixin);
} else {
// 修改账 status =1 , 会员 vip = 1
this.doUpdateUserWeiXinAndMember(userWeixinDTO,appId,openId,headImgUrl,nickname);
// 修改微信账户关注状态
this.doUpdateUserWeiXinStatus(userWeixinDTO,SUBSCRIBE_STATUS);
}
......@@ -280,7 +266,21 @@ public class UserOperationServiceImpl implements UserOperationService {
// 小屏会员
MemberDTO memberDTO = this.findMemberByAppIdAndOpenId(appId,openId);
// 账户
if (memberDTO != null) {
if (StringUtils.isNotBlank(headImgUrl) && StringUtils.isNotBlank(nickname)) {
memberDTO.setAvatarUrl(headImgUrl);
memberDTO.setNickname(nickname);
}
Integer vip = memberDTO.getVip();
// 未购买付费会员
if (Objects.isNull(vip) || vip < 1) {
memberDTO.setVip(1);
}
}
// 大屏账户
String platformAccount = iptvUserInfo.getString("platformAccount");
this.bind(memberDTO,platformAccount);
......@@ -299,8 +299,8 @@ public class UserOperationServiceImpl implements UserOperationService {
@Override
public boolean unsubscribe(SubscribeBean resources) {
String appId = resources.getAppId();
String openId = resources.getOpenId();
String appId = resources.getAppid();
String openId = resources.getOpenid();
// 修改关注状态 0:未关注
UserWeixinDTO userWeixinDTO = this.doUpdateUserWeiXinStatus(appId, openId, UNSUBSCRIBE_STATUS);
......@@ -426,9 +426,6 @@ public class UserOperationServiceImpl implements UserOperationService {
@AsyncMqSend
public boolean deleteCollection(String content) {
try {
log.info("receive UserCollection delete message, content [{}]", content);
JSONObject jsonObject = JSONObject.parseObject(content);
String platformAccount = jsonObject.getString("platformAccount");
String data = jsonObject.getString("data");
......@@ -512,7 +509,6 @@ public class UserOperationServiceImpl implements UserOperationService {
if (userCollectionMqList == null || userCollectionMqList.isEmpty())
return false;
Map<Long, List<UserCollectionMq>> collect = userCollectionMqList.stream().collect(Collectors.groupingBy(UserCollectionMq::getUserCollectionId));
for (Map.Entry<Long, List<UserCollectionMq>> entry : collect.entrySet()) {
......@@ -568,17 +564,16 @@ public class UserOperationServiceImpl implements UserOperationService {
public boolean appletBind(BindBean resources) {
Long id = resources.getId();
Long platformUserId = resources.getPlatformUserId();
String unionid = resources.getUnionid();
String platformAccount = resources.getPlatformAccount();
// 大屏账户
UserTvDTO userTvDTO = this.findUserIptvById(platformUserId);
UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
// 账户是否存在
if (Objects.isNull(userTvDTO.getId())){
log.error("Param ==> platformUserId ==> [{}]",platformUserId);
throw new EntityNotFoundException(UserTvDTO.class,"id","大屏账户不存在!");
log.error("appletBind ==> platformAccount ==> [{}]",platformAccount);
throw new EntityNotFoundException(UserTvDTO.class,"id",GlobeExceptionMsg.IPTV_IS_NULL);
}
UserWeixinDTO userWeixinDTO = null;
......@@ -591,42 +586,31 @@ public class UserOperationServiceImpl implements UserOperationService {
// 账户是否存在
if (Objects.isNull(userWeixinDTO.getId())) {
log.error("param ==> id ==> [{}]",id);
throw new EntityNotFoundException(UserWeixinDTO.class, "id", userWeixinDTO.getId().toString());
log.error("appletBind ==> weixinId ==> [{}]",id);
throw new EntityNotFoundException(UserWeixinDTO.class, "id", id.toString());
}
// 会员
Long memberId = userWeixinDTO.getMemberId();
if (Objects.isNull(memberId)) {
log.error("param ==> memberId ==> [{}]",id);
throw new EntityNotFoundException(UserWeixinDTO.class, "id", id.toString());
log.error("appletBind ==> memberId ==> [{}]",memberId);
throw new EntityNotFoundException(UserWeixinDTO.class, "memberId", memberId.toString());
}
MemberDTO memberDTO = this.findMemberById(memberId);
if (Objects.isNull(memberId)) {
log.error("param ==> memberId ==> [{}]",id);
throw new EntityNotFoundException(MemberDTO.class, "id", memberId.toString());
}
// 主账户会员
String code = memberDTO.getCode();
// 更新大屏信息,同步大屏信息时使用
userTvDTO.setMemberCode(code);
// 主账户
String priorityMemberCode = userTvDTO.getPriorityMemberCode();
if (StringUtils.isBlank(priorityMemberCode)) {
// 主账户会员
String code = memberDTO.getCode();
// 设置主账号
userTvDTO.setPriorityMemberCode(code);
}
// 更新小屏账户更新时间,epg需要根据修改时间来让绑定的二维码消失
this.doUpdateUserWeiXinUpdateTime(userWeixinDTO);
// 更新大屏信息,同步大屏信息时使用
userTvDTO.setMemberCode(memberDTO.getCode());
this.doUpdateUserTv(userTvDTO);
String platform = userTvDTO.getPlatform();
// 绑定IPTV平台 0:未知;1:电信;2:移动;3:联通
Integer bindIptvPlatformType = 0;
......@@ -646,8 +630,12 @@ public class UserOperationServiceImpl implements UserOperationService {
memberDTO.setBindIptvTime(LocalDateTime.now());
memberDTO.setBindIptvPlatformType(bindIptvPlatformType);
memberDTO.setPlatformAccount(platformAccount);
// 更新大屏账户
this.doUpdateUserTv(userTvDTO);
// 修改会员信息
this.doUpdateMemberByMemberDTO(memberDTO);
return true;
}
......@@ -690,7 +678,7 @@ public class UserOperationServiceImpl implements UserOperationService {
// 大屏账户
UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
if (Objects.isNull(userTvDTO)) {
throw new BadRequestException("大屏信息不存在!");
throw new BadRequestException(GlobeExceptionMsg.IPTV_IS_NULL);
}
// mq同步数据时使用
......@@ -821,28 +809,6 @@ public class UserOperationServiceImpl implements UserOperationService {
}
/**
*
* @param userWeixinDTO
* @param appId
* @param openId
*/
private void doUpdateUserWeiXinAndMember(UserWeixinDTO userWeixinDTO,String appId,String openId,String headImgUrl,String nickName) {
// 修改微信账户关注状态
this.doUpdateUserWeiXinStatus(userWeixinDTO,SUBSCRIBE_STATUS);
// 小屏会员
MemberDTO memberDTO_0 = this.findMemberByAppIdAndOpenId(appId,openId);
if (StringUtils.isNotBlank(headImgUrl) && StringUtils.isNotBlank(nickName)) {
memberDTO_0.setAvatarUrl(headImgUrl);
memberDTO_0.setNickname(nickName);
}
this.doUpdateMemberVip(memberDTO_0,1);
}
/**
* 获取小屏会员
* @param appId
* @param openId
......@@ -939,20 +905,20 @@ public class UserOperationServiceImpl implements UserOperationService {
* 修改会员
* @param memberDTO
*/
private void doUpdateMemberByMemberDTO(MemberDTO memberDTO){
private MemberDTO doUpdateMemberByMemberDTO(MemberDTO memberDTO){
Member member = new Member();
BeanUtils.copyProperties(memberDTO,member);
member.setUpdateTime(LocalDateTime.now());
log.info("doUpdateMemberByMemberDTO=====?>>member ==>> [{}]",member);
this.doUpdateMember(member);
return this.doUpdateMember(member);
}
/**
* 修改会员
* @param member
*/
private void doUpdateMember(Member member){
this.memberService.update(member);
private MemberDTO doUpdateMember(Member member){
return this.memberService.update(member);
}
......@@ -1062,46 +1028,43 @@ public class UserOperationServiceImpl implements UserOperationService {
* @param member
* @return
*/
private Long createMember(Member member){
return this.memberService.create(member).getId();
private MemberDTO createMember(Member member){
return this.memberService.create(member);
}
/**
*
* @param resources
* @param member
* @param memberId
* @return
*/
private UserTv createTvUser(UserTvDTO resources,Member member){
private UserTvDTO createTvUser(UserTv resources, Long memberId, String memberCode){
if (member != null) {
Long memberId = this.createMember(member);
resources.setMemberId(memberId);
}
resources.setMemberId(memberId);
resources.setMemberCode(memberCode);
UserTv userTv = this.userTvService.create(resources);
UserTv _userTv = new UserTv();
BeanUtils.copyProperties(resources,_userTv);
return this.userTvService.create(_userTv);
UserTvDTO userTvDTO = new UserTvDTO();
BeanUtils.copyProperties(userTv,userTvDTO);
return userTvDTO;
}
/**
*
* @param userWeixinDTO
* @param member
* @param resource
* @param memberId
* @param memberCode
* @return
*/
private UserWeixin createWeixinUser(UserWeixinDTO userWeixinDTO,Member member){
private UserWeixinDTO createWeixinUser(UserWeixin resource, Long memberId, String memberCode){
if (member != null) {
// 创建会员
Long memberId = this.createMember(member);
userWeixinDTO.setMemberId(memberId);
}
UserWeixin _userWeixin = new UserWeixin();
BeanUtils.copyProperties(userWeixinDTO,_userWeixin);
resource.setMemberId(memberId);
resource.setMemberCode(memberCode);
UserWeixin userWeixin = this.userWeixinService.create(resource);
return this.userWeixinService.create(_userWeixin);
UserWeixinDTO userWeixinDTO = new UserWeixinDTO();
BeanUtils.copyProperties(userWeixin,userWeixinDTO);
return userWeixinDTO;
}
}
......
package com.topdraw.business.process.service.impl.member;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.business.module.member.address.domain.MemberAddress;
import com.topdraw.business.module.member.address.service.MemberAddressService;
import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO;
import com.topdraw.business.process.service.member.MemberAddressOperationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/**
* @author XiangHan
* @date 2021-10-22
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
@Slf4j
public class MemberAddressOperationServiceImpl implements MemberAddressOperationService {
@Autowired
private MemberAddressService memberAddressService;
@Override
public MemberAddressDTO findById(Long id) {
return this.memberAddressService.findById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
@AsyncMqSend
public MemberAddressDTO create(MemberAddress resources) {
log.info("MemberAddressOperationServiceImpl ==>> create ==>> param ==>> [{}]",resources);
return this.memberAddressService.create(resources);
}
@Override
@Transactional(rollbackFor = Exception.class)
@AsyncMqSend
public MemberAddressDTO update(MemberAddress resources) {
log.info("MemberAddressOperationServiceImpl ==>> update ==>> param ==>> [{}]",resources);
return this.memberAddressService.update(resources);
}
@Override
@Transactional(rollbackFor = Exception.class)
@AsyncMqSend
public void delete(Long id) {
this.memberAddressService.delete(id);
}
}
package com.topdraw.business.process.service.impl;
package com.topdraw.business.process.service.impl.member;
import cn.hutool.core.util.ObjectUtil;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
import com.topdraw.business.module.member.profile.service.MemberProfileService;
import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
import com.topdraw.business.module.member.service.MemberService;
......@@ -12,12 +13,12 @@ import com.topdraw.business.module.user.weixin.domain.UserWeixin;
import com.topdraw.business.module.user.weixin.service.UserWeixinService;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO;
import com.topdraw.business.process.domian.weixin.BuyVipBean;
import com.topdraw.business.process.service.MemberOperationService;
import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.business.process.service.member.MemberProfileOperationService;
import com.topdraw.exception.EntityNotFoundException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
......@@ -35,7 +36,7 @@ public class MemberOperationServiceImpl implements MemberOperationService {
@Autowired
private MemberService memberService;
@Autowired
private MemberProfileService memberProfileService;
private MemberProfileOperationService memberProfileOperationService;
@Autowired
private MemberVipHistoryService memberVipHistoryService;
@Autowired
......@@ -103,6 +104,11 @@ public class MemberOperationServiceImpl implements MemberOperationService {
return member;
}
@Override
public MemberDTO findByCode(String code) {
return this.memberService.findByCode(code);
}
private UserWeixinDTO findWeiXinById(Long id) {
UserWeixinDTO userWeixinDTO = this.userWeixinService.findById(id);
......@@ -178,18 +184,6 @@ public class MemberOperationServiceImpl implements MemberOperationService {
MemberProfileDTO memberProfileDTO = new MemberProfileDTO();
BeanUtils.copyProperties(memberProfileDTO_0,memberProfileDTO);
/*// 真实姓名
String realname = memberProfileDTO.getRealname();
if (StringUtils.isNotBlank(realname)) {
realname = new String(Base64.getEncoder().encode(realname.getBytes(StandardCharsets.UTF_8)));
}
// 昵称
String nickname = memberDTO.getNickname();
if (StringUtils.isNotBlank(nickname)) {
nickname = new String(Base64.getEncoder().encode(nickname.getBytes(StandardCharsets.UTF_8)));
}*/
// vip
Integer vip = memberDTO.getVip();
// 过期时间
......@@ -217,16 +211,12 @@ public class MemberOperationServiceImpl implements MemberOperationService {
// 过期时间
memberProfileDTO.setVipExpireTime(timeLong);
// 真实姓名
// memberProfileDTO.setRealname(realname);
// 头像
memberProfileDTO.setAvatarUrl(memberDTO.getAvatarUrl());
// 生日
memberProfileDTO.setBirthday(memberDTO.getBirthday());
// 性别
memberProfileDTO.setGender(memberDTO.getGender());
// 昵称
// memberProfileDTO.setNickname(nickname);
// 会员id
memberProfileDTO.setMemberId(memberDTO.getId());
// vip
......@@ -285,6 +275,6 @@ public class MemberOperationServiceImpl implements MemberOperationService {
* @return
*/
private MemberProfileDTO findMemberProfileByMemberId(Long memberId) {
return this.memberProfileService.findByMemberId(memberId);
return this.memberProfileOperationService.findByMemberId(memberId);
}
}
......
package com.topdraw.business.process.service.impl.member;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
import com.topdraw.business.module.member.profile.service.MemberProfileService;
import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
import com.topdraw.business.process.service.member.MemberProfileOperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/3/20 17:34
* @version: :
* @modified By:
* @since : modified in 2022/3/20 17:34
*/
@Service
public class MemberProfileOperationServiceImpl implements MemberProfileOperationService {
@Autowired
private MemberProfileService memberProfileService;
@Override
public MemberProfileDTO findById(Long id) {
return this.memberProfileService.findById(id);
}
@Override
public MemberProfile create(MemberProfile resources) {
return this.memberProfileService.create(resources);
}
@Override
public MemberProfile createDefault(MemberProfile resources) {
return this.memberProfileService.createDefault(resources);
}
@Override
public MemberProfile createDefault(Member resources) {
return this.memberProfileService.createDefault(resources);
}
@Override
public MemberProfile createDefaultByMemberId(Long resources) {
return this.memberProfileService.createDefaultByMemberId(resources);
}
@Override
public MemberProfileDTO update(MemberProfile resources) {
return this.memberProfileService.update(resources);
}
@Override
public void delete(Long id) {
this.memberProfileService.delete(id);
}
@Override
public MemberProfileDTO findByMemberId(Long memberId) {
return this.memberProfileService.findByMemberId(memberId);
}
@Override
public MemberProfileDTO findByMemberCode(String memberCode) {
return this.memberProfileService.findByMemberCode(memberCode);
}
@Override
public void updateMemberProfileAndMember(MemberProfile resources) {
this.memberProfileService.updateMemberProfileAndMember(resources);
}
}
package com.topdraw.business.process.service.impl.member;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoService;
import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO;
import com.topdraw.business.process.service.member.MemberRelatedInfoOperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/3/20 18:41
* @version: :
* @modified By:
* @since : modified in 2022/3/20 18:41
*/
@Service
public class MemberRelatedInfoOperationServiceImpl implements MemberRelatedInfoOperationService {
@Autowired
private MemberRelatedInfoService memberRelatedInfoService;
@Override
public MemberRelatedInfoDTO findById(Long id) {
return this.memberRelatedInfoService.findById(id);
}
@Override
public void create(MemberRelatedInfo resources) {
this.memberRelatedInfoService.create(resources);
}
@Override
public void update(MemberRelatedInfo resources) {
this.memberRelatedInfoService.update(resources);
}
@Override
public void delete(Long id) {
this.memberRelatedInfoService.delete(id);
}
@Override
public MemberRelatedInfo findByIdCard(MemberRelatedInfo resources) {
return this.memberRelatedInfoService.findByIdCard(resources);
}
@Override
public MemberRelatedInfo findByIdCard(String idCard) {
return this.memberRelatedInfoService.findByIdCard(idCard);
}
@Override
public MemberRelatedInfo findByMemberIdAndIdCard(Long memberId, String idCard) {
return this.memberRelatedInfoService.findByMemberIdAndIdCard(memberId, idCard);
}
@Override
public MemberRelatedInfo findByMemberCodeAndIdCard(String memberCode, String idCard) {
return this.memberRelatedInfoService.findByMemberCodeAndIdCard(memberCode, idCard);
}
@Override
public MemberRelatedInfo findByMemberIdAndIdCard(MemberRelatedInfo resources) {
return this.memberRelatedInfoService.findByMemberIdAndIdCard(resources);
}
@Override
public MemberRelatedInfo findByMemberIdAndIdCard(Member member, MemberRelatedInfo resources) {
return this.memberRelatedInfoService.findByMemberIdAndIdCard(member, resources);
}
}
package com.topdraw.business.process.service.member;
import com.topdraw.business.module.member.address.domain.MemberAddress;
import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO;
public interface MemberAddressOperationService {
/**
* 根据ID查询
* @param resources ID
* @return MemberAddressDTO
*/
MemberAddressDTO findById(Long resources);
/**
* 保存会员地址
* @param resources
*/
MemberAddressDTO create(MemberAddress resources);
/**
* 修改会员地址
* @param resources
*/
MemberAddressDTO update(MemberAddress resources);
/**
* 通过id删除
* @param resources
*/
void delete(Long resources);
}
package com.topdraw.business.process.service;
package com.topdraw.business.process.service.member;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.process.domian.weixin.BuyVipBean;
......@@ -65,4 +66,10 @@ public interface MemberOperationService {
*/
MemberDTO update(Member resources);
/**
*
* @param code
* @return
*/
MemberDTO findByCode(String code);
}
......
package com.topdraw.business.process.service.member;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
public interface MemberProfileOperationService {
/**
* 根据ID查询
* @param id ID
* @return MemberProfileDTO
*/
MemberProfileDTO findById(Long id);
/**
* 保存
* @param resources 会员基本信息
* @return
*/
MemberProfile create(MemberProfile resources);
/**
* 默认属性
* @param resources
* @return
*/
MemberProfile createDefault(MemberProfile resources);
/**
* 通过会员创建默认属性
* @param resources
* @return
*/
MemberProfile createDefault(Member resources);
/**
* 通过会员id创建默认属性
* @param resources
* @return
*/
MemberProfile createDefaultByMemberId(Long resources);
/**
* 修改
* @param resources
*/
MemberProfileDTO update(MemberProfile resources);
/**
* 删除
* @param id
*/
void delete(Long id);
/**
* 通过会员id查询
* @param memberId
* @return
*/
MemberProfileDTO findByMemberId(Long memberId);
/**
* 通过会员code查询
* @param memberCode
* @return
*/
MemberProfileDTO findByMemberCode(String memberCode);
/**
* 修改会员属性并同步会员信息
* @param resources
*/
void updateMemberProfileAndMember(MemberProfile resources);
}
package com.topdraw.business.process.service.member;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO;
/**
* @author XiangHan
* @date 2021-10-22
*/
public interface MemberRelatedInfoOperationService {
/**
* 根据ID查询
* @param id ID
* @return MemberRelatedInfoDTO
*/
MemberRelatedInfoDTO findById(Long id);
/**
* 新增
* @param resources
*/
void create(MemberRelatedInfo resources);
/**
* 修改
* @param resources
*/
void update(MemberRelatedInfo resources);
/**
* 删除
* @param id
*/
void delete(Long id);
/**
* 通过身份证查询
* @param resources
* @return
*/
MemberRelatedInfo findByIdCard(MemberRelatedInfo resources);
/**
* 通过身份证查询
* @param idCard 身份证
* @return
*/
MemberRelatedInfo findByIdCard(String idCard);
/**
*
* @param memberId
* @param idCard
* @return
*/
MemberRelatedInfo findByMemberIdAndIdCard(Long memberId, String idCard);
/**
*
* @param memberCode
* @param idCard
* @return
*/
MemberRelatedInfo findByMemberCodeAndIdCard(String memberCode, String idCard);
/**
*
* @param resources
* @return
*/
MemberRelatedInfo findByMemberIdAndIdCard(MemberRelatedInfo resources);
/**
*
* @param member
* @param resources
* @return
*/
MemberRelatedInfo findByMemberIdAndIdCard(Member member, MemberRelatedInfo resources);
}
......@@ -35,8 +35,15 @@ public interface GlobeExceptionMsg {
/**************************************************************/
/** 账户管理 **/
/** iptv */
String IPTV_ID_IS_NULL = "iptvId is null";
String IPTV_PLATFORM_ACCOUNT_IS_NULL = "platformAccount is null";
String IPTV_IS_NULL = "iptv is null";
String VIS_USER_ID_IS_NULL = "visUserId is null";
/** 微信 */
String APP_ID_IS_NULL = "appId is null";
String OPEN_ID_IS_NULL = "openId is null";
String UNION_ID_IS_NULL = "unionId is null";
}
......
......@@ -2,9 +2,12 @@
spring:
datasource:
# 测试/演示库url:
url: jdbc:log4jdbc:mysql://139.196.192.242:3306/tj_user_0819?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
# url: jdbc:log4jdbc:mysql://139.196.192.242:3306/tj_user_0819?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
# username: root
# password: Tjlh@2017
url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
username: root
password: Tjlh@2017
password: root
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
#Druid
......
......@@ -3,7 +3,7 @@ package com.topdraw.test.business.basicdata.points;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.points.detail.domain.PointsDetail;
import com.topdraw.business.module.points.detail.service.PointsDetailService;
import com.topdraw.business.process.service.MemberOperationService;
import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.business.process.domian.TempPoints;
import com.topdraw.BaseTest;
import com.topdraw.util.IdWorker;
......
......@@ -5,7 +5,7 @@ import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.points.detail.domain.PointsDetail;
import com.topdraw.business.module.points.detail.service.PointsDetailService;
import com.topdraw.business.process.domian.TempPoints;
import com.topdraw.business.process.service.MemberOperationService;
import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.util.IdWorker;
import org.junit.Test;
import org.springframework.beans.BeanUtils;
......
......@@ -2,10 +2,9 @@ package com.topdraw.test.business.process.service;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.process.service.MemberOperationService;
import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.BaseTest;
import com.topdraw.util.IdWorker;
import com.topdraw.util.TimestampUtil;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
......
......@@ -2,6 +2,7 @@ package com.topdraw.test.business.process.service;
import com.alibaba.fastjson.JSON;
import com.topdraw.BaseTest;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
import com.topdraw.business.process.domian.weixin.WeiXinUserBean;
import com.topdraw.business.process.service.UserOperationService;
import com.topdraw.module.mq.DataSyncMsg;
......@@ -31,8 +32,8 @@ public class UserOperationServiceTest extends BaseTest {
String s = JSON.toJSONString(dataSyncMsg);*/
WeiXinUserBean weiXinUserBean = new WeiXinUserBean();
weiXinUserBean.setWxAppid("1");
UserWeixin weiXinUserBean = new UserWeixin();
/*weiXinUserBean.setWxAppid("1");
weiXinUserBean.setWxCode("1");
weiXinUserBean.setSourceType("1");
weiXinUserBean.setSourceId("1");
......@@ -41,7 +42,7 @@ public class UserOperationServiceTest extends BaseTest {
weiXinUserBean.setSourceEntity("1");
weiXinUserBean.setSourceDesc("1");
weiXinUserBean.setSourceUser(1L);
weiXinUserBean.setUserInfo("1");
weiXinUserBean.setUserInfo("1");*/
this.taskOperationService.appletLogin(weiXinUserBean);
}
......