Commit cbeea18c cbeea18c55367a69c1f7a483a96a5de302db8042 by xianghan

Merge branch '2.2.0-release'

2 parents 8189259a 2d8af089
Showing 156 changed files with 1376 additions and 787 deletions
......@@ -15,22 +15,16 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<jjwt.version>0.9.1</jjwt.version>
<cronos.version>1.1.0</cronos.version>
<cronos.version>1.2.0</cronos.version>
</properties>
<dependencies>
<!--<dependency>
<groupId>com.topdraw</groupId>
<artifactId>cronos-system</artifactId>
<version>${cronos.version}</version>
</dependency>-->
<dependency>
<groupId>com.topdraw</groupId>
<artifactId>code-generator</artifactId>
<version>3.1.0</version>
<artifactId>core-service</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
......
package com.topdraw;
import com.topdraw.utils.SpringContextHolder;
import com.topdraw.base.modules.utils.SpringContextHolder;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
......
......@@ -49,11 +49,13 @@ public interface RedisKeyConstants {
// 历史完成的任务数量
String cacheTotalFinishTaskCount = "uce::totalCount::memberId";
// app账号信息
String cacheAppById = "uce:appInfo:id";
String CACHE_PLATFROMACCOUNT_PLAYDURATION = "uce::eventPlay::playduration";
String CACHE_TODAY_FINISH_COUNT = "todayFinishCount";
String CACHE_TOTAL_FINISH_COUNT = "totalFinishCount";
}
......
package com.topdraw.business.module.contact.domain;
import com.topdraw.business.module.common.validated.CreateGroup;
import lombok.Data;
import lombok.experimental.Accessors;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import java.sql.Timestamp;
import java.io.Serializable;
/**
* @author XiangHan
* @date 2022-09-01
*/
@Entity
@Data
@EntityListeners(AuditingEntityListener.class)
@Accessors(chain = true)
@Table(name="uc_member_contacts")
public class MemberContacts implements Serializable {
// 主键
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
// 会员id
@Column(name = "member_id", nullable = false)
@NotNull(groups = CreateGroup.class, message = "会员id不的为空")
private Long memberId;
// 用户id
@Column(name = "user_id")
private Long userId;
// 实体id
@Column(name = "entity_id")
private Long entityId;
// 实体类型 1:订单;2:商品;3:活动;99:其他
@Column(name = "entity_type")
private Long entityType;
// 实体code
@Column(name = "entity_code")
private String entityCode;
// 设备类型 1:大屏;2:微信;3:app;99:其他
@Column(name = "device_type")
@NotNull(groups = CreateGroup.class, message = "设备类型不的为空")
private Long deviceType;
// 姓名
@Column(name = "realname")
@NotNull(groups = CreateGroup.class, message = "姓名不的为空")
@NotEmpty(groups = CreateGroup.class, message = "姓名不的为空")
private String realname;
// 生日
@Column(name = "birthday")
private String birthday;
// 手机号
@Column(name = "phone")
@NotNull(groups = CreateGroup.class, message = "手机号不的为空")
private String phone;
// 创建时间
@CreatedDate
@Column(name = "create_time")
private Timestamp createTime;
// 更新时间
@LastModifiedDate
@Column(name = "update_time")
private Timestamp updateTime;
public void copy(MemberContacts source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}
package com.topdraw.business.module.contact.repository;
import com.topdraw.business.module.contact.domain.MemberContacts;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.Optional;
/**
* @author XiangHan
* @date 2022-09-01
*/
public interface MemberContactsRepository extends JpaRepository<MemberContacts, Long>, JpaSpecificationExecutor<MemberContacts> {
}
package com.topdraw.business.module.contact.rest;
import com.topdraw.common.ResultInfo;
import com.topdraw.business.module.contact.domain.MemberContacts;
import com.topdraw.business.module.contact.service.MemberContactsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
/**
* @author XiangHan
* @date 2022-09-01
*/
@Api(tags = "MemberContacts管理")
@RestController
@RequestMapping("/api/MemberContacts")
public class MemberContactsController {
@Autowired
private MemberContactsService MemberContactsService;
@PostMapping
@ApiOperation("新增MemberContacts")
public ResultInfo create(@Validated @RequestBody MemberContacts resources) {
MemberContactsService.create(resources);
return ResultInfo.success();
}
}
package com.topdraw.business.module.contact.service;
import com.topdraw.business.module.contact.domain.MemberContacts;
import com.topdraw.business.module.contact.service.dto.MemberContactsDTO;
/**
* @author XiangHan
* @date 2022-09-01
*/
public interface MemberContactsService {
/**
* 根据ID查询
* @param id ID
* @return MemberContactsDTO
*/
MemberContactsDTO findById(Long id);
MemberContacts create(MemberContacts resources);
}
package com.topdraw.business.module.contact.service.dto;
import lombok.Data;
import java.sql.Timestamp;
import java.io.Serializable;
/**
* @author XiangHan
* @date 2022-09-01
*/
@Data
public class MemberContactsDTO implements Serializable {
// 主键
private Long id;
// 会员id
private Long memberId;
// 用户id
private Long userId;
// 实体id
private Long entityId;
// 实体类型 1:订单;2:商品;3:活动;99:其他
private Long entityType;
// 实体code
private String entityCode;
// 设备类型 1:大屏;2:微信;3:app;99:其他
private Long deviceType;
// 姓名
private String realname;
// 生日
private String birthday;
// 手机号
private String phone;
// 创建时间
private Timestamp createTime;
// 更新时间
private Timestamp updateTime;
}
package com.topdraw.business.module.contact.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.contact.domain.MemberContacts;
import com.topdraw.business.module.contact.repository.MemberContactsRepository;
import com.topdraw.business.module.contact.service.MemberContactsService;
import com.topdraw.business.module.contact.service.dto.MemberContactsDTO;
import com.topdraw.business.module.contact.service.mapper.MemberContactsMapper;
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 2022-09-01
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class MemberContactsServiceImpl implements MemberContactsService {
@Autowired
private MemberContactsRepository MemberContactsRepository;
@Autowired
private MemberContactsMapper MemberContactsMapper;
@Override
public MemberContactsDTO findById(Long id) {
MemberContacts MemberContacts = MemberContactsRepository.findById(id).orElseGet(MemberContacts::new);
ValidationUtil.isNull(MemberContacts.getId(),"MemberContacts","id",id);
return MemberContactsMapper.toDto(MemberContacts);
}
@Override
@Transactional(rollbackFor = Exception.class)
public MemberContacts create(MemberContacts resources) {
return MemberContactsRepository.save(resources);
}
}
package com.topdraw.business.module.contact.service.mapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.contact.domain.MemberContacts;
import com.topdraw.business.module.contact.service.dto.MemberContactsDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author XiangHan
* @date 2022-09-01
*/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface MemberContactsMapper extends BaseMapper<MemberContactsDTO, MemberContacts> {
}
package com.topdraw.business.module.contact.vis.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.base.modules.exception.BadRequestException;
import com.topdraw.business.module.contact.vis.service.dto.ActivityAddressDTO;
import com.topdraw.common.ResultInfo;
import com.topdraw.business.module.contact.vis.domain.ActivityAddress;
import com.topdraw.business.module.contact.vis.service.ActivityAddressService;
import com.topdraw.exception.BadRequestException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
......
package com.topdraw.business.module.contact.vis.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.contact.vis.domain.ActivityAddress;
import com.topdraw.util.TimestampUtil;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.contact.vis.repository.ActivityAddressRepository;
import com.topdraw.business.module.contact.vis.service.ActivityAddressService;
import com.topdraw.business.module.contact.vis.service.dto.ActivityAddressDTO;
import com.topdraw.business.module.contact.vis.service.mapper.ActivityAddressMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
......
package com.topdraw.business.module.contact.vis.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.contact.vis.domain.ActivityAddress;
import com.topdraw.business.module.contact.vis.service.dto.ActivityAddressDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.coupon.history.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.coupon.history.domain.CouponHistory;
import com.topdraw.business.module.coupon.history.domain.CouponHistoryBuilder;
import com.topdraw.util.LocalDateTimeUtil;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.coupon.history.repository.CouponHistoryRepository;
import com.topdraw.business.module.coupon.history.service.CouponHistoryService;
import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO;
......@@ -13,11 +13,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.sql.Date;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
/**
* @author XiangHan
......
package com.topdraw.business.module.coupon.history.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.coupon.history.domain.CouponHistory;
import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO;
import org.mapstruct.Mapper;
......
......@@ -7,13 +7,13 @@ import com.topdraw.business.module.coupon.repository.CouponRepository;
import com.topdraw.business.module.coupon.service.CouponService;
import com.topdraw.business.module.coupon.service.dto.CouponDTO;
import com.topdraw.business.module.coupon.service.mapper.CouponMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import com.topdraw.utils.StringUtils;
/**
......
package com.topdraw.business.module.coupon.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.coupon.domain.Coupon;
import com.topdraw.business.module.coupon.service.dto.CouponDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.exp.detail.service.impl;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.exp.detail.domain.ExpDetail;
import com.topdraw.business.module.exp.detail.domain.ExpDetailBuilder;
import com.topdraw.utils.RedisUtils;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.exp.detail.repository.ExpDetailRepository;
import com.topdraw.business.module.exp.detail.service.ExpDetailService;
import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO;
import com.topdraw.business.module.exp.detail.service.mapper.ExpDetailMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.util.Assert;
import com.topdraw.utils.StringUtils;
/**
......
package com.topdraw.business.module.exp.detail.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.exp.detail.domain.ExpDetail;
import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.exp.history.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.exp.history.domain.ExpHistory;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.exp.history.repository.ExpHistoryRepository;
import com.topdraw.business.module.exp.history.service.ExpHistoryService;
import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO;
import com.topdraw.business.module.exp.history.service.mapper.ExpHistoryMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.topdraw.utils.StringUtils;
/**
......
package com.topdraw.business.module.exp.history.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.exp.history.domain.ExpHistory;
import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.member.address.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.common.validated.CreateGroup;
import com.topdraw.business.module.common.validated.UpdateGroup;
import com.topdraw.business.module.member.address.service.dto.BasicMemberAddressDTO;
import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO;
import com.topdraw.business.process.service.member.MemberAddressOperationService;
import com.topdraw.common.ResultInfo;
import com.topdraw.business.module.member.address.domain.MemberAddress;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......
package com.topdraw.business.module.member.address.service.impl;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.member.address.domain.MemberAddress;
import com.topdraw.business.module.member.address.domain.MemberAddressBuilder;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.utils.RedisUtils;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.member.address.repository.MemberAddressRepository;
import com.topdraw.business.module.member.address.service.MemberAddressService;
import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO;
......
package com.topdraw.business.module.member.address.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.member.address.domain.MemberAddress;
import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.member.group.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.member.group.domain.Group;
import com.topdraw.business.module.member.group.repository.GroupRepository;
import com.topdraw.business.module.member.group.service.GroupService;
import com.topdraw.business.module.member.group.service.dto.GroupDTO;
import com.topdraw.business.module.member.group.service.mapper.GroupMapper;
import com.topdraw.utils.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......
package com.topdraw.business.module.member.group.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.member.group.domain.MemberGroup;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.member.group.repository.MemberGroupRepository;
import com.topdraw.business.module.member.group.service.MemberGroupService;
import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO;
......
package com.topdraw.business.module.member.group.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.member.group.domain.Group;
import com.topdraw.business.module.member.group.service.dto.GroupDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.member.group.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.member.group.domain.MemberGroup;
import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.member.level.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.member.level.domain.MemberLevel;
import com.topdraw.business.RedisKeyConstants;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.member.level.repository.MemberLevelRepository;
import com.topdraw.business.module.member.level.service.MemberLevelService;
import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO;
import com.topdraw.business.module.member.level.service.mapper.MemberLevelMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.topdraw.utils.StringUtils;
/**
* @author XiangHan
......
package com.topdraw.business.module.member.level.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.member.level.domain.MemberLevel;
import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.member.profile.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.common.validated.CreateGroup;
import com.topdraw.business.module.common.validated.UpdateGroup;
import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
import com.topdraw.business.process.service.member.MemberProfileOperationService;
import com.topdraw.common.ResultInfo;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......
package com.topdraw.business.module.member.profile.service.impl;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
import com.topdraw.business.module.member.profile.domain.MemberProfileBuilder;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.util.Base64Util;
import com.topdraw.util.RegexUtil;
import com.topdraw.utils.RedisUtils;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.member.profile.repository.MemberProfileRepository;
import com.topdraw.business.module.member.profile.service.MemberProfileService;
import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
......
package com.topdraw.business.module.member.profile.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.member.relatedinfo.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.common.validated.CreateGroup;
import com.topdraw.business.module.common.validated.UpdateGroup;
import com.topdraw.business.module.member.relatedinfo.service.dto.BasicMemberRelatedInfoDTO;
import com.topdraw.business.process.service.member.MemberRelatedInfoOperationService;
import com.topdraw.common.ResultInfo;
import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......
package com.topdraw.business.module.member.relatedinfo.service.impl;
import com.topdraw.base.modules.exception.BadRequestException;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfoBuilder;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.GlobeExceptionMsg;
import com.topdraw.util.Base64Util;
import com.topdraw.utils.RedisUtils;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.member.relatedinfo.repository.MemberRelatedInfoRepository;
import com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoService;
import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO;
......
package com.topdraw.business.module.member.relatedinfo.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.member.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.common.validated.CreateGroup;
import com.topdraw.business.module.common.validated.UpdateGroup;
import com.topdraw.business.module.member.domain.Member;
......@@ -8,7 +9,6 @@ import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.user.iptv.domain.UserTv;
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;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -19,7 +19,6 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* @author XiangHan
......
......@@ -2,6 +2,8 @@ package com.topdraw.business.module.member.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.base.modules.exception.BadRequestException;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.domain.MemberBuilder;
import com.topdraw.business.module.member.domain.MemberSimple;
......@@ -16,9 +18,7 @@ import com.topdraw.business.module.member.service.dto.MemberSimpleDTO;
import com.topdraw.business.module.member.service.mapper.MemberMapper;
import com.topdraw.business.module.member.service.mapper.MemberSimpleMapper;
import com.topdraw.business.RedisKeyConstants;
import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.GlobeExceptionMsg;
import com.topdraw.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
......
package com.topdraw.business.module.member.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.member.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.member.domain.MemberSimple;
import com.topdraw.business.module.member.service.dto.MemberSimpleDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.member.viphistory.service.impl;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.base.modules.utils.ValidationUtil;
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;
......@@ -12,7 +12,6 @@ import com.topdraw.business.module.member.viphistory.service.MemberVipHistorySer
import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO;
import com.topdraw.business.module.member.viphistory.service.mapper.MemberVipHistoryMapper;
import com.topdraw.util.TimestampUtil;
import com.topdraw.utils.ValidationUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
......@@ -90,8 +89,7 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService {
@Override
public MemberVipHistory findByTime(Long memberId, Timestamp nowTime) {
LocalDateTime localDateTime = TimestampUtil.timestamp2LocalDateTime(nowTime);
MemberVipHistory memberVipHistory = this.memberVipHistoryRepository.findByTime(memberId, localDateTime).orElseGet(MemberVipHistory::new);
return memberVipHistory;
return this.memberVipHistoryRepository.findByTime(memberId, localDateTime).orElseGet(MemberVipHistory::new);
}
private MemberDTO checkMember(MemberVipHistory resources){
......
package com.topdraw.business.module.member.viphistory.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.points.available.service.dto;
import com.topdraw.base.modules.annotation.Query;
import lombok.Data;
import com.topdraw.annotation.Query;
import java.sql.Timestamp;
......
package com.topdraw.business.module.points.available.service.impl;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.points.available.domain.PointsAvailable;
import com.topdraw.utils.RedisUtils;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.points.available.repository.PointsAvailableRepository;
import com.topdraw.business.module.points.available.service.PointsAvailableService;
import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO;
import com.topdraw.business.module.points.available.service.mapper.PointsAvailableMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.util.Assert;
import com.topdraw.utils.StringUtils;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.*;
/**
......
package com.topdraw.business.module.points.available.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.points.available.domain.PointsAvailable;
import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.points.detail.detailhistory.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.points.detail.detailhistory.repository.PointsDetailHistoryRepository;
import com.topdraw.business.module.points.detail.detailhistory.service.PointsDetailHistoryService;
import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO;
import com.topdraw.business.module.points.detail.detailhistory.service.mapper.PointsDetailHistoryMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.util.Assert;
import com.topdraw.utils.StringUtils;
/**
* @author XiangHan
......
package com.topdraw.business.module.points.detail.detailhistory.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory;
import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.points.detail.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.points.detail.domain.PointsDetail;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.points.detail.repository.PointsDetailRepository;
import com.topdraw.business.module.points.detail.service.PointsDetailService;
import com.topdraw.business.module.points.detail.service.dto.PointsDetailDTO;
import com.topdraw.business.module.points.detail.service.mapper.PointsDetailMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.util.Assert;
import com.topdraw.utils.StringUtils;
import java.util.List;
import java.util.Objects;
......
package com.topdraw.business.module.points.detail.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.points.detail.domain.PointsDetail;
import com.topdraw.business.module.points.detail.service.dto.PointsDetailDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.points.service.impl;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.points.domain.Points;
import com.topdraw.utils.RedisUtils;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.points.repository.PointsRepository;
import com.topdraw.business.module.points.service.PointsService;
import com.topdraw.business.module.points.service.dto.PointsDTO;
......
package com.topdraw.business.module.points.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.points.domain.Points;
import com.topdraw.business.module.points.service.dto.PointsDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.rights.history.service.dto;
import com.topdraw.annotation.Query;
import com.topdraw.base.modules.annotation.Query;
import lombok.Data;
import java.sql.Timestamp;
......
package com.topdraw.business.module.rights.history.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.rights.history.domain.RightsHistory;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.rights.history.repository.RightsHistoryRepository;
import com.topdraw.business.module.rights.history.service.RightsHistoryService;
import com.topdraw.business.module.rights.history.service.dto.RightsHistoryDTO;
import com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryCriteria;
import com.topdraw.business.module.rights.history.service.mapper.RightsHistoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -37,8 +36,7 @@ public class RightsHistoryServiceImpl implements RightsHistoryService {
@Override
public List<RightsHistoryDTO> findByMemberIdOrMemberCode(Long memberId, String memberCode) {
MemberDTO memberDTO = this.memberService.checkMember(memberId, memberCode);
List<RightsHistoryDTO> rightsHistoryDTOList = this.rightsHistoryRepository.findByMemberId(memberDTO.getId());
return rightsHistoryDTOList;
return this.rightsHistoryRepository.findByMemberId(memberDTO.getId());
}
@Override
......
package com.topdraw.business.module.rights.history.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.rights.history.domain.RightsHistory;
import com.topdraw.business.module.rights.history.service.dto.RightsHistoryDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.rights.permanentrights.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.rights.permanentrights.repository.PermanentRightsRepository;
import com.topdraw.business.module.rights.permanentrights.service.PermanentRightsService;
import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsDTO;
import com.topdraw.business.module.rights.permanentrights.service.mapper.PermanentRightsMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.topdraw.utils.StringUtils;
/**
* @author XiangHan
......
package com.topdraw.business.module.rights.permanentrights.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights;
import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsDTO;
import org.mapstruct.Mapper;
......
......@@ -2,11 +2,11 @@ package com.topdraw.business.module.rights.service.impl;
import com.topdraw.business.module.rights.domain.Rights;
import com.topdraw.business.RedisKeyConstants;
import com.topdraw.utils.*;
import com.topdraw.business.module.rights.repository.RightsRepository;
import com.topdraw.business.module.rights.service.RightsService;
import com.topdraw.business.module.rights.service.dto.RightsDTO;
import com.topdraw.business.module.rights.service.mapper.RightsMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
......
package com.topdraw.business.module.rights.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.rights.domain.Rights;
import com.topdraw.business.module.rights.service.dto.RightsDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.task.attribute.service.impl;
import com.alibaba.fastjson.JSON;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.task.attribute.domain.TaskAttr;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.task.attribute.repository.TaskAttrRepository;
import com.topdraw.business.module.task.attribute.service.TaskAttrService;
import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO;
......
package com.topdraw.business.module.task.attribute.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.task.attribute.domain.TaskAttr;
import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO;
import org.mapstruct.Mapper;
......
......@@ -38,6 +38,10 @@ public class Task implements Serializable {
@NotNull(message = "taskTemplateId is null", groups = {CreateGroup.class})
private Long taskTemplateId;
/** 关联实体id */
@Column(name = "entity_id", nullable = false)
private String entityId;
@Transient
private String taskTemplateCode;
......
......@@ -27,6 +27,7 @@ public class TaskBuilder {
task_.setTaskTemplateCode(task.getTaskTemplateCode());
task_.setName(task.getName());
task_.setEntityId(task.getEntityId());
task_.setCode(StringUtils.isEmpty(task.getCode()) ? IdWorker.generatorCode("task_") : task.getCode());
task_.setStatus(Objects.isNull(task.getStatus()) ? 1 : task.getStatus());
task_.setSequence(task.getSequence());
......
package com.topdraw.business.module.task.progress.service.impl;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.business.module.task.progress.domain.TrTaskProgress;
import com.topdraw.business.RedisKeyConstants;
import com.topdraw.utils.RedisUtils;
import com.topdraw.business.module.task.progress.repository.TrTaskProgressRepository;
import com.topdraw.business.module.task.progress.service.TrTaskProgressService;
import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO;
......@@ -44,14 +44,12 @@ public class TrTaskProgressServiceImpl implements TrTaskProgressService {
@Override
@Transactional(rollbackFor = Exception.class)
// @CachePut(cacheNames = RedisKeyConstants.cacheTaskProcessByMemberId, key = "#resources.memberId+':'+#resources.taskId+':'+#date", unless = "#result == null ")
public TrTaskProgress create(TrTaskProgress resources, String date) {
return this.trTaskProgressRepository.save(resources);
}
@Override
@Transactional(rollbackFor = Exception.class)
// @CachePut(cacheNames = RedisKeyConstants.cacheTaskProcessByMemberId, key = "#resources.memberId+':'+#resources.taskId+':'+#date", unless = "#result == null ")
public TrTaskProgress update(TrTaskProgress resources, String date) {
return this.trTaskProgressRepository.save(resources);
}
......@@ -94,7 +92,7 @@ public class TrTaskProgressServiceImpl implements TrTaskProgressService {
}
if (finishTasks.size() > 0) {
// 总记录一直存储
this.redisUtils.hmset(RedisKeyConstants.cacheTotalFinishTaskCount + "::" + memberId, finishTasks);
this.redisUtils.hmsetForObject(RedisKeyConstants.cacheTotalFinishTaskCount + "::" + memberId, finishTasks);
}
return finishTasks;
......@@ -124,7 +122,7 @@ public class TrTaskProgressServiceImpl implements TrTaskProgressService {
if (finishTasks.size() > 0) {
// 单天的记录只存储一天
this.redisUtils.hmset(RedisKeyConstants.cacheTodayFinishTaskCount + "::" + memberId + ":" + LocalDate.now(), finishTasks, 24*60*60);
this.redisUtils.hmsetForObject(RedisKeyConstants.cacheTodayFinishTaskCount + "::" + memberId + ":" + LocalDate.now(), finishTasks, 24*60*60);
}
return finishTasks;
......
package com.topdraw.business.module.task.progress.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.task.progress.domain.TrTaskProgress;
import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO;
import org.mapstruct.Mapper;
......
......@@ -29,5 +29,11 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
@Query(value = "SELECT ta.* FROM tr_task ta LEFT JOIN tr_task_template tm ON ta.task_template_id = tm.id " +
" WHERE ta.`status` = 1 AND ta.valid_time <= now() and ta.expire_time >= now() AND ta.delete_mark = 0 AND " +
" tm.type = ?1 AND ta.`member_level` <= ?2 and ta.`member_vip` <= ?3", nativeQuery = true)
List<Map<String,Object>> findByEventAndLevelAndVip(Integer event, Integer level, Integer vip);
List<Map<String,Object>> findByTypeAndLevelAndVip(Integer type, Integer level, Integer vip);
@Query(value = "SELECT ta.* FROM tr_task ta LEFT JOIN tr_task_template tm ON ta.task_template_id = tm.id " +
" WHERE ta.`status` = 1 AND ta.valid_time <= now() and ta.expire_time >= now() AND ta.delete_mark = 0 AND " +
" tm.event = ?1 AND ta.`member_level` <= ?2 and ta.`member_vip` <= ?3", nativeQuery = true)
List<Map<String,Object>> findByEventAndLevelAndVip(String event, Integer level, Integer vip);
}
......
......@@ -64,6 +64,6 @@ public interface TaskService {
* @param event
* @return
*/
List<Task> findByEventAndMemberLevelAndVip(Integer event, Integer level, Integer vip);
List<Task> findByEventAndMemberLevelAndVip(String event, Integer level, Integer vip);
}
......
......@@ -20,6 +20,9 @@ public class TaskDTO implements Serializable {
/** 任务模板id */
private Long taskTemplateId;
/** 关联实体id */
private String entityId;
/** 删除标识 0:正常;1:已删除;*/
private Integer deleteMark;
......
......@@ -3,6 +3,7 @@ package com.topdraw.business.module.task.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.business.module.task.attribute.service.TaskAttrService;
import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO;
import com.topdraw.business.module.task.domain.Task;
......@@ -11,7 +12,6 @@ import com.topdraw.business.module.task.service.TaskService;
import com.topdraw.business.module.task.service.dto.TaskDTO;
import com.topdraw.business.module.task.service.mapper.TaskMapper;
import com.topdraw.business.RedisKeyConstants;
import com.topdraw.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -19,10 +19,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -69,8 +66,14 @@ public class TaskServiceImpl implements TaskService {
@Override
public TaskDTO update(Task task) {
Task save = this.taskRepository.save(task);
return this.taskMapper.toDto(save);
Optional<Task> taskOptional = this.taskRepository.findById(task.getId());
if (taskOptional.isPresent()) {
Task task1 = taskOptional.get();
task1.copy(task);
Task result = this.taskRepository.save(task1);
return this.taskMapper.toDto(result);
}
return this.taskMapper.toDto(task);
}
@Override
......@@ -86,7 +89,7 @@ public class TaskServiceImpl implements TaskService {
@Override
@Transactional(readOnly = true)
public List<Task> findByEventAndMemberLevelAndVip(Integer event, Integer level, Integer vip) {
public List<Task> findByEventAndMemberLevelAndVip(String event, Integer level, Integer vip) {
try {
boolean b = this.redisUtils.hasKey(RedisKeyConstants.cacheTaskByEventAndMemberLevelAndVip + "::" + event + ":" + level + ":" + vip);
......@@ -102,30 +105,9 @@ public class TaskServiceImpl implements TaskService {
return tasks;
}
List<TaskAttrDTO> taskAttrDTOS = this.taskAttrService.findTasksByTaskIds(maps.stream().map(t -> t.get("id")).collect(Collectors.toSet()));
if (!CollectionUtils.isEmpty(taskAttrDTOS)) {
for (Map<String, Object> map : maps) {
Task task = JSONObject.parseObject(JSON.toJSONString(map), Task.class);
List<String> taskAttrs = taskAttrDTOS.stream().filter(taskAttrDTO -> taskAttrDTO.getTaskId().equals(task.getId())).
map(TaskAttrDTO::getAttrStr).collect(Collectors.toList());
log.info("任务属性值, dealTask# taskAttrs ==>> {}", taskAttrs);
if (!CollectionUtils.isEmpty(taskAttrs)) {
task.setAttr(String.join(",", taskAttrs));
}
tasks.add(task);
}
} else {
for (Map<String, Object> map : maps) {
Task task = JSONObject.parseObject(JSON.toJSONString(map), Task.class);
tasks.add(task);
}
for (Map<String, Object> map : maps) {
Task task = JSONObject.parseObject(JSON.toJSONString(map), Task.class);
tasks.add(task);
}
if (!CollectionUtils.isEmpty(tasks)) {
......
package com.topdraw.business.module.task.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.task.domain.Task;
import com.topdraw.business.module.task.service.dto.TaskDTO;
import org.mapstruct.Mapper;
......
......@@ -12,7 +12,7 @@ package com.topdraw.business.module.task.template.constant;
public interface TaskEventType {
//类型 1:登录;2:观影;3:参加活动;4:订购;5:优享会员;6:签到;7:完成设置;
// 8:播放记录;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他
int LOGIN = 1;
/*int LOGIN = 1;
int VIEW = 2;
int ACTIVITY = 3;
int ORDER = 4;
......@@ -22,8 +22,40 @@ public interface TaskEventType {
int PLAY = 8;
int BINDING = 10;
int POINTS_TRANS = 11;
int POINTS_EXCHANGE_GOODS = 30;
int POINTS_EXCHANGE_GOODS = 14;
int SYSTEM_OPERATE = 98;
int OHHER = 99;
int OHHER = 99;*/
// 登录
String LOGIN = "login";
// 观影
String VIEWING = "viewing";
// 参加活动
String JOINACTIVITIES = "join_activity";
// 购物
String ORDER = "order";
// 签到
String SIGN = "sign";
// 完善用户信息
String COMPLETEMEMBERINFO = "complete_member_info";
// 首次积分转移
String FIRSTPOINTSTRANS = "first_points_transfer";
// 微信分享
String WECHATSHARE = "wechat_share";
// 微信关注
String SUBSCRIBE = "subscribe";
// 成长报告
String GROWTHREPORT = "growth_report";
// 播放时长
String PLAY = "play";
// 大小屏绑定
String BINDING = "binding";
// 首次积分兑换
String FIRSTPOINTSEXCHANGE = "first_point_exchange";
// 添加收藏
String ADDCOLLECTION = "add_collection";
// 删除收藏
String DELETECOLLECTION = "delete_collection";
// 删除全部收藏
String DELETEALLCOLLECTION = "deleteAll_collection";
}
......
package com.topdraw.business.module.task.template.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.task.template.domain.TaskTemplate;
import com.topdraw.business.module.task.template.domain.TaskTemplateBuilder;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.task.template.repository.TaskTemplateRepository;
import com.topdraw.business.module.task.template.service.TaskTemplateService;
import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
import com.topdraw.business.module.task.template.service.mapper.TaskTemplateMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.util.Assert;
import com.topdraw.utils.StringUtils;
import java.util.List;
import java.util.Objects;
......@@ -85,8 +85,7 @@ public class TaskTemplateServiceImpl implements TaskTemplateService {
@Override
public Long countByCodeAndType(TaskTemplate taskTemplate) {
Long count = this.taskTemplateRepository.countByCodeAndType(taskTemplate.getCode(), taskTemplate.getType());
return count;
return this.taskTemplateRepository.countByCodeAndType(taskTemplate.getCode(), taskTemplate.getType());
}
}
......
package com.topdraw.business.module.task.template.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.task.template.domain.TaskTemplate;
import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
import org.mapstruct.Mapper;
......
......@@ -22,7 +22,11 @@ public class UserAppBuilder {
public static UserApp build(Long memberId, UserApp resource){
UserApp userApp = new UserApp();
userApp.setId(null);
if (Objects.nonNull(resource.getId())) {
userApp.setId(resource.getId());
} else {
userApp.setId(null);
}
userApp.setMemberId(memberId);
userApp.setUsername(resource.getUsername());
userApp.setTags(resource.getTags());
......
......@@ -61,4 +61,7 @@ public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpec
" :#{#resources.gender}, NULL, now(), NULL, :#{#resources.tags}, " +
" :#{#resources.description}, :#{#resources.createTime}, now());", nativeQuery = true)
void saveByIdManual(@Param("resources") UserAppIdManual userAppIdManual);
Optional<UserApp> findByMemberId(Long memberId);
}
......
package com.topdraw.business.module.user.app.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.user.app.domain.UserApp;
import com.topdraw.business.module.user.app.domain.UserAppBind;
import com.topdraw.business.module.user.app.service.UserAppBindService;
......@@ -10,8 +11,6 @@ import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple;
import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq;
import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo;
import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin;
import com.topdraw.common.ResultInfo;
import com.topdraw.annotation.Log;
import com.topdraw.business.module.user.app.service.UserAppService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -37,7 +36,6 @@ public class UserAppController {
@Autowired
private UserAppBindService userAppBindService;
@Log
@PostMapping(value = "/saveAppAndBindApple4Vis")
@ApiOperation("兼容海南app苹果数据")
@AnonymousAccess
......@@ -53,7 +51,6 @@ public class UserAppController {
return this.userAppService.saveAppAndBindApple4Vis(resources);
}
@Log
@PostMapping(value = "/saveAppAndBindWeibo4Vis")
@ApiOperation("兼容海南app原微博数据")
@AnonymousAccess
......@@ -69,7 +66,6 @@ public class UserAppController {
return this.userAppService.saveAppAndBindWeibo4Vis(resources);
}
@Log
@PostMapping(value = "/saveAppAndBindQq4Vis")
@ApiOperation("兼容海南app原QQ数据")
@AnonymousAccess
......@@ -85,7 +81,6 @@ public class UserAppController {
}
@Log
@PostMapping(value = "/saveAppAndBindWeixin4Vis")
@ApiOperation("兼容海南app原微信数据")
@AnonymousAccess
......@@ -108,7 +103,6 @@ public class UserAppController {
}
@Log
@PostMapping(value = "/updateAppLastActiveTimeAndNicknameAndHeadImgById")
@ApiOperation("修改app账号最后登录时间、昵称和头像和用户名")
@AnonymousAccess
......@@ -127,11 +121,9 @@ public class UserAppController {
return ResultInfo.failure("修改app账号最后登录时间、昵称和头像和用户名失败,参数错误,app账号不得为空");
}
boolean result = this.userAppService.updateAppLastActiveTimeAndNicknameAndHeadImgById(resources);
return ResultInfo.success(result);
return ResultInfo.success(this.userAppService.updateAppLastActiveTimeAndNicknameAndHeadImgById(resources));
}
@Log
@PostMapping(value = "/updateAppLastActiveTimeAndNicknameAndHeadImg")
@ApiOperation("修改app账号最后登录时间、昵称和头像")
@AnonymousAccess
......@@ -143,11 +135,9 @@ public class UserAppController {
return ResultInfo.failure("修改app账号密码失败,参数错误,app账号不得为空");
}
boolean result = this.userAppService.updateAppLastActiveTimeAndNicknameAndHeadImg(resources);
return ResultInfo.success(result);
return ResultInfo.success(this.userAppService.updateAppLastActiveTimeAndNicknameAndHeadImg(resources));
}
@Log
@PostMapping(value = "/updateAppPasswordByUsername")
@ApiOperation("修改app账号密码")
@AnonymousAccess
......@@ -171,11 +161,9 @@ public class UserAppController {
// return ResultInfo.failure("密码必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-25 之间");
// }
boolean result = this.userAppService.updatePasswordByUsername(resources);
return ResultInfo.success(result);
return ResultInfo.success(this.userAppService.updatePasswordByUsername(resources));
}
@Log
@PostMapping(value = "/updateLastActiveTime")
@ApiOperation("修改app账号最新登录时间")
@AnonymousAccess
......@@ -186,11 +174,9 @@ public class UserAppController {
log.error("修改app账号最新登录时间失败,参数错误,app账号不得为空,[updateLastActiveTime#{}]", resources);
return ResultInfo.failure("修改app账号最新登录时间失败,参数错误,app账号不得为空");
}
boolean result = this.userAppService.updateLastActiveTime(resources);
return ResultInfo.success(result);
return ResultInfo.success(this.userAppService.updateLastActiveTime(resources));
}
@Log
@PostMapping(value = "/saveThirdAccount")
@ApiOperation("保存第三方账号")
@AnonymousAccess
......@@ -208,11 +194,9 @@ public class UserAppController {
resources.setUserAppId(id);
}
UserAppBindDTO userAppBindDTO = this.userAppBindService.create(resources);
return ResultInfo.success(userAppBindDTO);
return this.userAppBindService.create(resources);
}
@Log
@PostMapping(value = "/updateValidStatusAndUserAppIdAndNickname")
@ApiOperation("修改第三方账号绑定状态、绑定的app账号以及第三方账号昵称")
@AnonymousAccess
......@@ -240,11 +224,9 @@ public class UserAppController {
return ResultInfo.failure("修改第三方账号, 参数错误, app账号不得为空");
}
boolean result = this.userAppBindService.updateValidStatusAndUserAppIdAndNickname(resources);
return ResultInfo.success(result);
return ResultInfo.success(this.userAppBindService.updateValidStatusAndUserAppIdAndNickname(resources));
}
@Log
@PostMapping(value = "/updateThirdAccountNickname")
@ApiOperation("修改第三方账号昵称")
@AnonymousAccess
......@@ -263,7 +245,6 @@ public class UserAppController {
return ResultInfo.failure("修改第三方账号昵称, 参数错误, 昵称不得为空");
}
boolean result = this.userAppBindService.updateThirdAccountNickname(resources);
return ResultInfo.success(result);
return ResultInfo.success(this.userAppBindService.updateThirdAccountNickname(resources));
}
}
......
package com.topdraw.business.module.user.app.service;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.user.app.domain.UserAppBind;
import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO;
......@@ -22,7 +23,7 @@ public interface UserAppBindService {
*
* @param resources
*/
UserAppBindDTO create(UserAppBind resources);
ResultInfo create(UserAppBind resources);
/**
*
......
package com.topdraw.business.module.user.app.service;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.user.app.domain.UserApp;
import com.topdraw.business.module.user.app.domain.UserAppBind;
import com.topdraw.business.module.user.app.service.dto.UserAppDTO;
......@@ -8,7 +9,6 @@ import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple;
import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq;
import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo;
import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin;
import com.topdraw.common.ResultInfo;
/**
* @author XiangHan
......@@ -92,4 +92,8 @@ public interface UserAppService {
ResultInfo saveAppAndBindWeixin4Vis(VisUserWeixin resources);
ResultInfo saveAppAndBindQq4Vis(VisUserQq resources);
UserAppDTO findByMemberId(Long memberId);
UserAppDTO createByManual(UserApp userApp);
}
......
package com.topdraw.business.module.user.app.service.impl;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.user.app.domain.UserAppBind;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.user.app.repository.UserAppBindRepository;
import com.topdraw.business.module.user.app.service.UserAppBindService;
import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO;
import com.topdraw.business.module.user.app.service.mapper.UserAppBindMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......@@ -14,6 +16,7 @@ import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.util.Assert;
import java.util.List;
import java.util.Objects;
/**
* @author XiangHan
......@@ -21,6 +24,7 @@ import java.util.List;
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
@Slf4j
public class UserAppBindServiceImpl implements UserAppBindService {
@Autowired
......@@ -38,9 +42,15 @@ public class UserAppBindServiceImpl implements UserAppBindService {
@Override
@Transactional(rollbackFor = Exception.class)
public UserAppBindDTO create(UserAppBind resources) {
public ResultInfo create(UserAppBind resources) {
UserAppBindDTO userAppBindDTO =
this.findFirstByAccountAndAccountType(resources.getAccount(), resources.getAccountType());
if (Objects.nonNull(userAppBindDTO.getId())) {
log.warn("保存第三方账号失败, saveThirdAccount# messgage ==>> 第三方账号已存在 | appBind ==>> {}", resources);
return ResultInfo.failure("保存第三方账号失败, 第三方账号已存在");
}
UserAppBind userAppBind = this.userAppBindRepository.save(resources);
return this.userAppBindMapper.toDto(userAppBind);
return ResultInfo.success(this.userAppBindMapper.toDto(userAppBind));
}
@Override
......
package com.topdraw.business.module.user.app.service.impl;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.domain.MemberBuilder;
import com.topdraw.business.module.member.domain.MemberTypeConstant;
......@@ -22,16 +24,14 @@ import com.topdraw.business.module.vis.hainan.apple.service.VisUserAppleService;
import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq;
import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo;
import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin;
import com.topdraw.common.ResultInfo;
import com.topdraw.util.Base64Util;
import com.topdraw.util.TimestampUtil;
import com.topdraw.utils.StringUtils;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.user.app.repository.UserAppRepository;
import com.topdraw.business.module.user.app.service.UserAppService;
import com.topdraw.business.module.user.app.service.dto.UserAppDTO;
import com.topdraw.business.module.user.app.service.mapper.UserAppMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -549,6 +549,21 @@ public class UserAppServiceImpl implements UserAppService {
return ResultInfo.failure(null);
}
@Override
@Transactional(readOnly = true)
public UserAppDTO findByMemberId(Long memberId) {
UserApp userApp = this.userAppRepository.findByMemberId(memberId).orElseGet(UserApp::new);
return this.userAppMapper.toDto(userApp);
}
@Override
@Transactional(rollbackFor = Exception.class)
public UserAppDTO createByManual(UserApp userApp) {
UserAppIdManual userAppIdManual = new UserAppIdManual();
BeanUtils.copyProperties(userApp, userAppIdManual);
this.userAppRepository.saveByIdManual(userAppIdManual);
return this.userAppMapper.toDto(userApp);
}
@Override
......
package com.topdraw.business.module.user.app.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.user.app.domain.UserAppBind;
import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.user.app.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.user.app.domain.UserApp;
import com.topdraw.business.module.user.app.service.dto.UserAppDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.user.app.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.module.user.app.domain.UserApp;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.user.app.domain.UserAppSimple;
import com.topdraw.business.module.user.app.service.dto.UserAppDTO;
import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.module.user.iptv.domain;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.GlobeExceptionMsg;
import com.topdraw.util.TimestampUtil;
import org.apache.commons.lang3.StringUtils;
......
package com.topdraw.business.module.user.iptv.growreport.rest;
import com.topdraw.common.ResultInfo;
import com.topdraw.annotation.Log;
import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport;
import com.topdraw.business.module.user.iptv.growreport.service.GrowthReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
......@@ -22,7 +20,6 @@ public class GrowthReportController {
@Autowired
private GrowthReportService GrowthReportService;
@Log
@PostMapping
@ApiOperation("新增GrowthReport")
public ResultInfo create(@Validated @RequestBody GrowthReport resources) {
......@@ -30,7 +27,6 @@ public class GrowthReportController {
return ResultInfo.success();
}
@Log
@PutMapping
@ApiOperation("修改GrowthReport")
public ResultInfo update(@Validated @RequestBody GrowthReport resources) {
......@@ -39,7 +35,6 @@ public class GrowthReportController {
}
@Log
@DeleteMapping(value = "/{id}")
@ApiOperation("删除GrowthReport")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.module.user.iptv.growreport.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.user.iptv.growreport.repository.GrowthReportRepository;
import com.topdraw.business.module.user.iptv.growreport.service.GrowthReportService;
import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO;
......@@ -13,14 +13,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.dao.EmptyResultDataAccessException;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.util.Assert;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import java.util.List;
import java.util.Map;
/**
* @author XiangHan
......
package com.topdraw.business.module.user.iptv.growreport.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport;
import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.user.iptv.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.base.modules.exception.BadRequestException;
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.common.ResultInfo;
import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.GlobeExceptionMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......
......@@ -3,6 +3,9 @@ package com.topdraw.business.module.user.iptv.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.base.modules.exception.EntityNotFoundException;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.base.modules.utils.ValidationUtil;
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;
......@@ -11,10 +14,7 @@ import com.topdraw.business.module.user.iptv.repository.UserTvSimpleRepository;
import com.topdraw.business.module.user.iptv.service.dto.UserTvSimpleDTO;
import com.topdraw.business.module.user.iptv.service.mapper.UserTvSimpleMapper;
import com.topdraw.business.RedisKeyConstants;
import com.topdraw.exception.EntityNotFoundException;
import com.topdraw.exception.GlobeExceptionMsg;
import com.topdraw.utils.RedisUtils;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.user.iptv.repository.UserTvRepository;
import com.topdraw.business.module.user.iptv.service.UserTvService;
import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
......
package com.topdraw.business.module.user.iptv.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.user.iptv.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.user.iptv.domain.UserTvSimple;
import com.topdraw.business.module.user.iptv.service.dto.UserTvSimpleDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.user.weixin.collection.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.user.weixin.collection.domain.UserCollectionDetail;
import com.topdraw.business.module.user.weixin.collection.repository.UserCollectionDetailRepository;
import com.topdraw.business.module.user.weixin.collection.service.UserCollectionDetailService;
import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDetailDTO;
import com.topdraw.business.module.user.weixin.collection.service.mapper.UserCollectionDetailMapper;
import com.topdraw.utils.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Service;
......
package com.topdraw.business.module.user.weixin.collection.service.impl;
import com.topdraw.base.modules.utils.FileUtil;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.user.weixin.collection.domain.UserCollection;
import com.topdraw.business.module.user.weixin.collection.repository.UserCollectionRepository;
import com.topdraw.business.module.user.weixin.collection.service.UserCollectionService;
import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDTO;
import com.topdraw.business.module.user.weixin.collection.service.mapper.UserCollectionMapper;
import com.topdraw.utils.FileUtil;
import com.topdraw.utils.ValidationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Service;
......
package com.topdraw.business.module.user.weixin.collection.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.user.weixin.collection.domain.UserCollectionDetail;
import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDetailDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.user.weixin.collection.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.user.weixin.collection.domain.UserCollection;
import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.user.weixin.domain;
import com.topdraw.base.modules.exception.BadRequestException;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.GlobeExceptionMsg;
import com.topdraw.util.TimestampUtil;
import org.apache.commons.lang3.StringUtils;
import java.sql.Timestamp;
......
package com.topdraw.business.module.user.weixin.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.common.ResultInfo;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
import com.topdraw.business.module.user.weixin.service.UserWeixinService;
import org.springframework.beans.factory.annotation.Autowired;
......
package com.topdraw.business.module.user.weixin.service.dto;
import com.topdraw.annotation.Query;
import com.topdraw.base.modules.annotation.Query;
import lombok.Data;
/**
......
package com.topdraw.business.module.user.weixin.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
import com.topdraw.business.module.user.weixin.domain.UserWeixinBuilder;
import com.topdraw.utils.ValidationUtil;
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;
......
package com.topdraw.business.module.user.weixin.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.user.weixin.subscribe.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.user.weixin.subscribe.domain.WechatSubscribeRecord;
import com.topdraw.business.module.user.weixin.subscribe.service.dto.WechatSubscribeRecordDTO;
import org.mapstruct.Mapper;
......
......@@ -2,7 +2,6 @@ package com.topdraw.business.module.user.weixin.wechatshare.rest;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.common.ResultInfo;
import com.topdraw.annotation.Log;
import com.topdraw.business.module.user.weixin.wechatshare.domain.WechatShareRecord;
import com.topdraw.business.module.user.weixin.wechatshare.service.WechatShareRecordService;
import lombok.extern.slf4j.Slf4j;
......@@ -24,7 +23,6 @@ public class WechatShareRecordController {
@Autowired
private WechatShareRecordService wechatShareRecordService;
@Log
@PostMapping(value = "/create")
@ApiOperation("新增WechatShareRecord")
public ResultInfo create(@Validated @RequestBody WechatShareRecord resources) {
......@@ -32,7 +30,6 @@ public class WechatShareRecordController {
return ResultInfo.success();
}
@Log
@PostMapping(value = "/update")
@ApiOperation("修改WechatShareRecord")
public ResultInfo update(@Validated @RequestBody WechatShareRecord resources) {
......@@ -40,7 +37,6 @@ public class WechatShareRecordController {
return ResultInfo.success();
}
@Log
@PostMapping(value = "/createOrUpdate")
@ApiOperation("修改WechatShareRecord")
public ResultInfo createOrUpdate(@Validated @RequestBody String content) {
......
package com.topdraw.business.module.user.weixin.wechatshare.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.user.weixin.wechatshare.domain.WechatShareRecord;
import com.topdraw.util.IdWorker;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.user.weixin.wechatshare.repository.WechatShareRecordRepository;
import com.topdraw.business.module.user.weixin.wechatshare.service.WechatShareRecordService;
import com.topdraw.business.module.user.weixin.wechatshare.service.dto.WechatShareRecordDTO;
import com.topdraw.business.module.user.weixin.wechatshare.service.mapper.WechatShareRecordMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.topdraw.utils.StringUtils;
import java.util.*;
......
package com.topdraw.business.module.user.weixin.wechatshare.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.user.weixin.wechatshare.domain.WechatShareRecord;
import com.topdraw.business.module.user.weixin.wechatshare.service.dto.WechatShareRecordDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.vis.hainan.app.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.vis.hainan.app.domain.VisUser;
import com.topdraw.business.module.vis.hainan.app.repository.VisUserRepository;
import com.topdraw.business.module.vis.hainan.app.service.VisUserService;
import com.topdraw.business.module.vis.hainan.app.service.dto.VisUserDTO;
import com.topdraw.business.module.vis.hainan.app.service.mapper.VisUserMapper;
import com.topdraw.utils.ValidationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......
package com.topdraw.business.module.vis.hainan.app.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.vis.hainan.app.domain.VisUser;
import com.topdraw.business.module.vis.hainan.app.service.dto.VisUserDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.vis.hainan.apple.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple;
import com.topdraw.business.module.vis.hainan.apple.repository.VisUserAppleRepository;
import com.topdraw.business.module.vis.hainan.apple.service.VisUserAppleService;
import com.topdraw.business.module.vis.hainan.apple.service.dto.VisUserAppleDTO;
import com.topdraw.business.module.vis.hainan.apple.service.mapper.VisUserAppleMapper;
import com.topdraw.utils.ValidationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......
package com.topdraw.business.module.vis.hainan.apple.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple;
import com.topdraw.business.module.vis.hainan.apple.service.dto.VisUserAppleDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.vis.hainan.qq.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq;
import com.topdraw.business.module.vis.hainan.qq.repository.VisUserQqRepository;
import com.topdraw.business.module.vis.hainan.qq.service.VisUserQqService;
import com.topdraw.business.module.vis.hainan.qq.service.dto.VisUserQqDTO;
import com.topdraw.business.module.vis.hainan.qq.service.mapper.VisUserQqMapper;
import com.topdraw.utils.ValidationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......
package com.topdraw.business.module.vis.hainan.qq.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq;
import com.topdraw.business.module.vis.hainan.qq.service.dto.VisUserQqDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.vis.hainan.weibo.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo;
import com.topdraw.business.module.vis.hainan.weibo.repository.VisUserWeiboRepository;
import com.topdraw.business.module.vis.hainan.weibo.service.VisUserWeiboService;
import com.topdraw.business.module.vis.hainan.weibo.service.dto.VisUserWeiboDTO;
import com.topdraw.business.module.vis.hainan.weibo.service.mapper.VisUserWeiboMapper;
import com.topdraw.utils.ValidationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......
package com.topdraw.business.module.vis.hainan.weibo.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo;
import com.topdraw.business.module.vis.hainan.weibo.service.dto.VisUserWeiboDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.business.module.vis.hainan.weixin.service.impl;
import com.topdraw.base.modules.utils.ValidationUtil;
import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin;
import com.topdraw.business.module.vis.hainan.weixin.repository.VisUserWeixinRepository;
import com.topdraw.business.module.vis.hainan.weixin.service.VisUserWeixinService;
import com.topdraw.business.module.vis.hainan.weixin.service.dto.VisUserWeixinDTO;
import com.topdraw.business.module.vis.hainan.weixin.service.mapper.VisUserWeixinMapper;
import com.topdraw.utils.ValidationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......
package com.topdraw.business.module.vis.hainan.weixin.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin;
import com.topdraw.business.module.vis.hainan.weixin.service.dto.VisUserWeixinDTO;
import org.mapstruct.Mapper;
......
......@@ -2,7 +2,7 @@ package com.topdraw.business.process.domian.weixin;
import com.alibaba.fastjson.annotation.JSONField;
import com.topdraw.annotation.Query;
import com.topdraw.base.modules.annotation.Query;
import lombok.Data;
import java.sql.Timestamp;
......
package com.topdraw.business.process.rest;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.process.domian.TempCoupon;
import com.topdraw.business.process.service.CouponOperationService;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......
package com.topdraw.business.process.rest;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.process.domian.TempExp;
import com.topdraw.business.process.service.ExpOperationService;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -13,9 +13,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
......
package com.topdraw.business.process.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.base.modules.common.IResultInfo;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.common.validated.CreateGroup;
import com.topdraw.business.module.common.validated.UpdateGroup;
import com.topdraw.business.module.contact.domain.MemberContacts;
import com.topdraw.business.module.contact.service.MemberContactsService;
import com.topdraw.business.module.member.address.domain.MemberAddress;
import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO;
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.member.MemberOperationBean;
import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.common.IResultInfo;
import com.topdraw.common.ResultInfo;
import com.topdraw.util.RegexUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -87,6 +91,19 @@ public class MemberOperationController {
MemberProfileDTO memberProfileDTO = this.memberOperationService.getMemberProfileAndCheckVip(memberId, appId);
return ResultInfo.success(memberProfileDTO);
}
@PostMapping("/createMemberContacts")
@ApiOperation("新增会员联络信息")
@AnonymousAccess
public ResultInfo createMemberContacts(@Validated(value = {CreateGroup.class}) @RequestBody MemberContacts resources) {
log.info("新增会员联络信息,参数 createMemberContacts# ==>> {}", resources);
if (!RegexUtil.mobileRegex(resources.getPhone())) {
return ResultInfo.failure("手机号格式不正确,请确认");
}
return this.memberOperationService.createMemberContacts(resources);
}
}
......
package com.topdraw.business.process.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.base.modules.exception.BadRequestException;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.user.iptv.service.UserTvService;
......@@ -11,9 +13,7 @@ import com.topdraw.business.process.domian.TempCustomPointBean;
import com.topdraw.business.process.domian.TempPoints;
import com.topdraw.business.process.service.dto.CustomPointsResult;
import com.topdraw.business.process.service.PointsOperationService;
import com.topdraw.common.ResultInfo;
import com.topdraw.business.LocalConstants;
import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.GlobeExceptionMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -78,6 +78,7 @@ public class PointsOperationController {
if (Objects.nonNull(memberDTO.getId())) {
tempPoints.setMemberId(memberDTO.getId());
tempPoints.setMemberCode(memberDTO.getCode());
tempPoints.setPointsType(0);
this.pointsOperationService.grantPointsByManualByTempPoints(tempPoints);
}
......
package com.topdraw.business.process.rest;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.rights.history.domain.RightsHistory;
import com.topdraw.business.process.service.RightsOperationService;
import com.topdraw.common.ResultInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......
package com.topdraw.business.process.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.base.modules.common.IResultInfo;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.base.modules.exception.BadRequestException;
import com.topdraw.business.module.common.validated.CreateGroup;
import com.topdraw.business.module.task.domain.Task;
import com.topdraw.business.module.task.service.dto.TaskDTO;
import com.topdraw.business.process.domian.TempIptvUser;
import com.topdraw.business.process.service.TaskOperationService;
import com.topdraw.business.process.service.dto.TaskOperationQueryCriteria;
import com.topdraw.common.IResultInfo;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -70,18 +70,14 @@ public class TaskOperationController {
@PostMapping(value = "/updateTask")
@ApiOperation("修改任务")
@AnonymousAccess
public void updateTask(@RequestBody @Validated Task content) {
log.info("taskOperation ==>> updateTask ==>> param ==>> {}", content);
public ResultInfo updateTask(@RequestBody @Validated Task content) {
log.info("修改任务,参数 updateTask# ==>> {}", content);
Long id = content.getId();
TaskDTO taskDTO = this.taskOperationService.findById(id);
if (Objects.nonNull(taskDTO.getId())) {
content.setCode(taskDTO.getCode());
Task task = new Task();
BeanUtils.copyProperties(taskDTO, task);
task.copy(content);
// 修改任务
this.taskOperationService.updateTask(task);
if (Objects.isNull(id)) {
throw new BadRequestException("修改任务失败,id不得为空");
}
// 修改任务
return this.taskOperationService.updateTask(content);
}
/**
......
package com.topdraw.business.process.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.business.module.task.template.domain.TaskTemplate;
import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
import com.topdraw.business.process.service.TaskTemplateOperationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......
......@@ -4,8 +4,10 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.annotation.Log;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.base.modules.exception.BadRequestException;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.business.module.common.validated.CreateGroup;
import com.topdraw.business.module.common.validated.UpdateGroup;
import com.topdraw.business.module.member.service.MemberService;
......@@ -17,7 +19,6 @@ import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport;
import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportRequest;
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;
......@@ -25,20 +26,15 @@ import com.topdraw.business.process.domian.member.MemberOperationBean;
import com.topdraw.business.process.domian.weixin.*;
import com.topdraw.business.process.service.UserOperationService;
import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.common.ResultInfo;
import com.topdraw.util.RedisKeyUtil;
import com.topdraw.util.*;
import com.topdraw.config.WechatConfig;
import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.EntityNotFoundException;
import com.topdraw.exception.GlobeExceptionMsg;
import com.topdraw.resttemplate.RestTemplateClient;
import com.topdraw.util.Base64Util;
import com.topdraw.util.JSONUtil;
import com.topdraw.utils.RedisUtils;
import com.topdraw.weixin.service.WeChatConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.math.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
......@@ -48,9 +44,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.naming.ConfigurationException;
import java.io.IOException;
import java.net.URLDecoder;
import java.sql.Timestamp;
import java.time.LocalDate;
import java.util.*;
@Api("账号处理")
......@@ -66,8 +62,6 @@ public class UserOperationController {
private UserOperationService userOperationService;
@Autowired
private MemberOperationService memberOperationService;
@Autowired
private UserTvService userTvService;
@Autowired
private RedisUtils redisUtils;
......@@ -78,6 +72,7 @@ public class UserOperationController {
private static final String UNSUBSCRIBE = "unsubscribe";
private static final Integer SUBSCRIBE_STATUS = 1;
private String secretKey = "f8681b9ce7c8fb6b";
/******************************************************* APP ************************************/
......@@ -87,17 +82,18 @@ public class UserOperationController {
* @param userApp app账号
* @return ResultInfo
*/
@Log
@PostMapping(value = "/appSignOut")
@ApiOperation("app账号退出登录")
@AnonymousAccess
public ResultInfo appSignOut(@Validated @RequestBody UserApp userApp) {
log.info("app账号退出登录,参数 ==>> [appSignOut#{}]", userApp.getId());
log.info("app账号退出登录,参数 appSignOut# userApp ==>> {} ", userApp);
if (Objects.isNull(userApp.getId())) {
log.error("app账号退出登录失败,参数错误,id不得为空,[appSignOut#]");
log.error("app账号退出登录失败,参数错误,appSignOut# message ==>> id不得为空");
return ResultInfo.failure("app账号退出登录失败,参数错误,id不得为空");
}
// TODO 2.2.0 版本之前无具体业务,后续等业务方确定具体业务后在进行拓展
return ResultInfo.success(true);
}
......@@ -106,29 +102,25 @@ public class UserOperationController {
* @param userApp app账号
* @return ResultInfo
*/
@Log
@PostMapping(value = "/appCancellation")
@ApiOperation("注销app账号")
@AnonymousAccess
public ResultInfo appCancellation(@Validated @RequestBody UserApp userApp) {
log.info("注销app账号,参数 ==>> [appCancellation#{}]", userApp.getId());
log.info("注销app账号,参数 appCancellation# resources ==>> {}", userApp);
if (Objects.isNull(userApp.getId())) {
log.error("注销app账号失败,参数错误,id不得为空,[appCancellation#]");
return ResultInfo.failure("");
log.error("注销app账号异常,appCancellation# message ==>> app账号id不的为空");
return ResultInfo.failure("app账号id不的为空");
}
boolean result = this.userOperationService.appCancellation(userApp);
return ResultInfo.success(result);
return ResultInfo.success(this.userOperationService.appCancellation(userApp));
}
@Log
@PostMapping(value = "/updateAppInfo")
@ApiOperation("修改app账号信息")
@AnonymousAccess
public ResultInfo updateAppInfo(@Validated @RequestBody UserApp resources) {
log.info("修改app账号信息,参数 ==>> [updateAppInfo#{}]", resources);
log.info("修改app账号信息,参数 updateAppInfo# resources ==>> {}", resources);
Long id = resources.getId();
if (Objects.isNull(id)) {
log.error("修改app账号密码,参数错误,id不得为空,[updateAppInfo#{}]", resources);
......@@ -147,59 +139,73 @@ public class UserOperationController {
return ResultInfo.success(result);
}
@Log
@PostMapping(value = "/appRegister")
@ApiOperation("app注册")
@AnonymousAccess
public ResultInfo appRegister(@Validated @RequestBody UserApp resources) {
log.info("app注册 ==>> param ==>> [appRegister#{}]", resources);
log.info("app注册, 参数 appRegister# resouces ==>> {}", resources);
String username = resources.getUsername();
if (StringUtils.isBlank(username)) {
log.error("app注册,参数错误,账号不得为空 ");
log.error("app注册,参数错误,appRegister# message ==>> 账号不得为空 ");
return ResultInfo.failure("app注册,参数错误,账号不得为空");
}
Integer type = resources.getType();
if (Objects.isNull(type)) {
log.error("app注册,参数错误,账号类型不得为空 ");
return ResultInfo.failure("app注册,参数错误,账号类型不得为空");
log.error("app注册,参数错误,appRegister# message ==>> 账号类型不得为空 ");
return ResultInfo.failure("app注册失败,账号类型不得为空");
}
String account = resources.getAccount();
if (StringUtils.isNotBlank(account)) {
if (Objects.isNull(resources.getAccountType())) {
log.error("app注册,参数错误,第三方账号类型不得为空");
return ResultInfo.failure("app注册,参数错误,第三方账号类型不得为空");
log.error("app注册,参数错误,appRegister# message ==>> 第三方账号类型不得为空");
return ResultInfo.failure("app注册失败,第三方账号类型不得为空");
}
}
if (StringUtils.isBlank(resources.getNickname())) {
// 昵称不存在时,默认使用手机号作为昵称
resources.setNickname(Base64Utils.encodeToString(username.getBytes()));
}
UserAppDTO userAppDTO = this.userOperationService.appRegister(resources);
return ResultInfo.success(userAppDTO);
if (Objects.isNull(resources.getId())) {
if (StringUtils.isNotBlank(resources.getPassword())) {
String clientPassword = AESUtil.decrypt(resources.getPassword(), secretKey);
if (clientPassword == null || clientPassword.length() <= 16) {
log.error("app注册异常,appRegister# message ==>> 密码格式不正确 | clientPassword ==>> {}", clientPassword);
return ResultInfo.failure("密码必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-25 之间");
}
String resultClientPassword = clientPassword.substring(16);
if (!RegexUtil.appPasswordRegex(resultClientPassword)) {
log.error("app注册异常,appRegister# message ==>> 密码格式不正确 | password ==>> {}", resultClientPassword);
return ResultInfo.failure("密码必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-25 之间");
}
resources.setPassword(AESUtil.decodePassword(resources.getPassword()));
}
}
return ResultInfo.success(this.userOperationService.appRegister(resources));
}
@Log
@PostMapping(value = "/appBindThirdAccount")
@ApiOperation("app账号绑定第三方账号")
@AnonymousAccess
public ResultInfo appBindThirdAccount(@Validated @RequestBody UserAppBind resources) {
log.info("app账号绑定第三方账号,参数 ==>> [appBindThirdAccount#{}]", resources);
log.info("app账号绑定第三方账号,参数 appBindThirdAccount# message ==>> {}", resources);
String username = resources.getUsername();
if (StringUtils.isBlank(username)) {
log.error("app账号绑定第三方账号,参数错误,账号不得为空 ");
log.error("app账号绑定第三方账号,参数错误,appBindThirdAccount# message ==>> 账号不得为空 ");
return ResultInfo.failure("app账号绑定第三方账号,参数错误,账号不得为空");
}
String account = resources.getAccount();
if (StringUtils.isNotBlank(account)) {
if (Objects.isNull(resources.getAccountType())) {
log.error("app账号绑定第三方账号,参数错误,第三方账号不得为空");
log.error("app账号绑定第三方账号,参数错误,appBindThirdAccount# message ==>> 第三方账号不得为空");
return ResultInfo.failure("app账号绑定第三方账号,参数错误,第三方账号不得为空");
}
}
......@@ -207,19 +213,18 @@ public class UserOperationController {
// 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号
Integer accountType = resources.getAccountType();
if (Objects.isNull(accountType)) {
log.error("app账号绑定第三方账号,参数错误,第三方账号类型不得为空");
log.error("app账号绑定第三方账号,参数错误,appBindThirdAccount# message ==>> 第三方账号类型不得为空");
return ResultInfo.failure("app账号绑定第三方账号,参数错误,第三方账号类型不得为空");
}
return this.userOperationService.appBindThirdAccount(resources);
}
@Log
@PostMapping(value = "/cancelUserAppBind")
@ApiOperation("取消关联第三方账号")
@AnonymousAccess
public ResultInfo cancelUserAppBind(@Validated @RequestBody UserAppBind resources) {
log.info("取消关联第三方账号, 参数 ==>> [cancelUserAppBind#{}]", resources);
log.info("取消关联第三方账号, 参数 cancelUserAppBind# resource ==>> {}", resources);
String account = resources.getAccount();
if (StringUtils.isBlank(account)) {
......@@ -242,20 +247,14 @@ public class UserOperationController {
@ApiOperation("app绑定大屏")
@AnonymousAccess
public ResultInfo appBind(@Validated(value = {BindGroup.class}) @RequestBody BindBean resources) {
log.info("UserOperationController ==> appletBind ==>> param ==> [{}]",resources);
log.info("app绑定大屏, 参数 appBind# resources ==> {}",resources);
Long memberId = resources.getMemberId();
if (Objects.isNull(memberId)) {
return ResultInfo.failure("参数错误,memberId 不存在");
}
String platformAccount = resources.getPlatformAccount();
if (StringUtils.isBlank(platformAccount)) {
return ResultInfo.failure("参数错误,大屏账号不存在");
return ResultInfo.failure("参数错误, memberId不得为空");
}
boolean result = this.userOperationService.appBind(resources);
return ResultInfo.success(result);
return this.userOperationService.appBind(resources);
}
@PostMapping("/appUnbind")
......@@ -276,7 +275,6 @@ public class UserOperationController {
/******************************************************* weixin ************************************/
@Log
@PostMapping(value = "/saveGrowthReport")
@ApiOperation("同步大屏成长报告")
@AnonymousAccess
......@@ -302,11 +300,11 @@ public class UserOperationController {
}
@PutMapping(value = "/updateWeixin")
@ApiOperation("修改UserWeixin")
@ApiOperation("修改微信信息")
@AnonymousAccess
public ResultInfo updateWeixin(@Validated @RequestBody UserWeixin resources) {
userOperationService.updateWeixin(resources);
return ResultInfo.success();
log.info("修改微信信息, 参数 updateWeixin# resources ==>> {}", resources);
return ResultInfo.success(this.userOperationService.updateWeixin(resources));
}
@RequestMapping(value = "/updateVipByUserId")
......@@ -314,23 +312,30 @@ public class UserOperationController {
@AnonymousAccess
public ResultInfo updateVipByUserId(@Validated(value = {UpdateGroup.class}) @RequestBody
UserOperationBean resources) {
log.info("userOperation ==>> updateVipByUserId ==>> param ==>> [{}]",resources);
log.info("通过账号id修改vip, 参数 updateVipByUserId# resources ==>> {}",resources);
Integer vip = resources.getVip();
if (Objects.isNull(vip) || vip < 1) {
return ResultInfo.failure("手动修改vip异常,参数错误,vip为空或者小于1");
}
Timestamp vipExpireTime = resources.getVipExpireTime();
// 微信账号id
Long userId = resources.getUserId();
if (Objects.isNull(userId)) {
return ResultInfo.failure("手动修改vip异常,参数错误,小屏账号id为空");
log.error("通过账号id修改vip异常,updateVipByUserId# message ==>> 小屏账号id不的为空");
return ResultInfo.failure("小屏账号id不的为空");
}
UserWeixinDTO userWeixinDTO = this.userOperationService.findById(userId);
Long memberId = userWeixinDTO.getMemberId();
MemberDTO memberDTO = this.memberService.findById(memberId);
if (Objects.isNull(memberDTO.getId())) {
log.error("通过账号id修改vip异常,updateVipByUserId# message ==>> 会员信息不存在");
return ResultInfo.failure("会员信息不存在");
}
MemberOperationBean memberOperationBean = new MemberOperationBean();
memberOperationBean.setMemberCode(memberDTO.getCode());
if (vip < memberDTO.getVip()) {
......@@ -340,68 +345,58 @@ public class UserOperationController {
}
memberOperationBean.setVip(vip);
MemberDTO memberDTO1 = this.memberOperationService.doUpdateVipByMemberCode(memberOperationBean);
return ResultInfo.success(memberDTO1);
return ResultInfo.success(this.memberOperationService.doUpdateVipByMemberCode(memberOperationBean));
}
@PostMapping(value = "/createWeixinUserAndCreateMember")
@ApiOperation("新增小屏账户同时创建会员信息")
@AnonymousAccess
public ResultInfo createWeixinUserAndMember(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) {
log.info("UserOperationController ==> createWeixinUserAndMember ==> param ==> [{}]",resources);
UserWeixinDTO result = this.userOperationService.createWeixinUserAndMember(resources);
return ResultInfo.success(result);
log.info("新增小屏账户同时创建会员信息, 参数 createWeixinUserAndMember# resources ==>> {}",resources);
return this.userOperationService.createWeixinUserAndMember(resources);
}
@PostMapping("/serviceLogin")
@ApiOperation("微信服务号(H5)登录")
@AnonymousAccess
public ResultInfo serviceLogin(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) {
log.info("UserOperationController ==> serviceLogin ==>> param ==> [{}]",resources);
UserWeixinDTO result = this.userOperationService.serviceLogin(resources);
return ResultInfo.success(result);
log.info("微信服务号(H5)登录, 参数 serviceLogin# resources ==>> {}",resources);
return ResultInfo.success(this.userOperationService.serviceLogin(resources));
}
@PostMapping("/appletLogin")
@ApiOperation("微信小程序登录")
@AnonymousAccess
public ResultInfo appletLogin(@Validated(value = {CreateGroup.class}) @RequestBody UserWeixin resources) {
log.info("UserOperationController ==> appletLogin ==>> param ==> [{}]",resources);
UserWeixinDTO result = this.userOperationService.appletLogin(resources);
return ResultInfo.success(result);
log.info("微信小程序登录, 参数 appletLogin# resource ==>> {}", resources);
return ResultInfo.success(this.userOperationService.appletLogin(resources));
}
@PostMapping("/subscribe")
@ApiOperation("微信公众号关注")
@AnonymousAccess
public ResultInfo subscribe(@Validated @RequestBody SubscribeBeanEvent data) throws Exception {
log.info("UserOperationController ==> subscribe ==>> param ==> [{}]",data);
public ResultInfo subscribe(@Validated @RequestBody SubscribeBeanEvent resource) throws Exception {
log.info("微信公众号关注, 参数 subscribe# resource ==> {}", resource);
SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(data.getContent(), SubscribeBean.class);
SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(resource.getContent(), SubscribeBean.class);
// 解析参数
this.parseSubscribe(subscribeBean);
boolean subscribe = this.userOperationService.subscribe(subscribeBean);
if (subscribe) {
if (this.userOperationService.subscribe(subscribeBean)) {
return ResultInfo.success("关注成功");
} else {
return ResultInfo.failure("关注失败");
}
return ResultInfo.failure("关注失败");
}
/**
*
* @param subscribeBean
* @throws IOException
*/
private void parseSubscribe(SubscribeBean subscribeBean) throws Exception {
// appId
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);
......@@ -415,15 +410,15 @@ public class UserOperationController {
// 程序类型
String appType = wxInfoMap.get("appType");
// 非订阅号,暂不处理。返回暂不支持
if (ObjectUtil.notEqual(appType, WeChatConstants.WX_SUBSCRIPTION))
if (ObjectUtil.notEqual(appType, WeChatConstants.WX_SUBSCRIPTION)) {
throw new BadRequestException("非订阅号");
}
// 大屏账户信息
JSONObject redisInfo = null;
// 缓存的大屏信息,使用unionid即可
String content = (String) this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionId));
log.info("获取redis中存储的数据,[subscribe#{}]", content);
if (StringUtils.isNotBlank(content)) {
// 大屏信息
redisInfo = JSONObject.parseObject(content);
......@@ -433,19 +428,20 @@ public class UserOperationController {
if (Objects.nonNull(redisInfo)) {
subscribeBean.setIptvUserInfo(redisInfo);
// 关注来源信息
log.info("关注来源信息,[subscribe#{}]", redisInfo);
subscribeBean.setSourceInfo(redisInfo);
String nickname = redisInfo.get("nickname").toString();
if (StringUtils.isNotBlank(nickname)) {
String nicknameDecode = URLDecoder.decode(nickname, "UTF-8");
String nicknameEncode = Base64Util.encode(nicknameDecode);
subscribeBean.setNickname(nicknameEncode);
boolean isBase64 = Base64Util.isBase64(nickname);
if (isBase64) {
subscribeBean.setNickname(nickname);
} else {
log.warn("关注时前端昵称为进行base64加密,subscribe# message =>> 采用默认昵称 | nickname ==>> {}", nickname);
subscribeBean.setNickname(Base64Util.encode("创造团用户"));
}
}
String headimgurl = redisInfo.get("headimgurl").toString();
log.info("parseSubscribe ==>> headimgurl ==>> {}", headimgurl);
if (StringUtils.isNotBlank(headimgurl)) {
String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8");
if (StringUtils.isNotBlank(headimgurlDecode)) {
......@@ -474,11 +470,10 @@ public class UserOperationController {
/**
* 获取配置的微信应用列表
* @param appid 应用Id
* @return
* @throws ConfigurationException
*/
private Map<String, String> getWeixinInfoByAppid(String appid) throws ConfigurationException {
if (com.topdraw.utils.StringUtils.isBlank(appid)) {
if (StringUtils.isBlank(appid)) {
throw new RuntimeException("wxAppid can not be null");
}
List<Map<String, String>> list = weixinInfoConfig.getWechatAppList();
......@@ -492,10 +487,10 @@ public class UserOperationController {
@PostMapping("/unsubscribe")
@ApiOperation("微信公众号取关")
@AnonymousAccess
public ResultInfo unsubscribe(@Validated @RequestBody SubscribeBeanEvent data) {
log.info("UserOperationController ==> unsubscribe ==>> param ==> [{}]",data);
public ResultInfo unsubscribe(@Validated @RequestBody SubscribeBeanEvent resource) {
log.info("微信公众号取关, 参数 unsubscribe# resource ==> {}", resource);
SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(data.getContent(), SubscribeBean.class);
SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(resource.getContent(), SubscribeBean.class);
String appId = subscribeBean.getAppid();
Assert.notNull(appId, GlobeExceptionMsg.APP_ID_IS_NULL);
......@@ -506,40 +501,40 @@ public class UserOperationController {
subscribeBean.setAppid(appId);
subscribeBean.setOpenid(openId);
boolean result = this.userOperationService.unsubscribe(subscribeBean);
return ResultInfo.success(result);
return ResultInfo.success(this.userOperationService.unsubscribe(subscribeBean));
}
@PostMapping("/minaBind")
@ApiOperation("微信小程序绑定大屏")
@AnonymousAccess
public ResultInfo minaBind(@Validated(value = {BindGroup.class}) @RequestBody BindBean resources) {
log.info("UserOperationController ==> appletBind ==>> param ==> [{}]",resources);
log.info("微信小程序绑定大屏, 参数 minaBind# resources ==>> {}", resources);
Long memberId = resources.getMemberId();
if (Objects.isNull(memberId)) {
return ResultInfo.failure("参数错误,memberId 不存在");
log.error("微信小程序绑定大屏异常,参数错误,minaBind# message ==>> memberId不的为空");
return ResultInfo.failure("参数错误,会员id不的为空");
}
String platformAccount = resources.getPlatformAccount();
if (StringUtils.isBlank(platformAccount)) {
return ResultInfo.failure("参数错误,大屏账号不存在");
log.error("微信小程序绑定大屏异常,参数错误,minaBind# message ==>> 大屏账号不的为空");
return ResultInfo.failure("参数错误,大屏账号不的为空");
}
boolean result = this.userOperationService.minaBind(resources);
return ResultInfo.success(result);
return ResultInfo.success(this.userOperationService.minaBind(resources));
}
@PostMapping("/minaUnbind")
@ApiOperation("小屏解绑")
@AnonymousAccess
public ResultInfo minaUnbind(@Validated(value = {UnbindGroup.class}) @RequestBody WeixinUnBindBean weixinUnBindBean) {
log.info("小屏解绑,参数 ==> [minaUnbind#{}]", weixinUnBindBean);
log.info("小屏解绑,参数 minaUnbind# resource ==>> {}", weixinUnBindBean);
Long memberId = weixinUnBindBean.getMemberId();
if (Objects.isNull(memberId)) {
log.error("小屏解绑失败,参数错误,memberId不存在");
return ResultInfo.failure("参数错误,无会员id");
log.error("小屏解绑失败,参数错误,minaUnbind# message ==>> memberId不存在");
return ResultInfo.failure("参数错误,会员id不的为空");
}
return this.userOperationService.minaUnbind(weixinUnBindBean);
......@@ -550,29 +545,25 @@ public class UserOperationController {
* 1.未关注、未绑定
* 2.已绑定、未关注
* 3.已关注、未绑定
* @param data
* @return
*/
@PostMapping(value = "/memberPreprocess")
@ApiOperation("暂存大小屏信息并检查关注与绑定状态")
@AnonymousAccess
public ResultInfo memberPreprocess(@RequestBody String data) {
log.info("暂存大小屏信息并检查关注与绑定状态,参数 memberPreprocess# resource ==>> {}", data);
log.info("UserOperationController ==> saveUserInfo ==>> param ==>> [{}]",data);
if (StringUtils.isBlank(data)) {
log.error("预存大小屏账号信息失败,无参数");
return ResultInfo.failure("参数错误");
log.error("预存大小屏账号信息异常,memberPreprocess# message ==>> 无参数");
return ResultInfo.failure("参数错误,无参数");
}
JSONObject json = JSONObject.parseObject(data);
String unionid = json.getString("unionid");
if (StringUtils.isBlank(unionid)) {
log.error("预存大小屏账号信息失败,参数错误,unionid不存在");
return ResultInfo.failure("参数错误,unionid不存在");
log.error("预存大小屏账号信息异常,memberPreprocess# message ==>> unionid不的为空");
return ResultInfo.failure("参数错误,unionid不的为空");
}
List<Object> resultList = new ArrayList<>();
// 大屏侧通过返回值来展示对应的小程序页面
String result = SUBSCRIBE;
......@@ -587,7 +578,6 @@ public class UserOperationController {
result = UNSUBSCRIBE;
resultList.add(result);
resultList.add(platformAccount1);
log.info("saveUserInfo ==>> result ==>> [{}]",resultList);
return ResultInfo.success(resultList);
} else {
......@@ -612,8 +602,8 @@ public class UserOperationController {
} else {
// 数据异常,没有会员
log.info("userWeixinDTO ==>> [{}]",userWeixinDTO);
throw new EntityNotFoundException(MemberDTO.class,"code","member is null !!");
log.error("预存大小屏账号信息异常,memberPreprocess# message ==>> 会员不存在");
return ResultInfo.failure("会员不存在");
}
......@@ -627,23 +617,21 @@ public class UserOperationController {
String content = (String) this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionid));
JSONObject iptvUserInfo = JSONObject.parseObject(content);
// redis中的大小屏信息
log.info("saveUserInfo ==> redis content iptvUserInfo ==> [{}]",iptvUserInfo);
log.info("预存大小屏账号信息,保存在redis中的信息,memberPreprocess# message ==> {}", iptvUserInfo);
// 大屏账户
String platformAccount = iptvUserInfo.getString("platformAccount");
if (StringUtils.isBlank(platformAccount)) {
log.warn("绑定失败,platformAccount is null ");
log.error("预存大小屏账号信息警告,memberPreprocess# message ==> 大屏账号不存在 ");
return ResultInfo.failure("绑定失败");
}
// 保存昵称和头像,头像需要进行本地化
try {
String headimgurl = iptvUserInfo.get("headimgurl").toString();
log.info("headimgurl ==>> {}", headimgurl);
String nickname = iptvUserInfo.get("nickname").toString();
if (StringUtils.isNotBlank(nickname)) {
String nicknameDecode = URLDecoder.decode(nickname, "UTF-8");
String nicknameEncode = Base64Util.encode(nicknameDecode);
......@@ -651,14 +639,11 @@ public class UserOperationController {
}
if (StringUtils.isNotBlank(headimgurl)) {
if(headimgurl.contains("https")||headimgurl.contains("http")) {
String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8");
// String imageEncode = Base64Util.encode(headimgurlDecode);
String image = RestTemplateClient.netImage(headimgurlDecode);
memberDTO.setAvatarUrl(StringUtils.isNotBlank(image) ? image:headimgurlDecode);
}
}
} catch (Exception e) {
......@@ -680,12 +665,7 @@ public class UserOperationController {
resultList.add(result);
resultList.add(platformAccount1);
// return ["subscribe","platform_account"]
ResultInfo<Object> success = ResultInfo.success(resultList);
log.info("saveUserInfo ==> ResultInfo ==> [{}]",success);
return success;
return ResultInfo.success(resultList);
}
private String downloadWeixinImge(String headimgurl){
......@@ -708,118 +688,105 @@ public class UserOperationController {
@ApiOperation("修改大屏账号")
@AnonymousAccess
public ResultInfo updateUserTv(@Validated(value = {UpdateGroup.class}) @RequestBody UserTv resources) {
log.info("UserOperationController ==> updateUserTv ==>> param ==> [{}]",resources);
UserTvDTO result = this.userOperationService.updateUserTv(resources);
return ResultInfo.success(result);
log.info("修改大屏账号,参数 updateUserTv# resources ==>> {}",resources);
return ResultInfo.success(this.userOperationService.updateUserTv(resources));
}
@PostMapping(value = "/createTvUserAndMember")
@ApiOperation("保存大屏账户同时创建会员信息")
@AnonymousAccess
public ResultInfo createTvUserAndMember(@Validated(value = {CreateGroup.class}) @RequestBody UserTv resources) {
log.info("UserOperationController ==> createTvUserAndMember ==>> param ==> [{}]",resources);
log.info("保存大屏账户同时创建会员信息, 参数 createTvUserAndMember# resources ==> {}",resources);
String platformAccount = resources.getPlatformAccount();
if (StringUtils.isBlank(platformAccount)) {
log.error("保存大屏账户同时创建会员信息异常,参数错误,大屏账号不存在");
log.error("保存大屏账户同时创建会员信息异常,createTvUserAndMember# message ==>> 大屏账号不存在");
return ResultInfo.failure("参数错误,大屏账号不存在");
}
UserTvDTO result = this.userOperationService.createTvUserAndMember(resources);
return ResultInfo.success(result);
return this.userOperationService.createTvUserAndMember(resources);
}
@RequestMapping(value = "/tvUnbind")
@ApiOperation("大屏解绑")
@AnonymousAccess
public ResultInfo tvUnbind(@Validated(value = {UpdateGroup.class}) @RequestBody TvUnBindBean resources) {
log.info("UserOperationController ==> unbind ==>> param ==> [{}]",resources);
log.info("大屏解绑, 参数 tvUnbind# resources ==> {}", resources);
String memberCode = resources.getMemberCode();
log.info("大屏解绑,前端参数,需要解绑的会员code,memberCode ==>> {}", memberCode);
if (StringUtils.isBlank(memberCode)) {
throw new BadRequestException(GlobeExceptionMsg.MEMBER_CODE_IS_NULL);
log.error("大屏解绑异常,tvUnbind# message ==>> 会员code不的为空");
return ResultInfo.failure("会员code不的为空");
}
String platformAccount = resources.getPlatformAccount();
log.info("大屏解绑,前端参数,大屏账号,platformAccount ==>> {}", platformAccount);
if (StringUtils.isBlank(platformAccount)) {
throw new BadRequestException(GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL);
log.error("大屏解绑异常,tvUnbind# message ==>> 大屏账号不得为空");
return ResultInfo.failure("大屏账号不的为空");
}
boolean b = this.userOperationService.tvUnbind(resources);
if (b) {
if (this.userOperationService.tvUnbind(resources)) {
return ResultInfo.success("解绑成功");
} else return ResultInfo.failure("解绑失败");
}
return ResultInfo.failure("解绑失败");
}
@RequestMapping(value = "/changeMainAccount")
@ApiOperation("大屏更换主账号")
@AnonymousAccess
public ResultInfo changeMainAccount(@Validated(value = {UpdateGroup.class}) @RequestBody BindBean resources) {
log.info("大屏更换主账号,参数 [changeMainAccount# ==> {}]",resources);
log.info("大屏更换主账号,参数 changeMainAccount# resources ==>> {}", resources);
// Long memberId = resources.getMemberId();
String memberCode = resources.getMemberCode();
/* if (StringUtils.isBlank(memberCode) && Objects.nonNull(memberId)) {
memberCode = this.memberService.findCodeById(memberId);
} else if (StringUtils.isNotBlank(memberCode) && Objects.isNull(memberId)) {
MemberDTO memberDTO = this.memberService.findByCode(memberCode);
memberCode = memberDTO.getCode();
}*/
if (StringUtils.isBlank(memberCode))
return ResultInfo.failure("会员code不得为空");
if (StringUtils.isBlank(memberCode)) {
log.error("大屏更换主账号异常,changeMainAccount# message ==>> 会员code不的为空");
return ResultInfo.failure("会员code不的为空");
}
MemberDTO memberDTO = this.memberService.findByCode(memberCode);
if (Objects.isNull(memberDTO.getId())) {
log.error("大屏更换主账号失败,会员信息不存在, changeMainAccount# ==> {}", memberCode);
log.error("大屏更换主账号异常,changeMainAccount# message ==>> 会员信息不存在 | memberCode ==>> {}", memberCode);
return ResultInfo.failure("会员信息不存在");
}
String platformAccount = resources.getPlatformAccount();
if (StringUtils.isBlank(platformAccount))
throw new BadRequestException(GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL);
if (StringUtils.isBlank(platformAccount)) {
log.error("大屏更换主账号异常,changeMainAccount# message ==>> 大屏账号不存在 | platformAccount ==>> {}", memberCode);
return ResultInfo.failure("大屏账号不存在");
}
UserTv userTv = new UserTv();
userTv.setMemberCode(memberCode);
userTv.setPlatformAccount(platformAccount);
boolean b = this.userOperationService.changeMainAccount(userTv);
return ResultInfo.success(b);
return ResultInfo.success(this.userOperationService.changeMainAccount(userTv));
}
@PostMapping(value = "/deleteAllCollection")
@ApiOperation("删除全部收藏")
@AnonymousAccess
public ResultInfo deleteAllCollection(@RequestBody String content) {
log.info("UserOperationController ==> deleteAllCollection ==> param ==> [{}]",content);
boolean result = this.userOperationService.deleteAllCollection(content);
return ResultInfo.success(result);
log.info("删除全部收藏,参数 deleteAllCollection# resources ==> {}", content);
return ResultInfo.success(this.userOperationService.deleteAllCollection(content));
}
@PostMapping(value = "/deleteCollection")
@ApiOperation("删除收藏")
@AnonymousAccess
public ResultInfo deleteCollection(@RequestBody String content) {
log.info("UserOperationController ==> deleteCollection ==> param ==> [{}]",content);
boolean result = this.userOperationService.deleteCollection(content);
return ResultInfo.success(result);
log.info("删除收藏,参数 deleteCollection# resources ==> {}", content);
return ResultInfo.success(this.userOperationService.deleteCollection(content));
}
@PostMapping(value = "/addCollection")
@ApiOperation("添加收藏")
@AnonymousAccess
public ResultInfo addCollection(@RequestBody String content) {
log.info("UserOperationController ==> addCollection ==>> param ==> [{}]",content);
log.info("添加收藏,参数 addCollection# ==>> {}", content);
if (StringUtils.isNotBlank(content)) {
boolean result = this.userOperationService.addCollection(content);
return ResultInfo.success(result);
return ResultInfo.success(this.userOperationService.addCollection(content));
}
return ResultInfo.success();
}
return ResultInfo.failure("无参数");
}
}
......
package com.topdraw.business.process.service;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.task.domain.Task;
import com.topdraw.business.module.task.service.dto.TaskDTO;
import com.topdraw.common.ResultInfo;
/**
* @description 权益操作接口
......@@ -42,7 +42,7 @@ public interface TaskOperationService {
*
* @param task
*/
TaskDTO updateTask(Task task);
ResultInfo updateTask(Task task);
/**
*
......
package com.topdraw.business.process.service;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.user.app.domain.UserApp;
import com.topdraw.business.module.user.app.domain.UserAppBind;
......@@ -14,7 +15,6 @@ import com.topdraw.business.process.domian.weixin.BindBean;
import com.topdraw.business.process.domian.weixin.SubscribeBean;
import com.topdraw.business.process.domian.weixin.TvUnBindBean;
import com.topdraw.business.process.domian.weixin.WeixinUnBindBean;
import com.topdraw.common.ResultInfo;
public interface UserOperationService {
......@@ -24,21 +24,21 @@ public interface UserOperationService {
* @param resources
* @return
*/
UserTvDTO createTvUserAndMember(UserTv resources);
ResultInfo createTvUserAndMember(UserTv resources);
/**
* 保存小屏账户并创建会员
* @param resources
* @return
*/
UserWeixinDTO createWeixinUserAndMember(UserWeixin resources);
ResultInfo createWeixinUserAndMember(UserWeixin resources);
/**
* 保存小屏账户并创建会员
* @param resources
* @return
*/
UserWeixinDTO createWeixinUserAndMember(UserWeixin resources, Integer vip);
ResultInfo createWeixinUserAndMember(UserWeixin resources, Integer vip);
/**
* 服务号(H5)登录
......@@ -124,7 +124,7 @@ public interface UserOperationService {
* @param resources
* @return
*/
boolean appBind(BindBean resources);
ResultInfo appBind(BindBean resources);
/**
*
......@@ -205,18 +205,15 @@ public interface UserOperationService {
/**
*
* @param resources
* @param growthReport
* @return
*/
boolean updatePasswordById(UserApp resources);
ResultInfo saveGrowthReport(GrowthReport growthReport);
/**
*
* @param growthReport
* @param userApp
* @return
*/
ResultInfo saveGrowthReport(GrowthReport growthReport);
boolean appCancellation(UserApp userApp);
}
......
package com.topdraw.business.process.service.impl;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.business.module.coupon.history.domain.CouponHistory;
import com.topdraw.business.module.coupon.history.service.CouponHistoryService;
import com.topdraw.business.module.coupon.service.CouponService;
......@@ -13,7 +14,6 @@ import com.topdraw.business.process.domian.TempCoupon;
import com.topdraw.business.process.service.RightsOperationService;
import com.topdraw.business.RedisKeyConstants;
import com.topdraw.util.TimestampUtil;
import com.topdraw.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.BeanUtils;
......
package com.topdraw.business.process.service.impl;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.business.module.exp.detail.domain.ExpDetail;
import com.topdraw.business.module.exp.detail.service.ExpDetailService;
import com.topdraw.business.module.member.domain.Member;
......@@ -13,9 +14,8 @@ import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.business.process.domian.TempExp;
import com.topdraw.business.RedisKeyConstants;
import com.topdraw.util.TimestampUtil;
import com.topdraw.utils.RedisUtils;
import com.topdraw.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -111,19 +111,19 @@ public class ExpOperationServiceImpl implements ExpOperationService {
MemberLevelDTO memberLevelDTO = this.memberLevelService.findByLevel(memberLevel + 1);
// 4.成长值比较,判断是否升级
Integer level = this.compareExp(totalExp, memberLevelDTO, memberLevel);
// 5.更新用户信息
Member member = new Member();
member.setId(memberId);
member.setCode(memberCode);
member.setExp(totalExp);
member.setLevel(level);
member.setUpdateTime(TimestampUtil.now());
this.memberOperationService.doUpdateMemberExpAndLevel(member);
((ExpOperationServiceImpl) AopContext.currentProxy()).asyncMemberExpAndLevel(member);
if (level > memberLevel) {
log.info("会员等级提升,更新会员等级 refreshMemberExpAndLevel#");
// 5.更新用户信息
Member member = new Member();
member.setId(memberId);
member.setCode(memberCode);
member.setExp(totalExp);
member.setLevel(level);
member.setUpdateTime(TimestampUtil.now());
this.memberOperationService.doUpdateMemberExpAndLevel(member);
((ExpOperationServiceImpl) AopContext.currentProxy()).asyncMemberExpAndLevel(member);
MemberSimpleDTO memberSimpleDTO = this.memberService.findSimpleById(memberId);
if (Objects.nonNull(memberLevelDTO.getId())) {
memberSimpleDTO.setLevel(level);
......@@ -132,16 +132,15 @@ public class ExpOperationServiceImpl implements ExpOperationService {
}
}
}
private Integer compareExp(long newExp, MemberLevelDTO memberLevelDTO, Integer oldMemberLevel) {
if (Objects.nonNull(memberLevelDTO.getId())) {
Long nextLevelExp = memberLevelDTO.getExpValue();
if (Objects.nonNull(nextLevelExp) && nextLevelExp > 0)
if(newExp - nextLevelExp >= 0){
return memberLevelDTO.getLevel();
}
private Integer compareExp(long totalExp, MemberLevelDTO memberLevelDTO, Integer oldMemberLevel) {
Long nextLevelExp = memberLevelDTO.getExpValue();
log.info("当前会员经验值 ==>> {} || 下一级会员经验值 ==>> {}", totalExp, nextLevelExp);
if (Objects.nonNull(nextLevelExp) && nextLevelExp > 0) {
if (totalExp - nextLevelExp >= 0) {
return memberLevelDTO.getLevel();
}
}
return oldMemberLevel;
}
......
......@@ -2,6 +2,7 @@ package com.topdraw.business.process.service.impl;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.base.modules.utils.RedisUtils;
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;
......@@ -18,9 +19,8 @@ import com.topdraw.business.RedisKeyConstants;
import com.topdraw.util.DateUtil;
import com.topdraw.util.IdWorker;
import com.topdraw.util.TimestampUtil;
import com.topdraw.utils.RedisUtils;
import com.topdraw.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -204,7 +204,7 @@ public class PointsOperationServiceImpl implements PointsOperationService {
BeanUtils.copyProperties(pointsAvailableDTO, _tempPoints);
BeanUtils.copyProperties(tempPoints, _tempPoints);
_tempPoints.setPoints(-(Math.abs(points)));
Long totalPoints = currentPoints + tempPoints.getPoints();
Long totalPoints = currentPoints - points;
this.doInsertTrPointsDetail(memberId, memberCode, _tempPoints, currentPoints, totalPoints);
}
......
package com.topdraw.business.process.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.business.module.coupon.service.CouponService;
import com.topdraw.business.module.coupon.service.dto.CouponDTO;
import com.topdraw.business.module.member.service.dto.MemberSimpleDTO;
import com.topdraw.business.module.rights.service.RightsService;
import com.topdraw.business.module.rights.service.dto.RightsDTO;
import com.topdraw.business.module.task.attribute.domain.TaskAttr;
import com.topdraw.business.module.task.attribute.service.TaskAttrService;
import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO;
import com.topdraw.business.module.task.domain.TaskBuilder;
......@@ -32,25 +32,22 @@ import com.topdraw.business.module.task.service.TaskService;
import com.topdraw.business.module.task.template.service.TaskTemplateService;
import com.topdraw.business.process.domian.*;
import com.topdraw.business.process.service.UserOperationService;
import com.topdraw.common.ResultInfo;
import com.topdraw.business.LocalConstants;
import com.topdraw.business.module.rights.constant.RightTypeConstants;
import com.topdraw.business.module.task.template.constant.TaskEventType;
import com.topdraw.business.RedisKeyConstants;
import com.topdraw.mq.module.mq.DataSyncMsg;
import com.topdraw.util.*;
import com.topdraw.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.sql.Timestamp;
......@@ -100,68 +97,70 @@ public class TaskOperationServiceImpl implements TaskOperationService {
private static final Integer POINTS_MIN = 1;
@Override
// @CacheEvict(cacheNames = RedisKeyConstants.cacheTaskByEvent, key = "#task.event")
public TaskDTO createTask(Task task) {
Long taskTemplateId = task.getTaskTemplateId();
@Transactional(rollbackFor = Exception.class)
public TaskDTO createTask(Task content) {
Long taskTemplateId = content.getTaskTemplateId();
TaskTemplateDTO taskTemplateDTO = this.taskTemplateService.findById(taskTemplateId);
task.setTaskTemplateCode(taskTemplateDTO.getCode());
Task task_ = TaskBuilder.build(task);
TaskDTO taskDTO = this.taskService.create(task_);
content.setTaskTemplateCode(taskTemplateDTO.getCode());
Task task = TaskBuilder.build(content);
TaskDTO taskDTO = this.taskService.create(task);
((TaskOperationServiceImpl) AopContext.currentProxy()).asyncCreateTask(task_);
((TaskOperationServiceImpl) AopContext.currentProxy()).asyncCreateTask(task);
return taskDTO;
}
@Override
// @CacheEvict(cacheNames = RedisKeyConstants.cacheTaskByEventAndMemberLevelAndVip, key = "#task.event")
public TaskDTO updateTask(Task task) {
Long taskTemplateId = task.getTaskTemplateId();
TaskTemplateDTO taskTemplateDTO = this.taskTemplateService.findById(taskTemplateId);
task.setTaskTemplateCode(taskTemplateDTO.getCode());
TaskDTO update = this.taskService.update(task);
if (Objects.nonNull(update.getId())) {
this.updateTaskAttr(task);
@Transactional(rollbackFor = Exception.class)
public ResultInfo updateTask(Task content) {
Long taskTemplateId = content.getTaskTemplateId();
if (Objects.nonNull(taskTemplateId)) {
TaskTemplateDTO taskTemplateDTO = this.taskTemplateService.findById(taskTemplateId);
content.setTaskTemplateCode(taskTemplateDTO.getCode());
}
((TaskOperationServiceImpl) AopContext.currentProxy()).asyncUpdateTask(task);
TaskDTO taskDTO = this.taskService.update(content);
((TaskOperationServiceImpl) AopContext.currentProxy()).asyncUpdateTask(content);
return update;
}
/**
*
* @param task 任务
*/
private void updateTaskAttr(Task task) {
TaskAttrDTO taskAttrDTO = this.taskAttrService.findByTaskId(task.getId());
if (Objects.nonNull(taskAttrDTO.getId())) {
TaskAttr taskAttr = new TaskAttr();
BeanUtils.copyProperties(taskAttrDTO, taskAttr);
taskAttr.setAttrStr(task.getAttr());
this.taskAttrService.update(taskAttr);
Set<Object> tasks = this.redisUtils.keys(RedisKeyConstants.cacheTaskByEventAndMemberLevelAndVip+"*");
if (!CollectionUtils.isEmpty(tasks)) {
for (Object key : tasks) {
this.redisUtils.del(key.toString());
}
}
return ResultInfo.success(taskDTO);
}
@Override
// @CacheEvict(cacheNames = RedisKeyConstants.cacheTaskByEvent, key = "#task.event")
public Integer deleteTask(Task task) {
Long id = task.getId();
@Transactional(rollbackFor = Exception.class)
public Integer deleteTask(Task content) {
Long id = content.getId();
TaskDTO taskDTO = this.findById(id);
if (Objects.nonNull(taskDTO.getId())) {
task.setId(taskDTO.getId());
Integer delete = this.taskService.delete(task);
task.setCode(taskDTO.getCode());
((TaskOperationServiceImpl) AopContext.currentProxy()).asyncDeleteTask(task);
content.setId(taskDTO.getId());
Integer count = this.taskService.delete(content);
content.setCode(taskDTO.getCode());
((TaskOperationServiceImpl) AopContext.currentProxy()).asyncDeleteTask(content);
Set<Object> tasks = this.redisUtils.keys(RedisKeyConstants.cacheTaskByEventAndMemberLevelAndVip+"*");
if (!CollectionUtils.isEmpty(tasks)) {
for (Object key : tasks) {
this.redisUtils.del(key.toString());
}
}
return delete;
return count;
}
return 0;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer deleteTask(Long id) {
TaskDTO taskDTO = this.findById(id);
if (Objects.nonNull(taskDTO.getId())) {
......@@ -175,6 +174,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
}
@Override
@Transactional(readOnly = true)
public TaskDTO findById(Long id) {
TaskDTO taskDTO = this.taskService.findById(id);
Long id1 = taskDTO.getId();
......@@ -187,6 +187,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
}
@Override
@Transactional(readOnly = true)
public TaskDTO findByCode(String code) {
return this.taskService.findByCode(code);
}
......@@ -263,7 +264,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
}
// 检索满足条件的任务 1.先检查redis中是否存在符合条件的任务 2.从redis中获取当前会员未完成的任务
List<Task> tasks = this.findValidTasksAndRefreshTaskProcess(memberDTO, dataSyncMsg.getEvent(), msgData);
List<Task> tasks = this.findValidTasksAndRefreshTaskProcess(memberDTO, dataSyncMsg.getEvt(), msgData);
log.info("当前用户可执行的任务详情, dealTask# tasks ==>> [{}]", tasks);
if (CollectionUtils.isEmpty(tasks)) {
// 类型 1:登录;2:观影;3:参加活动;4:订购;5:优享会员;6:签到;7:完成设置;8:播放记录;
......@@ -314,7 +315,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
Map<Object, Object> finishTasks = new HashMap<>();
finishTasks.put(task.getId(), 1);
// 单天的记录只存储一天
this.redisUtils.hmset(RedisKeyConstants.cacheTodayFinishTaskCount + "::" + memberId + ":" + LocalDate.now(), finishTasks, 24*60*60);
this.redisUtils.hmsetForObject(RedisKeyConstants.cacheTodayFinishTaskCount + "::" + memberId + ":" + LocalDate.now(), finishTasks, 24*60*60);
} else {
this.redisUtils.hincr(RedisKeyConstants.cacheTodayFinishTaskCount+"::"+memberId+":"+LocalDate.now(), task.getId().toString(), 1);
}
......@@ -332,13 +333,13 @@ public class TaskOperationServiceImpl implements TaskOperationService {
* @param event 任务模板类型
* @return
*/
private List<Task> findValidTasksAndRefreshTaskProcess(MemberSimpleDTO memberDTO, Integer event, JSONObject msgData) {
private List<Task> findValidTasksAndRefreshTaskProcess(MemberSimpleDTO memberDTO, String event, JSONObject msgData) {
// 任务是否存在
List<Task> tasks = this.taskService.findByEventAndMemberLevelAndVip(event, memberDTO.getLevel(), memberDTO.getVip());
log.info("查询任务列表, dealTask# tasks ==>> [{}]",tasks);
if (Objects.isNull(tasks) || CollectionUtils.isEmpty(tasks)) {
return Collections.singletonList(null);
return null;
}
// 获取当前会员所有任务的完成进度
......@@ -406,13 +407,13 @@ public class TaskOperationServiceImpl implements TaskOperationService {
}
break;
// 观影
case TaskEventType.VIEW:
case TaskEventType.VIEWING:
if (this.doViewEvent(msgData, task, memberDTO)) {
tasksResult.add(task);
}
break;
// 参加活动
case TaskEventType.ACTIVITY:
case TaskEventType.JOINACTIVITIES:
if (this.doActivityEvent(msgData, task, memberDTO)) {
tasksResult.add(task);
}
......@@ -423,9 +424,6 @@ public class TaskOperationServiceImpl implements TaskOperationService {
tasksResult.add(task);
}
break;
// 优享会员
case TaskEventType.MEMBER_PRIORITY:
break;
// 签到
case TaskEventType.SIGN:
if (this.doSignEvent(msgData, task, memberDTO)) {
......@@ -433,7 +431,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
}
break;
// 完善个人资料
case TaskEventType.COMPLETE_INFO:
case TaskEventType.COMPLETEMEMBERINFO:
if (this.doCompleteMemberInfoEvent(msgData, task, memberDTO)) {
tasksResult.add(task);
}
......@@ -453,21 +451,18 @@ public class TaskOperationServiceImpl implements TaskOperationService {
}
break;
// 积分转移
case TaskEventType.POINTS_TRANS:
case TaskEventType.FIRSTPOINTSTRANS:
if (this.doPointsTransEvent(msgData, task, memberDTO)) {
tasksResult.add(task);
}
break;
// 积分兑换商品
case TaskEventType.POINTS_EXCHANGE_GOODS:
case TaskEventType.FIRSTPOINTSEXCHANGE:
// 完成设置次数
if (this.doPointsExchangeGoodsEvent(msgData, task, memberDTO)) {
tasksResult.add(task);
}
break;
// 其他
case TaskEventType.SYSTEM_OPERATE:
break;
default:
log.info("没有找到对应的任务");
break;
......@@ -546,8 +541,8 @@ public class TaskOperationServiceImpl implements TaskOperationService {
private boolean doActivityEvent(JSONObject msgData, Task task, MemberSimpleDTO memberDTO) {
Integer actionAmount = task.getActionAmount();
String attrStr = task.getAttr();
if (StringUtils.isBlank(attrStr)) {
String entityId = task.getEntityId();
if (StringUtils.isBlank(entityId)) {
int joinCount = 1;//msgData.getInteger("joinCount");
if (joinCount >= actionAmount) {
this.saveOrUpdateTaskProcess(null, memberDTO.getId(), task, joinCount, TASK_FINISH_STATUS);
......@@ -556,7 +551,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
}
Integer marketingActivityId = msgData.getInteger("marketingActivityId");
if (new ArrayList<>(Arrays.asList(attrStr.split(","))).contains(Integer.toString(marketingActivityId))) {
if (new ArrayList<>(Arrays.asList(entityId.split(","))).contains(Integer.toString(marketingActivityId))) {
int joinCount = 1;//msgData.getInteger("joinCount");
if (joinCount >= actionAmount) {
this.saveOrUpdateTaskProcess(null, memberDTO.getId(), task, joinCount, TASK_FINISH_STATUS);
......@@ -564,7 +559,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
}
}
log.warn("未找到对应的活动,参数 marketingActivityId ==>> {} || 任务属性 ==>> {}", marketingActivityId, attrStr);
log.warn("未找到对应的活动,参数 marketingActivityId ==>> {} || 营销活动id ==>> [{}]", marketingActivityId, entityId);
return false;
}
......@@ -895,6 +890,10 @@ public class TaskOperationServiceImpl implements TaskOperationService {
Timestamp expireTime = task.getExpireTime();
// 积分类型(0:定值、1:随机)
Integer pointsType = task.getPointsType();
if (Objects.isNull(pointsType)) {
log.error("当前任务的积分类型不存在,请检查数据 task ==>> {}", task);
return;
}
// 随机积分的最大值
Integer rewardMaxPoints = task.getRewardMaxPoints();
if (Objects.nonNull(rewardPoints) && rewardPoints > 0) {
......
......@@ -6,7 +6,6 @@ import com.topdraw.business.module.task.template.domain.TaskTemplateBuilder;
import com.topdraw.business.module.task.template.service.TaskTemplateService;
import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
import com.topdraw.business.process.service.TaskTemplateOperationService;
import com.topdraw.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.BeanUtils;
......
......@@ -6,6 +6,11 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.base.modules.exception.BadRequestException;
import com.topdraw.base.modules.exception.EntityNotFoundException;
import com.topdraw.base.modules.utils.QueryHelp;
import com.topdraw.base.modules.utils.RedisUtils;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.domain.MemberBuilder;
import com.topdraw.business.module.member.domain.MemberTypeConstant;
......@@ -48,15 +53,10 @@ import com.topdraw.business.process.service.dto.MemberAndWeixinUserDTO;
import com.topdraw.business.process.service.mapper.CollectionMq2DetailMapper;
import com.topdraw.business.LocalConstants;
import com.topdraw.business.RedisKeyConstants;
import com.topdraw.common.ResultInfo;
import com.topdraw.util.RedisKeyUtil;
import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.EntityNotFoundException;
import com.topdraw.exception.GlobeExceptionMsg;
import com.topdraw.resttemplate.RestTemplateClient;
import com.topdraw.util.TimestampUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.aop.framework.AopContext;
......@@ -128,19 +128,24 @@ public class UserOperationServiceImpl implements UserOperationService {
@Transactional(rollbackFor = Exception.class)
public UserAppDTO appRegister(UserApp resources) {
// 只查询有效或者禁止状态的
UserAppDTO userAppDTO = this.userAppService.findByUsername(resources.getUsername());
if (Objects.isNull(userAppDTO.getId())) {
// 先创建会员
Member member = MemberBuilder.build(MemberTypeConstant.app, resources.getHeadimgurl(), resources.getNickname(), 0);
MemberDTO memberDTO = this.memberService.create(member);
// 无app账号
if (Objects.isNull(userAppDTO.getId())) {
// 先创建会员,缓存至redis
MemberDTO memberDTO = this.createMember(MemberBuilder.build(MemberTypeConstant.app, resources.getHeadimgurl(), resources.getNickname(), 0));
if (Objects.nonNull(memberDTO.getId())) {
UserApp userApp = UserAppBuilder.build(memberDTO.getId(), resources);
// 保存app账号
UserAppDTO _userAppDTO = this.userAppService.create(UserAppBuilder.build(memberDTO.getId(), resources));
UserAppDTO _userAppDTO = null;
if (Objects.isNull(userApp.getId())) {
_userAppDTO = this.userAppService.create(userApp);
} else {
_userAppDTO = this.userAppService.createByManual(userApp);
}
if (Objects.nonNull(_userAppDTO.getId()) && StringUtils.isNotBlank(resources.getAccount())) {
if (Objects.nonNull(_userAppDTO.getId()) && Objects.nonNull(_userAppDTO.getId()) && StringUtils.isNotBlank(resources.getAccount())) {
UserAppBindDTO userAppBindDTO = this.userAppBindService.findFirstByAccount(resources.getAccount());
if (Objects.isNull(userAppBindDTO.getId())) {
// 保存绑定关系
......@@ -152,18 +157,27 @@ public class UserOperationServiceImpl implements UserOperationService {
}
}
// 同步至大屏侧
AppRegisterDTO appRegisterDTO = new AppRegisterDTO();
appRegisterDTO.setMemberDTO(memberDTO);
appRegisterDTO.setUserAppDTO(_userAppDTO);
((UserOperationServiceImpl)AopContext.currentProxy()).asyncAppRegister(appRegisterDTO);
return _userAppDTO;
try {
Map<Object, Object> appCache = new HashMap<>();
appCache.put("id", _userAppDTO.getId());
appCache.put("memberId", _userAppDTO.getMemberId());
boolean appCacheResult = this.redisUtils.set(RedisKeyConstants.cacheAppById + ":" + _userAppDTO.getId(), appCache);
log.info("app注册时,缓存app账号信息,appRegister# appCacheResult ==>> "+ appCacheResult);
} catch (Exception e) {
log.error("app注册时,缓存app账号信息异常,appRegister# message ==>> {}", e.getMessage());
}
return _userAppDTO;
}
}
// app账号存在的话直接返回
return userAppDTO;
}
......@@ -176,16 +190,18 @@ public class UserOperationServiceImpl implements UserOperationService {
if (Objects.nonNull(userAppBindDTO.getUserAppId())) {
UserAppDTO userAppDTO = this.userAppService.findById(userAppBindDTO.getUserAppId());
if (Objects.isNull(userAppDTO.getId())) {
log.error("解绑第三方账号失败异常,cancelUserAppBind# message ==>> app账号不存在");
return ResultInfo.failure("app账号不存在");
}
}
boolean b = this.userAppBindService.cancelUserAppBind(account, accountType);
if (b) {
if (this.userAppBindService.cancelUserAppBind(account, accountType)) {
return ResultInfo.success(true);
}
}
return ResultInfo.failure("取消绑定失败");
log.error("解绑第三方账号失败异常,cancelUserAppBind# message ==>> 无第三方账号");
return ResultInfo.failure("解绑第三方账号失败,无第三方账号");
}
......@@ -197,7 +213,7 @@ public class UserOperationServiceImpl implements UserOperationService {
String nickname = resources.getNickname();
UserAppDTO userAppDTO = this.userAppService.findByUsername(username);
log.info("通过app账号查询app信息是否存在,[appBindThirdAccount#{}]", userAppDTO);
log.info("查询app信息,appBindThirdAccount# userAppDTO ==>> {}", userAppDTO);
if (Objects.isNull(userAppDTO.getId())) {
return ResultInfo.failure("app账号不存在");
}
......@@ -236,7 +252,7 @@ public class UserOperationServiceImpl implements UserOperationService {
}
}
userApp.setNickname(nickname);
log.info("同步app账号的昵称、头像,[appBindThirdAccount#{}]", userAppDTO);
log.info("修改数据库,修改app账号的昵称、头像,appBindThirdAccount# userApp ==>> {}", userApp);
boolean result = this.userAppService.updateAppLastActiveTimeAndNicknameAndHeadImg(userApp);
if (result) {
UserAppDTO userAppDTO1 = new UserAppDTO();
......@@ -247,6 +263,7 @@ public class UserOperationServiceImpl implements UserOperationService {
if (Objects.nonNull(userAppBindDTO.getId())) {
resources.setUserAppId(userAppDTO.getId());
log.info("修改数据库,修改绑定关系的昵称、头像,updateValidStatusAndUserAppIdAndNickname# resources ==>> {}", resources);
boolean result = this.userAppBindService.updateValidStatusAndUserAppIdAndNickname(resources);
if (result) {
UserAppDTO userAppDTO1 = new UserAppDTO();
......@@ -259,7 +276,7 @@ public class UserOperationServiceImpl implements UserOperationService {
} else {
resources.setUserAppId(userAppDTO.getId());
resources.setStatus(1);
log.info("第三方账号不存在,新增关联关系[appBindThirdAccount#{}]", resources);
log.info("保存关联关系,updateValidStatusAndUserAppIdAndNickname# resources ==>> {}", resources);
this.userAppBindService.create(resources);
UserAppDTO userAppDTO1 = new UserAppDTO();
......@@ -273,7 +290,7 @@ public class UserOperationServiceImpl implements UserOperationService {
@Override
public UserAppSimpleDTO updateAppInfo(UserApp resources) {
log.info("修改app信息,updateValidStatusAndUserAppIdAndNickname# resources ==>> {}", resources);
UserAppSimpleDTO userAppSimpleDTO = this.userAppService.updateAppInfo(resources);
if (Objects.nonNull(userAppSimpleDTO.getId())) {
UserAppDTO userAppDTO = new UserAppDTO();
......@@ -281,26 +298,10 @@ public class UserOperationServiceImpl implements UserOperationService {
userAppDTO.setUsername(userAppSimpleDTO.getUsername());
((UserOperationServiceImpl)AopContext.currentProxy()).asyncUpdateAppInfo(userAppDTO);
}
return userAppSimpleDTO;
}
@Override
public boolean updatePasswordById(UserApp resources) {
UserAppDTO userAppDTO = this.userAppService.findById(resources.getId());
if (Objects.nonNull(userAppDTO.getId())) {
if (this.userAppService.updatePasswordById(resources)) {
((UserOperationServiceImpl)AopContext.currentProxy()).asyncUpdatePasswordByUsername(userAppDTO);
return true;
}
}
return false;
return userAppSimpleDTO;
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultInfo saveGrowthReport(GrowthReport growthReport) {
......@@ -308,7 +309,7 @@ public class UserOperationServiceImpl implements UserOperationService {
UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
if (Objects.isNull(userTvDTO.getId())) {
log.error("保存成长报告失败,大屏信息不存在[saveGrowthReport#]");
log.error("保存成长报告异常,saveGrowthReport# message ==>> 大屏信息不存在 | platformAccount ==>> {}", platformAccount);
return ResultInfo.failure("保存成长报告失败,大屏信息不存在");
}
......@@ -322,10 +323,10 @@ public class UserOperationServiceImpl implements UserOperationService {
growthReport.setMemberId(memberId);
growthReport.setStartDate(weekFirstDay);
growthReport.setEndDate(weekLastDay);
log.info("保存成长报告,参数[saveGrowthReport#{}]", growthReport);
log.info("保存成长报告,saveGrowthReport# message ==>> {}", growthReport);
this.growthReportService.create(growthReport);
} else {
log.info("修改成长报告,参数[saveGrowthReport#{}]", growthReport);
log.info("修改成长报告,saveGrowthReport# message ==>> {}", growthReport);
this.growthReportService.updateGrowthReportData(growthReportDTO.getId(), growthReport.getData());
}
......@@ -338,12 +339,11 @@ public class UserOperationServiceImpl implements UserOperationService {
public boolean appCancellation(UserApp userApp) {
UserAppDTO userAppDTO = this.userAppService.findById(userApp.getId());
if (Objects.nonNull(userAppDTO.getId())){
boolean b = this.userAppService.appCancellation(userApp.getId());
if (b) {
if (this.userAppService.appCancellation(userApp.getId())) {
List<UserAppBindDTO> userAppBindDTOS = this.userAppBindService.findByUserAppId(userAppDTO.getId());
if (!CollectionUtils.isEmpty(userAppBindDTOS)) {
List<Long> ids = userAppBindDTOS.stream().map(UserAppBindDTO::getId).collect(Collectors.toList());
this.userAppBindService.appCancellation(ids);
return this.userAppBindService.appCancellation(ids);
}
((UserOperationServiceImpl)AopContext.currentProxy()).asyncAppCancellation(userAppDTO);
......@@ -351,7 +351,7 @@ public class UserOperationServiceImpl implements UserOperationService {
}
return true;
return false;
}
/**
......@@ -362,39 +362,29 @@ public class UserOperationServiceImpl implements UserOperationService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public UserTvDTO createTvUserAndMember(UserTv resources) {
public ResultInfo createTvUserAndMember(UserTv resources) {
// 大屏账户
String platformAccount = resources.getPlatformAccount();
UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
// 无账号
if (Objects.isNull(userTvDTO.getId())) {
// 会员昵称默认采用大屏账号,昵称通过base64加密与小屏保持一致
String platformAccountEncode = Base64Utils.encodeToString(platformAccount.getBytes());
// x_member
Member member =
MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_VIS,
null, platformAccountEncode, 0);
MemberDTO memberDTO = this.createMember(member);
MemberDTO memberDTO = this.createMember(MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_VIS,
null, platformAccountEncode, 0));
if (Objects.nonNull(memberDTO)) {
UserTv userTv = UserTvBuilder.build(memberDTO.getId(), memberDTO.getCode(), resources);
// 创建大屏账户
UserTvDTO _tvUserDTO = this.createTvUser(userTv, memberDTO.getId(), memberDTO.getCode());
((UserOperationServiceImpl)AopContext.currentProxy()).asyncMemberAndUserTv4Iptv(new MemberAndUserTvDTO(memberDTO, _tvUserDTO));
return _tvUserDTO;
return ResultInfo.success(_tvUserDTO);
}
log.error("保存大屏账号信息异常,无法创建大屏账号对应的会员,platoformAccount ==> {}", platformAccount);
throw new EntityNotFoundException(MemberDTO.class, "code", GlobeExceptionMsg.MEMBER_ID_IS_NULL);
log.error("保存大屏账号信息异常,createTvUserAndMember# message ==> 会员创建失败");
return ResultInfo.failure(GlobeExceptionMsg.MEMBER_ID_IS_NULL);
// 有账号
} else {
......@@ -402,14 +392,12 @@ public class UserOperationServiceImpl implements UserOperationService {
Long memberId = userTvDTO.getMemberId();
// 有会员
if (Objects.nonNull(memberId)) {
return userTvDTO;
return ResultInfo.success(userTvDTO);
}
// 无会员
Member member =
MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_VIS,
null, platformAccount, 0);
MemberDTO memberDTO = this.createMember(member);
MemberDTO memberDTO = this.createMember(MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_VIS,
null, platformAccount, 0));
if (Objects.nonNull(memberDTO)) {
......@@ -421,12 +409,12 @@ public class UserOperationServiceImpl implements UserOperationService {
UserTvDTO _userTvDTO = this.userTvService.update(userTv);
((UserOperationServiceImpl)AopContext.currentProxy()).asyncMemberAndUserTv4Iptv(new MemberAndUserTvDTO(memberDTO, _userTvDTO));
return _userTvDTO;
return ResultInfo.success(_userTvDTO);
}
}
throw new BadRequestException(GlobeExceptionMsg.ENTITY_ALREADY_EXISTS);
return ResultInfo.failure(GlobeExceptionMsg.ENTITY_ALREADY_EXISTS);
}
......@@ -437,12 +425,17 @@ public class UserOperationServiceImpl implements UserOperationService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public UserWeixinDTO createWeixinUserAndMember(UserWeixin resources) {
public ResultInfo createWeixinUserAndMember(UserWeixin resources) {
return this.createWeixinUserAndMember(resources, 0);
}
@Override
public UserWeixinDTO createWeixinUserAndMember(UserWeixin resources, Integer vip) {
public ResultInfo createWeixinUserAndMember(UserWeixin resources, Integer vip) {
UserWeixinDTO userWeixinDTO = this.createWeixinAndMember(resources, vip);
return ResultInfo.success(userWeixinDTO);
}
private UserWeixinDTO createWeixinAndMember(UserWeixin resources, Integer vip){
String appId = resources.getAppid();
String openId = resources.getOpenid();
String unionId = resources.getUnionid();
......@@ -453,8 +446,8 @@ public class UserOperationServiceImpl implements UserOperationService {
// 小屏账号
UserWeixinDTO userWeixinDTO = this.findFirstByAppIdAndOpenId(appId, openId);
if (Objects.nonNull(userWeixinDTO.getId()) && Objects.nonNull(userWeixinDTO.getMemberId())) {
log.error("createWeixinUserAndMember ==>> result ==>> [{}]", userWeixinDTO);
throw new BadRequestException(GlobeExceptionMsg.OPERATION_FORBID + "==>> " + GlobeExceptionMsg.ENTITY_ALREADY_EXISTS);
log.warn("创建微信账号时异常,createWeixinUserAndMember# message ==>> 微信账号已存在 | userWeixinDTO ==>> {}", userWeixinDTO);
return userWeixinDTO;
}
// 账号存在但无会员
......@@ -480,10 +473,8 @@ public class UserOperationServiceImpl implements UserOperationService {
} else {
// 有其他账号但都无会员,新建会员并将此账号绑定新建的这个会员
Member member = MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
headimgurl, nickname, vip, sex);
MemberDTO memberDTO = this.createMember(member);
MemberDTO memberDTO = this.createMember( MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
headimgurl, nickname, vip, sex));
if (Objects.nonNull(memberDTO)) {
userWeixinDTO.setMemberId(memberDTO.getId());
......@@ -497,16 +488,15 @@ public class UserOperationServiceImpl implements UserOperationService {
}
throw new RuntimeException("系统错误,保存微信账号失败,创建会员信息失败");
}
} else {
// 该账号存在但无其他账号,新建会员
Member member =
MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
headimgurl, nickname, vip, sex);
MemberDTO memberDTO = this.createMember(member);
MemberDTO memberDTO = this.createMember(MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
headimgurl, nickname, vip, sex));
if (Objects.nonNull(memberDTO)) {
userWeixinDTO.setMemberId(memberDTO.getId());
......@@ -520,6 +510,8 @@ public class UserOperationServiceImpl implements UserOperationService {
}
throw new RuntimeException("系统错误,保存微信账号失败,创建会员信息失败");
}
}
......@@ -572,15 +564,11 @@ public class UserOperationServiceImpl implements UserOperationService {
} else {
// 新建会员
Member _member =
MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
headimgurl, nickname, vip, sex);
MemberDTO memberDTO = this.createMember(_member);
MemberDTO memberDTO = this.createMember(MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
headimgurl, nickname, vip, sex));
if (Objects.nonNull(memberDTO)) {
UserWeixin userWeixin = UserWeixinBuilder.build(memberDTO.getId(), resources);
UserWeixinDTO _userWeixinDTO1 = this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode());
UserWeixinDTO _userWeixinDTO1 = this.createWeixinUser(UserWeixinBuilder.build(memberDTO.getId(), resources), memberDTO.getId(), memberDTO.getCode());
// 同步至iptv
((UserOperationServiceImpl)AopContext.currentProxy()).
......@@ -589,7 +577,7 @@ public class UserOperationServiceImpl implements UserOperationService {
return _userWeixinDTO1;
}
throw new EntityNotFoundException(MemberDTO.class, "code", GlobeExceptionMsg.MEMBER_CODE_IS_NULL);
throw new RuntimeException("系统错误,保存微信账号失败,创建会员信息失败");
}
......@@ -607,7 +595,7 @@ public class UserOperationServiceImpl implements UserOperationService {
public UserWeixinDTO serviceLogin(UserWeixin resources) {
// 创建小屏账户同时创建会员
UserWeixinDTO userWeixinDTO = this.createWeixinUserAndMember(resources);
UserWeixinDTO userWeixinDTO = this.createWeixinAndMember(resources, 0);
// 为了保证返回的同一用户
return this.getFirstId(userWeixinDTO);
......@@ -623,8 +611,7 @@ public class UserOperationServiceImpl implements UserOperationService {
public UserWeixinDTO appletLogin(UserWeixin resources) {
// 创建小屏账户同时创建会员
UserWeixinDTO userWeixinDTO = this.createWeixinUserAndMember(resources);
UserWeixinDTO userWeixinDTO = this.createWeixinAndMember(resources, 0);
// 为了保证返回的同一用户
return this.getFirstId(userWeixinDTO);
}
......@@ -663,7 +650,7 @@ public class UserOperationServiceImpl implements UserOperationService {
userWeixin.setHeadimgurl(headImgUrl);
// 创建小屏账户同时创建会员
userWeixinDTO = this.createWeixinUserAndMember(userWeixin, 1);
userWeixinDTO = this.createWeixinAndMember(userWeixin, 1);
Long memberId = userWeixinDTO.getMemberId();
memberDTO = this.memberService.findById(memberId);
......@@ -673,6 +660,7 @@ public class UserOperationServiceImpl implements UserOperationService {
UserWeixin userWeixin = new UserWeixin();
userWeixin.setId(userWeixinDTO.getId());
userWeixin.setStatus(SUBSCRIBE_STATUS);
log.info("修改微信信息status状态应改为1, subscribe# userWeixin ==>> {}" , userWeixin);
userWeixinDTO = this.userWeixinService.doUpdateWeixinStatus(userWeixin);
// 小屏会员
memberDTO = this.memberService.findById(userWeixinDTO.getMemberId());
......@@ -692,14 +680,14 @@ public class UserOperationServiceImpl implements UserOperationService {
}
}
// 修改会员信息
log.info("修改会员信息vip以及vip过期时间, subscribe# member ==>> {}" , member);
memberDTO = this.memberService.doUpdateMemberVipAndVipExpireTime(member);
log.info("发送关注消息至大屏侧,发送的账号信息 ==>> {} || 会员信息 ==>> {}", userWeixinDTO , memberDTO);
// 同步大屏侧
((UserOperationServiceImpl)AopContext.currentProxy()).asyncSubscribe(new MemberAndWeixinUserDTO(memberDTO, userWeixinDTO));
// 大屏信息
JSONObject visUserInfo = resources.getIptvUserInfo();
log.info("存储的大小屏账号信息 iptvUserInfo ==>> {}" , visUserInfo);
log.info("关注时大屏信息, subscribe# visUserInfo ==>> {}" , visUserInfo);
if (Objects.nonNull(visUserInfo)) {
// 大屏账户
String platformAccount = visUserInfo.getString("platformAccount");
......@@ -713,20 +701,19 @@ public class UserOperationServiceImpl implements UserOperationService {
}
if (StringUtils.isBlank(platformAccount)) {
log.error("关注后绑定失败,platformAccount is null ");
log.error("关注后绑定异常,subscribe# message ==>> 无大屏账号");
return false;
}
}
log.info("存储的大屏账号信息 platformAccount ==>> {}" , platformAccount);
// 绑定
log.info("关注后绑定,绑定信息 subscribe# memberDTO ==>> {} | platformAccount ==>> {}", memberDTO, platformAccount);
this.bind(memberDTO, platformAccount);
log.info("绑定结束");
}
// 保存关注记录
JSONObject sourceInfo = resources.getSourceInfo();
log.info("保存关注记录,数据 [subscribe#{}]", sourceInfo);
log.info("保存关注记录,subscribe# sourceInfo ==>> {}", sourceInfo);
this.saveWechatSubscribeRecord(memberDTO, sourceInfo, 1);
return true;
......@@ -801,12 +788,12 @@ public class UserOperationServiceImpl implements UserOperationService {
UserWeixinDTO userWeixinDTO = this.userWeixinService.findFirstByAppIdAndOpenId(appId, openId);
if (Objects.isNull(userWeixinDTO.getId())) {
log.error("取关失败,通过appid ==>> {} 和 openId ==>> {} 无法查询到指定的微信账号", appId, openId);
log.error("取关失败,unsubscribe# message ==>> 通过appid ==>> {} 和 openId ==>> {} 无法查询到指定的微信账号", appId, openId);
return false;
}
if (Objects.isNull(userWeixinDTO.getMemberId())) {
log.error("取关失败,该微信账号无会员id ==>> {}", userWeixinDTO);
log.error("取关失败,unsubscribe# message ==>> 该微信账号无会员 userWeixinDTO ==>> {}", userWeixinDTO);
return false;
}
......@@ -863,8 +850,6 @@ public class UserOperationServiceImpl implements UserOperationService {
@Override
public UserWeixinDTO saveUserInfo(String data) {
log.info("result ====>> [{}]",data);
JSONObject json = JSONObject.parseObject(data);
String unionId = json.getString("unionid");
// 订阅号appid
......@@ -893,7 +878,6 @@ public class UserOperationServiceImpl implements UserOperationService {
this.redisUtils.set(RedisKeyUtil.genSeSuSubscribeKey(unionId), data, 300);
Object o = this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionId));
String contentJsonStr = JSON.toJSONString(o);
log.info("H5 save in redis contentJsonStr ====>> [{}]",contentJsonStr);
// 若未传dyAppId。不走下面的流程
if (StrUtil.isNotBlank(appId)) {
......@@ -921,8 +905,9 @@ public class UserOperationServiceImpl implements UserOperationService {
String platformAccount = resources.getPlatformAccount();
UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
if (Objects.nonNull(userTvDTO)) {
if (StringUtils.isNotBlank(userTvDTO.getPriorityMemberCode()) && userTvDTO.getPriorityMemberCode().equalsIgnoreCase(memberCode))
if (StringUtils.isNotBlank(userTvDTO.getPriorityMemberCode()) && userTvDTO.getPriorityMemberCode().equalsIgnoreCase(memberCode)) {
throw new BadRequestException("会员已是主账户");
}
} else {
throw new EntityNotFoundException(UserTvDTO.class , "platformAccount" , GlobeExceptionMsg.IPTV_IS_NULL);
}
......@@ -937,6 +922,13 @@ public class UserOperationServiceImpl implements UserOperationService {
// 同步至iptv
((UserOperationServiceImpl)AopContext.currentProxy()).asyncUserTvChangeMainAccount(userTvDTO);
UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount);
if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount())) {
userTvSimpleDTO.setPriorityMemberCode(memberCode);
JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class);
this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + platformAccount, hashMap);
}
return true;
}
......@@ -954,16 +946,16 @@ public class UserOperationServiceImpl implements UserOperationService {
String memberCode = resources.getMemberCode();
UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
log.info("大屏解绑,通过大屏账号查询大屏账号信息,结果 userTvDTO ==>> {}", userTvDTO);
log.info("大屏解绑,通过大屏账号查询大屏账号信息,结果 tvUnbind# userTvDTO ==>> {}", userTvDTO);
if (Objects.isNull(userTvDTO.getId())) {
log.error("大屏解绑失败,无对应的大屏账号信息, platformAccount ==>> {}", platformAccount);
return false;
log.error("大屏解绑异常,tvUnbind# message ==>>无对应的大屏账号信息 | platformAccount ==>> {}", platformAccount);
throw new EntityNotFoundException(UserTvDTO.class , "platformAccount" , GlobeExceptionMsg.IPTV_IS_NULL);
}
MemberDTO memberDTO = this.memberService.findByCode(memberCode);
log.info("大屏解绑,通过会员code查询会员信息,结果memberDTO==>>{}", memberDTO);
log.info("大屏解绑,通过会员code查询会员信息,tvUnbind# memberDTO ==>> {}", memberDTO);
if (Objects.isNull(memberDTO.getId())) {
log.error("大屏解绑失败,无对应的会员信息, memberCode ==>> {}", memberCode);
log.error("大屏解绑异常,tvUnbind# message ==>> 无对应的会员信息");
return false;
}
......@@ -974,9 +966,8 @@ public class UserOperationServiceImpl implements UserOperationService {
member.setBindIptvTime(null);
member.setUserIptvId(null);
member.setBindIptvPlatformType(null);
log.info("置空会员绑定的大屏信息, member ==>> {}", member);
log.info("置空会员绑定的大屏信息, 参数 tvUnbind# member ==>> {}", member);
memberDTO = this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member);
log.info("会员信息置空大屏的结果,memberDTO ==>> {}", memberDTO);
memberDTO.setPlatformAccount(platformAccount);
if (StringUtils.isBlank(bindMemberCode)) {
......@@ -988,10 +979,14 @@ public class UserOperationServiceImpl implements UserOperationService {
UserTvDTO _userTvDTO = new UserTvDTO();
_userTvDTO.setPlatformAccount(platformAccount);
_userTvDTO.setPriorityMemberCode(null);
log.info("大屏账号置空主会员的结果,userTvDTO ==>> {}", _userTvDTO);
((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO));
this.updateUserTvSimplePriorityMemberCodeRedis(platformAccount, "");
UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount);
if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount())) {
userTvSimpleDTO.setPriorityMemberCode("");
JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class);
this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + platformAccount, hashMap);
}
} else {
......@@ -1004,9 +999,14 @@ public class UserOperationServiceImpl implements UserOperationService {
UserTvDTO _userTvDTO = new UserTvDTO();
_userTvDTO.setPlatformAccount(platformAccount);
_userTvDTO.setPriorityMemberCode(bindMemberCode);
log.info("大屏账号置空主会员的结果,userTvDTO ==>> {}", userTvDTO);
((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO));
this.updateUserTvSimplePriorityMemberCodeRedis(platformAccount, bindMemberCode);
UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount);
if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount())) {
userTvSimpleDTO.setPriorityMemberCode(bindMemberCode);
JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class);
this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + platformAccount, hashMap);
}
}
return true;
......@@ -1159,9 +1159,7 @@ public class UserOperationServiceImpl implements UserOperationService {
}
for (UserCollectionMq collectionMq : value) {
UserCollectionDetail userCollectionDetail = collectionMq2DetailMapper.toEntity(collectionMq);
List<UserCollectionDetail> userCollectionDetailOptional = userCollectionDetailRepository
.findByDetailIdAndDetailTypeAndUserCollectionId(userCollectionDetail.getDetailId(),
userCollectionDetail.getDetailType(), userCollection.getId());
......@@ -1206,39 +1204,38 @@ public class UserOperationServiceImpl implements UserOperationService {
public boolean minaBind(BindBean resources) {
Long memberId = resources.getMemberId();
String platformAccount = resources.getPlatformAccount();
// 大屏账户
UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
log.info("查询大屏账号信息, userTvDTO ==>> {}", userTvDTO);
log.info("小程序绑定,查询大屏账号信息 minaBind# userTvDTO ==>> {}", userTvDTO);
// 账户是否存在
if (Objects.isNull(userTvDTO.getId())) {
log.error("大屏账号信息不存在,platformAccount ==> {}",platformAccount);
log.error("小程序绑定异常,minaBind# message ==>> 大屏账号信息不存在");
return false;
}
// 微信账户
if (Objects.nonNull(memberId)) {
UserWeixinDTO userWeixinDTO = this.userWeixinService.findFirstByMemberId(memberId);
log.info("检查小屏账号是否存在, userWeixinDTO ==>> {}", userWeixinDTO);
log.info("检查小屏账号,minaBind# userWeixinDTO ==>> {}", userWeixinDTO);
// 账户是否存在
if (Objects.isNull(userWeixinDTO.getId())) {
log.error("通过会员id无法找到对应的微信账号,memberId ==> {}", memberId);
log.error("小程序绑定大屏异常,minaBind# message ==> 微信账号不存在 | memberId ==>> {}", memberId);
return false;
}
}
MemberDTO memberDTO = this.memberService.findById(memberId);
log.info("检查会员是否存在, memberDTO ==>> {}", memberDTO);
log.info("查询会员信息,minaBind# memberDTO ==>> {}", memberDTO);
if (Objects.nonNull(memberDTO.getId())) {
Long userIptvId = memberDTO.getUserIptvId();
if (Objects.nonNull(userIptvId)) {
log.error("该会员已绑定,大屏id ==> {}", userIptvId);
log.error("小程序绑定大屏异常,minaBind# message ==> 当前账号信息绑定了其他大屏 | 绑定的大屏id ==>> {}", userIptvId);
throw new BadRequestException(GlobeExceptionMsg.ALREADY_BIND);
}
} else {
log.error("会员信息不存在,请检查数据, memberId ==>> {}", memberId);
log.error("小程序绑定大屏异常,minaBind# message ==> 会员信息不存在 | memberId ==>> {}", memberId);
return false;
}
......@@ -1247,14 +1244,13 @@ public class UserOperationServiceImpl implements UserOperationService {
if (StringUtils.isBlank(priorityMemberCode)) {
priorityMemberCode = memberDTO.getCode();
log.info("大屏账号为绑定主账号,开始设置主会员 priorityMemberCode ==>> {}", priorityMemberCode);
UserTv userTv = new UserTv();
userTv.setId(userTvDTO.getId());
userTv.setPriorityMemberCode(priorityMemberCode);
// 更新大屏账户
log.info("设置主会员,minaBind# userTv ==>> {}", userTv);
this.userTvService.doUpdatePriorityMemberCode(userTv);
userTvDTO.setPriorityMemberCode(memberDTO.getCode());
}
......@@ -1279,24 +1275,119 @@ public class UserOperationServiceImpl implements UserOperationService {
member.setUserIptvId(userTvDTO.getId());
member.setBindIptvTime(TimestampUtil.now());
member.setBindIptvPlatformType(bindIptvPlatformType);
log.info("修改小屏会员对应的绑定关系,member ==>> {}", member);
log.info("修改小屏会员对应的绑定关系,minaBind# member ==>> {}", member);
// 修改会员信息
this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member);
memberDTO.setPlatformAccount(platformAccount);
log.info("发送绑定消息至大屏,memberDTO ==>> {} || userTvDTO ==>> {}", memberDTO, userTvDTO);
log.info("发送绑定消息至大屏,minaBind# memberDTO ==>> {} || userTvDTO ==>> {}", memberDTO, userTvDTO);
// 同步至iptv
((UserOperationServiceImpl)AopContext.currentProxy())
.asyncMinaBind(new MemberAndUserTvDTO(memberDTO, userTvDTO));
this.updateUserTvSimplePriorityMemberCodeRedis(platformAccount, memberDTO.getCode());
UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount);
if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount()) && StringUtils.isBlank(userTvSimpleDTO.getPriorityMemberCode())) {
userTvSimpleDTO.setPriorityMemberCode(priorityMemberCode);
JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class);
this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + platformAccount, hashMap);
}
return true;
}
@Override
public boolean appBind(BindBean resources) {
return this.minaBind(resources);
public ResultInfo appBind(BindBean resources) {
Long memberId = resources.getMemberId();
String platformAccount = resources.getPlatformAccount();
// 大屏账户
UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
log.info("查询大屏账号信息, appBind# userTvDTO ==>> {}", userTvDTO);
// 账户是否存在
if (Objects.isNull(userTvDTO.getId())) {
log.error("大屏账号信息不存在, appBind# platformAccount ==> {}",platformAccount);
return ResultInfo.failure("大屏账号信息不存在, 请检查数据");
}
// app账户
if (Objects.nonNull(memberId)) {
UserAppDTO userAppDTO = this.userAppService.findByMemberId(memberId);
log.info("检查app账号是否存在, appBind# userAppDTO ==>> {}", userAppDTO);
// 账户是否存在
if (Objects.isNull(userAppDTO.getId())) {
log.error("通过会员id无法找到对应的app账号, appBind# memberId ==> {}", memberId);
return ResultInfo.failure("app账号不存在,请检查数据");
}
}
MemberDTO memberDTO = this.memberService.findById(memberId);
log.info("检查会员是否存在, appBind# memberDTO ==>> {}", memberDTO);
if (Objects.nonNull(memberDTO.getId())) {
Long userIptvId = memberDTO.getUserIptvId();
if (Objects.nonNull(userIptvId)) {
log.error("该会员已绑定,appBind# 会员id ==> {} | 绑定的大屏账号id ==>> {}", memberDTO.getId(), userIptvId);
return ResultInfo.failure(GlobeExceptionMsg.ALREADY_BIND);
}
} else {
log.error("会员信息不存在,请检查数据, appBind# memberId ==>> {}", memberId);
return ResultInfo.failure("会员信息不存在,请检查数据");
}
// 主账户
String priorityMemberCode = userTvDTO.getPriorityMemberCode();
if (StringUtils.isBlank(priorityMemberCode)) {
priorityMemberCode = memberDTO.getCode();
UserTv userTv = new UserTv();
userTv.setId(userTvDTO.getId());
userTv.setPriorityMemberCode(priorityMemberCode);
log.info("设置主会员,appBind# userTv ==>> {}", userTv);
this.userTvService.doUpdatePriorityMemberCode(userTv);
userTvDTO.setPriorityMemberCode(memberDTO.getCode());
}
Member member = new Member();
member.setId(memberDTO.getId());
member.setCode(memberDTO.getCode());
String platform = userTvDTO.getPlatform();
// 绑定IPTV平台 0:未知;1:电信;2:移动;3:联通
Integer bindIptvPlatformType = 0;
// 联通
if (UserConstant.platform_lt.contains(platform)) {
bindIptvPlatformType = PLATFORM_LIST[3];
}
// 移动
if (UserConstant.platform_yd.contains(platform)) {
bindIptvPlatformType = PLATFORM_LIST[2];
}
// 电信
if (UserConstant.platform_dx.contains(platform)) {
bindIptvPlatformType = PLATFORM_LIST[1];
}
member.setUserIptvId(userTvDTO.getId());
member.setBindIptvTime(TimestampUtil.now());
member.setBindIptvPlatformType(bindIptvPlatformType);
log.info("修改小屏会员对应的绑定关系,appBind# member ==>> {}", member);
// 修改会员信息
this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member);
memberDTO.setPlatformAccount(platformAccount);
log.info("发送绑定消息至大屏,appBind# memberDTO ==>> {} || userTvDTO ==>> {}", memberDTO, userTvDTO);
// 同步至iptv
((UserOperationServiceImpl)AopContext.currentProxy())
.asyncMinaBind(new MemberAndUserTvDTO(memberDTO, userTvDTO));
UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount);
if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount()) && StringUtils.isBlank(userTvSimpleDTO.getPriorityMemberCode())) {
userTvSimpleDTO.setPriorityMemberCode(priorityMemberCode);
JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class);
this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + platformAccount, hashMap);
}
return ResultInfo.success(true);
}
/**
......@@ -1307,16 +1398,15 @@ public class UserOperationServiceImpl implements UserOperationService {
*/
@Override
public UserTvDTO bind(MemberDTO resource, String platformAccount) {
log.info("bind start");
MemberDTO memberDTO = this.memberService.findByCode(resource.getCode());
log.info("查询会员信息 ==>> {}", memberDTO);
log.info("查询会员信息,bind# memberDTO ==>> {}", memberDTO);
if (Objects.nonNull(memberDTO.getUserIptvId())) {
return this.userTvService.findById(memberDTO.getUserIptvId());
}
// 大屏账户
UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
log.info("查询大屏账号信息 ==>> {}", userTvDTO);
log.info("查询大屏账号信息,bind# userTvDTO ==>> {}", userTvDTO);
if (Objects.isNull(userTvDTO)) {
throw new BadRequestException(GlobeExceptionMsg.IPTV_IS_NULL);
}
......@@ -1328,6 +1418,7 @@ public class UserOperationServiceImpl implements UserOperationService {
userTv.setId(userTvDTO.getId());
userTv.setPriorityMemberCode(memberDTO.getCode());
log.info("修改大屏对应的主会员,bind# userTv ==>> {}", userTv);
this.userTvService.doUpdatePriorityMemberCode(userTv);
userTvDTO.setPriorityMemberCode(memberDTO.getCode());
......@@ -1350,34 +1441,30 @@ public class UserOperationServiceImpl implements UserOperationService {
if (UserConstant.platform_dx.contains(platform)) {
bindIptvPlatformType = PLATFORM_LIST[1];
}
member.setId(memberDTO.getId());
member.setUserIptvId(userTvDTO.getId());
member.setBindIptvTime(TimestampUtil.now());
member.setBindIptvPlatformType(bindIptvPlatformType);
member.setPlatformAccount(platformAccount);
// 修改会员
log.info("修改会员对应的绑定关系,bind# member ==>> {}", member);
this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member);
memberDTO.setPlatformAccount(platformAccount);
log.info("发送绑定消息至大屏侧, 会员信息 ==>> {} || 账号信息 ==>> {}", memberDTO , userTvDTO);
log.info("发送绑定消息至大屏侧, bind# memberDTO ==>> {} || userTvDTO ==>> {}", memberDTO , userTvDTO);
// 同步至大屏侧
((UserOperationServiceImpl)AopContext.currentProxy()).asyncMinaBind(new MemberAndUserTvDTO(memberDTO, userTvDTO));
this.updateUserTvSimplePriorityMemberCodeRedis(platformAccount, memberDTO.getCode());
return userTvDTO;
}
private void updateUserTvSimplePriorityMemberCodeRedis(String platformAccount, String priorityMemberCode){
// 修改缓存中MemberSimple的大屏主账号信息,因为执行任务之前会去检查主会员d
UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount);
if (Objects.nonNull(userTvSimpleDTO)) {
if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount()) && StringUtils.isBlank(userTvSimpleDTO.getPriorityMemberCode())) {
userTvSimpleDTO.setPriorityMemberCode(priorityMemberCode);
JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class);
this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + platformAccount, hashMap);
}
return userTvDTO;
}
/**
......@@ -1399,7 +1486,6 @@ public class UserOperationServiceImpl implements UserOperationService {
return this.memberService.findById(memberId);
}
/**
*
* @param unionId 身份标识
......@@ -1472,12 +1558,16 @@ public class UserOperationServiceImpl implements UserOperationService {
* @param member 会员信息
* @return MemberDTO
*/
public MemberDTO createMember(Member member){
public MemberDTO createMember(Member member) {
MemberDTO memberDTO = this.memberService.create(member);
if (Objects.nonNull(memberDTO.getId())) {
MemberSimpleDTO memberSimpleDTO = new MemberSimpleDTO();
BeanUtils.copyProperties(memberDTO, memberSimpleDTO);
this.redisUtils.set(RedisKeyConstants.cacheMemberSimpleById+"::"+memberDTO.getId(), memberSimpleDTO);
try {
this.redisUtils.set(RedisKeyConstants.cacheMemberSimpleById + "::" + memberDTO.getId(), memberSimpleDTO);
} catch (Exception e) {
log.error("创建会员时,缓存会员信息异常, createMember# message ==>> {}", e.getMessage());
}
}
return memberDTO;
}
......@@ -1488,11 +1578,19 @@ public class UserOperationServiceImpl implements UserOperationService {
* @param memberId 会员id
* @return UserTvDTO
*/
private UserTvDTO createTvUser(UserTv resources, Long memberId, String memberCode){
private UserTvDTO createTvUser(UserTv resources, Long memberId, String memberCode) {
resources.setMemberId(memberId);
resources.setMemberCode(memberCode);
return this.userTvService.create(resources);
UserTvDTO userTvDTO = this.userTvService.create(resources);
if (Objects.nonNull(userTvDTO.getId())) {
Map<String, Object> map = new HashMap<>();
map.put("visUserId", resources.getVisUserId());
map.put("platformAccount", resources.getPlatformAccount());
map.put("id", resources.getId());
boolean redisResult = this.redisUtils.set("uus::visUser::" + userTvDTO.getPlatformAccount(), map);
log.info("保存大屏账号redis结果 createTvUser# redisResult ==>> {}", redisResult);
}
return userTvDTO;
}
/**
......@@ -1540,19 +1638,19 @@ public class UserOperationServiceImpl implements UserOperationService {
MemberDTO memberDTO = this.memberService.findById(memberId);
if (Objects.isNull(memberDTO.getId())) {
log.error("小屏解绑失败,会员信息不存在, minaUnbind# ==>> {}", memberId);
log.error("小屏解绑异常,minaUnbind# message ==>> 当前会员信息不存在 | memberId ==>> {}", memberId);
return ResultInfo.failure("小屏解绑失败,当前会员信息不存在");
}
if (Objects.isNull(memberDTO.getUserIptvId())) {
log.error("小屏解绑失败,无绑定的大屏, memberId ==>> {}", memberId);
log.error("小屏解绑异常,minaUnbind# message ==>> 无绑定的大屏 | memberId ==>> {}", memberId);
return ResultInfo.failure("小屏解绑失败,无绑定的大屏");
}
UserTvDTO userTvDTO = this.userTvService.findById(memberDTO.getUserIptvId());
if (Objects.isNull(userTvDTO.getPlatformAccount())) {
log.info("小屏解绑失败,绑定的大屏账号不存在 minaUnbind# ==>> userIptvId ==>> {}", memberDTO.getUserIptvId());
return ResultInfo.failure("小屏解绑失败,大屏信息不存在请联系客服");
log.info("小屏解绑异常,minaUnbind# message ==>> 当前会员绑定的大屏账号不存在 | memberId ==>> {}", memberDTO.getId());
return ResultInfo.failure("小屏解绑失败,大屏信息不存在");
}
// 解绑(置空大屏信息)
......@@ -1562,19 +1660,17 @@ public class UserOperationServiceImpl implements UserOperationService {
member.setBindIptvTime(null);
member.setUserIptvId(null);
member.setBindIptvPlatformType(null);
log.info("置空会员绑定的大屏信息, member ==>> {}", member);
log.info("置空会员绑定的大屏信息,minaUnbind# member ==>> {}", member);
this.memberService.doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(member);
log.info("会员信息置空大屏的结果,memberDTO ==>> {}", memberDTO);
// 有其他绑定的小程序会员,排除自己
List<MemberDTO> memberDTOS = this.memberService.findByUserIptvId(userTvDTO.getId());
log.info("后台指定一个默认主会员,通过大屏id查询到的绑定的小屏会员memberDTOList ==>> {}", memberDTOS);
log.info("通过大屏id查询到的绑定的小屏会员,minaUnbind# memberDTOList ==>> {}", memberDTOS);
if (!CollectionUtils.isEmpty(memberDTOS)) {
String oldMemberCode = memberDTO.getCode();
List<MemberDTO> collect =
memberDTOS.stream().filter(memberDTO_ ->
!memberDTO_.getCode().equalsIgnoreCase(oldMemberCode)).collect(Collectors.toList());
log.info("过滤掉当前会员 ==>> {}", collect);
if (!CollectionUtils.isEmpty(collect)) {
......@@ -1585,31 +1681,45 @@ public class UserOperationServiceImpl implements UserOperationService {
userTv.setId(userTvDTO.getId());
userTv.setPlatform(userTvDTO.getPlatformAccount());
userTv.setPriorityMemberCode(collect.get(0).getCode());
log.info("设置主会员,minaUnbind# userTv ==>> {}", userTv);
this.userTvService.doUpdatePriorityMemberCode(userTv);
UserTvDTO _userTvDTO = new UserTvDTO();
_userTvDTO.setPlatformAccount(userTvDTO.getPlatformAccount());
_userTvDTO.setPriorityMemberCode(userTv.getPriorityMemberCode());
log.info("同步绑定信息至大屏侧, 参数 ==>> {}", new MemberAndUserTvDTO(memberDTO, _userTvDTO));
log.info("同步信息至大屏侧,minaUnbind# MemberAndUserTvDTO ==>> {} ", new MemberAndUserTvDTO(memberDTO, _userTvDTO));
((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO));
this.updateUserTvSimplePriorityMemberCodeRedis(userTvDTO.getPlatformAccount(), userTv.getPriorityMemberCode());
UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(userTvDTO.getPlatformAccount());
if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount())) {
userTvSimpleDTO.setPriorityMemberCode(userTv.getPriorityMemberCode());
JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class);
this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + userTvDTO.getPlatformAccount(), hashMap);
}
}
} else {
log.info("无其他绑定的小屏会员信息 ");
// 绑定新的主账号
UserTv userTv = new UserTv();
userTv.setId(userTvDTO.getId());
userTv.setPriorityMemberCode(null);
log.info("无其他绑定的小屏会员信息,置空主会员 minaUnbind# userTv ==>> {}", userTv);
this.userTvService.doUpdatePriorityMemberCode(userTv);
UserTvDTO _userTvDTO = new UserTvDTO();
_userTvDTO.setPlatformAccount(userTvDTO.getPlatformAccount());
_userTvDTO.setPriorityMemberCode(null);
log.info("同步绑定信息至大屏侧, 参数 ==>> {}", new MemberAndUserTvDTO(memberDTO, _userTvDTO));
log.info("同步信息至大屏侧,minaUnbind# MemberAndUserTvDTO ==>> {}", new MemberAndUserTvDTO(memberDTO, _userTvDTO));
((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO));
this.updateUserTvSimplePriorityMemberCodeRedis(userTvDTO.getPlatformAccount(), "");
UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(userTvDTO.getPlatformAccount());
if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount())) {
userTvSimpleDTO.setPriorityMemberCode("");
JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class);
this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + userTvDTO.getPlatformAccount(), hashMap);
}
}
return ResultInfo.success("解绑成功");
......@@ -1656,10 +1766,6 @@ public class UserOperationServiceImpl implements UserOperationService {
@AsyncMqSend
public void asyncUpdateAppLastActiveTimeAndNicknameAndHeadImg(UserAppDTO userAppDTO) { }
@AsyncMqSend
public void asyncCancelUserAppBind(UserAppBindDTO userAppBindDTO) {}
@AsyncMqSend
public void asyncUpdatePasswordByUsername(UserAppDTO userAppDTO) {}
@AsyncMqSend
public void asyncUpdateAppInfo(UserAppDTO userAppDTO) {}
@AsyncMqSend
public void asyncAppCancellation(UserAppDTO userAppDTO) {}
......
package com.topdraw.business.process.service.impl.member;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.base.modules.exception.BadRequestException;
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.BasicMemberAddressDTO;
......@@ -8,7 +9,6 @@ import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.process.service.member.MemberAddressOperationService;
import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.GlobeExceptionMsg;
import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.framework.AopContext;
......
......@@ -2,6 +2,9 @@ package com.topdraw.business.process.service.impl.member;
import cn.hutool.core.util.ObjectUtil;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.contact.domain.MemberContacts;
import com.topdraw.business.module.contact.service.MemberContactsService;
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.domain.Member;
......@@ -25,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Service;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;
......@@ -42,23 +46,14 @@ public class MemberOperationServiceImpl implements MemberOperationService {
@Autowired
private MemberProfileService memberProfileService;
@Autowired
private MemberVipHistoryService memberVipHistoryService;
@Autowired
private MemberAddressService memberAddressService;
@Autowired
private MemberContactsService memberContactsService;
@Autowired
private MemberVipHistoryService memberVipHistoryService;
@AsyncMqSend
public void asyncUpdateMemberVipAndVipExpireTime(MemberDTO memberDTO) {}
@AsyncMqSend
public void asyncCreateMemberVipHistory(MemberVipHistoryDTO memberVipHistoryDTO) {}
@AsyncMqSend
public void asyncDoUpdateGroupsBatch(List<Member> resources) {}
@AsyncMqSend
@Override
public MemberDTO update(Member resources) {
return this.memberService.update(resources);
}
@Override
public MemberDTO findByCode(String code) {
......@@ -169,6 +164,11 @@ public class MemberOperationServiceImpl implements MemberOperationService {
return null;
}
@Override
public ResultInfo createMemberContacts(MemberContacts resources) {
return ResultInfo.success(this.memberContactsService.create(resources));
}
@Override
public MemberProfileDTO getMemberProfileAndCheckVip(Long memberId, String appId) {
......@@ -285,4 +285,18 @@ public class MemberOperationServiceImpl implements MemberOperationService {
private MemberProfileDTO findMemberProfileByMemberId(Long memberId) {
return this.memberProfileService.findByMemberId(memberId);
}
@AsyncMqSend
public void asyncUpdateMemberVipAndVipExpireTime(MemberDTO memberDTO) {}
@AsyncMqSend
public void asyncCreateMemberVipHistory(MemberVipHistoryDTO memberVipHistoryDTO) {}
@AsyncMqSend
public void asyncDoUpdateGroupsBatch(List<Member> resources) {}
@AsyncMqSend
@Override
public MemberDTO update(Member resources) {
return this.memberService.update(resources);
}
}
......
package com.topdraw.business.process.service.impl.member;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.base.modules.exception.EntityExistException;
import com.topdraw.base.modules.exception.EntityNotFoundException;
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;
......@@ -9,8 +11,6 @@ import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.process.service.dto.MemberProfileAndMemberDTO;
import com.topdraw.business.process.service.member.MemberProfileOperationService;
import com.topdraw.exception.EntityExistException;
import com.topdraw.exception.EntityNotFoundException;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......
package com.topdraw.business.process.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.business.module.user.weixin.collection.domain.UserCollectionDetail;
import com.topdraw.business.process.domian.weixin.UserCollectionMq;
import org.mapstruct.Mapper;
......
package com.topdraw.business.process.service.member;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.contact.domain.MemberContacts;
import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO;
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.dto.MemberDTO;
import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
import com.topdraw.business.process.domian.member.MemberOperationBean;
import com.topdraw.business.process.domian.weixin.BuyVipBean;
import java.util.List;
......@@ -76,8 +76,24 @@ public interface MemberOperationService {
*/
MemberDTO doUpdateVipByMemberCode(MemberOperationBean resources);
/**
*
* @param resources
* @return
*/
Integer doUpdateGroupsBatch(List<Member> resources);
/**
*
* @param memberId
* @return
*/
MemberAddressDTO updateDefaultMemberAddressById(Long memberId);
/**
*
* @param resources
* @return
*/
ResultInfo createMemberContacts(MemberContacts resources);
}
......
package com.topdraw.common;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/8/18 11:36
* @version: :
* @modified By:
* @since : modified in 2022/8/18 11:36
*/
public interface IResultCode {
long getCode();
String getDescription();
}
package com.topdraw.common;
import java.io.Serializable;
import java.util.List;
/**
* @author lvjian
* @Title:
* @Package
* @Description:
* @date 2021/1/7 17:26
*/
public interface IResultInfo<T> extends Serializable {
long getBusinessCode();
List<T> getResultSet();
String getDescription();
long getCount();
}
package com.topdraw.common;
/**
* 枚举了一些常用API返回码
* Created by cy on 2021/01/08.
*/
public enum ResultCode implements IResultCode {
SUCCESS(200, "操作成功"),
FAILED(500, "操作失败"),
VALIDATE_FAILED(400, "参数检验失败"),
UNAUTHORIZED(401, "未登录或token已经过期"),
FORBIDDEN(403, "无权限"),
METHOD_NOT_ALLOWED(405, "方法不允许");
private long code;
private String description;
ResultCode(long code, String description) {
this.code = code;
this.description = description;
}
public long getCode() {
return code;
}
public String getDescription() {
return description;
}
}
\ No newline at end of file
package com.topdraw.common;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 通用返回对象
* Created by cy on 2021/01/08.
*/
@Getter
public class ResultInfo<T> implements IResultInfo<T> {
private static final long serialVersionUID = -7313465544799377989L;
private long businessCode;
private List<T> resultSet;
private String description;
private long count;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime currentTime;
public ResultInfo(long businessCode, List<T> resultSet, String description) {
this.businessCode = businessCode;
this.resultSet = resultSet;
this.description = description;
this.count = resultSet.size();
currentTime = LocalDateTime.now();
}
public ResultInfo(long businessCode, Map<String, Object> page, String description) {
this.businessCode = businessCode;
this.resultSet = (List<T>) page.get("content");
this.count = (Long) page.get("totalElements");
this.description = description;
currentTime = LocalDateTime.now();
}
/**
* 成功返回不分页结果集
* @param resultSet
* @param <T>
* @return
*/
public static <T> ResultInfo<T> success(List<T> resultSet) {
return new ResultInfo<T>(ResultCode.SUCCESS.getCode(), resultSet, "");
}
/**
* 成功返回单一实体结果集
* @param result
* @param <T>
* @return
*/
public static <T> ResultInfo<T> success(T result) {
List<T> list = new ArrayList<>();
list.add(result);
return new ResultInfo<T>(ResultCode.SUCCESS.getCode(), list, "");
}
public static <T> ResultInfo<T> success() {
return new ResultInfo<>(ResultCode.SUCCESS.getCode(), new ArrayList<>(), "");
}
/**
* 成功返回分页结果集
* @param page
* @param <T>
* @return
*/
public static <T> ResultInfo<T> successPage(Map<String, Object> page) {
return new ResultInfo<T>(ResultCode.SUCCESS.getCode(), page, "");
}
/**
* 成功返回带描述的不分页结果集
* @param resultSet
* @param description
* @param <T>
* @return
*/
public static <T> ResultInfo<T> success(List<T> resultSet, String description) {
return new ResultInfo<T>(ResultCode.SUCCESS.getCode(), resultSet, description);
}
/**
* 带描述的服务端处理失败返回
* @param description
* @param <T>
* @return
*/
public static <T> ResultInfo<T> failed(String description) {
return new ResultInfo<T>(ResultCode.FAILED.getCode(), new ArrayList<>(), description);
}
/**
* 带描述的服务端处理失败返回
* @param description
* @param <T>
* @return
*/
public static <T> ResultInfo<T> failure(String description) {
return new ResultInfo<T>(ResultCode.FAILED.getCode(), new ArrayList<>(), description);
}
/**
* 未登录或token过期的失败返回
* @param <T>
* @return
*/
public static <T> ResultInfo<T> unauthorized() {
return new ResultInfo<T>(ResultCode.UNAUTHORIZED.getCode(), new ArrayList<>(), ResultCode.UNAUTHORIZED.getDescription());
}
/**
* 未授权的失败返回
* @param description
* @param <T>
* @return
*/
public static <T> ResultInfo<T> forbidden(String description) {
return new ResultInfo<T>(ResultCode.FORBIDDEN.getCode(), new ArrayList<>(), description);
}
/**
* 参数验证失败的返回
* @param <T>
* @return
*/
public static <T> ResultInfo<T> validateFailed() {
return new ResultInfo<T>(ResultCode.VALIDATE_FAILED.getCode(), new ArrayList<>(), ResultCode.VALIDATE_FAILED.getDescription());
}
/**
* 带描述的参数验证失败返回
* @param description
* @param <T>
* @return
*/
public static <T> ResultInfo<T> validateFailed(String description) {
return new ResultInfo<T>(ResultCode.VALIDATE_FAILED.getCode(), new ArrayList<>(), description);
}
/**
* 请求方法错误的返回
* @param description
* @param <T>
* @return
*/
public static <T> ResultInfo<T> methodNotAllowed(String description) {
return new ResultInfo<T>(ResultCode.METHOD_NOT_ALLOWED.getCode(), new ArrayList<>(), description);
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
package com.topdraw.util;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.utils.StringUtils;
import com.topdraw.base.modules.utils.MD5Util;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
......@@ -18,6 +18,16 @@ import java.util.Arrays;
@Slf4j
public class AESUtil {
public static String decodePassword(String password) {
String decrypt = AESUtil.decrypt(password, "f8681b9ce7c8fb6b");
String substring = decrypt.substring(16);
String s = MD5Util.encodePassword(substring);
log.info("加密前的密码:==>> {} || 解密后的密码:==>> {} | md5之后的密码: ==>> {}", decrypt, substring, s);
return s;
}
public static String encrypt(String data, String key) {
String strResult = null;
try {
......
package com.topdraw.weixin.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.common.ResultInfo;
import com.topdraw.base.modules.annotation.AnonymousAccess;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.weixin.service.UserWeixinWeixinMessageTemplateService;
import com.topdraw.weixin.service.dto.UpdateUserWeixinWeixinMessageTemplateQueryCriteria;
import io.swagger.annotations.Api;
......
package com.topdraw.weixin.service.dto;
import com.topdraw.annotation.Query;
import com.topdraw.base.modules.annotation.Query;
import lombok.Data;
/**
......
package com.topdraw.weixin.service.dto;
import com.topdraw.annotation.Query;
import com.topdraw.base.modules.annotation.Query;
import lombok.Data;
import java.util.List;
......
package com.topdraw.weixin.service.impl;
import com.topdraw.utils.QueryHelp;
import com.topdraw.base.modules.utils.QueryHelp;
import com.topdraw.weixin.domain.UserWeixinWeixinMessageTemplate;
import com.topdraw.weixin.domain.WeixinMessageTemplate;
import com.topdraw.weixin.repository.UserWeixinWeixinMessageTemplateRepository;
......
package com.topdraw.weixin.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.weixin.domain.UserWeixinWeixinMessageTemplate;
import com.topdraw.weixin.service.dto.UserWeixinWeixinMessageTemplateDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.weixin.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.base.modules.base.BaseMapper;
import com.topdraw.weixin.domain.WeixinMessageTemplate;
import com.topdraw.weixin.service.dto.WeixinMessageTemplateDTO;
import org.mapstruct.Mapper;
......
package com.topdraw.code;
import com.topdraw.BaseTest;
import com.topdraw.domain.GenConfig;
import com.topdraw.domain.vo.ColumnInfo;
import com.topdraw.MemberServiceApplication;
import com.topdraw.service.GeneratorService;
import com.topdraw.generator.modules.domain.GenConfig;
import com.topdraw.generator.modules.domain.vo.ColumnInfo;
import com.topdraw.generator.modules.service.GeneratorService;
import lombok.var;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -39,14 +39,14 @@ public class GeneratorCode extends BaseTest {
@Rollback(value = false)
@Transactional(rollbackFor = Exception.class)
public void generator() {
var dbName = "uc_growth_report";
var dbName = "uc_member_contacts";
// 表名称,支持多表
var tableNames = Arrays.asList(dbName);
String[] s = dbName.split("_");
var pre = s[0];
var target1 = s[s.length-1];
var preRoute = "com.topdraw.business.module.user.iptv.growreport";
var preRoute = "com.topdraw.business.module.contact";
StringBuilder builder = new StringBuilder(preRoute);
// builder.append("wechatshare");
// builder.append(target);
......
......@@ -3,7 +3,6 @@ package com.topdraw.test.business.basicdata.member;
import com.topdraw.business.module.member.rest.MemberController;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.BaseTest;
import com.topdraw.common.ResultInfo;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
......
package com.topdraw.test.business.basicdata.member.rest;
import com.alibaba.fastjson.JSON;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.member.address.domain.MemberAddress;
import com.topdraw.business.module.member.address.rest.MemberAddressController;
import com.topdraw.common.ResultInfo;
import com.topdraw.BaseTest;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
......
package com.topdraw.test.business.basicdata.member.rest;
import com.alibaba.fastjson.JSON;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.rest.MemberController;
import com.topdraw.common.ResultInfo;
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;
import java.time.LocalDateTime;
public class MemberControllerTest extends BaseTest {
......
package com.topdraw.test.business.basicdata.member.rest;
import com.alibaba.fastjson.JSON;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.module.member.relatedinfo.rest.MemberRelatedInfoController;
import com.topdraw.common.ResultInfo;
import com.topdraw.BaseTest;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.time.LocalDate;
//public class MemberControllerTest {
public class MemberRelatedInfoControllerTest extends BaseTest {
......
package com.topdraw.test.business.process.rest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.BaseTest;
import com.topdraw.business.process.domian.TempCoupon;
import com.topdraw.business.process.rest.CouponOperationController;
import com.topdraw.common.ResultInfo;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class CouponOperationControllerTest extends BaseTest {
......
......@@ -2,20 +2,13 @@ package com.topdraw.test.business.process.rest;
import com.alibaba.fastjson.JSON;
import com.topdraw.BaseTest;
import com.topdraw.business.process.domian.TempCoupon;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.process.domian.TempExp;
import com.topdraw.business.process.rest.CouponOperationController;
import com.topdraw.business.process.rest.ExpOperationController;
import com.topdraw.common.ResultInfo;
import com.topdraw.util.TimestampUtil;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class ExpOperationControllerTest extends BaseTest {
@Autowired
......
......@@ -2,9 +2,9 @@ package com.topdraw.test.business.process.rest;
import com.alibaba.fastjson.JSON;
import com.topdraw.BaseTest;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.process.domian.TempPoints;
import com.topdraw.business.process.rest.PointsOperationController;
import com.topdraw.common.ResultInfo;
import com.topdraw.util.TimestampUtil;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
......
......@@ -2,9 +2,9 @@ package com.topdraw.test.business.process.rest;
import com.topdraw.BaseTest;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.rights.history.domain.RightsHistory;
import com.topdraw.business.process.rest.RightsOperationController;
import com.topdraw.common.ResultInfo;
import com.topdraw.util.TimestampUtil;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
......
package com.topdraw.test.business.process.rest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.BaseTest;
import com.topdraw.base.modules.common.ResultInfo;
import com.topdraw.business.module.user.app.domain.UserApp;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
import com.topdraw.business.process.domian.weixin.BindBean;
import com.topdraw.business.process.domian.weixin.SubscribeBean;
import com.topdraw.business.process.domian.weixin.TvUnBindBean;
import com.topdraw.business.process.domian.weixin.WeixinUnBindBean;
import com.topdraw.business.process.rest.UserOperationController;
import com.topdraw.common.ResultInfo;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Base64Utils;
import java.sql.Timestamp;
import java.util.HashMap;
public class UserOperationControllerTest extends BaseTest {
......