Commit e6e3d83d e6e3d83d3720cd45ab8c9b058cc0b9ec2053b9d8 by xianghan

1.优化

1 parent c86ef2b6
Showing 81 changed files with 761 additions and 448 deletions
......@@ -12,7 +12,6 @@ import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author XiangHan
......@@ -93,7 +92,7 @@ public class Coupon implements Serializable {
/** 过期时间 */
@Column(name = "expire_time")
private LocalDateTime expireTime;
private Timestamp expireTime;
/** 自领取当日,几天内有效 */
@Column(name = "valid_days")
......
......@@ -7,7 +7,6 @@ import org.springframework.beans.BeanUtils;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.Objects;
/**
......@@ -49,7 +48,7 @@ public class CouponBuilder {
Integer itemRange,
Integer effectType,
Timestamp startTime,
LocalDateTime expireTime,
Timestamp expireTime,
Integer validDays,String description , Integer status){
Coupon coupon = new Coupon();
......
......@@ -11,7 +11,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import java.sql.Timestamp;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author XiangHan
......@@ -51,11 +50,11 @@ public class CouponHistory implements Serializable {
/** 领取时间 */
@Column(name = "receive_time")
private LocalDateTime receiveTime;
private Timestamp receiveTime;
/** 失效时间 */
@Column(name = "expire_time")
private LocalDateTime expireTime;
private Timestamp expireTime;
/** 使用状态 0:未使用;1:已使用;-1:已过期 */
@Column(name = "use_status")
......@@ -63,7 +62,7 @@ public class CouponHistory implements Serializable {
/** 使用时间 */
@Column(name = "use_time")
private LocalDateTime useTime;
private Timestamp useTime;
/** 订单详情id */
@Column(name = "order_detail_id")
......@@ -72,12 +71,12 @@ public class CouponHistory implements Serializable {
/** 创建时间 */
@CreatedDate
@Column(name = "create_time")
private LocalDateTime createTime;
private Timestamp createTime;
/** 更新时间 */
@LastModifiedDate
@Column(name = "update_time")
private LocalDateTime updateTime;
private Timestamp updateTime;
public void copy(CouponHistory source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
......
package com.topdraw.business.module.coupon.history.domain;
import com.topdraw.business.module.coupon.domain.Coupon;
import com.topdraw.util.TimestampUtil;
import org.apache.commons.lang3.StringUtils;
import java.time.LocalDateTime;
import java.sql.Timestamp;
import java.util.Objects;
/**
......@@ -30,12 +31,12 @@ public class CouponHistoryBuilder {
public static CouponHistory build(Coupon coupon,Long userId,String userNickname,Long orderDetailId){
return build(null,
coupon.getId(),userId,coupon.getCode(),userNickname,LocalDateTime.now(),
coupon.getId(),userId,coupon.getCode(),userNickname, TimestampUtil.now(),
coupon.getExpireTime(),coupon.getStatus(),null,orderDetailId);
}
public static CouponHistory build(Long id , Long couponId , Long userId,String couponCode,String userNickname,LocalDateTime receiveTime,
LocalDateTime expireTime,Integer useStatus,LocalDateTime useTime,
public static CouponHistory build(Long id , Long couponId , Long userId, String couponCode, String userNickname, Timestamp receiveTime,
Timestamp expireTime, Integer useStatus, Timestamp useTime,
Long orderDetailId) {
CouponHistory couponHistory = new CouponHistory();
couponHistory.setId(id);
......
......@@ -2,7 +2,7 @@ package com.topdraw.business.module.coupon.history.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.sql.Timestamp;
/**
......@@ -28,23 +28,23 @@ public class CouponHistoryDTO implements Serializable {
private String userNickname;
/** 领取时间 */
private LocalDateTime receiveTime;
private Timestamp receiveTime;
/** 失效时间 */
private LocalDateTime expireTime;
private Timestamp expireTime;
/** 使用状态 0:未使用;1:已使用;-1:已过期 */
private Integer useStatus;
/** 使用时间 */
private LocalDateTime useTime;
private Timestamp useTime;
/** 订单详情id */
private Long orderDetailId;
/** 创建时间 */
private LocalDateTime createTime;
private Timestamp createTime;
/** 更新时间 */
private LocalDateTime updateTime;
private Timestamp updateTime;
}
......
......@@ -4,7 +4,6 @@ import lombok.Data;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
......@@ -63,7 +62,7 @@ public class CouponDTO implements Serializable {
private Timestamp startTime;
/** 过期时间 */
private LocalDateTime expireTime;
private Timestamp expireTime;
/** 自领取当日,几天内有效 */
private Integer validDays;
......
......@@ -2,10 +2,6 @@ package com.topdraw.business.module.exp.history.service;
import com.topdraw.business.module.exp.history.domain.ExpHistory;
import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO;
import com.topdraw.business.module.exp.history.service.dto.ExpHistoryQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
/**
* @author XiangHan
......
package com.topdraw.business.module.exp.history.service.dto;
import lombok.Data;
/**
* @author XiangHan
* @date 2021-10-22
*/
@Data
public class ExpHistoryQueryCriteria{
}
......@@ -12,7 +12,7 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.sql.Timestamp;
/**
* @author XiangHan
......@@ -86,12 +86,12 @@ public class MemberAddress extends AsyncMqModule implements Serializable {
/** 创建时间 */
@CreatedDate
@Column(name = "create_time")
private LocalDateTime createTime;
private Timestamp createTime;
/** 更新时间 */
@LastModifiedDate
@Column(name = "update_time")
private LocalDateTime updateTime;
private Timestamp updateTime;
public void copy(MemberAddress source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
......
......@@ -2,6 +2,7 @@ package com.topdraw.business.module.member.address.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
......@@ -58,8 +59,8 @@ public class MemberAddressDTO implements Serializable {
private String zipCode;
/** 创建时间 */
private LocalDateTime createTime;
private Timestamp createTime;
/** 更新时间 */
private LocalDateTime updateTime;
private Timestamp updateTime;
}
......
......@@ -13,7 +13,6 @@ import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
* @author XiangHan
......@@ -32,7 +31,7 @@ public class Member implements Serializable {
/** 会员过期时间 */
@Column(name = "vip_expire_time", nullable = false)
private LocalDateTime vipExpireTime;
private Timestamp vipExpireTime;
/** 主键 */
@Id
......@@ -119,7 +118,7 @@ public class Member implements Serializable {
/** iptv账号绑定时间 */
@Column(name = "bind_iptv_time")
private LocalDateTime bindIptvTime;
private Timestamp bindIptvTime;
/** 创建时间 */
@CreatedDate
......
package com.topdraw.business.module.member.domain;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.util.IdWorker;
import org.apache.commons.lang3.StringUtils;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Objects;
/**
......
......@@ -3,7 +3,6 @@ package com.topdraw.business.module.member.group.service.dto;
import lombok.Data;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.Set;
/**
......
package com.topdraw.business.module.member.profile.domain;
import com.topdraw.business.module.common.validated.CreateGroup;
import com.topdraw.business.module.common.validated.UpdateGroup;
import lombok.Data;
import lombok.experimental.Accessors;
......
......@@ -5,8 +5,6 @@ import com.topdraw.exception.GlobeExceptionMsg;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.Assert;
import java.util.Objects;
public class MemberProfileBuilder {
public static MemberProfile build(Member member){
......
......@@ -15,7 +15,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import java.sql.Timestamp;
import java.io.Serializable;
import java.time.LocalDate;
/**
* @author XiangHan
......
......@@ -3,8 +3,6 @@ package com.topdraw.business.module.member.relatedinfo.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDate;
/**
......
......@@ -4,7 +4,6 @@ import lombok.Data;
import java.sql.Timestamp;
import java.io.Serializable;
import java.time.LocalDate;
/**
......
......@@ -4,7 +4,6 @@ import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
......@@ -20,7 +19,7 @@ public class BasicMemberDTO implements Serializable {
private Integer iptvMajor;
/** vip过期时间 */
private LocalDateTime vipExpireTime;
private Timestamp vipExpireTime;
/** 主键 */
private Long id;
......@@ -83,7 +82,7 @@ public class BasicMemberDTO implements Serializable {
private Integer bindIptvPlatformType;
/** iptv账号绑定时间 */
private LocalDateTime bindIptvTime;
private Timestamp bindIptvTime;
/** 创建时间 */
private Timestamp createTime;
......
......@@ -20,7 +20,7 @@ public class MemberDTO implements Serializable {
private Integer iptvMajor;
/** vip过期时间 */
private LocalDateTime vipExpireTime;
private Timestamp vipExpireTime;
/** 主键 */
private Long id;
......@@ -83,7 +83,7 @@ public class MemberDTO implements Serializable {
private Integer bindIptvPlatformType;
/** iptv账号绑定时间 */
private LocalDateTime bindIptvTime;
private Timestamp bindIptvTime;
/** 创建时间 */
private Timestamp createTime;
......
......@@ -55,7 +55,7 @@ public class MemberServiceImpl implements MemberService {
@Override
public MemberDTO findById(Long id) {
Member member = this.memberRepository.findById(id).orElseGet(Member::new);
ValidationUtil.isNull(member.getId(),"Member","id",id);
// ValidationUtil.isNull(member.getId(),"Member","id",id);
return this.memberMapper.toDto(member);
......
......@@ -12,7 +12,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
* @author luerlong
......@@ -45,7 +44,7 @@ public class MemberVipHistory extends AsyncMqModule implements Serializable {
// vip失效时间
@Column(name = "vip_expire_time")
private LocalDateTime vipExpireTime;
private Timestamp vipExpireTime;
// 状态 1正常 0已过期
@Column(name = "status")
......
......@@ -2,7 +2,7 @@ package com.topdraw.business.module.member.viphistory.domain;
import com.topdraw.business.module.member.domain.Member;
import java.time.LocalDateTime;
import java.sql.Timestamp;
import java.util.Objects;
public class MemberVipHistoryBuilder {
......@@ -10,7 +10,7 @@ public class MemberVipHistoryBuilder {
public static MemberVipHistory build(Member member , Integer beforeVip) {
Long id = member.getId();
Integer vip = member.getVip();
LocalDateTime vipExpireTime = member.getVipExpireTime();
Timestamp vipExpireTime = member.getVipExpireTime();
MemberVipHistory memberVipHistory = new MemberVipHistory();
memberVipHistory.setMemberId(Objects.isNull(id)? null:id);
......@@ -20,7 +20,7 @@ public class MemberVipHistoryBuilder {
return build(memberVipHistory);
}
public static MemberVipHistory build(Long memberId, Integer vip, Integer beforeVip, LocalDateTime vipExpireTime ) {
public static MemberVipHistory build(Long memberId, Integer vip, Integer beforeVip, Timestamp vipExpireTime ) {
MemberVipHistory memberVipHistory = new MemberVipHistory();
memberVipHistory.setMemberId(Objects.isNull(memberId)? null:memberId);
memberVipHistory.setVip(Objects.isNull(vip)? null:vip);
......@@ -38,7 +38,7 @@ public class MemberVipHistoryBuilder {
memberVipHistory.getStatus());
}
public static MemberVipHistory build(Long id, Long memberId , Integer vip , Integer beforeVip , LocalDateTime vipExpireTime, Integer status){
public static MemberVipHistory build(Long id, Long memberId , Integer vip , Integer beforeVip , Timestamp vipExpireTime, Integer status){
MemberVipHistory memberVipHistory = new MemberVipHistory();
memberVipHistory.setId(Objects.isNull(id)? null:id);
memberVipHistory.setMemberId(Objects.isNull(memberId)? null:memberId) ;
......
......@@ -4,6 +4,7 @@ import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
......@@ -49,6 +50,6 @@ public interface MemberVipHistoryService {
* @param nowTime
* @return
*/
MemberVipHistory findByTime(Long id, LocalDateTime nowTime);
MemberVipHistory findByTime(Long id, Timestamp nowTime);
}
......
......@@ -4,7 +4,6 @@ import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
......@@ -27,7 +26,7 @@ public class MemberVipHistoryDTO implements Serializable {
private Integer beforeVip;
// vip失效时间
private LocalDateTime vipExpireTime;
private Timestamp vipExpireTime;
// 状态 1正常 0已过期
private Integer status;
......
package com.topdraw.business.module.member.viphistory.service.dto;
import lombok.Data;
/**
* @author luerlong
* @date 2021-12-10
*/
@Data
public class MemberVipHistoryQueryCriteria {
}
......@@ -11,6 +11,7 @@ import com.topdraw.business.module.member.viphistory.repository.MemberVipHistory
import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService;
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;
......@@ -20,6 +21,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
......@@ -85,8 +87,9 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService {
}
@Override
public MemberVipHistory findByTime(Long memberId, LocalDateTime nowTime) {
MemberVipHistory memberVipHistory = this.memberVipHistoryRepository.findByTime(memberId, nowTime).orElseGet(MemberVipHistory::new);
public MemberVipHistory findByTime(Long memberId, Timestamp nowTime) {
LocalDateTime localDateTime = TimestampUtil.timestamp2LocalDateTime(nowTime);
MemberVipHistory memberVipHistory = this.memberVipHistoryRepository.findByTime(memberId, localDateTime).orElseGet(MemberVipHistory::new);
return memberVipHistory;
}
......
package com.topdraw.business.module.points.available.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.topdraw.business.module.common.domain.AsyncMqModule;
import lombok.Data;
import lombok.experimental.Accessors;
......@@ -11,7 +10,6 @@ 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.time.LocalDateTime;
import java.io.Serializable;
......@@ -55,9 +53,9 @@ public class PointsAvailable extends AsyncMqModule implements Serializable {
private Long points;
/** 过期时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",locale = "")
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",locale = "")
@Column(name = "expire_time")
private LocalDateTime expireTime;
private Timestamp expireTime;
/** 描述 */
@Column(name = "description")
......
......@@ -25,7 +25,7 @@ public interface PointsAvailableRepository extends JpaRepository<PointsAvailable
List<PointsAvailableDTO> findByMemberId(Long memberId);
List<PointsAvailable> findByMemberIdAndExpireTimeBefore(Long memberId , LocalDateTime now);
List<PointsAvailable> findByMemberIdAndExpireTimeBefore(Long memberId , Timestamp now);
/**
* 即将过期的积分
......
......@@ -5,6 +5,7 @@ import com.topdraw.business.module.points.available.service.dto.PointsAvailableD
import com.topdraw.business.module.points.available.service.dto.PointsAvailableQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.List;
......@@ -59,7 +60,7 @@ public interface PointsAvailableService {
* @param timestamp
* @return
*/
List<PointsAvailableDTO> findByMemberIdAndExpireTimeBefore(Long memberId, LocalDateTime timestamp);
List<PointsAvailableDTO> findByMemberIdAndExpireTimeBefore(Long memberId, Timestamp timestamp);
/**
* 即将过期的积分
......
......@@ -32,7 +32,7 @@ public class PointsAvailableDTO implements Serializable {
private Long points;
/** 过期时间 */
private LocalDateTime expireTime;
private Timestamp expireTime;
/** 描述 */
private String description;
......
......@@ -15,6 +15,7 @@ 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.*;
......@@ -120,7 +121,7 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
}
@Override
public List<PointsAvailableDTO> findByMemberIdAndExpireTimeBefore(Long memberId, LocalDateTime timestamp) {
public List<PointsAvailableDTO> findByMemberIdAndExpireTimeBefore(Long memberId, Timestamp timestamp) {
return Objects.nonNull(memberId)?
this.pointsAvailableMapper.toDto(this.pointsAvailableRepository.findByMemberIdAndExpireTimeBefore(memberId, timestamp))
:null;
......
......@@ -2,10 +2,6 @@ package com.topdraw.business.module.points.detail.detailhistory.service;
import com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory;
import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO;
import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
/**
* @author XiangHan
......@@ -14,31 +10,28 @@ import java.util.List;
public interface PointsDetailHistoryService {
/**
* 查询数据分页
* @param criteria 条件参数
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(PointsDetailHistoryQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<PointsDetailHistoryDTO>
*/
List<PointsDetailHistoryDTO> queryAll(PointsDetailHistoryQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return PointsDetailHistoryDTO
*/
PointsDetailHistoryDTO findById(Long id);
/**
*
* @param resources
*/
void create(PointsDetailHistory resources);
/**
*
* @param resources
*/
void update(PointsDetailHistory resources);
/**
*
* @param id
*/
void delete(Long id);
/**
......
package com.topdraw.business.module.points.detail.detailhistory.service.dto;
import lombok.Data;
/**
* @author XiangHan
* @date 2021-10-22
*/
@Data
public class PointsDetailHistoryQueryCriteria{
}
package com.topdraw.business.module.points.detail.detailhistory.service.impl;
import com.topdraw.aspect.AsyncMqSend;
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.dto.PointsDetailHistoryQueryCriteria;
import com.topdraw.business.module.points.detail.detailhistory.service.mapper.PointsDetailHistoryMapper;
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.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 com.topdraw.utils.StringUtils;
import java.util.List;
import java.util.Map;
/**
* @author XiangHan
* @date 2021-10-22
......@@ -32,60 +23,45 @@ import java.util.Map;
public class PointsDetailHistoryServiceImpl implements PointsDetailHistoryService {
@Autowired
private PointsDetailHistoryRepository PointsDetailHistoryRepository;
private PointsDetailHistoryRepository pointsDetailHistoryRepository;
@Autowired
private PointsDetailHistoryMapper PointsDetailHistoryMapper;
@Override
public Map<String, Object> queryAll(PointsDetailHistoryQueryCriteria criteria, Pageable pageable) {
Page<PointsDetailHistory> page = PointsDetailHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(PointsDetailHistoryMapper::toDto));
}
@Override
public List<PointsDetailHistoryDTO> queryAll(PointsDetailHistoryQueryCriteria criteria) {
return PointsDetailHistoryMapper.toDto(PointsDetailHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
private PointsDetailHistoryMapper pointsDetailHistoryMapper;
@Override
public PointsDetailHistoryDTO findById(Long id) {
PointsDetailHistory PointsDetailHistory = PointsDetailHistoryRepository.findById(id).orElseGet(PointsDetailHistory::new);
ValidationUtil.isNull(PointsDetailHistory.getId(),"PointsDetailHistory","id",id);
return PointsDetailHistoryMapper.toDto(PointsDetailHistory);
PointsDetailHistory pointsDetailHistory = this.pointsDetailHistoryRepository.findById(id).orElseGet(PointsDetailHistory::new);
ValidationUtil.isNull(pointsDetailHistory.getId(),"PointsDetailHistory","id",id);
return this.pointsDetailHistoryMapper.toDto(pointsDetailHistory);
}
@Override
@Transactional(rollbackFor = Exception.class)
@AsyncMqSend()
public void create(PointsDetailHistory resources) {
PointsDetailHistoryRepository.save(resources);
this.pointsDetailHistoryRepository.save(resources);
}
@Override
@Transactional(rollbackFor = Exception.class)
@AsyncMqSend()
public void update(PointsDetailHistory resources) {
PointsDetailHistory PointsDetailHistory = PointsDetailHistoryRepository.findById(resources.getId()).orElseGet(PointsDetailHistory::new);
ValidationUtil.isNull( PointsDetailHistory.getId(),"PointsDetailHistory","id",resources.getId());
PointsDetailHistory.copy(resources);
PointsDetailHistoryRepository.save(PointsDetailHistory);
PointsDetailHistory pointsDetailHistory = this.pointsDetailHistoryRepository.findById(resources.getId()).orElseGet(PointsDetailHistory::new);
ValidationUtil.isNull( pointsDetailHistory.getId(),"PointsDetailHistory","id",resources.getId());
pointsDetailHistory.copy(resources);
this.pointsDetailHistoryRepository.save(pointsDetailHistory);
}
@Override
@Transactional(rollbackFor = Exception.class)
@AsyncMqSend()
public void delete(Long id) {
Assert.notNull(id, "The given id must not be null!");
PointsDetailHistory PointsDetailHistory = PointsDetailHistoryRepository.findById(id).orElseThrow(
PointsDetailHistory pointsDetailHistory = this.pointsDetailHistoryRepository.findById(id).orElseThrow(
() -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", PointsDetailHistory.class, id), 1));
PointsDetailHistoryRepository.delete(PointsDetailHistory);
this.pointsDetailHistoryRepository.delete(pointsDetailHistory);
}
@Override
public PointsDetailHistoryDTO getByCode(String code) {
return StringUtils.isNotEmpty(code) ? PointsDetailHistoryMapper.toDto(PointsDetailHistoryRepository.findFirstByCode(code).orElseGet(PointsDetailHistory::new))
return StringUtils.isNotEmpty(code) ? this.pointsDetailHistoryMapper.toDto(this.pointsDetailHistoryRepository.findFirstByCode(code).orElseGet(PointsDetailHistory::new))
: new PointsDetailHistoryDTO();
}
}
......
......@@ -59,7 +59,7 @@ public class Rights implements Serializable {
/** 失效时间,空为不失效,否则为获得权益后直到失效的毫秒数 */
@Column(name = "expire_time")
private Long expireTime;
private Timestamp expireTime;
/** 创建时间 */
@CreatedDate
......
......@@ -56,7 +56,7 @@ public class RightsHistory extends AsyncMqModule implements Serializable {
// 失效时间
@Column(name = "expire_time")
private LocalDateTime expireTime;
private Timestamp expireTime;
@CreatedDate
@Column(name = "create_time")
......
......@@ -33,7 +33,7 @@ public class RightsHistoryDTO implements Serializable {
private Timestamp sendTime;
// 失效时间
private LocalDateTime expireTime;
private Timestamp expireTime;
private Timestamp createTime;
......
......@@ -37,7 +37,7 @@ public class RightsDTO implements Serializable {
private Timestamp validTime;
/** 失效时间,空为不失效,否则为获得权益后直到失效的毫秒数 */
private Long expireTime;
private Timestamp expireTime;
/** 创建时间 */
private Timestamp createTime;
......
......@@ -53,15 +53,15 @@ public class TaskAttrServiceImpl implements TaskAttrService {
@Transactional(rollbackFor = Exception.class)
public void delete(Long id) {
Assert.notNull(id, "The given id must not be null!");
TaskAttr TaskAttr = this.taskAttrRepository.findById(id).orElseThrow(
TaskAttr taskAttr = this.taskAttrRepository.findById(id).orElseThrow(
() -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", TaskAttr.class, id), 1));
this.taskAttrRepository.delete(TaskAttr);
this.taskAttrRepository.delete(taskAttr);
}
@Override
public TaskAttrDTO findByTaskId(Long taskId) {
TaskAttr TaskAttr = this.taskAttrRepository.findByTaskId(taskId).orElseGet(TaskAttr::new);
return this.taskAttrMapper.toDto(TaskAttr);
TaskAttr taskAttr = this.taskAttrRepository.findByTaskId(taskId).orElseGet(TaskAttr::new);
return this.taskAttrMapper.toDto(taskAttr);
}
......
package com.topdraw.business.module.task.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.NotNull;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
......@@ -31,8 +34,12 @@ public class Task implements Serializable {
/** 任务模板id */
@Column(name = "task_template_id", nullable = false)
@NotNull(message = "taskTemplateId is null", groups = {CreateGroup.class})
private Long taskTemplateId;
@Transient
private String taskTemplateCode;
/** 任务重复类型,-1:不限次;1:单次;>1:多次 */
@Column(name = "task_repeat_type", nullable = false)
private Integer taskRepeatType;
......@@ -51,7 +58,7 @@ public class Task implements Serializable {
/** 任务失效时间 */
@Column(name = "expire_time")
private LocalDateTime expireTime;
private Timestamp expireTime;
/** 显示顺序 */
@Column(name = "sequence")
......@@ -117,10 +124,33 @@ public class Task implements Serializable {
@Column(name = "rights3_amount")
private Integer rights3Amount;
/** 会员专享 0:会员专享 1:非会员专享 */
@Column(name = "member_exclusive")
private Integer memberExclusive;
/** 状态 0:失效;1:生效 */
@Column(name = "status", nullable = false)
private Integer status;
/** 任务名称 */
@Column(name = "name", nullable = false)
private String name;
/** 编号 */
@Column(name = "code", nullable = false)
private String code;
/** 任务描述 */
@Column(name = "description", nullable = false)
private String description;
/** 删除标识 0:正常;1:已删除;*/
@Column(name = "delete_mark", nullable = false)
private Integer deleteMark;
@Transient
private String attr;
/** 创建时间 */
@CreatedDate
@Column(name = "create_time")
......
......@@ -24,30 +24,31 @@ public class TaskBuilder {
Task task_ = new Task();
task_.setTaskTemplateId(task.getTaskTemplateId());
task_.setTaskTemplateCode(task.getTaskTemplateCode());
//task_.setName(task.getName());
//task_.setCode(StringUtils.isEmpty(task.getCode()) ? IdWorker.generatorCode("task_") : task.getCode());
task_.setName(task.getName());
task_.setCode(StringUtils.isEmpty(task.getCode()) ? IdWorker.generatorCode("task_") : task.getCode());
task_.setStatus(Objects.isNull(task.getStatus()) ? 1 : task.getStatus());
task_.setSequence(task.getSequence());
task_.setValidTime(Objects.isNull(task.getValidTime()) ? TimestampUtil.now() : task.getValidTime());
task_.setExpireTime(task.getExpireTime());
//task_.setDescription(task.getDescription());
task_.setDescription(task.getDescription());
task_.setActionAmount(task.getActionAmount());
task_.setTaskDailyReset(Objects.isNull(task.getTaskDailyReset()) ? 1 : task.getTaskDailyReset());
task_.setTaskRepeatType(Objects.isNull(task.getTaskRepeatType()) ? 1 : task.getTaskRepeatType());
task_.setRightsSendStrategy(Objects.isNull(task.getRightsSendStrategy()) ? 1 : task.getRightsSendStrategy());
task_.setGroups(task.getGroups());
task_.setMemberLevel(task.getMemberLevel());
task_.setMemberVip(task.getMemberVip());
//task_.setMemberExclusive(task.getMemberExclusive());
task_.setMemberLevel(Objects.isNull(task.getMemberLevel()) ? 1 : task.getMemberLevel());
task_.setMemberVip(Objects.isNull(task.getMemberVip()) ? 0 : task.getMemberVip());
task_.setMemberExclusive(Objects.isNull(task.getMemberExclusive()) ? 1 : 0);
task_.setPointsType(Objects.isNull(task.getPointsType()) ? 1 : task.getPointsType());
task_.setRewardPoints(Objects.isNull(task.getRewardPoints()) ? null : task.getRewardPoints());
//task_.setRewardPointsExpireTime(Objects.isNull(task.getRewardPointsExpireTime()) ?
// DateUtil.getLastDateTimeSecondYearLong() : task.getRewardPointsExpireTime());
//task_.setRewardMaxPoints(Objects.isNull(task.getRewardMaxPoints()) ?
//RandomUtil.getRandomPoints(1, 10).intValue() : task.getRewardMaxPoints());
task_.setPointsType(Objects.isNull(task.getPointsType()) ? 0 : task.getPointsType());
task_.setRewardPoints(Objects.isNull(task.getRewardPoints()) ? 0 : task.getRewardPoints());
task_.setRewardPointsExpireTime(Objects.isNull(task.getRewardPointsExpireTime()) ?
DateUtil.getLastDateTimeSecondYearLong() : task.getRewardPointsExpireTime());
task_.setRewardMaxPoints(Objects.isNull(task.getRewardMaxPoints()) ?
RandomUtil.getRandomPoints(1, 10).intValue() : task.getRewardMaxPoints());
task_.setRewardExp(Objects.isNull(task.getRewardExp()) ? 0L : task.getRewardExp());
......@@ -58,7 +59,10 @@ public class TaskBuilder {
task_.setRights3Id(task.getRights3Id());
task_.setRights3Amount(task.getRights3Amount());
return task;
task_.setDeleteMark(Objects.isNull(task.getDeleteMark()) ? 0 : task.getDeleteMark());
task_.setAttr(StringUtils.isBlank(task.getAttr()) ? null : task.getAttr());
return task_;
}
}
......
......@@ -3,8 +3,12 @@ package com.topdraw.business.module.task.repository;
import com.topdraw.business.module.task.domain.Task;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Optional;
/**
* @author XiangHan
......@@ -14,4 +18,10 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
List<Task> findByTaskTemplateId(Long taskTemplateId);
@Modifying
@Transactional
@Query(value = "UPDATE `tr_task` SET `delete_mark` = 1 , `update_time` = now() WHERE `id` = ?1", nativeQuery = true)
void updateDeleteMark(Long id);
Optional<Task> findByCode(String code);
}
......
......@@ -11,7 +11,7 @@ import java.util.List;
public interface TaskService {
/**
* 根据ID查询
*
* @param id ID
* @return TaskDTO
*/
......@@ -19,8 +19,39 @@ public interface TaskService {
/**
*
* @param code 编号
* @return TaskDTO
*/
TaskDTO findByCode(String code);
/**
*
* @param taskTemplateId
* @return
*/
List<Task> findByTemplateId(Long taskTemplateId);
/**
*
* @param task
*/
TaskDTO create(Task task);
/**
*
* @param task
*/
TaskDTO update(Task task);
/**
*
* @param task
*/
void delete(Task task);
/**
*
* @param id
*/
void delete(Long id);
}
......
......@@ -2,6 +2,7 @@ package com.topdraw.business.module.task.service.dto;
import lombok.Data;
import javax.persistence.Column;
import java.sql.Timestamp;
import java.io.Serializable;
import java.time.LocalDateTime;
......@@ -19,6 +20,9 @@ public class TaskDTO implements Serializable {
/** 任务模板id */
private Long taskTemplateId;
/** 删除标识 0:正常;1:已删除;*/
private Integer deleteMark;
/** 任务重复类型,-1:不限次;1:单次;>1:多次 */
private Integer taskRepeatType;
......@@ -32,7 +36,7 @@ public class TaskDTO implements Serializable {
private Timestamp validTime;
/** 任务失效时间 */
private LocalDateTime expireTime;
private Timestamp expireTime;
/** 显示顺序 */
private Integer sequence;
......@@ -73,9 +77,23 @@ public class TaskDTO implements Serializable {
/** 权益3数量 */
private Integer rights3Amount;
/** 会员专享 0:会员专享 1:非会员专享 */
private Integer memberExclusive;
/** 状态 0:失效;1:生效 */
private Integer status;
/** 任务名称 */
private String name;
/** 编号 */
private String code;
/** 任务描述 */
private String description;
private String attr;
/** 创建时间 */
private Timestamp createTime;
......
package com.topdraw.business.module.task.service.impl;
import com.topdraw.business.module.task.domain.Task;
import com.topdraw.utils.ValidationUtil;
import com.topdraw.business.module.task.repository.TaskRepository;
import com.topdraw.business.module.task.service.TaskService;
import com.topdraw.business.module.task.service.dto.TaskDTO;
......@@ -10,8 +9,6 @@ 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 java.util.List;
import java.util.Objects;
......@@ -29,11 +26,15 @@ public class TaskServiceImpl implements TaskService {
@Autowired
private TaskRepository taskRepository;
@Override
public TaskDTO findById(Long id) {
Task Task = this.taskRepository.findById(id).orElseGet(Task::new);
ValidationUtil.isNull(Task.getId(),"Task","id",id);
return this.taskMapper.toDto(Task);
}
@Override
public TaskDTO findByCode(String code) {
Task Task = this.taskRepository.findByCode(code).orElseGet(Task::new);
return this.taskMapper.toDto(Task);
}
......@@ -42,5 +43,27 @@ public class TaskServiceImpl implements TaskService {
return Objects.nonNull(taskTemplateId) ? this.taskRepository.findByTaskTemplateId(taskTemplateId) : null;
}
@Override
public TaskDTO create(Task task) {
Task save = this.taskRepository.save(task);
return this.taskMapper.toDto(save);
}
@Override
public TaskDTO update(Task task) {
Task save = this.taskRepository.save(task);
return this.taskMapper.toDto(save);
}
@Override
public void delete(Task task) {
Long id = task.getId();
this.delete(id);
}
@Override
public void delete(Long id) {
this.taskRepository.updateDeleteMark(id);
}
}
......
package com.topdraw.business.module.task.template.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.NotNull;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
......@@ -28,34 +31,40 @@ public class TaskTemplate implements Serializable {
@Column(name = "id")
private Long id;
// 标识
/** 标识 */
@Column(name = "code")
private String code;
// 名称
/** 名称 */
@Column(name = "name")
private String name;
// 关注事件(和MQ topic相关)
/** 关注事件(和MQ topic相关) */
@Column(name = "event")
@NotNull(message = "event is null", groups = {CreateGroup.class})
private String event;
// 描述
/** 描述 */
@Column(name = "description")
private String description;
// 状态 0:失效;1:生效
/** 状态 0:失效;1:生效 */
@Column(name = "status")
private Integer status;
// 类型 0:活动任务模板
/** 类型 0:活动任务模板 */
@Column(name = "type")
@NotNull(message = "type is null", groups = {CreateGroup.class})
private Integer type;
// 模板参数,json
/** 模板参数,json */
@Column(name = "params")
private String params;
/** 删除标识 0:正常;1:已删除; */
@Column(name = "delete_mark")
private Integer deleteMark;
@CreatedDate
@Column(name = "create_time")
private Timestamp createTime;
......
......@@ -27,7 +27,7 @@ public class TaskTemplateBuilder {
taskTemplate_.setEvent(taskTemplate.getEvent());
taskTemplate_.setParams(taskTemplate.getParams());
taskTemplate_.setDescription(taskTemplate.getDescription());
// taskTemplate_.setDeleteMark(Objects.isNull(taskTemplate.getDeleteMark()) ? 0 : taskTemplate.getDeleteMark());
taskTemplate_.setDeleteMark(Objects.isNull(taskTemplate.getDeleteMark()) ? 0 : taskTemplate.getDeleteMark());
return taskTemplate_;
}
......
......@@ -3,6 +3,9 @@ package com.topdraw.business.module.task.template.repository;
import com.topdraw.business.module.task.template.domain.TaskTemplate;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Optional;
......@@ -15,7 +18,12 @@ public interface TaskTemplateRepository extends JpaRepository<TaskTemplate, Long
Optional<TaskTemplate> findFirstByCode(String code);
TaskTemplate findByEvent(String event);
Optional<TaskTemplate> findByEvent(String event);
List<TaskTemplate> findByType(Integer event);
Optional<TaskTemplate> findByType(Integer event);
@Modifying
@Transactional
@Query(value = "UPDATE `tr_task_template` SET `delete_mark` = 1 , `update_time` = now() WHERE `id` = ?1", nativeQuery = true)
void updateDeleteMark(Long id);
}
......
......@@ -2,9 +2,6 @@ package com.topdraw.business.module.task.template.service;
import com.topdraw.business.module.task.template.domain.TaskTemplate;
import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
import com.topdraw.business.module.task.template.service.dto.TaskTemplateQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
/**
......@@ -14,41 +11,54 @@ import java.util.List;
public interface TaskTemplateService {
/**
* 查询数据分页
* @param criteria 条件参数
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TaskTemplateQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TaskTemplateDTO>
*/
List<TaskTemplateDTO> queryAll(TaskTemplateQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TaskTemplateDTO
*/
TaskTemplateDTO findById(Long id);
void create(TaskTemplate resources);
/**
*
* @param resources
*/
TaskTemplateDTO create(TaskTemplate resources);
void update(TaskTemplate resources);
/**
*
* @param resources
*/
TaskTemplateDTO update(TaskTemplate resources);
/**
*
* @param id
*/
void delete(Long id);
/**
*
* @param resources
*/
void delete(TaskTemplate resources);
/**
* Code校验
* @param code
* @return TaskTemplateDTO
*/
TaskTemplateDTO getByCode(String code);
TaskTemplateDTO findByCode(String code);
TaskTemplate findByEvent(String event);
/**
*
* @param event
* @return
*/
TaskTemplateDTO findByEvent(String event);
List<TaskTemplate> findByType(Integer event);
/**
*
* @param event
* @return
*/
TaskTemplateDTO findByType(Integer event);
}
......
......@@ -14,27 +14,30 @@ public class TaskTemplateDTO implements Serializable {
private Long id;
// 标识
/** 标识 */
private String code;
// 名称
/** 名称 */
private String name;
// 关注事件(和MQ topic相关)
/** 关注事件(和MQ topic相关) */
private String event;
// 描述
/** 描述 */
private String description;
// 状态 0:失效;1:生效
/** 状态 0:失效;1:生效 */
private Integer status;
// 类型 0:活动任务模板
/** 类型 0:活动任务模板 */
private Integer type;
// 模板参数,json
/** 模板参数,json */
private String params;
/** 删除标识 0:正常;1:已删除; */
private Integer deleteMark;
private Timestamp createTime;
private Timestamp updateTime;
......
package com.topdraw.business.module.task.template.service.dto;
import lombok.Data;
/**
* @author XiangHan
* @date 2021-10-22
*/
@Data
public class TaskTemplateQueryCriteria{
}
package com.topdraw.business.module.task.template.service.impl;
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.dto.TaskTemplateQueryCriteria;
import com.topdraw.business.module.task.template.service.mapper.TaskTemplateMapper;
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.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 com.topdraw.utils.StringUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
......@@ -32,69 +27,60 @@ import java.util.Objects;
public class TaskTemplateServiceImpl implements TaskTemplateService {
@Autowired
private TaskTemplateRepository TaskTemplateRepository;
private TaskTemplateRepository taskTemplateRepository;
@Autowired
private TaskTemplateMapper TaskTemplateMapper;
@Override
public Map<String, Object> queryAll(TaskTemplateQueryCriteria criteria, Pageable pageable) {
Page<TaskTemplate> page = TaskTemplateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(TaskTemplateMapper::toDto));
}
@Override
public List<TaskTemplateDTO> queryAll(TaskTemplateQueryCriteria criteria) {
return TaskTemplateMapper.toDto(TaskTemplateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
private TaskTemplateMapper taskTemplateMapper;
@Override
public TaskTemplateDTO findById(Long id) {
TaskTemplate TaskTemplate = TaskTemplateRepository.findById(id).orElseGet(TaskTemplate::new);
ValidationUtil.isNull(TaskTemplate.getId(),"TaskTemplate","id",id);
return TaskTemplateMapper.toDto(TaskTemplate);
TaskTemplate TaskTemplate = this.taskTemplateRepository.findById(id).orElseGet(TaskTemplate::new);
ValidationUtil.isNull(TaskTemplate.getId(),"TaskTemplate","id", id);
return this.taskTemplateMapper.toDto(TaskTemplate);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(TaskTemplate resources) {
TaskTemplateRepository.save(resources);
public TaskTemplateDTO create(TaskTemplate resources) {
TaskTemplate save = this.taskTemplateRepository.save(resources);
return this.taskTemplateMapper.toDto(save);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TaskTemplate resources) {
TaskTemplate TaskTemplate = TaskTemplateRepository.findById(resources.getId()).orElseGet(TaskTemplate::new);
ValidationUtil.isNull( TaskTemplate.getId(),"TaskTemplate","id",resources.getId());
TaskTemplate.copy(resources);
TaskTemplateRepository.save(TaskTemplate);
public TaskTemplateDTO update(TaskTemplate resources) {
TaskTemplate taskTemplate = this.taskTemplateRepository.findById(resources.getId()).orElseGet(TaskTemplate::new);
ValidationUtil.isNull(taskTemplate.getId(),"TaskTemplate","id", resources.getId());
taskTemplate.copy(resources);
TaskTemplate save = this.taskTemplateRepository.save(taskTemplate);
return this.taskTemplateMapper.toDto(save);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Long id) {
Assert.notNull(id, "The given id must not be null!");
TaskTemplate TaskTemplate = TaskTemplateRepository.findById(id).orElseThrow(
() -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", TaskTemplate.class, id), 1));
TaskTemplateRepository.delete(TaskTemplate);
this.taskTemplateRepository.updateDeleteMark(id);
}
@Override
public void delete(TaskTemplate resources) {
this.delete(resources.getId());
}
@Override
public TaskTemplateDTO getByCode(String code) {
return StringUtils.isNotEmpty(code) ? TaskTemplateMapper.toDto(TaskTemplateRepository.findFirstByCode(code).orElseGet(TaskTemplate::new))
public TaskTemplateDTO findByCode(String code) {
return StringUtils.isNotEmpty(code) ? this.taskTemplateMapper.toDto(this.taskTemplateRepository.findFirstByCode(code).orElseGet(TaskTemplate::new))
: new TaskTemplateDTO();
}
@Override
public TaskTemplate findByEvent(String event) {
return StringUtils.isNotEmpty(event) ? this.TaskTemplateRepository.findByEvent(event) : null;
public TaskTemplateDTO findByEvent(String event) {
return StringUtils.isNotEmpty(event) ? this.taskTemplateMapper.toDto(this.taskTemplateRepository.findByEvent(event).orElseGet(TaskTemplate::new)) : new TaskTemplateDTO();
}
// @Cacheable(cacheNames = "uc-admin_taskTemplate" , key = "#event")
@Override
public List<TaskTemplate> findByType(Integer event) {
return Objects.nonNull(event) ? this.TaskTemplateRepository.findByType(event) : null;
public TaskTemplateDTO findByType(Integer event) {
return Objects.nonNull(event) ? this.taskTemplateMapper.toDto(this.taskTemplateRepository.findByType(event).orElseGet(TaskTemplate::new)) : new TaskTemplateDTO();
}
}
......
......@@ -2,13 +2,11 @@ package com.topdraw.business.module.user.weixin.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.topdraw.business.module.common.domain.AsyncMqModule;
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.NotNull;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
......
......@@ -5,9 +5,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
* 权益-非持久化数据
......@@ -51,7 +49,7 @@ public class TempRights {
/** 过期时间 */
@Transient
protected LocalDateTime expireTime;
protected Timestamp expireTime;
/** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */
......
......@@ -22,7 +22,7 @@ public class MemberOperationBean {
private Integer vip;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime vipExpireTime;
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Timestamp vipExpireTime;
}
......
......@@ -3,6 +3,7 @@ package com.topdraw.business.process.domian.weixin;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
......@@ -15,8 +16,8 @@ public class BuyVipBean extends WeiXinUserBean {
private Integer vip;
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime vipExpireTime;
// @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private Timestamp vipExpireTime;
}
......
......@@ -41,7 +41,7 @@ public class MemberOperationController {
public ResultInfo updateVipByMemberId(@Validated(value = {UpdateGroup.class}) @RequestBody MemberOperationBean resources) {
log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources);
Integer vip = resources.getVip();
LocalDateTime vipExpireTime = resources.getVipExpireTime();
Timestamp vipExpireTime = resources.getVipExpireTime();
Long memberId = resources.getMemberId();
MemberDTO memberDTO = this.memberOperationService.findById(memberId);
......
package com.topdraw.business.process.rest;
import com.topdraw.annotation.AnonymousAccess;
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.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.*;
import java.util.Arrays;
import java.util.Objects;
@Api("任务处理")
@RestController
@RequestMapping(value = "/uce/taskOperation")
@Slf4j
public class TaskOperationController {
@Autowired
TaskOperationService taskOperationService;
private TaskOperationService taskOperationService;
/**
* 处理事件
......@@ -34,7 +41,63 @@ public class TaskOperationController {
this.taskOperationService.dealTask(criteria.getContent());
}
/**
* 新增任务
*
* @param task 消息
*/
@PostMapping(value = "/createTask")
@ApiOperation("新增任务")
@AnonymousAccess
public void createTask(@RequestBody @Validated(value = {CreateGroup.class}) Task task) {
log.info("taskOperation ==>> createTask ==>> param ==>> {}", task);
String code = task.getCode();
TaskDTO taskDTO = this.taskOperationService.findByCode(code);
if (Objects.isNull(taskDTO.getId())) {
// 新增任务
this.taskOperationService.createTask(task);
}
}
/**
* 修改任务
*
* @param task 消息
*/
@PostMapping(value = "/updateTask")
@ApiOperation("修改任务")
@AnonymousAccess
public void updateTask(@RequestBody @Validated Task task) {
log.info("taskOperation ==>> updateTask ==>> param ==>> {}", task);
Long id = task.getId();
TaskDTO taskDTO = this.taskOperationService.findById(id);
if (Objects.nonNull(taskDTO.getId())) {
task.setCode(taskDTO.getCode());
Task task_ = new Task();
BeanUtils.copyProperties(taskDTO, task_);
task_.copy(task);
// 修改任务
this.taskOperationService.updateTask(task_);
}
}
/**
* 删除任务
*
* @param task 消息
*/
@PostMapping(value = "/deleteTask")
@ApiOperation("删除任务")
@AnonymousAccess
public void deleteTask(@RequestBody @Validated Task task) {
log.info("taskOperation ==>> deleteTask ==>> param ==>> {}", task);
Long id = task.getId();
// 删除任务
this.taskOperationService.deleteTask(id);
}
/**
* 针对重庆20211220号的积分兑换活动专门定制的接口
......
......@@ -2,6 +2,7 @@ package com.topdraw.business.process.rest;
import com.topdraw.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;
......@@ -10,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
@Api("任务模板处理")
@RestController
@RequestMapping(value = "/uce/taskTemplateOperation")
......@@ -29,10 +32,17 @@ public class TaskTemplateOperationController {
@AnonymousAccess
public void create(@RequestBody @Validated TaskTemplate taskTemplate) {
log.info("taskTemplateOperation ==>> create ==>> param ==>> {}", taskTemplate);
String code = taskTemplate.getCode();
Integer type = taskTemplate.getType();
TaskTemplateDTO taskTemplateDTO_ = this.taskTemplateOperationService.findByCode(code);
TaskTemplateDTO taskTemplateDTO_1 = this.taskTemplateOperationService.findByType(type);
if (Objects.isNull(taskTemplateDTO_.getId()) && Objects.isNull(taskTemplateDTO_1.getId())) {
// 新增任务
this.taskTemplateOperationService.create(taskTemplate);
}
}
/**
* 修改任务
*
......@@ -50,13 +60,15 @@ public class TaskTemplateOperationController {
/**
* 删除任务
*
* @param id 消息
* @param taskTemplate 消息
*/
@PostMapping(value = "/delete")
@ApiOperation("删除任务模板")
@AnonymousAccess
public void delete(@RequestParam(value = "id") Long id) {
log.info("taskTemplateOperation ==>> delete ==>> param ==>> {}", id);
public void delete(@RequestBody @Validated TaskTemplate taskTemplate) {
log.info("taskTemplateOperation ==>> delete ==>> param ==>> {}", taskTemplate);
Long id = taskTemplate.getId();
// 删除任务
this.taskTemplateOperationService.delete(id);
}
......
package com.topdraw.business.process.service;
import com.topdraw.business.module.task.domain.Task;
import com.topdraw.business.module.task.service.dto.TaskDTO;
import com.topdraw.common.ResultInfo;
/**
......@@ -9,6 +11,10 @@ import com.topdraw.common.ResultInfo;
*/
public interface TaskOperationService {
TaskDTO findById(Long id);
TaskDTO findByCode(String code);
/**
* 处理任务
*
......@@ -18,9 +24,36 @@ public interface TaskOperationService {
/**
*
* @param task
*/
void createTask(Task task);
/**
*
* @param task
*/
void updateTask(Task task);
/**
*
* @param task
*/
void deleteTask(Task task);
/**
*
* @param id
*/
void deleteTask(Long id);
/**
*
* @param platformAccount
* @param points
* @return
*/
boolean createPoint2ChongQing(String platformAccount, Long points);
}
......
package com.topdraw.business.process.service;
import com.topdraw.business.module.task.template.domain.TaskTemplate;
import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
/**
* @description 权益操作接口
......@@ -33,4 +34,31 @@ public interface TaskTemplateOperationService {
*/
void delete(Long id);
/**
*
* @param code
* @return
*/
TaskTemplateDTO findByCode(String code);
/**
*
* @param id
* @return
*/
TaskTemplateDTO findById(Long id);
/**
*
* @param event
* @return
*/
TaskTemplateDTO findByEvent(String event);
/**
*
* @param event
* @return
*/
TaskTemplateDTO findByType(Integer event);
}
......
......@@ -206,7 +206,7 @@ public class CouponOperationServiceImpl implements CouponOperationService {
couponHistory.setMemberCode(tempCoupon.getMemberCode());
couponHistory.setUserNickname(tempCoupon.getUserNickname());
couponHistory.setOrderDetailId(tempCoupon.getOrderId());
couponHistory.setReceiveTime(LocalDateTime.now());
couponHistory.setReceiveTime(TimestampUtil.now());
couponHistory.setUseStatus(Objects.nonNull(couponHistory.getUseStatus()) ? couponHistory.getUseStatus():0);
this.couponHistoryService.create(couponHistory);
......
......@@ -35,6 +35,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.TimeUnit;
......@@ -95,7 +96,10 @@ public class PointsOperationServiceImpl implements PointsOperationService {
@Override
public void grantPointsByManualByTempPoints(TempPoints tempPoints) {
if (Objects.nonNull(tempPoints) && Objects.nonNull(tempPoints.getPoints())) {
tempPoints.setExpireTime(DateUtil.getLastDateTimeSecondYear());
Timestamp expireTime = tempPoints.getExpireTime();
if (Objects.isNull(expireTime)){
tempPoints.setExpireTime(TimestampUtil.localDateTime2Timestamp(DateUtil.getLastDateTimeSecondYear()));
}
this.refresh(tempPoints);
}
}
......@@ -329,7 +333,7 @@ public class PointsOperationServiceImpl implements PointsOperationService {
private void cleanInvalidAvailablePointsByMemberId(Long memberId) {
List<PointsAvailableDTO> pointsAvailableDTOS =
pointsAvailableService.findByMemberIdAndExpireTimeBefore(memberId,LocalDateTime.now());
pointsAvailableService.findByMemberIdAndExpireTimeBefore(memberId, TimestampUtil.now());
if (!CollectionUtils.isEmpty(pointsAvailableDTOS)) {
......@@ -555,7 +559,7 @@ public class PointsOperationServiceImpl implements PointsOperationService {
String description = pointsAvailable.getDescription();
pointsAvailable.setCode(String.valueOf(IdWorker.generator()));
pointsAvailable.setDescription(StringUtils.isEmpty(description)?"#":description);
LocalDateTime timestamp = tempPoints.getExpireTime();
Timestamp timestamp = tempPoints.getExpireTime();
if (Objects.nonNull(timestamp)) {
pointsAvailable.setExpireTime(timestamp);
}
......
......@@ -21,8 +21,8 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.sql.Timestamp;
import java.util.*;
import java.util.concurrent.*;
/**
* 权益处理
......@@ -230,7 +230,7 @@ public class RightsOperationServiceImpl implements RightsOperationService {
RightsDTO rightsDTO = this.getRights(rightId);
// 权益的实体类型 1:积分;2成长值;3优惠券
String type = rightsDTO.getEntityType();
Long expireTime = rightsDTO.getExpireTime();
Timestamp expireTime = rightsDTO.getExpireTime();
switch (type) {
// 优惠券
......@@ -246,7 +246,8 @@ public class RightsOperationServiceImpl implements RightsOperationService {
tempCoupon.setRightsSendStrategy(0);
tempCoupon.setCode(couponDTO.getCode());
if (Objects.nonNull(expireTime))
tempCoupon.setExpireTime(TimestampUtil.long2LocalDateTime(expireTime));
// tempCoupon.setExpireTime(TimestampUtil.long2LocalDateTime(expireTime));
tempCoupon.setExpireTime(expireTime);
tempCouponList.add(tempCoupon);
}
break;
......
......@@ -3,20 +3,22 @@ package com.topdraw.business.process.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.business.module.coupon.service.CouponService;
import com.topdraw.business.module.coupon.service.dto.CouponDTO;
import com.topdraw.business.module.member.group.service.MemberGroupService;
import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO;
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.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;
import com.topdraw.business.module.task.progress.domain.TrTaskProgress;
import com.topdraw.business.module.task.progress.service.TrTaskProgressService;
import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO;
import com.topdraw.business.module.task.service.dto.TaskDTO;
import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
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;
......@@ -38,13 +40,14 @@ import com.topdraw.exception.BadRequestException;
import com.topdraw.module.mq.DataSyncMsg;
import com.topdraw.util.*;
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.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
......@@ -65,27 +68,27 @@ import static java.util.stream.Collectors.toList;
@Slf4j
public class TaskOperationServiceImpl implements TaskOperationService {
@Autowired
private TaskService taskService;
@Autowired
private UserTvService userTvService;
@Autowired
private MemberService memberService;
@Autowired
private RightsService rightsService;
@Autowired
private TaskTemplateService taskTemplateService;
@Autowired
private RightsOperationService rightsOperationService;
@Autowired
private TrTaskProgressService trTaskProgressService;
@Autowired
private CouponService couponService;
@Autowired
private TaskAttrService taskAttrService;
@Autowired
private MemberGroupService memberGroupService;
@Autowired
private TaskAttrService taskAttrService;
private TaskTemplateService taskTemplateService;
@Autowired
private UserTvService userTvService;
private TrTaskProgressService trTaskProgressService;
@Autowired
private RightsOperationService rightsOperationService;
private static final Integer TASK_FINISH_STATUS = 1;
private static final Integer TASK_UNFINISH_STATUS = 2;
......@@ -93,6 +96,118 @@ public class TaskOperationServiceImpl implements TaskOperationService {
private static final Integer POINTS_MIN = 1;
@AsyncMqSend
public void asyncCreateTask(Task task) {}
@AsyncMqSend
public void asyncUpdateTask(Task task) {}
@AsyncMqSend
public void asyncDeleteTask(Task task) {}
@Override
public void createTask(Task task) {
Long taskTemplateId = task.getTaskTemplateId();
TaskTemplateDTO taskTemplateDTO = this.findByTemplateId(taskTemplateId);
task.setTaskTemplateCode(taskTemplateDTO.getCode());
Task task_ = TaskBuilder.build(task);
TaskDTO taskDTO = this.taskService.create(task_);
if (Objects.nonNull(taskDTO.getId())) {
task_.setId(taskDTO.getId());
this.createTaskAttr(task_);
}
((TaskOperationServiceImpl) AopContext.currentProxy()).asyncCreateTask(task_);
}
/**
*
* @param taskTemplateId
* @return
*/
private TaskTemplateDTO findByTemplateId(Long taskTemplateId){
return this.taskTemplateService.findById(taskTemplateId);
}
/**
*
* @param task_
*/
private void createTaskAttr(Task task_) {
TaskAttr taskAttr = new TaskAttr();
taskAttr.setAttrStr(task_.getAttr());
taskAttr.setTaskId(task_.getId());
this.taskAttrService.create(taskAttr);
}
@Override
public void updateTask(Task task) {
Long taskTemplateId = task.getTaskTemplateId();
TaskTemplateDTO taskTemplateDTO = this.findByTemplateId(taskTemplateId);
task.setTaskTemplateCode(taskTemplateDTO.getCode());
TaskDTO update = this.taskService.update(task);
if (Objects.nonNull(update.getId())) {
this.updateTaskAttr(task);
}
((TaskOperationServiceImpl) AopContext.currentProxy()).asyncUpdateTask(task);
}
/**
*
* @param task_
*/
private void updateTaskAttr(Task task_) {
TaskAttrDTO taskAttrDTO = this.findTaskAttrByTaskId(task_.getId());
if (Objects.nonNull(taskAttrDTO.getId())) {
TaskAttr taskAttr = new TaskAttr();
BeanUtils.copyProperties(taskAttrDTO, taskAttr);
taskAttr.setAttrStr(task_.getAttr());
this.taskAttrService.update(taskAttr);
}
}
@Override
public void deleteTask(Task task) {
Long id = task.getId();
TaskDTO taskDTO = this.findById(id);
if (Objects.nonNull(taskDTO.getId())) {
task.setId(taskDTO.getId());
this.taskService.delete(task);
task.setCode(taskDTO.getCode());
((TaskOperationServiceImpl) AopContext.currentProxy()).asyncDeleteTask(task);
}
}
@Override
public void deleteTask(Long id) {
TaskDTO taskDTO = this.findById(id);
if (Objects.nonNull(taskDTO.getId())) {
Task task = new Task();
task.setId(taskDTO.getId());
task.setCode(taskDTO.getCode());
this.deleteTask(task);
}
}
@Override
public TaskDTO findById(Long id) {
TaskDTO taskDTO = this.taskService.findById(id);
Long id1 = taskDTO.getId();
TaskAttrDTO taskAttrDTO = this.taskAttrService.findByTaskId(id1);
if (Objects.nonNull(taskAttrDTO.getId())) {
String attrStr = taskAttrDTO.getAttrStr();
taskDTO.setAttr(attrStr);
}
return taskDTO;
}
@Override
public TaskDTO findByCode(String code) {
TaskDTO taskDTO = this.taskService.findByCode(code);
return taskDTO;
}
@Override
public ResultInfo dealTask(String content) {
......@@ -101,7 +216,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
Integer event = msgData.getEvent();
String memberCode = msgData.getMemberCode();
Long memberId = msgData.getMemberId();
if (StringUtils.hasText(memberCode)) {
if (StringUtils.isNotBlank(memberCode)) {
MemberDTO memberDTO = this.memberService.findByCode(memberCode);
memberId = memberDTO.getId();
}
......@@ -109,7 +224,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
// 检查当前会员的黑名单状态
boolean b = this.validatedMemberBlackStatus(memberId);
if (!b) {
return ResultInfo.forbidden(" 会员已被加入黑名单");
return ResultInfo.forbidden("会员已被加入黑名单");
}
// 1.通过任务标识获取任务模板,通过模板参数获取具体的模板
......@@ -136,6 +251,8 @@ public class TaskOperationServiceImpl implements TaskOperationService {
}
/**
* 风控检查
* @param memberId
......@@ -156,7 +273,6 @@ public class TaskOperationServiceImpl implements TaskOperationService {
log.info("validatedMember -->>【memberId】 -->> " + memberId);
MemberDTO memberDTO = this.memberService.findById(memberId);
Long blackStatus = memberDTO.getBlackStatus();
// TODO 检查balckStatus无法获取的原因
if (Objects.nonNull(blackStatus) && blackStatus == 1) {
log.error("validatedMember -->> 会员已被加入黑名单 【blackStatus】 -->> " + blackStatus);
return false;
......@@ -216,78 +332,6 @@ public class TaskOperationServiceImpl implements TaskOperationService {
}
private Long getIptvPriorityMemberId(Long memberId1,DataSyncMsg.MsgData msgData) {
//
if (Objects.nonNull(memberId1)) {
return memberId1;
}
@NotNull Integer deviceType = msgData.getDeviceType();
Long userId = msgData.getUserId();
// 大屏
if (Objects.nonNull(userId) || deviceType == 1) {
}
MemberDTO memberDTO = this.findMemberById(memberId1);
if (Objects.nonNull(memberDTO.getId())) {
Long userIptvId = memberDTO.getUserIptvId();
// 绑定了大屏,直接返回小屏会员id
if (Objects.nonNull(userIptvId)) {
return memberDTO.getId();
} else {
//
}
}
return null;
}
/**
* 验证是否满足永久权益
* @param permanentRights
* @param memberId
* @return
*/
private boolean validatedPermanentRights(PermanentRightsDTO permanentRights, Long memberId){
// 永久权益类型 0:vip;1:会员等级
Integer type = 0;
// 等级(当权益类型为vip时,对应vip值,当权益类型为会员等级时,对应等级index)
Integer level = 0;
if (Objects.nonNull(permanentRights)) {
level = permanentRights.getLevel();
type = permanentRights.getType();
}
boolean result = false;
MemberDTO memberDTO = this.memberService.findById(memberId);
if (Objects.nonNull(memberDTO)) {
// 会员vip等级
Integer memberVip = memberDTO.getVip();
// 会员等级
Integer memberLevel = memberDTO.getLevel();
switch (type) {
// vip等级
case 0:
if ((Objects.isNull(memberVip) ? 0 : memberVip) >= level)
result = true;
break;
// 会员等级
case 1:
if ((Objects.isNull(memberLevel) ? 0 : memberLevel) >= level)
result = true;
break;
default:
break;
}
}
return result;
}
/**
* 创建权益
* @param memberId
......@@ -301,9 +345,9 @@ public class TaskOperationServiceImpl implements TaskOperationService {
tempRights.setMemberId(memberId);
tempRights.setMemberCode(memberCode);
tempRights.setRightsAmount(rightsAmount);
Long expireTime = rightsDTO.getExpireTime();
Timestamp expireTime = rightsDTO.getExpireTime();
if (Objects.nonNull(expireTime))
tempRights.setExpireTime(TimestampUtil.long2LocalDateTime(expireTime));
tempRights.setExpireTime(expireTime);
return tempRights;
}
......@@ -485,7 +529,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
Long rewardPoints = task.getRewardPoints();
// 过期时间
Long rewardPointsExpireTime = task.getRewardPointsExpireTime();
LocalDateTime expireTime = task.getExpireTime();
Timestamp expireTime = task.getExpireTime();
// 积分类型(0:定值、1:随机)
Integer pointsType = task.getPointsType();
// 随机积分的最大值
......@@ -544,7 +588,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
List<Task> taskStream = taskList1.stream().filter(task1 ->
task1.getStatus() == 1 &&
(Objects.isNull(task1.getExpireTime()) || task1.getExpireTime().compareTo(LocalDateTime.now()) >= 0) &&
(Objects.isNull(task1.getExpireTime()) || task1.getExpireTime().compareTo(TimestampUtil.now()) >= 0) &&
(Objects.isNull(task1.getValidTime()) || task1.getValidTime().compareTo(TimestampUtil.now()) <= 0) &&
(Objects.isNull(task1.getMemberLevel()) || task1.getMemberLevel() <= memberDTO1.getLevel()) &&
(Objects.isNull(task1.getMemberVip()) || task1.getMemberVip() <= memberDTO1.getVip())
......@@ -868,7 +912,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
continue;
String attrStr = taskAttrDTO.getAttrStr();
if (StringUtils.hasText(attrStr)) {
if (StringUtils.isNotBlank(attrStr)) {
JSONObject jsonObject = JSONObject.parseObject(attrStr);
JSONArray values_0 = jsonObject.getJSONArray("value");
......@@ -977,11 +1021,13 @@ public class TaskOperationServiceImpl implements TaskOperationService {
} else {
List<TaskTemplate> taskTemplateList = this.taskTemplateService.findByType(event);
TaskTemplateDTO taskTemplateDTO = this.taskTemplateService.findByType(event);
if (!CollectionUtils.isEmpty(taskTemplateList)) {
if (Objects.nonNull(taskTemplateDTO)) {
return taskTemplateList.get(0);
TaskTemplate taskTemplate = new TaskTemplate();
BeanUtils.copyProperties(taskTemplateDTO, taskTemplate);
return taskTemplate;
} else {
......@@ -994,22 +1040,22 @@ public class TaskOperationServiceImpl implements TaskOperationService {
private TaskTemplate findByTypeAndParam(Integer event, DataSyncMsg.MsgData taskTemplateParam) {
String param = taskTemplateParam.getParam();
if (StringUtils.hasText(param)) {
if (StringUtils.isNotBlank(param)) {
Map<String,String> jsonObject = JSONObject.parseObject(param,Map.class);
List<TaskTemplate> taskTemplateList = this.taskTemplateService.findByType(event);
if (!CollectionUtils.isEmpty(taskTemplateList)) {
TaskTemplateDTO taskTemplateDTO = this.taskTemplateService.findByType(event);
if (Objects.nonNull(taskTemplateDTO)) {
for (TaskTemplate taskTemplate : taskTemplateList) {
String templateParams = taskTemplate.getParams();
if(StringUtils.hasText(templateParams)) {
String templateParams = taskTemplateDTO.getParams();
if(StringUtils.isNotBlank(templateParams)) {
String templateParamsUpperCase = templateParams.toUpperCase();
Set<String> keySet = jsonObject.keySet();
for (String key : keySet) {
String s = key.toUpperCase();
if (s.equals(templateParamsUpperCase)) {
TaskTemplate taskTemplate = new TaskTemplate();
BeanUtils.copyProperties(taskTemplateDTO, taskTemplate);
return taskTemplate;
}
continue;
......@@ -1020,8 +1066,6 @@ public class TaskOperationServiceImpl implements TaskOperationService {
}
}
return null;
}
......@@ -1075,7 +1119,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
tempPoints.setDeviceType(1);
tempPoints.setEvtType(3);
tempPoints.setPointsType(0);
tempPoints.setExpireTime(LocalDateTime.of(2022,12,31,23,59,59));
tempPoints.setExpireTime(TimestampUtil.localDateTime2Timestamp(LocalDateTime.of(2022,12,31,23,59,59)));
this.pointsOperationService.grantPointsByManualByTempPoints(tempPoints);
}
......
......@@ -6,6 +6,7 @@ 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;
......@@ -32,50 +33,67 @@ public class TaskTemplateOperationServiceImpl implements TaskTemplateOperationSe
private TaskTemplateService taskTemplateService;
@AsyncMqSend
public void asyncTaskTemplate(TaskTemplate resources) {}
public void asyncCreate(TaskTemplate resources) {}
@AsyncMqSend
public void asyncUpdate(TaskTemplate resources) {}
@AsyncMqSend
public void asyncDelete(TaskTemplate resources) {}
@Override
public void create(TaskTemplate resources) {
TaskTemplate taskTemplate = TaskTemplateBuilder.build(resources);
//TaskTemplateDTO taskTemplate_ = this.taskTemplateService.create(taskTemplate);
TaskTemplateDTO taskTemplate_ = this.taskTemplateService.create(taskTemplate);
TaskTemplate taskTemplate1 = new TaskTemplate();
//BeanUtils.copyProperties(taskTemplate_, taskTemplate1);
//((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncTaskTemplate(taskTemplate1);
BeanUtils.copyProperties(taskTemplate_, taskTemplate1);
((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncCreate(taskTemplate1);
}
@Override
public void update(TaskTemplate resources) {
//TaskTemplateDTO taskTemplate_ = this.taskTemplateService.update(resources);
TaskTemplateDTO taskTemplate_ = this.taskTemplateService.update(resources);
TaskTemplate taskTemplate1 = new TaskTemplate();
//BeanUtils.copyProperties(taskTemplate_, taskTemplate1);
((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncTaskTemplate(taskTemplate1);
BeanUtils.copyProperties(taskTemplate_, taskTemplate1);
((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncUpdate(taskTemplate1);
}
@Override
public void delete(TaskTemplate resources) {
//this.taskTemplateService.delete(resources);
//((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncTaskTemplate(resources);
this.taskTemplateService.delete(resources);
((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncDelete(resources);
}
@Override
public void delete(Long id) {
TaskTemplateDTO taskTemplateDTO = this.findById(id);
//this.taskTemplateService.delete(id);
if (Objects.nonNull(taskTemplateDTO.getId())) {
TaskTemplate taskTemplate = new TaskTemplate();
BeanUtils.copyProperties(taskTemplateDTO, taskTemplate);
//taskTemplate.setDeleteMark(1);
//((TaskTemplateOperationServiceImpl) AopContext.currentProxy()).asyncTaskTemplate(taskTemplate);
taskTemplate.setId(id);
taskTemplate.setCode(taskTemplateDTO.getCode());
this.delete(taskTemplate);
}
}
@Override
public TaskTemplateDTO findByCode(String code) {
return null;//this.taskTemplateService.findByCode(code);
return this.taskTemplateService.findByCode(code);
}
@Override
public TaskTemplateDTO findById(Long id) {
return this.taskTemplateService.findById(id);
}
@Override
public TaskTemplateDTO findByEvent(String event) {
return this.taskTemplateService.findByEvent(event);
}
@Override
public TaskTemplateDTO findByType(Integer type) {
return this.taskTemplateService.findByType(type);
}
}
......
......@@ -36,7 +36,6 @@ import com.topdraw.config.RedisKeyUtil;
import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.EntityNotFoundException;
import com.topdraw.exception.GlobeExceptionMsg;
import com.topdraw.mq.producer.MessageProducer;
import com.topdraw.util.TimestampUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.RedisUtils;
......@@ -689,7 +688,7 @@ public class UserOperationServiceImpl implements UserOperationService {
bindIptvPlatformType = PLATFORM_LIST[1];
}
memberDTO.setUserIptvId(userTvDTO.getId());
memberDTO.setBindIptvTime(LocalDateTime.now());
memberDTO.setBindIptvTime(TimestampUtil.now());
memberDTO.setBindIptvPlatformType(bindIptvPlatformType);
memberDTO.setPlatformAccount(platformAccount);
......@@ -771,7 +770,7 @@ public class UserOperationServiceImpl implements UserOperationService {
bindIptvPlatformType = PLATFORM_LIST[1];
}
memberDTO.setUserIptvId(userTvDTO.getId());
memberDTO.setBindIptvTime(LocalDateTime.now());
memberDTO.setBindIptvTime(TimestampUtil.now());
memberDTO.setBindIptvPlatformType(bindIptvPlatformType);
memberDTO.setPlatformAccount(platformAccount);
......
......@@ -17,6 +17,7 @@ import com.topdraw.business.process.domian.weixin.BuyVipBean;
import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.business.process.service.member.MemberProfileOperationService;
import com.topdraw.exception.EntityNotFoundException;
import com.topdraw.util.TimestampUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
......@@ -26,6 +27,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Objects;
......@@ -52,7 +54,7 @@ public class MemberOperationServiceImpl implements MemberOperationService {
Long id = resources.getId();
// 过期时间
LocalDateTime vipExpireTime1 = resources.getVipExpireTime();
Timestamp vipExpireTime1 = resources.getVipExpireTime();
Integer vip1 = resources.getVip();
// 查询微信账户
......@@ -65,7 +67,7 @@ public class MemberOperationServiceImpl implements MemberOperationService {
Integer vip = memberDTO.getVip();
//
LocalDateTime vipExpireTime = memberDTO.getVipExpireTime();
Timestamp vipExpireTime = memberDTO.getVipExpireTime();
if (Objects.nonNull(vipExpireTime1)) {
vipExpireTime = vipExpireTime1;
}
......@@ -74,9 +76,10 @@ public class MemberOperationServiceImpl implements MemberOperationService {
if (Objects.isNull(vipExpireTime1)) {
if (ObjectUtil.isNull(vipExpireTime)) {
LocalDateTime now = LocalDateTime.now();
vipExpireTime = now.plusYears(1L);
vipExpireTime = TimestampUtil.localDateTime2Timestamp(now.plusYears(1L));
} else {
vipExpireTime = vipExpireTime.plusYears(1L);
LocalDateTime localDateTime = TimestampUtil.timestamp2LocalDateTime(vipExpireTime).plusYears(1L);
vipExpireTime = TimestampUtil.localDateTime2Timestamp(localDateTime);
}
}
......@@ -190,7 +193,7 @@ public class MemberOperationServiceImpl implements MemberOperationService {
// vip
Integer vip = memberDTO.getVip();
// 过期时间
LocalDateTime vipExpireTime = memberDTO.getVipExpireTime();
Timestamp vipExpireTime = memberDTO.getVipExpireTime();
Long timeLong = 0L;
if (ObjectUtil.isNotNull(vipExpireTime)) {
......@@ -206,9 +209,9 @@ public class MemberOperationServiceImpl implements MemberOperationService {
});
vip = memberDTO1.getVip();
LocalDateTime vipExpireTime1 = memberDTO1.getVipExpireTime();
Timestamp vipExpireTime1 = memberDTO1.getVipExpireTime();
if (Objects.nonNull(vipExpireTime1)) {
timeLong = vipExpireTime1.toInstant(ZoneOffset.of("+8")).toEpochMilli();
timeLong = TimestampUtil.timestamp2long(vipExpireTime1);//vipExpireTime1.toInstant(ZoneOffset.of("+8")).toEpochMilli();
}
}
......@@ -236,16 +239,16 @@ public class MemberOperationServiceImpl implements MemberOperationService {
* @param vipExpireTime
* @return
*/
private MemberDTO checkVipStatus(MemberDTO memberDTO,LocalDateTime vipExpireTime, String appid) {
private MemberDTO checkVipStatus(MemberDTO memberDTO,Timestamp vipExpireTime, String appid) {
Long memberId = memberDTO.getId();
LocalDateTime nowTime = LocalDateTime.now();
Timestamp nowTime = TimestampUtil.now();
//vip过期,回退上个vip状态 同时修改member表vip
if (nowTime.compareTo(vipExpireTime) >= 0 ) {
Integer vip = 0;
LocalDateTime vipExpireTime1 = memberDTO.getVipExpireTime();
Timestamp vipExpireTime1 = memberDTO.getVipExpireTime();
//查询小于失效时间的那条记录 查不到 取微信表里 关注状态
MemberVipHistory memberVipHistory = this.memberVipHistoryService.findByTime(memberId, nowTime);
......
......@@ -32,6 +32,12 @@ public class DateUtil {
return localDateTime;
}
public static Long getLastDateTimeSecondYearLong(){
LocalDateTime localDateTime = getLastDateTimeSecondYear();
long l = TimestampUtil.localDateTime2long(localDateTime);
return l;
}
/**
* 获取指定某一天的开始时间戳
......
......@@ -10,10 +10,10 @@ public class RandomUtil {
* @param min
* @return
*/
public static long getRandomPoints(Integer min,Integer max) {
public static Long getRandomPoints(Integer min,Integer max) {
Random random = new Random();
int s = random.nextInt(max)%(max-min+1) + min;
return s;
return Long.valueOf(s);
}
public static void main(String[] args) {
......
......@@ -36,6 +36,12 @@ public class TimestampUtil {
return l;
}
public static LocalDateTime timestamp2LocalDateTime(Timestamp timestamp){
long l1 = timestamp2long(timestamp);
LocalDateTime localDateTime = long2LocalDateTime(l1);
return localDateTime;
}
public static LocalDateTime long2LocalDateTime(Long expireTime) {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(expireTime),ZoneOffset.of("+8"));
}
......
......@@ -6,6 +6,7 @@ import com.topdraw.business.module.points.available.service.dto.PointsAvailableD
import com.topdraw.business.process.domian.TempPoints;
import com.topdraw.BaseTest;
import com.topdraw.util.IdWorker;
import com.topdraw.util.TimestampUtil;
import org.junit.Test;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -22,7 +23,7 @@ public class PointsAvailableServiceTest extends BaseTest {
public void loadListExpirePointsByMemberId() {
Long memberId = 2L;
List<PointsAvailableDTO> pointsAvailableDTOS =
this.pointsAvailableService.findByMemberIdAndExpireTimeBefore(memberId, LocalDateTime.now());
this.pointsAvailableService.findByMemberIdAndExpireTimeBefore(memberId,TimestampUtil.now());
LOG.info("===>>>"+pointsAvailableDTOS);
}
......@@ -51,7 +52,7 @@ public class PointsAvailableServiceTest extends BaseTest {
// tempPoints.setDescription("#");
tempPoints.setEvtType(1);
tempPoints.setPoints(10L);
tempPoints.setExpireTime(LocalDateTime.now());
tempPoints.setExpireTime(TimestampUtil.now());
PointsAvailable pointsAvailable = new PointsAvailable();
BeanUtils.copyProperties(tempPoints,pointsAvailable);
......
......@@ -7,6 +7,7 @@ import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.business.process.domian.TempPoints;
import com.topdraw.BaseTest;
import com.topdraw.util.IdWorker;
import com.topdraw.util.TimestampUtil;
import org.junit.Test;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -37,7 +38,7 @@ public class PointsDetailServiceTest extends BaseTest {
tempPoints.setDescription("");
tempPoints.setEvtType(1);
tempPoints.setPoints(10L);
tempPoints.setExpireTime(LocalDateTime.now());
tempPoints.setExpireTime(TimestampUtil.now());
MemberDTO memberDTO = this.memberOperationService.findById(memberId);
......
......@@ -7,6 +7,7 @@ import com.topdraw.business.module.points.detail.service.PointsDetailService;
import com.topdraw.business.process.domian.TempPoints;
import com.topdraw.business.process.service.member.MemberOperationService;
import com.topdraw.util.IdWorker;
import com.topdraw.util.TimestampUtil;
import org.junit.Test;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -37,7 +38,7 @@ public class RightsServiceTest extends BaseTest {
tempPoints.setDescription("");
tempPoints.setEvtType(1);
tempPoints.setPoints(10L);
tempPoints.setExpireTime(LocalDateTime.now());
tempPoints.setExpireTime(TimestampUtil.now());
MemberDTO memberDTO = this.memberOperationService.findById(memberId);
......
......@@ -3,6 +3,7 @@ package com.topdraw.test.business.basicdata.task;
import com.topdraw.business.module.task.template.domain.TaskTemplate;
import com.topdraw.business.module.task.template.service.TaskTemplateService;
import com.topdraw.BaseTest;
import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -14,7 +15,7 @@ public class TaskTemplateServiceTest extends BaseTest {
@Test
public void dealTaskTest(){
String eventCode = "tv";
TaskTemplate taskTemplate = this.taskTemplateService.findByEvent(eventCode);
TaskTemplateDTO taskTemplate = this.taskTemplateService.findByEvent(eventCode);
LOG.info("=====>>>" + taskTemplate);
}
......
......@@ -7,6 +7,7 @@ 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;
......@@ -29,7 +30,7 @@ public class ExpOperationControllerTest extends BaseTest {
tempExp.setRewardExp(10L);
tempExp.setRightsSendStrategy(0);
tempExp.setAccountId(userId);
tempExp.setExpireTime(LocalDateTime.now());
tempExp.setExpireTime(TimestampUtil.now());
tempExp.setDeviceType(2);
tempExp.setAppCode("WEI_XIN_GOLD_PANDA");
tempExp.setOrderId(null);
......
......@@ -5,6 +5,7 @@ import com.topdraw.BaseTest;
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;
......@@ -39,7 +40,7 @@ public class PointsOperationControllerTest extends BaseTest {
tempPoints.setPointsType(0);
tempPoints.setRightsSendStrategy(0);
tempPoints.setAccountId(2L);
tempPoints.setExpireTime(LocalDateTime.now());
tempPoints.setExpireTime(TimestampUtil.now());
tempPoints.setDeviceType(2);
tempPoints.setAppCode("WEI_XIN_GOLD_PANDA");
tempPoints.setOrderId(null);
......@@ -72,7 +73,7 @@ public class PointsOperationControllerTest extends BaseTest {
tempPoints.setDescription("系统发放");
tempPoints.setEvtType(1);
String s = JSON.toJSONString(tempPoints);*/
ResultInfo byId = this.pointsOperationController.cleanInvalidPointsAndCalculateCurrentPoints(5L);
ResultInfo byId = this.pointsOperationController.cleanInvalidPointsAndCalculateCurrentPoints(22L);
LOG.info("===>>>"+byId);
}
......
......@@ -5,6 +5,7 @@ import com.topdraw.BaseTest;
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;
......@@ -22,7 +23,7 @@ public class RightOperationControllerTest extends BaseTest {
rightsHistory.setMemberId(3L);
rightsHistory.setOperatorId(3L);
rightsHistory.setOperatorName("鲁二龙");
rightsHistory.setExpireTime(LocalDateTime.now());
rightsHistory.setExpireTime(TimestampUtil.now());
rightsHistory.setUserId(2L);
ResultInfo byId = this.rightsOperationController.grantRightsByManual(rightsHistory);
LOG.info("===>>>"+byId);
......
package com.topdraw.test.business.process.rest;
import com.alibaba.fastjson.JSON;
import com.topdraw.business.module.task.domain.Task;
import com.topdraw.business.module.task.service.dto.TaskDTO;
import com.topdraw.business.process.rest.TaskOperationController;
import com.topdraw.business.process.service.TaskOperationService;
import com.topdraw.business.process.service.dto.TaskOperationQueryCriteria;
import com.topdraw.module.mq.DataSyncMsg;
import com.topdraw.module.mq.EventType;
import com.topdraw.BaseTest;
import com.topdraw.util.TimestampUtil;
import org.junit.Test;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.time.LocalDateTime;
import java.util.concurrent.FutureTask;
public class TaskOperationControllerTest extends BaseTest {
@Autowired
TaskOperationController taskOperationController;
@Autowired
TaskOperationService taskOperationService;
@Test
public void createTask() {
Task task = new Task();
task.setName("testTask");
task.setCode("testTaskCode1122");
task.setRightsSendStrategy(0);
task.setMemberLevel(null);
task.setMemberVip(null);
task.setActionAmount(1);
task.setGroups(null);
task.setRewardExp(0L);
task.setStatus(1);
task.setTaskDailyReset(1);
task.setTaskRepeatType(1);
task.setTaskTemplateId(13L);
task.setExpireTime(TimestampUtil.now());
task.setValidTime(TimestampUtil.now());
task.setPointsType(0);
task.setAttr("{\"value\":\"[1,2]\"}");
task.setTaskTemplateId(13L);
this.taskOperationController.createTask(task);
}
@Test
public void updateTask() {
TaskDTO taskDTO = this.taskOperationService.findById(15L);
Task task = new Task();
BeanUtils.copyProperties(taskDTO, task);
task.setName("testTask4455");
task.setAttr("{\"value\":\"[4,10]\"}");
this.taskOperationController.updateTask(task);
}
@Test
public void deleteTask() {
Task task = new Task();
task.setId(15L);
this.taskOperationController.deleteTask(task);
}
@Test
public void activity() {
......
......@@ -73,7 +73,7 @@ public class MemberOperationServiceTest extends BaseTest {
member.setDueCouponAmount(0L);
member.setUserIptvId(1L);
member.setBindIptvPlatformType(0);
member.setBindIptvTime(LocalDateTime.now());
member.setBindIptvTime(TimestampUtil.now());
// member.setUpdateTime(Timestamp.valueOf(LocalDateTime.now()));
this.memberOperationService.doInsertMember(member);
}
......