Commit 82a96a78 82a96a78bf9d4f12e0e9a064800918669ec03fdb by xianghan

1.update

1 parent bd7691dc
Showing 241 changed files with 4047 additions and 670 deletions
......@@ -33,8 +33,8 @@
<!--代码生成器-->
<dependency>
<groupId>com.topdraw</groupId>
<artifactId>code-generator</artifactId>
<version>3.1.0</version>
<artifactId>cronos-system</artifactId>
<version>1.1.0</version>
</dependency>
<!-- Spring boot 热部署 : 此热部署会遇到 java.lang.ClassCastException 异常 -->
......
package com.topdraw.business.module.common.domain;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.persistence.Transient;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/2/10 10:12
* @version: :
* @modified By:
* @since : modified in 2022/2/10 10:12
*/
@Data
@Accessors(chain = true)
public class DefaultAsyncMqModule {
@Transient
private String memberCode;
}
package com.topdraw.business.basicdata.coupon.domain;
package com.topdraw.business.module.coupon.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.coupon.history.domain;
package com.topdraw.business.module.coupon.history.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......@@ -11,6 +11,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
* @author XiangHan
......@@ -47,11 +48,11 @@ public class CouponHistory implements Serializable {
// 领取时间
@Column(name = "receive_time")
private Timestamp receiveTime;
private LocalDateTime receiveTime;
// 失效时间
@Column(name = "expire_time")
private Timestamp expireTime;
private LocalDateTime expireTime;
// 使用状态 0:未使用;1:已使用;-1:已过期
@Column(name = "use_status")
......@@ -59,7 +60,7 @@ public class CouponHistory implements Serializable {
// 使用时间
@Column(name = "use_time")
private Timestamp useTime;
private LocalDateTime useTime;
// 订单详情id
@Column(name = "order_detail_id")
......@@ -68,12 +69,12 @@ public class CouponHistory implements Serializable {
// 创建时间
@CreatedDate
@Column(name = "create_time")
private Timestamp createTime;
private LocalDateTime createTime;
// 更新时间
@LastModifiedDate
@Column(name = "update_time")
private Timestamp updateTime;
private LocalDateTime updateTime;
public void copy(CouponHistory source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
......
package com.topdraw.business.basicdata.coupon.history.repository;
package com.topdraw.business.module.coupon.history.repository;
import com.topdraw.business.basicdata.coupon.history.domain.CouponHistory;
import com.topdraw.business.module.coupon.history.domain.CouponHistory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
* @author XiangHan
......@@ -14,7 +15,7 @@ public interface CouponHistoryRepository extends JpaRepository<CouponHistory, Lo
Long countByUserId(Long userId);
Long countByUserIdAndExpireTimeBefore(Long userId, Timestamp now);
Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now);
Long countByUserIdAndExpireTimeBetween(Long userId, Timestamp now, Timestamp expireTime);
Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime);
}
......
package com.topdraw.business.basicdata.coupon.history.rest;
package com.topdraw.business.module.coupon.history.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.coupon.history.domain.CouponHistory;
import com.topdraw.business.basicdata.coupon.history.service.CouponHistoryService;
import com.topdraw.business.basicdata.coupon.history.service.dto.CouponHistoryQueryCriteria;
import com.topdraw.business.module.coupon.history.domain.CouponHistory;
import com.topdraw.business.module.coupon.history.service.CouponHistoryService;
import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,7 +35,6 @@ public class CouponHistoryController {
return ResultInfo.success(CouponHistoryService.queryAll(criteria));
}
@Log
@PostMapping
@ApiOperation("新增CouponHistory")
public ResultInfo create(@Validated @RequestBody CouponHistory resources) {
......@@ -44,7 +42,6 @@ public class CouponHistoryController {
return ResultInfo.success();
}
@Log
@PutMapping
@ApiOperation("修改CouponHistory")
public ResultInfo update(@Validated @RequestBody CouponHistory resources) {
......@@ -53,7 +50,6 @@ public class CouponHistoryController {
}
@Log
@DeleteMapping(value = "/{id}")
@ApiOperation("删除CouponHistory")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.basicdata.coupon.history.service;
package com.topdraw.business.module.coupon.history.service;
import com.topdraw.business.basicdata.coupon.history.domain.CouponHistory;
import com.topdraw.business.basicdata.coupon.history.service.dto.CouponHistoryDTO;
import com.topdraw.business.basicdata.coupon.history.service.dto.CouponHistoryQueryCriteria;
import com.topdraw.business.module.coupon.history.domain.CouponHistory;
import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO;
import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
......@@ -45,7 +46,7 @@ public interface CouponHistoryService {
Long countByUserId(Long userId);
Long countByUserIdAndExpireTimeBefore(Long userId, Timestamp now);
Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now);
Long countByUserIdAndExpireTimeBetween(Long userId, Timestamp now, Timestamp expireTime);
Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime);
}
......
package com.topdraw.business.basicdata.coupon.history.service.dto;
package com.topdraw.business.module.coupon.history.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
......@@ -29,23 +30,23 @@ public class CouponHistoryDTO implements Serializable {
private String userNickname;
// 领取时间
private Timestamp receiveTime;
private LocalDateTime receiveTime;
// 失效时间
private Timestamp expireTime;
private LocalDateTime expireTime;
// 使用状态 0:未使用;1:已使用;-1:已过期
private Integer useStatus;
// 使用时间
private Timestamp useTime;
private LocalDateTime useTime;
// 订单详情id
private Long orderDetailId;
// 创建时间
private Timestamp createTime;
private LocalDateTime createTime;
// 更新时间
private Timestamp updateTime;
private LocalDateTime updateTime;
}
......
package com.topdraw.business.basicdata.coupon.history.service.dto;
package com.topdraw.business.module.coupon.history.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.coupon.history.service.impl;
import com.topdraw.business.basicdata.coupon.history.domain.CouponHistory;
import com.topdraw.business.basicdata.coupon.history.repository.CouponHistoryRepository;
import com.topdraw.business.basicdata.coupon.history.service.CouponHistoryService;
import com.topdraw.business.basicdata.coupon.history.service.dto.CouponHistoryDTO;
import com.topdraw.business.basicdata.coupon.history.service.dto.CouponHistoryQueryCriteria;
import com.topdraw.business.basicdata.coupon.history.service.mapper.CouponHistoryMapper;
package com.topdraw.business.module.coupon.history.service.impl;
import com.topdraw.business.module.coupon.history.domain.CouponHistory;
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;
import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria;
import com.topdraw.business.module.coupon.history.service.mapper.CouponHistoryMapper;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.ValidationUtil;
......@@ -19,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
......@@ -84,12 +85,12 @@ public class CouponHistoryServiceImpl implements CouponHistoryService {
}
@Override
public Long countByUserIdAndExpireTimeBefore(Long userId, Timestamp now) {
public Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now) {
return this.CouponHistoryRepository.countByUserIdAndExpireTimeBefore(userId,now);
}
@Override
public Long countByUserIdAndExpireTimeBetween(Long userId, Timestamp now, Timestamp expireTime) {
public Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime) {
return this.CouponHistoryRepository.countByUserIdAndExpireTimeBetween(userId,now,expireTime);
}
......
package com.topdraw.business.basicdata.coupon.history.service.mapper;
package com.topdraw.business.module.coupon.history.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.coupon.history.domain.CouponHistory;
import com.topdraw.business.basicdata.coupon.history.service.dto.CouponHistoryDTO;
import com.topdraw.business.module.coupon.history.domain.CouponHistory;
import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.coupon.repository;
package com.topdraw.business.module.coupon.repository;
import com.topdraw.business.basicdata.coupon.domain.Coupon;
import com.topdraw.business.module.coupon.domain.Coupon;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.coupon.rest;
package com.topdraw.business.module.coupon.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.coupon.domain.Coupon;
import com.topdraw.business.basicdata.coupon.service.CouponService;
import com.topdraw.business.basicdata.coupon.service.dto.CouponQueryCriteria;
import com.topdraw.business.module.coupon.domain.Coupon;
import com.topdraw.business.module.coupon.service.CouponService;
import com.topdraw.business.module.coupon.service.dto.CouponQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,7 +35,6 @@ public class CouponController {
return ResultInfo.success(CouponService.queryAll(criteria));
}
@Log
@PostMapping
@ApiOperation("新增Coupon")
public ResultInfo create(@Validated @RequestBody Coupon resources) {
......@@ -44,7 +42,6 @@ public class CouponController {
return ResultInfo.success();
}
@Log
@PutMapping
@ApiOperation("修改Coupon")
public ResultInfo update(@Validated @RequestBody Coupon resources) {
......@@ -52,8 +49,6 @@ public class CouponController {
return ResultInfo.success();
}
@Log
@DeleteMapping(value = "/{id}")
@ApiOperation("删除Coupon")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.basicdata.coupon.service;
package com.topdraw.business.module.coupon.service;
import com.topdraw.business.basicdata.coupon.domain.Coupon;
import com.topdraw.business.basicdata.coupon.service.dto.CouponDTO;
import com.topdraw.business.basicdata.coupon.service.dto.CouponQueryCriteria;
import com.topdraw.business.module.coupon.domain.Coupon;
import com.topdraw.business.module.coupon.service.dto.CouponDTO;
import com.topdraw.business.module.coupon.service.dto.CouponQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......
package com.topdraw.business.basicdata.coupon.service.dto;
package com.topdraw.business.module.coupon.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.coupon.service.dto;
package com.topdraw.business.module.coupon.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.coupon.service.impl;
package com.topdraw.business.module.coupon.service.impl;
import com.topdraw.business.basicdata.coupon.domain.Coupon;
import com.topdraw.business.basicdata.coupon.repository.CouponRepository;
import com.topdraw.business.basicdata.coupon.service.CouponService;
import com.topdraw.business.basicdata.coupon.service.dto.CouponDTO;
import com.topdraw.business.basicdata.coupon.service.dto.CouponQueryCriteria;
import com.topdraw.business.basicdata.coupon.service.mapper.CouponMapper;
import com.topdraw.business.module.coupon.domain.Coupon;
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.dto.CouponQueryCriteria;
import com.topdraw.business.module.coupon.service.mapper.CouponMapper;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.StringUtils;
......
package com.topdraw.business.basicdata.coupon.service.mapper;
package com.topdraw.business.module.coupon.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.coupon.domain.Coupon;
import com.topdraw.business.basicdata.coupon.service.dto.CouponDTO;
import com.topdraw.business.module.coupon.domain.Coupon;
import com.topdraw.business.module.coupon.service.dto.CouponDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.exp.detail.domain;
package com.topdraw.business.module.exp.detail.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.exp.detail.repository;
package com.topdraw.business.module.exp.detail.repository;
import com.topdraw.business.basicdata.exp.detail.domain.ExpDetail;
import com.topdraw.business.module.exp.detail.domain.ExpDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.exp.detail.rest;
package com.topdraw.business.module.exp.detail.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.exp.detail.domain.ExpDetail;
import com.topdraw.business.basicdata.exp.detail.service.ExpDetailService;
import com.topdraw.business.basicdata.exp.detail.service.dto.ExpDetailQueryCriteria;
import com.topdraw.business.module.exp.detail.domain.ExpDetail;
import com.topdraw.business.module.exp.detail.service.ExpDetailService;
import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,7 +35,6 @@ public class ExpDetailController {
return ResultInfo.success(ExpDetailService.queryAll(criteria));
}
@Log
@PostMapping
@ApiOperation("新增ExpDetail")
public ResultInfo create(@Validated @RequestBody ExpDetail resources) {
......@@ -44,7 +42,6 @@ public class ExpDetailController {
return ResultInfo.success();
}
@Log
@PutMapping
@ApiOperation("修改ExpDetail")
public ResultInfo update(@Validated @RequestBody ExpDetail resources) {
......@@ -52,8 +49,6 @@ public class ExpDetailController {
return ResultInfo.success();
}
@Log
@DeleteMapping(value = "/{id}")
@ApiOperation("删除ExpDetail")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.basicdata.exp.detail.service;
package com.topdraw.business.module.exp.detail.service;
import com.topdraw.business.basicdata.exp.detail.domain.ExpDetail;
import com.topdraw.business.basicdata.exp.detail.service.dto.ExpDetailDTO;
import com.topdraw.business.basicdata.exp.detail.service.dto.ExpDetailQueryCriteria;
import com.topdraw.business.module.exp.detail.domain.ExpDetail;
import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO;
import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......
package com.topdraw.business.basicdata.exp.detail.service.dto;
package com.topdraw.business.module.exp.detail.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.exp.detail.service.dto;
package com.topdraw.business.module.exp.detail.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.exp.detail.service.impl;
package com.topdraw.business.module.exp.detail.service.impl;
import com.topdraw.business.basicdata.exp.detail.domain.ExpDetail;
import com.topdraw.business.basicdata.exp.detail.repository.ExpDetailRepository;
import com.topdraw.business.basicdata.exp.detail.service.ExpDetailService;
import com.topdraw.business.basicdata.exp.detail.service.dto.ExpDetailDTO;
import com.topdraw.business.basicdata.exp.detail.service.dto.ExpDetailQueryCriteria;
import com.topdraw.business.basicdata.exp.detail.service.mapper.ExpDetailMapper;
import com.topdraw.business.module.exp.detail.domain.ExpDetail;
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.dto.ExpDetailQueryCriteria;
import com.topdraw.business.module.exp.detail.service.mapper.ExpDetailMapper;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.StringUtils;
......
package com.topdraw.business.basicdata.exp.detail.service.mapper;
package com.topdraw.business.module.exp.detail.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.exp.detail.domain.ExpDetail;
import com.topdraw.business.basicdata.exp.detail.service.dto.ExpDetailDTO;
import com.topdraw.business.module.exp.detail.domain.ExpDetail;
import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.exp.history.domain;
package com.topdraw.business.module.exp.history.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.exp.history.repository;
package com.topdraw.business.module.exp.history.repository;
import com.topdraw.business.basicdata.exp.history.domain.ExpHistory;
import com.topdraw.business.module.exp.history.domain.ExpHistory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.exp.history.rest;
package com.topdraw.business.module.exp.history.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.exp.history.domain.ExpHistory;
import com.topdraw.business.basicdata.exp.history.service.ExpHistoryService;
import com.topdraw.business.basicdata.exp.history.service.dto.ExpHistoryQueryCriteria;
import com.topdraw.business.module.exp.history.domain.ExpHistory;
import com.topdraw.business.module.exp.history.service.ExpHistoryService;
import com.topdraw.business.module.exp.history.service.dto.ExpHistoryQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,7 +35,6 @@ public class ExpHistoryController {
return ResultInfo.success(ExpHistoryService.queryAll(criteria));
}
@Log
@PostMapping
@ApiOperation("新增ExpHistory")
public ResultInfo create(@Validated @RequestBody ExpHistory resources) {
......@@ -44,7 +42,6 @@ public class ExpHistoryController {
return ResultInfo.success();
}
@Log
@PutMapping
@ApiOperation("修改ExpHistory")
public ResultInfo update(@Validated @RequestBody ExpHistory resources) {
......@@ -52,8 +49,6 @@ public class ExpHistoryController {
return ResultInfo.success();
}
@Log
@DeleteMapping(value = "/{id}")
@ApiOperation("删除ExpHistory")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.basicdata.exp.history.service;
package com.topdraw.business.module.exp.history.service;
import com.topdraw.business.basicdata.exp.history.domain.ExpHistory;
import com.topdraw.business.basicdata.exp.history.service.dto.ExpHistoryDTO;
import com.topdraw.business.basicdata.exp.history.service.dto.ExpHistoryQueryCriteria;
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.List;
......
package com.topdraw.business.basicdata.exp.history.service.dto;
package com.topdraw.business.module.exp.history.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.exp.history.service.dto;
package com.topdraw.business.module.exp.history.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.exp.history.service.impl;
package com.topdraw.business.module.exp.history.service.impl;
import com.topdraw.business.basicdata.exp.history.domain.ExpHistory;
import com.topdraw.business.basicdata.exp.history.repository.ExpHistoryRepository;
import com.topdraw.business.basicdata.exp.history.service.ExpHistoryService;
import com.topdraw.business.basicdata.exp.history.service.dto.ExpHistoryDTO;
import com.topdraw.business.basicdata.exp.history.service.dto.ExpHistoryQueryCriteria;
import com.topdraw.business.basicdata.exp.history.service.mapper.ExpHistoryMapper;
import com.topdraw.business.module.exp.history.domain.ExpHistory;
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.dto.ExpHistoryQueryCriteria;
import com.topdraw.business.module.exp.history.service.mapper.ExpHistoryMapper;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.StringUtils;
......
package com.topdraw.business.basicdata.exp.history.service.mapper;
package com.topdraw.business.module.exp.history.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.exp.history.domain.ExpHistory;
import com.topdraw.business.basicdata.exp.history.service.dto.ExpHistoryDTO;
import com.topdraw.business.module.exp.history.domain.ExpHistory;
import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.member.address.domain;
package com.topdraw.business.module.member.address.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.member.address.repository;
package com.topdraw.business.module.member.address.repository;
import com.topdraw.business.basicdata.member.address.domain.MemberAddress;
import com.topdraw.business.module.member.address.domain.MemberAddress;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.member.address.rest;
package com.topdraw.business.module.member.address.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.member.address.domain.MemberAddress;
import com.topdraw.business.basicdata.member.address.service.MemberAddressService;
import com.topdraw.business.basicdata.member.address.service.dto.MemberAddressQueryCriteria;
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.MemberAddressQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,7 +35,6 @@ public class MemberAddressController {
return ResultInfo.success(MemberAddressService.findById(id));
}
@Log
@PostMapping(value = "/create")
@ApiOperation("新增MemberAddress")
public ResultInfo create(@Validated @RequestBody MemberAddress resources) {
......@@ -44,7 +42,6 @@ public class MemberAddressController {
return ResultInfo.success();
}
@Log
@PutMapping(value = "/update")
@ApiOperation("修改MemberAddress")
public ResultInfo update(@Validated @RequestBody MemberAddress resources) {
......@@ -52,7 +49,6 @@ public class MemberAddressController {
return ResultInfo.success();
}
@Log
@DeleteMapping(value = "/delete/{id}")
@ApiOperation("删除MemberAddress")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.basicdata.member.address.service;
package com.topdraw.business.module.member.address.service;
import com.topdraw.business.basicdata.member.address.domain.MemberAddress;
import com.topdraw.business.basicdata.member.address.service.dto.MemberAddressDTO;
import com.topdraw.business.basicdata.member.address.service.dto.MemberAddressQueryCriteria;
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.address.service.dto.MemberAddressQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......
package com.topdraw.business.basicdata.member.address.service.dto;
package com.topdraw.business.module.member.address.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.member.address.service.dto;
package com.topdraw.business.module.member.address.service.dto;
import com.topdraw.annotation.Query;
import lombok.Data;
......
package com.topdraw.business.basicdata.member.address.service.impl;
package com.topdraw.business.module.member.address.service.impl;
import com.topdraw.business.basicdata.member.address.domain.MemberAddress;
import com.topdraw.business.basicdata.member.address.repository.MemberAddressRepository;
import com.topdraw.business.basicdata.member.address.service.MemberAddressService;
import com.topdraw.business.basicdata.member.address.service.dto.MemberAddressDTO;
import com.topdraw.business.basicdata.member.address.service.dto.MemberAddressQueryCriteria;
import com.topdraw.business.basicdata.member.address.service.mapper.MemberAddressMapper;
import com.topdraw.business.basicdata.member.service.MemberService;
import com.topdraw.business.basicdata.member.service.dto.MemberDTO;
import com.topdraw.business.module.member.address.domain.MemberAddress;
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;
import com.topdraw.business.module.member.address.service.dto.MemberAddressQueryCriteria;
import com.topdraw.business.module.member.address.service.mapper.MemberAddressMapper;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.ValidationUtil;
......@@ -63,6 +63,9 @@ public class MemberAddressServiceImpl implements MemberAddressService {
@Transactional(rollbackFor = Exception.class)
public void create(MemberAddress resources) {
String memberCode = resources.getMemberCode();
MemberDTO memberDTO = this.memberService.getByCode(memberCode);
Long id = memberDTO.getId();
resources.setMemberId(id);
MemberAddressRepository.save(resources);
}
......
package com.topdraw.business.basicdata.member.address.service.mapper;
package com.topdraw.business.module.member.address.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.member.address.domain.MemberAddress;
import com.topdraw.business.basicdata.member.address.service.dto.MemberAddressDTO;
import com.topdraw.business.module.member.address.domain.MemberAddress;
import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.member.domain;
package com.topdraw.business.module.member.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......@@ -116,17 +116,17 @@ public class Member implements Serializable {
// iptv账号绑定时间
@Column(name = "bind_iptv_time")
private Timestamp bindIptvTime;
private LocalDateTime bindIptvTime;
// 创建时间
@CreatedDate
@Column(name = "create_time")
private Timestamp createTime;
private LocalDateTime createTime;
// 更新时间
@LastModifiedDate
@Column(name = "update_time")
private Timestamp updateTime;
private LocalDateTime updateTime;
// 是否在黑名单 1:是;0否
@Column(name = "black_status")
......
package com.topdraw.business.basicdata.member.level.domain;
package com.topdraw.business.module.member.level.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.member.level.repository;
package com.topdraw.business.module.member.level.repository;
import com.topdraw.business.basicdata.member.level.domain.MemberLevel;
import com.topdraw.business.module.member.level.domain.MemberLevel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.member.level.rest;
package com.topdraw.business.module.member.level.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.member.level.domain.MemberLevel;
import com.topdraw.business.basicdata.member.level.service.MemberLevelService;
import com.topdraw.business.basicdata.member.level.service.dto.MemberLevelQueryCriteria;
import com.topdraw.business.module.member.level.domain.MemberLevel;
import com.topdraw.business.module.member.level.service.MemberLevelService;
import com.topdraw.business.module.member.level.service.dto.MemberLevelQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,7 +35,6 @@ public class MemberLevelController {
return ResultInfo.success(MemberLevelService.queryAll(criteria));
}
@Log
@PostMapping
@ApiOperation("新增MemberLevel")
public ResultInfo create(@Validated @RequestBody MemberLevel resources) {
......@@ -44,7 +42,6 @@ public class MemberLevelController {
return ResultInfo.success();
}
@Log
@PutMapping
@ApiOperation("修改MemberLevel")
public ResultInfo update(@Validated @RequestBody MemberLevel resources) {
......@@ -52,8 +49,6 @@ public class MemberLevelController {
return ResultInfo.success();
}
@Log
@DeleteMapping(value = "/{id}")
@ApiOperation("删除MemberLevel")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.basicdata.member.level.service;
package com.topdraw.business.module.member.level.service;
import com.topdraw.business.basicdata.member.level.domain.MemberLevel;
import com.topdraw.business.basicdata.member.level.service.dto.MemberLevelDTO;
import com.topdraw.business.basicdata.member.level.service.dto.MemberLevelQueryCriteria;
import com.topdraw.business.module.member.level.domain.MemberLevel;
import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO;
import com.topdraw.business.module.member.level.service.dto.MemberLevelQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......
package com.topdraw.business.basicdata.member.level.service.dto;
package com.topdraw.business.module.member.level.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.member.level.service.dto;
package com.topdraw.business.module.member.level.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.member.level.service.impl;
package com.topdraw.business.module.member.level.service.impl;
import com.topdraw.business.basicdata.member.level.domain.MemberLevel;
import com.topdraw.business.basicdata.member.level.repository.MemberLevelRepository;
import com.topdraw.business.basicdata.member.level.service.MemberLevelService;
import com.topdraw.business.basicdata.member.level.service.dto.MemberLevelDTO;
import com.topdraw.business.basicdata.member.level.service.dto.MemberLevelQueryCriteria;
import com.topdraw.business.basicdata.member.level.service.mapper.MemberLevelMapper;
import com.topdraw.business.module.member.level.domain.MemberLevel;
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.dto.MemberLevelQueryCriteria;
import com.topdraw.business.module.member.level.service.mapper.MemberLevelMapper;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.StringUtils;
......
package com.topdraw.business.basicdata.member.level.service.mapper;
package com.topdraw.business.module.member.level.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.member.level.domain.MemberLevel;
import com.topdraw.business.basicdata.member.level.service.dto.MemberLevelDTO;
import com.topdraw.business.module.member.level.domain.MemberLevel;
import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.member.profile.domain;
package com.topdraw.business.module.member.profile.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.member.profile.repository;
package com.topdraw.business.module.member.profile.repository;
import com.topdraw.business.basicdata.member.profile.domain.MemberProfile;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.Optional;
/**
* @author XiangHan
* @date 2021-10-22
......
package com.topdraw.business.basicdata.member.profile.rest;
package com.topdraw.business.module.member.profile.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.member.profile.domain.MemberProfile;
import com.topdraw.business.basicdata.member.profile.service.MemberProfileService;
import com.topdraw.business.basicdata.member.profile.service.dto.MemberProfileQueryCriteria;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
import com.topdraw.business.module.member.profile.service.MemberProfileService;
import com.topdraw.business.module.member.profile.service.dto.MemberProfileQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,7 +35,6 @@ public class MemberProfileController {
return ResultInfo.success(MemberProfileService.queryAll(criteria));
}
@Log
@PostMapping
@ApiOperation("新增MemberProfile")
public ResultInfo create(@Validated @RequestBody MemberProfile resources) {
......@@ -44,7 +42,6 @@ public class MemberProfileController {
return ResultInfo.success();
}
@Log
@PutMapping
@ApiOperation("修改MemberProfile")
public ResultInfo update(@Validated @RequestBody MemberProfile resources) {
......@@ -52,8 +49,6 @@ public class MemberProfileController {
return ResultInfo.success();
}
@Log
@DeleteMapping(value = "/{id}")
@ApiOperation("删除MemberProfile")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.basicdata.member.profile.service;
package com.topdraw.business.module.member.profile.service;
import com.topdraw.business.basicdata.member.profile.domain.MemberProfile;
import com.topdraw.business.basicdata.member.profile.service.dto.MemberProfileDTO;
import com.topdraw.business.basicdata.member.profile.service.dto.MemberProfileQueryCriteria;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
import com.topdraw.business.module.member.profile.service.dto.MemberProfileQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......@@ -36,7 +36,7 @@ public interface MemberProfileService {
*/
MemberProfileDTO findById(Long id);
void create(MemberProfile resources);
MemberProfile create(MemberProfile resources);
void update(MemberProfile resources);
......
package com.topdraw.business.basicdata.member.profile.service.dto;
package com.topdraw.business.module.member.profile.service.dto;
import lombok.Data;
import javax.persistence.Column;
import java.io.Serializable;
import java.sql.Timestamp;
......
package com.topdraw.business.basicdata.member.profile.service.dto;
package com.topdraw.business.module.member.profile.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.member.profile.service.impl;
import com.topdraw.business.basicdata.member.profile.domain.MemberProfile;
import com.topdraw.business.basicdata.member.profile.repository.MemberProfileRepository;
import com.topdraw.business.basicdata.member.profile.service.MemberProfileService;
import com.topdraw.business.basicdata.member.profile.service.dto.MemberProfileDTO;
import com.topdraw.business.basicdata.member.profile.service.dto.MemberProfileQueryCriteria;
import com.topdraw.business.basicdata.member.profile.service.mapper.MemberProfileMapper;
import com.topdraw.business.basicdata.member.service.MemberService;
import com.topdraw.business.basicdata.member.service.dto.MemberDTO;
package com.topdraw.business.module.member.profile.service.impl;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
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;
import com.topdraw.business.module.member.profile.service.dto.MemberProfileQueryCriteria;
import com.topdraw.business.module.member.profile.service.mapper.MemberProfileMapper;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.StringUtils;
......@@ -61,7 +61,7 @@ public class MemberProfileServiceImpl implements MemberProfileService {
@Override
@Transactional(rollbackFor = Exception.class)
public void create(MemberProfile resources) {
public MemberProfile create(MemberProfile resources) {
String memberCode = resources.getMemberCode();
MemberDTO memberDTO = this.memberService.getByCode(memberCode);
if (Objects.nonNull(memberDTO)) {
......@@ -73,6 +73,8 @@ public class MemberProfileServiceImpl implements MemberProfileService {
MemberProfileRepository.save(resources);
}
}
return resources;
}
@Override
......
package com.topdraw.business.basicdata.member.profile.service.mapper;
package com.topdraw.business.module.member.profile.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.member.profile.domain.MemberProfile;
import com.topdraw.business.basicdata.member.profile.service.dto.MemberProfileDTO;
import com.topdraw.business.module.member.profile.domain.MemberProfile;
import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.member.relatedinfo.domain;
package com.topdraw.business.module.member.relatedinfo.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.member.relatedinfo.repository;
package com.topdraw.business.module.member.relatedinfo.repository;
import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoDTO;
import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
import java.util.Optional;
/**
* @author XiangHan
......
package com.topdraw.business.basicdata.member.relatedinfo.rest;
package com.topdraw.business.module.member.relatedinfo.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.basicdata.member.relatedinfo.service.MemberRelatedInfoService;
import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria;
import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoService;
import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -30,7 +29,6 @@ public class MemberRelatedInfoController {
return ResultInfo.successPage(MemberRelatedInfoService.queryAll(criteria,pageable));
}
@Log
@PostMapping(value = "/create")
@ApiOperation("新增MemberRelatedInfo")
public ResultInfo create(@Validated @RequestBody MemberRelatedInfo resources) {
......@@ -38,7 +36,6 @@ public class MemberRelatedInfoController {
return ResultInfo.success();
}
@Log
@PutMapping(value = "/update")
@ApiOperation("修改MemberRelatedInfo")
public ResultInfo update(@Validated @RequestBody MemberRelatedInfo resources) {
......@@ -52,7 +49,6 @@ public class MemberRelatedInfoController {
return ResultInfo.success(MemberRelatedInfoService.findById(id));
}
@Log
@DeleteMapping(value = "/delete//{id}")
@ApiOperation("删除MemberRelatedInfo")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.basicdata.member.relatedinfo.service;
package com.topdraw.business.module.member.relatedinfo.service;
import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoDTO;
import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria;
import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO;
import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......
package com.topdraw.business.basicdata.member.relatedinfo.service.dto;
package com.topdraw.business.module.member.relatedinfo.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.member.relatedinfo.service.dto;
package com.topdraw.business.module.member.relatedinfo.service.dto;
import com.topdraw.annotation.Query;
import lombok.Data;
......
package com.topdraw.business.basicdata.member.relatedinfo.service.impl;
package com.topdraw.business.module.member.relatedinfo.service.impl;
import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.basicdata.member.relatedinfo.repository.MemberRelatedInfoRepository;
import com.topdraw.business.basicdata.member.relatedinfo.service.MemberRelatedInfoService;
import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoDTO;
import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria;
import com.topdraw.business.basicdata.member.relatedinfo.service.mapper.MemberRelatedInfoMapper;
import com.topdraw.business.basicdata.member.service.MemberService;
import com.topdraw.business.basicdata.member.service.dto.MemberDTO;
import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo;
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;
import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria;
import com.topdraw.business.module.member.relatedinfo.service.mapper.MemberRelatedInfoMapper;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.ValidationUtil;
......@@ -24,7 +24,6 @@ import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
/**
* @author XiangHan
......
package com.topdraw.business.basicdata.member.relatedinfo.service.mapper;
package com.topdraw.business.module.member.relatedinfo.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoDTO;
import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.member.repository;
package com.topdraw.business.module.member.repository;
import com.topdraw.business.basicdata.member.domain.Member;
import com.topdraw.business.module.member.domain.Member;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
......
package com.topdraw.business.basicdata.member.rest;
package com.topdraw.business.module.member.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.member.domain.Member;
import com.topdraw.business.basicdata.member.service.MemberService;
import com.topdraw.business.basicdata.member.service.dto.MemberQueryCriteria;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,7 +35,6 @@ public class MemberController {
return ResultInfo.success(memberService.findById(id));
}
@Log
@PostMapping(value = "/create")
@ApiOperation("新增Member")
public ResultInfo create(@Validated @RequestBody Member resources) {
......@@ -44,7 +42,6 @@ public class MemberController {
return ResultInfo.success();
}
@Log
@PutMapping(value = "/update")
@ApiOperation("修改Member")
public ResultInfo update(@Validated @RequestBody Member resources) {
......
package com.topdraw.business.basicdata.member.service;
package com.topdraw.business.module.member.service;
import com.topdraw.business.basicdata.member.domain.Member;
import com.topdraw.business.basicdata.member.service.dto.MemberDTO;
import com.topdraw.business.basicdata.member.service.dto.MemberQueryCriteria;
import com.topdraw.business.basicdata.user.iptv.domain.UserTv;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.member.service.dto.MemberQueryCriteria;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import org.springframework.data.domain.Pageable;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
......@@ -39,6 +40,8 @@ public interface MemberService {
Long create(Member resources);
void unbind(Member resources);
void update(Member resources);
void delete(Long id);
......@@ -53,4 +56,6 @@ public interface MemberService {
boolean createMemberByUserTv(UserTv resources);
void doUpdateMemberPoints(Member member);
Member createAndReturnMember(Member resources);
}
......
package com.topdraw.business.basicdata.member.service.dto;
package com.topdraw.business.module.member.service.dto;
import lombok.Data;
......@@ -78,13 +78,13 @@ public class MemberDTO implements Serializable {
private Integer bindIptvPlatformType;
// iptv账号绑定时间
private Timestamp bindIptvTime;
private LocalDateTime bindIptvTime;
// 创建时间
private Timestamp createTime;
private LocalDateTime createTime;
// 更新时间
private Timestamp updateTime;
private LocalDateTime updateTime;
// 是否在黑名单 1:是;0否
// private Integer blackStatus;
......
package com.topdraw.business.basicdata.member.service.dto;
package com.topdraw.business.module.member.service.dto;
import com.topdraw.annotation.Query;
import lombok.Data;
......
package com.topdraw.business.basicdata.member.service.impl;
import com.topdraw.business.basicdata.member.domain.Member;
import com.topdraw.business.basicdata.member.repository.MemberRepository;
import com.topdraw.business.basicdata.member.service.MemberService;
import com.topdraw.business.basicdata.member.service.dto.MemberDTO;
import com.topdraw.business.basicdata.member.service.dto.MemberQueryCriteria;
import com.topdraw.business.basicdata.member.service.mapper.MemberMapper;
import com.topdraw.business.basicdata.user.iptv.domain.UserTv;
import com.topdraw.business.basicdata.user.iptv.service.UserTvService;
import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvDTO;
package com.topdraw.business.module.member.service.impl;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.repository.MemberRepository;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.member.service.dto.MemberQueryCriteria;
import com.topdraw.business.module.member.service.mapper.MemberMapper;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
import com.topdraw.config.LocalConstants;
import com.topdraw.util.IdWorker;
import com.topdraw.util.RedissonUtil;
......@@ -22,6 +21,7 @@ import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
......@@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
......@@ -50,7 +51,7 @@ public class MemberServiceImpl implements MemberService {
private MemberMapper memberMapper;
@Autowired
private com.topdraw.business.basicdata.user.iptv.service.UserTvService UserTvService;
private com.topdraw.business.module.user.iptv.service.UserTvService UserTvService;
@Autowired
private RedissonClient redissonClient;
......@@ -105,14 +106,31 @@ public class MemberServiceImpl implements MemberService {
return member;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void unbind(Member resources) {
try {
String code = resources.getCode();
MemberDTO memberDTO = this.getByCode(code);
// Member member = memberRepository.findById(resources.getId()).orElseGet(Member::new);
ValidationUtil.isNull(memberDTO.getId(), "Member", "id", resources.getId());
Member member = new Member();
BeanUtils.copyProperties(memberDTO,member);
member.setUserIptvId(null);
member.setBindIptvTime(null);
member.setBindIptvPlatformType(null);
this.save(member);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(Member resources) {
RLock rLock = this.redissonClient.getLock("Member::update::code" + resources.getCode());
try {
RedissonUtil.lock(rLock);
Member member = memberRepository.findByCode(resources.getCode()).orElseGet(Member::new);
ValidationUtil.isNull( member.getId(),"Member","id",member.getId());
if (Objects.nonNull(member)) {
......@@ -121,21 +139,24 @@ public class MemberServiceImpl implements MemberService {
String platformAccount = resources.getPlatformAccount();
if (StringUtils.isNotEmpty(platformAccount)) {
resources.setUserIptvId(null);
UserTvDTO userTvDTO = this.UserTvService.findByPlatformAccount(platformAccount);
if (Objects.nonNull(userTvDTO)) {
Long userIptvId = userTvDTO.getId();
resources.setUserIptvId(userIptvId);
resources.setBindIptvPlatformType(1);
resources.setBindIptvTime(LocalDateTime.now());
}
}
}
member.copy(resources);
log.info("memberService ==>> update ==>> [{}]",member);
memberRepository.save(member);
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
RedissonUtil.unlock(rLock);
}
}
......@@ -186,7 +207,7 @@ public class MemberServiceImpl implements MemberService {
if (Objects.nonNull(userIptvId)) {
member.setId(memberId);
member.setUserIptvId(userIptvId);
member.setBindIptvTime(TimestampUtil.now());
member.setBindIptvTime(LocalDateTime.now());
this.bindIptvId(member);
}
}
......@@ -216,10 +237,17 @@ public class MemberServiceImpl implements MemberService {
}
}
private void save(Member member){
@Override
@Transactional(rollbackFor = Exception.class)
public Member createAndReturnMember(Member resources) {
Member member = this.checkMemberData(resources);
memberRepository.save(member);
return resources;
}
private void save(Member member){
memberRepository.save(member);
}
public void bindIptvId(Member resources) {
RLock rLock = this.redissonClient.getLock("Member::update::code::" + resources.getCode());
......
package com.topdraw.business.basicdata.member.service.mapper;
package com.topdraw.business.module.member.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.member.domain.Member;
import com.topdraw.business.basicdata.member.service.dto.MemberDTO;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.module.member.viphistory.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
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
* @date 2021-12-10
*/
@Entity
@Data
@EntityListeners(AuditingEntityListener.class)
@Accessors(chain = true)
@Table(name="uc_member_vip_history")
public class MemberVipHistory implements Serializable {
// 主键
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
// 会员id
@Column(name = "member_id")
private Long memberId;
// 会员vip等级
@Column(name = "vip")
private Integer vip;
// 修改之前vip等级
@Column(name = "before_vip")
private Integer beforeVip;
// vip失效时间
@Column(name = "vip_expire_time")
private LocalDateTime vipExpireTime;
// 状态 1正常 0已过期
@Column(name = "status")
private Integer status;
// 创建时间
@CreatedDate
@Column(name = "create_time")
private Timestamp createTime;
// 修改时间
@LastModifiedDate
@Column(name = "update_time")
private Timestamp updateTime;
public void copy(MemberVipHistory source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}
package com.topdraw.business.module.member.viphistory.repository;
import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.time.LocalDateTime;
import java.util.Optional;
/**
* @author luerlong
* @date 2021-12-10
*/
public interface MemberVipHistoryRepository extends JpaRepository<MemberVipHistory, Long>, JpaSpecificationExecutor<MemberVipHistory> {
@Query(value = "SELECT * FROM uc_member_vip_history " +
" WHERE vip_expire_time >= ?2 AND member_id = ?1 order by create_time desc limit 1 ", nativeQuery = true)
Optional<MemberVipHistory> findByTime(Long memberId, LocalDateTime nowTime);
}
package com.topdraw.business.module.member.viphistory.rest;
import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService;
import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.*;
/**
* @author luerlong
* @date 2021-12-10
*/
@Api(tags = "MemberVipHistory管理")
@RestController
@RequestMapping("/api/memberVipHistory")
public class MemberVipHistoryController {
@Autowired
private MemberVipHistoryService memberVipHistoryService;
@GetMapping
@ApiOperation("查询MemberVipHistory")
public ResultInfo getMemberVipHistorys(MemberVipHistoryQueryCriteria criteria, Pageable pageable) {
return ResultInfo.successPage(memberVipHistoryService.queryAll(criteria,pageable));
}
@GetMapping(value = "/all")
@ApiOperation("查询所有MemberVipHistory")
public ResultInfo getMemberVipHistorys(MemberVipHistoryQueryCriteria criteria) {
return ResultInfo.success(memberVipHistoryService.queryAll(criteria));
}
@PostMapping
@ApiOperation("新增MemberVipHistory")
public ResultInfo create(@Validated @RequestBody MemberVipHistory resources) {
memberVipHistoryService.create(resources);
return ResultInfo.success();
}
@PutMapping
@ApiOperation("修改MemberVipHistory")
public ResultInfo update(@Validated @RequestBody MemberVipHistory resources) {
memberVipHistoryService.update(resources);
return ResultInfo.success();
}
@DeleteMapping(value = "/{id}")
@ApiOperation("删除MemberVipHistory")
public ResultInfo delete(@PathVariable Long id) {
memberVipHistoryService.delete(id);
return ResultInfo.success();
}
}
package com.topdraw.business.module.member.viphistory.service;
import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO;
import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* @author luerlong
* @date 2021-12-10
*/
public interface MemberVipHistoryService {
/**
* 查询数据分页
* @param criteria 条件参数
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(MemberVipHistoryQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<MemberVipHistoryDTO>
*/
List<MemberVipHistoryDTO> queryAll(MemberVipHistoryQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return MemberVipHistoryDTO
*/
MemberVipHistoryDTO findById(Long id);
void create(MemberVipHistory resources);
void update(MemberVipHistory resources);
void delete(Long id);
MemberVipHistory findByTime(Long id, LocalDateTime nowTime);
}
package com.topdraw.business.module.member.viphistory.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
* @author luerlong
* @date 2021-12-10
*/
@Data
public class MemberVipHistoryDTO implements Serializable {
// 主键
private Long id;
// 会员id
private Long memberId;
// 会员vip等级
private Integer vip;
// 修改之前vip等级
private Integer beforeVip;
// vip失效时间
private LocalDateTime vipExpireTime;
// 状态 1正常 0已过期
private Integer status;
// 创建时间
private Timestamp createTime;
// 修改时间
private Timestamp updateTime;
}
package com.topdraw.business.module.member.viphistory.service.dto;
import lombok.Data;
/**
* @author luerlong
* @date 2021-12-10
*/
@Data
public class MemberVipHistoryQueryCriteria {
}
package com.topdraw.business.module.member.viphistory.service.impl;
import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
import com.topdraw.business.module.member.viphistory.repository.MemberVipHistoryRepository;
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.dto.MemberVipHistoryQueryCriteria;
import com.topdraw.business.module.member.viphistory.service.mapper.MemberVipHistoryMapper;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.ValidationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* @author luerlong
* @date 2021-12-10
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class MemberVipHistoryServiceImpl implements MemberVipHistoryService {
@Autowired
private MemberVipHistoryRepository memberVipHistoryRepository;
@Autowired
private MemberVipHistoryMapper memberVipHistoryMapper;
@Override
public Map<String, Object> queryAll(MemberVipHistoryQueryCriteria criteria, Pageable pageable) {
Page<MemberVipHistory> page = memberVipHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(memberVipHistoryMapper::toDto));
}
@Override
public List<MemberVipHistoryDTO> queryAll(MemberVipHistoryQueryCriteria criteria) {
return memberVipHistoryMapper.toDto(memberVipHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
public MemberVipHistoryDTO findById(Long id) {
MemberVipHistory memberVipHistory = memberVipHistoryRepository.findById(id).orElseGet(MemberVipHistory::new);
ValidationUtil.isNull(memberVipHistory.getId(),"MemberVipHistory","id",id);
return memberVipHistoryMapper.toDto(memberVipHistory);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(MemberVipHistory resources) {
memberVipHistoryRepository.save(resources);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(MemberVipHistory resources) {
MemberVipHistory memberVipHistory = memberVipHistoryRepository.findById(resources.getId()).orElseGet(MemberVipHistory::new);
ValidationUtil.isNull( memberVipHistory.getId(),"MemberVipHistory","id",resources.getId());
memberVipHistory.copy(resources);
memberVipHistoryRepository.save(memberVipHistory);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Long id) {
Assert.notNull(id, "The given id must not be null!");
MemberVipHistory memberVipHistory = memberVipHistoryRepository.findById(id).orElseThrow(
() -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberVipHistory.class, id), 1));
memberVipHistoryRepository.delete(memberVipHistory);
}
@Override
public MemberVipHistory findByTime(Long memberId, LocalDateTime nowTime) {
MemberVipHistory memberVipHistory = this.memberVipHistoryRepository.findByTime(memberId, nowTime).orElseGet(MemberVipHistory::new);
return memberVipHistory;
}
}
package com.topdraw.business.module.member.viphistory.service.mapper;
import com.topdraw.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;
import org.mapstruct.ReportingPolicy;
/**
* @author luerlong
* @date 2021-12-10
*/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface MemberVipHistoryMapper extends BaseMapper<MemberVipHistoryDTO, MemberVipHistory> {
}
package com.topdraw.business.basicdata.points.available.domain;
package com.topdraw.business.module.points.available.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.points.available.repository;
package com.topdraw.business.module.points.available.repository;
import com.topdraw.business.basicdata.points.available.domain.PointsAvailable;
import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO;
import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryCriteria;
import com.topdraw.business.module.points.available.domain.PointsAvailable;
import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO;
import com.topdraw.business.module.points.available.service.dto.PointsAvailableQueryCriteria;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
......
package com.topdraw.business.basicdata.points.available.rest;
package com.topdraw.business.module.points.available.rest;
/**
* @author XiangHan
......
package com.topdraw.business.basicdata.points.available.service;
package com.topdraw.business.module.points.available.service;
import com.topdraw.business.basicdata.points.available.domain.PointsAvailable;
import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO;
import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryCriteria;
import com.topdraw.business.module.points.available.domain.PointsAvailable;
import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO;
import com.topdraw.business.module.points.available.service.dto.PointsAvailableQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.time.LocalDateTime;
......
package com.topdraw.business.basicdata.points.available.service.dto;
package com.topdraw.business.module.points.available.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.points.available.service.dto;
package com.topdraw.business.module.points.available.service.dto;
import com.topdraw.annotation.Query;
import lombok.Data;
......
package com.topdraw.business.basicdata.points.available.service.dto;
package com.topdraw.business.module.points.available.service.dto;
public enum PointsAvailableQueryType {
......
package com.topdraw.business.basicdata.points.available.service.impl;
import com.topdraw.business.basicdata.member.service.MemberService;
import com.topdraw.business.basicdata.member.service.dto.MemberDTO;
import com.topdraw.business.basicdata.points.available.domain.PointsAvailable;
import com.topdraw.business.basicdata.points.available.repository.PointsAvailableRepository;
import com.topdraw.business.basicdata.points.available.service.PointsAvailableService;
import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO;
import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryCriteria;
import com.topdraw.business.basicdata.points.available.service.mapper.PointsAvailableMapper;
package com.topdraw.business.module.points.available.service.impl;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.points.available.domain.PointsAvailable;
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.dto.PointsAvailableQueryCriteria;
import com.topdraw.business.module.points.available.service.mapper.PointsAvailableMapper;
import com.topdraw.util.RedissonUtil;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
......
package com.topdraw.business.basicdata.points.available.service.mapper;
package com.topdraw.business.module.points.available.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.points.available.domain.PointsAvailable;
import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO;
import com.topdraw.business.module.points.available.domain.PointsAvailable;
import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.points.detail.detailhistory.domain;
package com.topdraw.business.module.points.detail.detailhistory.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.points.detail.detailhistory.repository;
package com.topdraw.business.module.points.detail.detailhistory.repository;
import com.topdraw.business.basicdata.points.detail.detailhistory.domain.PointsDetailHistory;
import com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.points.detail.detailhistory.rest;
package com.topdraw.business.module.points.detail.detailhistory.rest;
import io.swagger.annotations.Api;
......
package com.topdraw.business.basicdata.points.detail.detailhistory.service;
package com.topdraw.business.module.points.detail.detailhistory.service;
import com.topdraw.business.basicdata.points.detail.detailhistory.domain.PointsDetailHistory;
import com.topdraw.business.basicdata.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO;
import com.topdraw.business.basicdata.points.detail.detailhistory.service.dto.PointsDetailHistoryQueryCriteria;
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.List;
......
package com.topdraw.business.basicdata.points.detail.detailhistory.service.dto;
package com.topdraw.business.module.points.detail.detailhistory.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.points.detail.detailhistory.service.dto;
package com.topdraw.business.module.points.detail.detailhistory.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.points.detail.detailhistory.service.impl;
package com.topdraw.business.module.points.detail.detailhistory.service.impl;
import com.topdraw.business.basicdata.points.detail.detailhistory.domain.PointsDetailHistory;
import com.topdraw.business.basicdata.points.detail.detailhistory.repository.PointsDetailHistoryRepository;
import com.topdraw.business.basicdata.points.detail.detailhistory.service.PointsDetailHistoryService;
import com.topdraw.business.basicdata.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO;
import com.topdraw.business.basicdata.points.detail.detailhistory.service.dto.PointsDetailHistoryQueryCriteria;
import com.topdraw.business.basicdata.points.detail.detailhistory.service.mapper.PointsDetailHistoryMapper;
import com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory;
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 com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.StringUtils;
......
package com.topdraw.business.basicdata.points.detail.detailhistory.service.mapper;
package com.topdraw.business.module.points.detail.detailhistory.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.points.detail.detailhistory.domain.PointsDetailHistory;
import com.topdraw.business.basicdata.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO;
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;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.points.detail.domain;
package com.topdraw.business.module.points.detail.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.points.detail.repository;
package com.topdraw.business.module.points.detail.repository;
import com.topdraw.business.basicdata.points.detail.domain.PointsDetail;
import com.topdraw.business.module.points.detail.domain.PointsDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.points.detail.rest;
package com.topdraw.business.module.points.detail.rest;
import io.swagger.annotations.Api;
......
package com.topdraw.business.basicdata.points.detail.service;
package com.topdraw.business.module.points.detail.service;
import com.topdraw.business.basicdata.points.detail.domain.PointsDetail;
import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailDTO;
import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailQueryCriteria;
import com.topdraw.business.module.points.detail.domain.PointsDetail;
import com.topdraw.business.module.points.detail.service.dto.PointsDetailDTO;
import com.topdraw.business.module.points.detail.service.dto.PointsDetailQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......
package com.topdraw.business.basicdata.points.detail.service.dto;
package com.topdraw.business.module.points.detail.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.points.detail.service.dto;
package com.topdraw.business.module.points.detail.service.dto;
import com.topdraw.annotation.Query;
import lombok.Data;
......
package com.topdraw.business.basicdata.points.detail.service.impl;
import com.topdraw.business.basicdata.member.service.MemberService;
import com.topdraw.business.basicdata.member.service.dto.MemberDTO;
import com.topdraw.business.basicdata.points.detail.domain.PointsDetail;
import com.topdraw.business.basicdata.points.detail.repository.PointsDetailRepository;
import com.topdraw.business.basicdata.points.detail.service.PointsDetailService;
import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailDTO;
import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailQueryCriteria;
import com.topdraw.business.basicdata.points.detail.service.mapper.PointsDetailMapper;
package com.topdraw.business.module.points.detail.service.impl;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.points.detail.domain.PointsDetail;
import com.topdraw.business.module.points.detail.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.dto.PointsDetailQueryCriteria;
import com.topdraw.business.module.points.detail.service.mapper.PointsDetailMapper;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.StringUtils;
......
package com.topdraw.business.basicdata.points.detail.service.mapper;
package com.topdraw.business.module.points.detail.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.points.detail.domain.PointsDetail;
import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailDTO;
import com.topdraw.business.module.points.detail.domain.PointsDetail;
import com.topdraw.business.module.points.detail.service.dto.PointsDetailDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.points.domain;
package com.topdraw.business.module.points.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.points.repository;
package com.topdraw.business.module.points.repository;
import com.topdraw.business.basicdata.points.domain.Points;
import com.topdraw.business.module.points.domain.Points;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.points.rest;
package com.topdraw.business.module.points.rest;
import io.swagger.annotations.Api;
......
package com.topdraw.business.basicdata.points.service;
package com.topdraw.business.module.points.service;
import com.topdraw.business.basicdata.points.domain.Points;
import com.topdraw.business.basicdata.points.service.dto.PointsDTO;
import com.topdraw.business.basicdata.points.service.dto.PointsQueryCriteria;
import com.topdraw.business.module.points.domain.Points;
import com.topdraw.business.module.points.service.dto.PointsDTO;
import com.topdraw.business.module.points.service.dto.PointsQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......
package com.topdraw.business.basicdata.points.service.dto;
package com.topdraw.business.module.points.service.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
......
package com.topdraw.business.basicdata.points.service.dto;
package com.topdraw.business.module.points.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.points.service.impl;
package com.topdraw.business.module.points.service.impl;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import com.topdraw.business.basicdata.points.domain.Points;
import com.topdraw.business.basicdata.points.repository.PointsRepository;
import com.topdraw.business.basicdata.points.service.PointsService;
import com.topdraw.business.basicdata.points.service.dto.PointsDTO;
import com.topdraw.business.basicdata.points.service.dto.PointsQueryCriteria;
import com.topdraw.business.basicdata.points.service.mapper.PointsMapper;
import com.topdraw.business.module.points.domain.Points;
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;
import com.topdraw.business.module.points.service.dto.PointsQueryCriteria;
import com.topdraw.business.module.points.service.mapper.PointsMapper;
import com.topdraw.util.RedissonUtil;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
......
package com.topdraw.business.basicdata.points.service.mapper;
package com.topdraw.business.module.points.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.points.domain.Points;
import com.topdraw.business.basicdata.points.service.dto.PointsDTO;
import com.topdraw.business.module.points.domain.Points;
import com.topdraw.business.module.points.service.dto.PointsDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.points.standingbook.domain;
package com.topdraw.business.module.points.standingbook.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.points.standingbook.repository;
package com.topdraw.business.module.points.standingbook.repository;
import com.topdraw.business.basicdata.points.standingbook.domain.PointsStandingBook;
import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.points.standingbook.rest;
package com.topdraw.business.module.points.standingbook.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.points.standingbook.domain.PointsStandingBook;
import com.topdraw.business.basicdata.points.standingbook.service.PointsStandingBookService;
import com.topdraw.business.basicdata.points.standingbook.service.dto.PointsStandingBookQueryCriteria;
import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook;
import com.topdraw.business.module.points.standingbook.service.PointsStandingBookService;
import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,7 +35,6 @@ public class PointsStandingBookController {
return ResultInfo.success(PointsStandingBookService.queryAll(criteria));
}
@Log
@PostMapping
@ApiOperation("新增PointsStandingBook")
public ResultInfo create(@Validated @RequestBody PointsStandingBook resources) {
......@@ -44,7 +42,6 @@ public class PointsStandingBookController {
return ResultInfo.success();
}
@Log
@PutMapping
@ApiOperation("修改PointsStandingBook")
public ResultInfo update(@Validated @RequestBody PointsStandingBook resources) {
......@@ -52,8 +49,6 @@ public class PointsStandingBookController {
return ResultInfo.success();
}
@Log
@DeleteMapping(value = "/{id}")
@ApiOperation("删除PointsStandingBook")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.basicdata.points.standingbook.service;
package com.topdraw.business.module.points.standingbook.service;
import com.topdraw.business.basicdata.points.standingbook.domain.PointsStandingBook;
import com.topdraw.business.basicdata.points.standingbook.service.dto.PointsStandingBookDTO;
import com.topdraw.business.basicdata.points.standingbook.service.dto.PointsStandingBookQueryCriteria;
import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook;
import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookDTO;
import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......
package com.topdraw.business.basicdata.points.standingbook.service.dto;
package com.topdraw.business.module.points.standingbook.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.points.standingbook.service.dto;
package com.topdraw.business.module.points.standingbook.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.points.standingbook.service.impl;
package com.topdraw.business.module.points.standingbook.service.impl;
import com.topdraw.business.basicdata.points.standingbook.domain.PointsStandingBook;
import com.topdraw.business.basicdata.points.standingbook.repository.PointsStandingBookRepository;
import com.topdraw.business.basicdata.points.standingbook.service.PointsStandingBookService;
import com.topdraw.business.basicdata.points.standingbook.service.dto.PointsStandingBookDTO;
import com.topdraw.business.basicdata.points.standingbook.service.dto.PointsStandingBookQueryCriteria;
import com.topdraw.business.basicdata.points.standingbook.service.mapper.PointsStandingBookMapper;
import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook;
import com.topdraw.business.module.points.standingbook.repository.PointsStandingBookRepository;
import com.topdraw.business.module.points.standingbook.service.PointsStandingBookService;
import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookDTO;
import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookQueryCriteria;
import com.topdraw.business.module.points.standingbook.service.mapper.PointsStandingBookMapper;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.ValidationUtil;
......
package com.topdraw.business.basicdata.points.standingbook.service.mapper;
package com.topdraw.business.module.points.standingbook.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.points.standingbook.domain.PointsStandingBook;
import com.topdraw.business.basicdata.points.standingbook.service.dto.PointsStandingBookDTO;
import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook;
import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.rights.domain;
package com.topdraw.business.module.rights.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.rights.history.domain;
package com.topdraw.business.module.rights.history.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.topdraw.business.module.common.domain.DefaultAsyncMqModule;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.CreatedDate;
......@@ -11,6 +12,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
* @author XiangHan
......@@ -21,7 +23,7 @@ import java.sql.Timestamp;
@EntityListeners(AuditingEntityListener.class)
@Accessors(chain = true)
@Table(name="tr_rights_histroy")
public class RightsHistory implements Serializable {
public class RightsHistory extends DefaultAsyncMqModule implements Serializable {
// 主键id
@Id
......@@ -50,19 +52,19 @@ public class RightsHistory implements Serializable {
// 发放时间
@Column(name = "send_time")
private Timestamp sendTime;
private LocalDateTime sendTime;
// 失效时间
@Column(name = "expire_time")
private Timestamp expireTime;
private LocalDateTime expireTime;
@CreatedDate
@Column(name = "create_time")
private Timestamp createTime;
private LocalDateTime createTime;
@LastModifiedDate
@Column(name = "update_time")
private Timestamp updateTime;
private LocalDateTime updateTime;
public void copy(RightsHistory source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
......
package com.topdraw.business.basicdata.rights.history.repository;
package com.topdraw.business.module.rights.history.repository;
import com.topdraw.business.basicdata.rights.history.domain.RightsHistory;
import com.topdraw.business.module.rights.history.domain.RightsHistory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.rights.history.rest;
package com.topdraw.business.module.rights.history.rest;
import com.topdraw.business.basicdata.rights.history.service.RightsHistoryService;
import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryQueryCriteria;
import com.topdraw.business.module.rights.history.service.RightsHistoryService;
import com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryCriteria;
import com.topdraw.common.ResultInfo;
import com.topdraw.util.TimestampUtil;
import io.swagger.annotations.Api;
......
package com.topdraw.business.basicdata.rights.history.service;
package com.topdraw.business.module.rights.history.service;
import com.topdraw.business.basicdata.rights.history.domain.RightsHistory;
import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryDTO;
import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryQueryCriteria;
import com.topdraw.business.module.rights.history.domain.RightsHistory;
import com.topdraw.business.module.rights.history.service.dto.RightsHistoryDTO;
import com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......
package com.topdraw.business.basicdata.rights.history.service.dto;
package com.topdraw.business.module.rights.history.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
......@@ -29,12 +30,12 @@ public class RightsHistoryDTO implements Serializable {
private String operatorName;
// 发放时间
private Timestamp sendTime;
private LocalDateTime sendTime;
// 失效时间
private Timestamp expireTime;
private LocalDateTime expireTime;
private Timestamp createTime;
private LocalDateTime createTime;
private Timestamp updateTime;
private LocalDateTime updateTime;
}
......
package com.topdraw.business.basicdata.rights.history.service.dto;
package com.topdraw.business.module.rights.history.service.dto;
import com.topdraw.annotation.Query;
import lombok.Data;
......
package com.topdraw.business.basicdata.rights.history.service.dto;
package com.topdraw.business.module.rights.history.service.dto;
public enum RightsHistoryQueryType {
......
package com.topdraw.business.basicdata.rights.history.service.impl;
package com.topdraw.business.module.rights.history.service.impl;
import com.topdraw.business.basicdata.rights.history.domain.RightsHistory;
import com.topdraw.business.basicdata.rights.history.repository.RightsHistoryRepository;
import com.topdraw.business.basicdata.rights.history.service.RightsHistoryService;
import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryDTO;
import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryQueryCriteria;
import com.topdraw.business.basicdata.rights.history.service.mapper.RightsHistoryMapper;
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.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 com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.ValidationUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.domain.Page;
......@@ -33,6 +36,9 @@ public class RightsHistoryServiceImpl implements RightsHistoryService {
private RightsHistoryRepository RightsHistoryRepository;
@Autowired
private MemberService memberService;
@Autowired
private RightsHistoryMapper RightsHistoryMapper;
@Override
......@@ -56,6 +62,12 @@ public class RightsHistoryServiceImpl implements RightsHistoryService {
@Override
@Transactional(rollbackFor = Exception.class)
public void create(RightsHistory resources) {
String memberCode = resources.getMemberCode();
if (StringUtils.isNotBlank(memberCode)) {
MemberDTO memberDTO = this.memberService.getByCode(memberCode);
Long id = memberDTO.getId();
resources.setMemberId(id);
}
RightsHistoryRepository.save(resources);
}
......
package com.topdraw.business.basicdata.rights.history.service.mapper;
package com.topdraw.business.module.rights.history.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.rights.history.domain.RightsHistory;
import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryDTO;
import com.topdraw.business.module.rights.history.domain.RightsHistory;
import com.topdraw.business.module.rights.history.service.dto.RightsHistoryDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.rights.permanentrights.domain;
package com.topdraw.business.module.rights.permanentrights.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.rights.permanentrights.repository;
package com.topdraw.business.module.rights.permanentrights.repository;
import com.topdraw.business.basicdata.rights.permanentrights.domain.PermanentRights;
import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.rights.permanentrights.rest;
package com.topdraw.business.module.rights.permanentrights.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.rights.permanentrights.domain.PermanentRights;
import com.topdraw.business.basicdata.rights.permanentrights.service.PermanentRightsService;
import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsQueryCriteria;
import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights;
import com.topdraw.business.module.rights.permanentrights.service.PermanentRightsService;
import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,7 +35,6 @@ public class PermanentRightsController {
return ResultInfo.success(PermanentRightsService.findById(id));
}
@Log
@PostMapping(value = "/create")
@ApiOperation("新增PermanentRights")
public ResultInfo create(@Validated @RequestBody PermanentRights resources) {
......@@ -44,7 +42,6 @@ public class PermanentRightsController {
return ResultInfo.success();
}
@Log
@PutMapping(value = "/update")
@ApiOperation("修改PermanentRights")
public ResultInfo update(@Validated @RequestBody PermanentRights resources) {
......@@ -52,7 +49,6 @@ public class PermanentRightsController {
return ResultInfo.success();
}
@Log
@DeleteMapping(value = "/delete/{id}")
@ApiOperation("删除PermanentRights")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.basicdata.rights.permanentrights.service;
package com.topdraw.business.module.rights.permanentrights.service;
import com.topdraw.business.basicdata.rights.permanentrights.domain.PermanentRights;
import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsDTO;
import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsQueryCriteria;
import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights;
import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsDTO;
import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......
package com.topdraw.business.basicdata.rights.permanentrights.service.dto;
package com.topdraw.business.module.rights.permanentrights.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.rights.permanentrights.service.dto;
package com.topdraw.business.module.rights.permanentrights.service.dto;
import com.topdraw.annotation.Query;
import lombok.Data;
......
package com.topdraw.business.basicdata.rights.permanentrights.service.impl;
package com.topdraw.business.module.rights.permanentrights.service.impl;
import com.topdraw.business.basicdata.rights.permanentrights.domain.PermanentRights;
import com.topdraw.business.basicdata.rights.permanentrights.repository.PermanentRightsRepository;
import com.topdraw.business.basicdata.rights.permanentrights.service.PermanentRightsService;
import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsDTO;
import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsQueryCriteria;
import com.topdraw.business.basicdata.rights.permanentrights.service.mapper.PermanentRightsMapper;
import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights;
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.dto.PermanentRightsQueryCriteria;
import com.topdraw.business.module.rights.permanentrights.service.mapper.PermanentRightsMapper;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.StringUtils;
......
package com.topdraw.business.basicdata.rights.permanentrights.service.mapper;
package com.topdraw.business.module.rights.permanentrights.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.rights.permanentrights.domain.PermanentRights;
import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsDTO;
import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights;
import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.rights.repository;
package com.topdraw.business.module.rights.repository;
import com.topdraw.business.basicdata.rights.domain.Rights;
import com.topdraw.business.module.rights.domain.Rights;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
......
package com.topdraw.business.basicdata.rights.rest;
package com.topdraw.business.module.rights.rest;
import com.topdraw.business.basicdata.rights.service.RightsService;
import com.topdraw.business.module.rights.service.RightsService;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......
package com.topdraw.business.basicdata.rights.service;
package com.topdraw.business.module.rights.service;
import com.topdraw.business.basicdata.rights.domain.Rights;
import com.topdraw.business.basicdata.rights.service.dto.RightsDTO;
import com.topdraw.business.basicdata.rights.service.dto.RightsQueryCriteria;
import com.topdraw.business.module.rights.domain.Rights;
import com.topdraw.business.module.rights.service.dto.RightsDTO;
import com.topdraw.business.module.rights.service.dto.RightsQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......
package com.topdraw.business.basicdata.rights.service.dto;
package com.topdraw.business.module.rights.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.rights.service.dto;
package com.topdraw.business.module.rights.service.dto;
import com.topdraw.annotation.Query;
import lombok.Data;
......
package com.topdraw.business.basicdata.rights.service.dto;
package com.topdraw.business.module.rights.service.dto;
public enum RightsQueryType {
......
package com.topdraw.business.basicdata.rights.service.impl;
package com.topdraw.business.module.rights.service.impl;
import com.topdraw.business.basicdata.rights.domain.Rights;
import com.topdraw.business.basicdata.rights.repository.RightsRepository;
import com.topdraw.business.basicdata.rights.service.RightsService;
import com.topdraw.business.basicdata.rights.service.dto.RightsDTO;
import com.topdraw.business.basicdata.rights.service.dto.RightsQueryCriteria;
import com.topdraw.business.basicdata.rights.service.mapper.RightsMapper;
import com.topdraw.business.module.rights.domain.Rights;
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.dto.RightsQueryCriteria;
import com.topdraw.business.module.rights.service.mapper.RightsMapper;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.StringUtils;
......
package com.topdraw.business.basicdata.rights.service.mapper;
package com.topdraw.business.module.rights.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.rights.domain.Rights;
import com.topdraw.business.basicdata.rights.service.dto.RightsDTO;
import com.topdraw.business.module.rights.domain.Rights;
import com.topdraw.business.module.rights.service.dto.RightsDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.task.domain;
package com.topdraw.business.module.task.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.task.repository;
package com.topdraw.business.module.task.repository;
import com.topdraw.business.basicdata.task.domain.Task;
import com.topdraw.business.module.task.domain.Task;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.task.rest;
package com.topdraw.business.module.task.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.task.domain.Task;
import com.topdraw.business.basicdata.task.service.TaskService;
import com.topdraw.business.basicdata.task.service.dto.TaskQueryCriteria;
import com.topdraw.aop.log.Log;
import com.topdraw.business.module.task.domain.Task;
import com.topdraw.business.module.task.service.TaskService;
import com.topdraw.business.module.task.service.dto.TaskQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......
package com.topdraw.business.basicdata.task.service;
package com.topdraw.business.module.task.service;
import com.topdraw.business.basicdata.task.domain.Task;
import com.topdraw.business.basicdata.task.service.dto.TaskDTO;
import com.topdraw.business.basicdata.task.service.dto.TaskQueryCriteria;
import com.topdraw.business.module.task.domain.Task;
import com.topdraw.business.module.task.service.dto.TaskDTO;
import com.topdraw.business.module.task.service.dto.TaskQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......
package com.topdraw.business.basicdata.task.service.dto;
package com.topdraw.business.module.task.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.task.service.dto;
package com.topdraw.business.module.task.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.task.service.impl;
package com.topdraw.business.module.task.service.impl;
import com.topdraw.business.basicdata.task.domain.Task;
import com.topdraw.business.basicdata.task.repository.TaskRepository;
import com.topdraw.business.basicdata.task.service.TaskService;
import com.topdraw.business.basicdata.task.service.dto.TaskDTO;
import com.topdraw.business.basicdata.task.service.dto.TaskQueryCriteria;
import com.topdraw.business.basicdata.task.service.mapper.TaskMapper;
import com.topdraw.business.module.task.domain.Task;
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;
import com.topdraw.business.module.task.service.dto.TaskQueryCriteria;
import com.topdraw.business.module.task.service.mapper.TaskMapper;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.ValidationUtil;
......
package com.topdraw.business.basicdata.task.service.mapper;
package com.topdraw.business.module.task.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.task.domain.Task;
import com.topdraw.business.basicdata.task.service.dto.TaskDTO;
import com.topdraw.business.module.task.domain.Task;
import com.topdraw.business.module.task.service.dto.TaskDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.basicdata.task.template.domain;
package com.topdraw.business.module.task.template.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......
package com.topdraw.business.basicdata.task.template.repository;
package com.topdraw.business.module.task.template.repository;
import com.topdraw.business.basicdata.task.template.domain.TaskTemplate;
import com.topdraw.business.module.task.template.domain.TaskTemplate;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.task.template.rest;
package com.topdraw.business.module.task.template.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.task.template.domain.TaskTemplate;
import com.topdraw.business.basicdata.task.template.service.TaskTemplateService;
import com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateQueryCriteria;
import com.topdraw.business.module.task.template.domain.TaskTemplate;
import com.topdraw.business.module.task.template.service.TaskTemplateService;
import com.topdraw.business.module.task.template.service.dto.TaskTemplateQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,7 +35,6 @@ public class TaskTemplateController {
return ResultInfo.success(TaskTemplateService.queryAll(criteria));
}
@Log
@PostMapping
@ApiOperation("新增TaskTemplate")
public ResultInfo create(@Validated @RequestBody TaskTemplate resources) {
......@@ -44,7 +42,6 @@ public class TaskTemplateController {
return ResultInfo.success();
}
@Log
@PutMapping
@ApiOperation("修改TaskTemplate")
public ResultInfo update(@Validated @RequestBody TaskTemplate resources) {
......@@ -52,8 +49,6 @@ public class TaskTemplateController {
return ResultInfo.success();
}
@Log
@DeleteMapping(value = "/{id}")
@ApiOperation("删除TaskTemplate")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.basicdata.task.template.service;
package com.topdraw.business.module.task.template.service;
import com.topdraw.business.basicdata.task.template.domain.TaskTemplate;
import com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateDTO;
import com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateQueryCriteria;
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.List;
......
package com.topdraw.business.basicdata.task.template.service.dto;
package com.topdraw.business.module.task.template.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.task.template.service.dto;
package com.topdraw.business.module.task.template.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.task.template.service.impl;
package com.topdraw.business.module.task.template.service.impl;
import com.topdraw.business.basicdata.task.template.domain.TaskTemplate;
import com.topdraw.business.basicdata.task.template.repository.TaskTemplateRepository;
import com.topdraw.business.basicdata.task.template.service.TaskTemplateService;
import com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateDTO;
import com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateQueryCriteria;
import com.topdraw.business.basicdata.task.template.service.mapper.TaskTemplateMapper;
import com.topdraw.business.module.task.template.domain.TaskTemplate;
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 com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.StringUtils;
......
package com.topdraw.business.basicdata.task.template.service.mapper;
package com.topdraw.business.module.task.template.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.task.template.domain.TaskTemplate;
import com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateDTO;
import com.topdraw.business.module.task.template.domain.TaskTemplate;
import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.module.user.iptv.domain;
import java.util.Arrays;
import java.util.List;
public interface UserConstant {
// 电信
List<String> platform_lt = Arrays.asList("SC.CTCC","SC.CTC","CTC.ChongQing","ChongQing.CTC","CQ.CTC","CQ.CTCC");
// 移动
List<String> platform_yd = Arrays.asList("SC.CMCC","CMCC.SC","ChongQing.CMCC","CMCC.ChongQing");
// 联通
List<String> platform_dx = Arrays.asList("SC.CUCC","");
}
package com.topdraw.business.basicdata.user.iptv.domain;
package com.topdraw.business.module.user.iptv.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
......@@ -11,6 +11,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
* @author XiangHan
......@@ -23,6 +24,10 @@ import java.sql.Timestamp;
@Table(name="uc_user_tv")
public class UserTv implements Serializable {
/** 绑定的小屏账户会员编码 */
@Column(name = "priority_member_code")
private String priorityMemberCode;
@Transient
private String memberCode;
......@@ -74,7 +79,7 @@ public class UserTv implements Serializable {
// 活跃时间
@Column(name = "`active_time`")
private Timestamp activeTime;
private LocalDateTime activeTime;
// 分组 分组ID用逗号分隔
@Column(name = "`groups`")
......@@ -103,7 +108,7 @@ public class UserTv implements Serializable {
// 创建时间
@CreatedDate
@Column(name = "`create_time`")
private Timestamp createTime;
private LocalDateTime createTime;
// 更新者
@Column(name = "`update_by`")
......@@ -112,7 +117,7 @@ public class UserTv implements Serializable {
// 更新时间
@LastModifiedDate
@Column(name = "`update_time`")
private Timestamp updateTime;
private LocalDateTime updateTime;
// 会员id
@Column(name = "`member_id`")
......
package com.topdraw.business.basicdata.user.iptv.repository;
package com.topdraw.business.module.user.iptv.repository;
import com.topdraw.business.basicdata.user.iptv.domain.UserTv;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.topdraw.business.basicdata.user.iptv.rest;
package com.topdraw.business.module.user.iptv.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.user.iptv.domain.UserTv;
import com.topdraw.business.basicdata.user.iptv.service.UserTvService;
import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvQueryCriteria;
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.UserTvQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,7 +35,6 @@ public class UserTvController {
return ResultInfo.success(UserTvService.queryAll(criteria));
}
@Log
@PostMapping
@ApiOperation("新增UserTv")
public ResultInfo create(@Validated @RequestBody UserTv resources) {
......@@ -44,7 +42,6 @@ public class UserTvController {
return ResultInfo.success();
}
@Log
@PutMapping
@ApiOperation("修改UserTv")
public ResultInfo update(@Validated @RequestBody UserTv resources) {
......@@ -52,7 +49,6 @@ public class UserTvController {
return ResultInfo.success();
}
@Log
@DeleteMapping(value = "/{id}")
@ApiOperation("删除UserTv")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.basicdata.user.iptv.service;
package com.topdraw.business.module.user.iptv.service;
import com.topdraw.business.basicdata.user.iptv.domain.UserTv;
import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvDTO;
import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvQueryCriteria;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
import com.topdraw.business.module.user.iptv.service.dto.UserTvQueryCriteria;
import org.springframework.data.domain.Pageable;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
......@@ -40,6 +41,9 @@ public interface UserTvService {
void update(UserTv resources);
@Transactional(rollbackFor = Exception.class)
void unbindPriorityMemberCode(UserTv resources);
void delete(Long id);
UserTvDTO findByPlatformAccount(String platformAccount);
......
package com.topdraw.business.basicdata.user.iptv.service.dto;
package com.topdraw.business.module.user.iptv.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
......@@ -47,7 +48,7 @@ public class UserTvDTO implements Serializable {
private Integer continueDays;
// 活跃时间
private Timestamp activeTime;
private LocalDateTime activeTime;
// 分组 分组ID用逗号分隔
private String groups;
......@@ -68,13 +69,13 @@ public class UserTvDTO implements Serializable {
private String createBy;
// 创建时间
private Timestamp createTime;
private LocalDateTime createTime;
// 更新者
private String updateBy;
// 更新时间
private Timestamp updateTime;
private LocalDateTime updateTime;
// 会员id
private Long memberId;
......
package com.topdraw.business.basicdata.user.iptv.service.dto;
package com.topdraw.business.module.user.iptv.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.user.iptv.service.impl;
import com.topdraw.business.basicdata.member.service.MemberService;
import com.topdraw.business.basicdata.member.service.dto.MemberDTO;
import com.topdraw.business.basicdata.user.iptv.domain.UserTv;
import com.topdraw.business.basicdata.user.iptv.repository.UserTvRepository;
import com.topdraw.business.basicdata.user.iptv.service.UserTvService;
import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvDTO;
import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvQueryCriteria;
import com.topdraw.business.basicdata.user.iptv.service.mapper.UserTvMapper;
package com.topdraw.business.module.user.iptv.service.impl;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.module.user.iptv.repository.UserTvRepository;
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.iptv.service.dto.UserTvQueryCriteria;
import com.topdraw.business.module.user.iptv.service.mapper.UserTvMapper;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.ValidationUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.domain.Page;
......@@ -20,6 +21,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
......@@ -75,10 +77,33 @@ public class UserTvServiceImpl implements UserTvService {
@Override
@Transactional(rollbackFor = Exception.class)
public void update(UserTv resources) {
UserTv UserTv = UserTvRepository.findById(resources.getId()).orElseGet(UserTv::new);
ValidationUtil.isNull( UserTv.getId(),"UserTv","id",resources.getId());
UserTv.copy(resources);
UserTvRepository.save(UserTv);
String platformAccount = resources.getPlatformAccount();
UserTvDTO userTvDTO = this.findByPlatformAccount(platformAccount);
ValidationUtil.isNull(userTvDTO.getId(),"UserTv","id",resources.getId());
UserTv userTv = new UserTv();
BeanUtils.copyProperties(resources,userTv);
userTv.setId(userTvDTO.getId());
userTv.setMemberId(userTvDTO.getMemberId());
userTv.setUpdateTime(LocalDateTime.now());
UserTvRepository.save(userTv);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void unbindPriorityMemberCode(UserTv resources) {
String platformAccount = resources.getPlatformAccount();
UserTvDTO userTvDTO = this.findByPlatformAccount(platformAccount);
// UserTv UserTv = UserTvRepository.findById(resources.getId()).orElseGet(UserTv::new);
ValidationUtil.isNull( userTvDTO.getId(),"UserTv","id",resources.getId());
//UserTv.copy(resources);
UserTv userTv = new UserTv();
BeanUtils.copyProperties(userTvDTO,userTv);
userTv.setPriorityMemberCode(null);
UserTvRepository.save(userTv);
}
@Override
......
package com.topdraw.business.basicdata.user.iptv.service.mapper;
package com.topdraw.business.module.user.iptv.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.user.iptv.domain.UserTv;
import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvDTO;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.module.user.weixin.collection.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* @author pengmengqing
* @date 2021-04-02
*/
@Entity
@Data
@EntityListeners(AuditingEntityListener.class)
@Accessors(chain = true)
@Table(name="uc_user_collection")
public class UserCollection implements Serializable {
// ID
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
// 应用ID
@Column(name = "app_id")
private Long appId;
// 用户ID
@Column(name = "user_id")
private Long userId;
// 收藏夹类型:1-收藏 2-播放记录 3-播放列表 4-评分 5-点赞/关注/订阅
@Column(name = "type")
private Integer type;
// 收藏夹名称
@Column(name = "name")
private String name;
// 数量
@Column(name = "count")
private Integer count;
// 创建时间
@CreatedDate
@Column(name = "create_time")
private Timestamp createTime;
// 更新时间
@LastModifiedDate
@Column(name = "update_time")
private Timestamp updateTime;
public void copy(UserCollection source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}
package com.topdraw.business.module.user.weixin.collection.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* @author pengmengqing
* @date 2021-04-02
*/
@Entity
@Data
@EntityListeners(AuditingEntityListener.class)
@Accessors(chain = true)
@Table(name="uc_user_collection_detail")
public class UserCollectionDetail implements Serializable {
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "user_collection_id", insertable = false, updatable = false)
private UserCollection userCollection;
// ID
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
// 收藏夹ID
@Column(name = "user_collection_id")
private Long userCollectionId;
// 自定义收藏内容的类型CODE,默认:DEFAULT
@Column(name = "detail_folder_code")
private String detailFolderCode;
// 收藏内容的类型:MEDIA|EPISODE|CATEGORY|SUBJECT|ARTICLE|ARTIST|SCHOOL
@Column(name = "detail_type")
private String detailType;
// 收藏内容的ID
@Column(name = "detail_id")
private Long detailId;
// 收藏内容的CODE
@Column(name = "detail_code")
private String detailCode;
// 收藏内容的剧集ID
@Column(name = "detail_episode_id")
private Long detailEpisodeId;
// 收藏内容的剧集CODE
@Column(name = "detail_episode_code")
private String detailEpisodeCode;
// 收藏内容的名称
@Column(name = "detail_name")
private String detailName;
// 收藏内容的标记
@Column(name = "detail_mark")
private Integer detailMark;
// 收藏内容的图片
@Column(name = "detail_img")
private String detailImg;
// 收藏内容的剧集序号
@Column(name = "detail_index")
private Integer detailIndex;
// 收藏内容的剧集总数
@Column(name = "detail_total_index")
private Integer detailTotalIndex;
// 收藏内容的播放时间
@Column(name = "detail_play_time")
private Integer detailPlayTime;
// 收藏内容的总时间
@Column(name = "detail_total_time")
private Integer detailTotalTime;
// 收藏内容在同一folder中的顺序
@Column(name = "detail_sequence")
private Integer detailSequence;
// 收藏内容的评分
@Column(name = "detail_score")
private Float detailScore;
// 收藏内容(根据文件夹和类型的不同)的点赞/关注/订阅
@Column(name = "detail_like")
private Integer detailLike;
// 收藏内容的扩展数据
@Column(name = "detail_ext_data")
private String detailExtData;
// 创建时间
@Column(name = "create_time")
private Timestamp createTime;
// 更新时间
@Column(name = "update_time")
private Timestamp updateTime;
public void copy(UserCollectionDetail source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}
package com.topdraw.business.module.user.weixin.collection.repository;
import com.topdraw.business.module.user.weixin.collection.domain.UserCollectionDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import java.util.Optional;
/**
* @author pengmengqing
* @date 2021-04-02
*/
public interface UserCollectionDetailRepository extends JpaRepository<UserCollectionDetail, Long>, JpaSpecificationExecutor<UserCollectionDetail> {
@Modifying
void deleteAllByUserCollectionId(Long userCollectionId);
Optional<UserCollectionDetail> findByDetailIdAndDetailTypeAndUserCollectionId(Long detailId, String detailType, Long userCollectionId);
}
package com.topdraw.business.module.user.weixin.collection.repository;
import com.topdraw.business.module.user.weixin.collection.domain.UserCollection;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
import java.util.Optional;
/**
* @author pengmengqing
* @date 2021-04-02
*/
public interface UserCollectionRepository extends JpaRepository<UserCollection, Long>, JpaSpecificationExecutor<UserCollection> {
Optional<UserCollection> findFirstByUserIdAndTypeAndName(Long userId, Integer type, String name);
List<UserCollection> findByUserIdAndType(Long userId, Integer type);
}
package com.topdraw.business.module.user.weixin.collection.service;
import com.topdraw.business.module.user.weixin.collection.domain.UserCollectionDetail;
import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDetailDTO;
import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDetailQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @author pengmengqing
* @date 2021-04-02
*/
public interface UserCollectionDetailService {
/**
* 查询数据分页
* @param criteria 条件参数
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(UserCollectionDetailQueryCriteria criteria, Pageable pageable);
/**
* 根据ID查询
* @param id ID
* @return UserCollectionDetailDTO
*/
UserCollectionDetailDTO findById(Long id);
UserCollectionDetailDTO create(UserCollectionDetail resources);
void update(UserCollectionDetail resources);
void delete(Long id);
void deleteAllByUserCollectionId(Long id);
void deleteAll(List<UserCollectionDetail> userCollectionDetailOptional);
}
package com.topdraw.business.module.user.weixin.collection.service;
import com.topdraw.business.module.user.weixin.collection.domain.UserCollection;
import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionDTO;
import com.topdraw.business.module.user.weixin.collection.service.dto.UserCollectionQueryCriteria;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* @author pengmengqing
* @date 2021-04-02
*/
public interface UserCollectionService {
/**
* 查询数据分页
* @param criteria 条件参数
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(UserCollectionQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<UserCollectionDTO>
*/
List<UserCollectionDTO> queryAll(UserCollectionQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return UserCollectionDTO
*/
UserCollectionDTO findById(Long id);
UserCollectionDTO create(UserCollection resources);
void update(UserCollection resources);
void delete(Long id);
void download(List<UserCollectionDTO> all, HttpServletResponse response) throws IOException;
List<UserCollection> findByUserIdAndType(Long id, Integer type);
Optional<UserCollection> findFirstByUserIdAndTypeAndName(Long id, Integer type, String name);
UserCollection save(UserCollection userCollection);
}
package com.topdraw.business.module.user.weixin.collection.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* @author pengmengqing
* @date 2021-04-02
*/
@Data
public class UserCollectionDTO implements Serializable {
// ID
private Long id;
// 应用ID
private Long appId;
// 用户ID
private Long userId;
// 收藏夹类型:1-收藏 2-播放记录 3-播放列表 4-评分 5-点赞/关注/订阅
private Integer type;
// 收藏夹名称
private String name;
// 数量
private Integer count;
// 创建时间
private Timestamp createTime;
// 更新时间
private Timestamp updateTime;
}
package com.topdraw.business.module.user.weixin.collection.service.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* @author pengmengqing
* @date 2021-04-02
*/
@Data
public class UserCollectionDetailDTO implements Serializable {
// ID
private Long id;
// 收藏夹ID
private Long userCollectionId;
// 自定义收藏内容的类型CODE,默认:DEFAULT
private String detailFolderCode;
// 收藏内容的类型:MEDIA|EPISODE|CATEGORY|SUBJECT|ARTICLE|ARTIST|SCHOOL
private String detailType;
// 收藏内容的ID
private Long detailId;
// 收藏内容的CODE
private String detailCode;
// 收藏内容的剧集ID
private Long detailEpisodeId;
// 收藏内容的剧集CODE
private String detailEpisodeCode;
// 收藏内容的名称
private String detailName;
// 收藏内容的标记
private Integer detailMark;
// 收藏内容的图片
private String detailImg;
// 收藏内容的剧集序号
private Integer detailIndex;
// 收藏内容的剧集总数
private Integer detailTotalIndex;
// 收藏内容的播放时间
private Integer detailPlayTime;
// 收藏内容的总时间
private Integer detailTotalTime;
// 收藏内容在同一folder中的顺序
private Integer detailSequence;
// 收藏内容的评分
private Float detailScore;
// 收藏内容(根据文件夹和类型的不同)的点赞/关注/订阅
private Integer detailLike;
// 收藏内容的扩展数据
private String detailExtData;
// 创建时间
@JsonFormat(
pattern = "MM月dd日 HH:mm",
timezone = "GMT+8"
)
private Timestamp createTime;
// 更新时间
@JsonFormat(
pattern = "MM月dd日 HH:mm",
timezone = "GMT+8"
)
private Timestamp updateTime;
}
package com.topdraw.business.module.user.weixin.collection.service.dto;
import com.topdraw.annotation.Query;
import lombok.Data;
import javax.persistence.criteria.JoinType;
/**
* @author pengmengqing
* @date 2021-04-02
*/
@Data
public class UserCollectionDetailQueryCriteria{
private Long userWeixinId;
@Query(joinType = JoinType.INNER, joinName = "userCollection")
private Long userId;
@Query(joinType = JoinType.INNER, joinName = "userCollection")
private Integer type;
private String detailType;
private String detailFolderCode = "DEFAULT";
private Long detailId;
}
package com.topdraw.business.module.user.weixin.collection.service.dto;
import lombok.Data;
/**
* @author pengmengqing
* @date 2021-04-02
*/
@Data
public class UserCollectionQueryCriteria{
}
package com.topdraw.business.module.user.weixin.collection.service.impl;
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.dto.UserCollectionDetailQueryCriteria;
import com.topdraw.business.module.user.weixin.collection.service.mapper.UserCollectionDetailMapper;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.ValidationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.util.List;
import java.util.Map;
/**
* @author pengmengqing
* @date 2021-04-02
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class UserCollectionDetailServiceImpl implements UserCollectionDetailService {
@Autowired
private UserCollectionDetailRepository userCollectionDetailRepository;
@Autowired
private UserCollectionDetailMapper userCollectionDetailMapper;
@Override
public Map<String, Object> queryAll(UserCollectionDetailQueryCriteria criteria, Pageable pageable) {
Page<UserCollectionDetail> page = userCollectionDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(userCollectionDetailMapper::toDto));
}
@Override
public UserCollectionDetailDTO findById(Long id) {
UserCollectionDetail userCollectionDetail = userCollectionDetailRepository.findById(id).orElseGet(UserCollectionDetail::new);
ValidationUtil.isNull(userCollectionDetail.getId(),"UserCollectionDetail","id",id);
return userCollectionDetailMapper.toDto(userCollectionDetail);
}
@Override
@Transactional(rollbackFor = Exception.class)
public UserCollectionDetailDTO create(UserCollectionDetail resources) {
return userCollectionDetailMapper.toDto(userCollectionDetailRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(UserCollectionDetail resources) {
UserCollectionDetail userCollectionDetail = userCollectionDetailRepository.findById(resources.getId()).orElseGet(UserCollectionDetail::new);
ValidationUtil.isNull( userCollectionDetail.getId(),"UserCollectionDetail","id",resources.getId());
userCollectionDetail.copy(resources);
userCollectionDetailRepository.save(userCollectionDetail);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Long id) {
Assert.notNull(id, "The given id must not be null!");
UserCollectionDetail userCollectionDetail = userCollectionDetailRepository.findById(id).orElseThrow(
() -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", UserCollectionDetail.class, id), 1));
userCollectionDetailRepository.delete(userCollectionDetail);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAllByUserCollectionId(Long id) {
this.userCollectionDetailRepository.deleteAllByUserCollectionId(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(List<UserCollectionDetail> userCollectionDetailOptional) {
this.userCollectionDetailRepository.deleteAll(userCollectionDetailOptional);
}
}
package com.topdraw.business.module.user.weixin.collection.service.impl;
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.dto.UserCollectionQueryCriteria;
import com.topdraw.business.module.user.weixin.collection.service.mapper.UserCollectionMapper;
import com.topdraw.utils.FileUtil;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.ValidationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
/**
* @author pengmengqing
* @date 2021-04-02
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class UserCollectionServiceImpl implements UserCollectionService {
@Autowired
private UserCollectionRepository userCollectionRepository;
@Autowired
private UserCollectionMapper userCollectionMapper;
@Override
public Map<String, Object> queryAll(UserCollectionQueryCriteria criteria, Pageable pageable) {
Page<UserCollection> page = userCollectionRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(userCollectionMapper::toDto));
}
@Override
public List<UserCollectionDTO> queryAll(UserCollectionQueryCriteria criteria) {
return userCollectionMapper.toDto(userCollectionRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
public UserCollectionDTO findById(Long id) {
UserCollection userCollection = userCollectionRepository.findById(id).orElseGet(UserCollection::new);
ValidationUtil.isNull(userCollection.getId(),"UserCollection","id",id);
return userCollectionMapper.toDto(userCollection);
}
@Override
@Transactional(rollbackFor = Exception.class)
public UserCollectionDTO create(UserCollection resources) {
return userCollectionMapper.toDto(userCollectionRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(UserCollection resources) {
UserCollection userCollection = userCollectionRepository.findById(resources.getId()).orElseGet(UserCollection::new);
ValidationUtil.isNull( userCollection.getId(),"UserCollection","id",resources.getId());
userCollection.copy(resources);
userCollectionRepository.save(userCollection);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Long id) {
Assert.notNull(id, "The given id must not be null!");
UserCollection userCollection = userCollectionRepository.findById(id).orElseThrow(
() -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", UserCollection.class, id), 1));
userCollectionRepository.delete(userCollection);
}
@Override
public void download(List<UserCollectionDTO> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (UserCollectionDTO userCollection : all) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("应用ID", userCollection.getAppId());
// map.put("用户ID", userCollection.getSubscriberId());
// map.put("platformAccount", userCollection.getPlatformAccount());
map.put("收藏夹类型:1-收藏 2-播放记录 3-播放列表 4-评分 5-点赞/关注/订阅", userCollection.getType());
map.put("收藏夹名称", userCollection.getName());
map.put("数量", userCollection.getCount());
map.put("创建时间", userCollection.getCreateTime());
map.put("更新时间", userCollection.getUpdateTime());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
@Override
public List<UserCollection> findByUserIdAndType(Long id, Integer type) {
return this.userCollectionRepository.findByUserIdAndType(id,type);
}
@Override
public Optional<UserCollection> findFirstByUserIdAndTypeAndName(Long id, Integer type, String name) {
return Optional.empty();
}
@Override
public UserCollection save(UserCollection userCollection) {
this.userCollectionRepository.save(userCollection);
return userCollection;
}
}
package com.topdraw.business.module.user.weixin.collection.service.mapper;
import com.topdraw.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;
import org.mapstruct.ReportingPolicy;
/**
* @author pengmengqing
* @date 2021-04-02
*/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface UserCollectionDetailMapper extends BaseMapper<UserCollectionDetailDTO, UserCollectionDetail> {
}
package com.topdraw.business.module.user.weixin.collection.service.mapper;
import com.topdraw.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;
import org.mapstruct.ReportingPolicy;
/**
* @author pengmengqing
* @date 2021-04-02
*/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface UserCollectionMapper extends BaseMapper<UserCollectionDTO, UserCollection> {
}
package com.topdraw.business.basicdata.user.weixin.domain;
package com.topdraw.business.module.user.weixin.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.topdraw.business.module.common.domain.DefaultAsyncMqModule;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.CreatedDate;
......@@ -11,6 +12,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
* @author XiangHan
......@@ -21,7 +23,7 @@ import java.sql.Timestamp;
@EntityListeners(AuditingEntityListener.class)
@Accessors(chain = true)
@Table(name="uc_user_weixin")
public class UserWeixin implements Serializable {
public class UserWeixin extends DefaultAsyncMqModule implements Serializable {
// ID
@Id
......@@ -79,7 +81,7 @@ public class UserWeixin implements Serializable {
// 超时时间
@Column(name = "expires_time")
private Timestamp expiresTime;
private LocalDateTime expiresTime;
// 描述
@Column(name = "description")
......@@ -92,7 +94,7 @@ public class UserWeixin implements Serializable {
// 创建时间
@CreatedDate
@Column(name = "create_time")
private Timestamp createTime;
private LocalDateTime createTime;
// 更新者
@Column(name = "update_by")
......@@ -101,7 +103,7 @@ public class UserWeixin implements Serializable {
// 更新时间
@LastModifiedDate
@Column(name = "update_time")
private Timestamp updateTime;
private LocalDateTime updateTime;
// 来源类型
@Column(name = "source_type")
......@@ -129,7 +131,7 @@ public class UserWeixin implements Serializable {
// 授权时间
@Column(name = "auth_time")
private Timestamp authTime;
private LocalDateTime authTime;
@Column(name = "sex")
private Integer sex;
......
package com.topdraw.business.basicdata.user.weixin.repository;
package com.topdraw.business.module.user.weixin.repository;
import com.topdraw.business.basicdata.user.weixin.domain.UserWeixin;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
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.data.repository.query.Param;
import javax.transaction.Transactional;
import java.util.Optional;
/**
* @author XiangHan
......@@ -10,4 +16,10 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
*/
public interface UserWeixinRepository extends JpaRepository<UserWeixin, Long>, JpaSpecificationExecutor<UserWeixin> {
Optional<UserWeixin> findFirstByAppidAndOpenid(String appId, String openId);
@Modifying
@Transactional
@Query(value = "update uc_user_weixin set update_time = :#{#resources.updateTime} where appid = :#{#resources.appid} and openid = :#{#resources.openid}" , nativeQuery = true)
void updateTime(@Param("resources") UserWeixin resources);
}
......
package com.topdraw.business.basicdata.user.weixin.rest;
package com.topdraw.business.module.user.weixin.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.user.weixin.domain.UserWeixin;
import com.topdraw.business.basicdata.user.weixin.service.UserWeixinService;
import com.topdraw.business.basicdata.user.weixin.service.dto.UserWeixinQueryCriteria;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
import com.topdraw.business.module.user.weixin.service.UserWeixinService;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,7 +35,6 @@ public class UserWeixinController {
return ResultInfo.success(UserWeixinService.queryAll(criteria));
}
@Log
@PostMapping
@ApiOperation("新增UserWeixin")
public ResultInfo create(@Validated @RequestBody UserWeixin resources) {
......@@ -44,7 +42,6 @@ public class UserWeixinController {
return ResultInfo.success();
}
@Log
@PutMapping
@ApiOperation("修改UserWeixin")
public ResultInfo update(@Validated @RequestBody UserWeixin resources) {
......@@ -52,8 +49,6 @@ public class UserWeixinController {
return ResultInfo.success();
}
@Log
@DeleteMapping(value = "/{id}")
@ApiOperation("删除UserWeixin")
public ResultInfo delete(@PathVariable Long id) {
......
package com.topdraw.business.basicdata.user.weixin.service;
package com.topdraw.business.module.user.weixin.service;
import com.topdraw.business.basicdata.user.weixin.domain.UserWeixin;
import com.topdraw.business.basicdata.user.weixin.service.dto.UserWeixinDTO;
import com.topdraw.business.basicdata.user.weixin.service.dto.UserWeixinQueryCriteria;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
......@@ -36,10 +36,14 @@ public interface UserWeixinService {
*/
UserWeixinDTO findById(Long id);
void updateTime(UserWeixin resources);
void create(UserWeixin resources);
void update(UserWeixin resources);
void delete(Long id);
UserWeixinDTO findFirstByAppIdAndOpenId(String appId, String openId);
}
......
package com.topdraw.business.basicdata.user.weixin.service.dto;
package com.topdraw.business.module.user.weixin.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
/**
......@@ -53,7 +54,7 @@ public class UserWeixinDTO implements Serializable {
private Integer expiresIn;
// 超时时间
private Timestamp expiresTime;
private LocalDateTime expiresTime;
// 描述
private String description;
......@@ -62,13 +63,13 @@ public class UserWeixinDTO implements Serializable {
private String createBy;
// 创建时间
private Timestamp createTime;
private LocalDateTime createTime;
// 更新者
private String updateBy;
// 更新时间
private Timestamp updateTime;
private LocalDateTime updateTime;
// 来源类型
private String sourceType;
......@@ -89,7 +90,7 @@ public class UserWeixinDTO implements Serializable {
private String sourceEntity;
// 授权时间
private Timestamp authTime;
private LocalDateTime authTime;
private Integer sex;
......
package com.topdraw.business.basicdata.user.weixin.service.dto;
package com.topdraw.business.module.user.weixin.service.dto;
import lombok.Data;
......
package com.topdraw.business.basicdata.user.weixin.service.impl;
package com.topdraw.business.module.user.weixin.service.impl;
import com.topdraw.business.basicdata.user.weixin.domain.UserWeixin;
import com.topdraw.business.basicdata.user.weixin.repository.UserWeixinRepository;
import com.topdraw.business.basicdata.user.weixin.service.UserWeixinService;
import com.topdraw.business.basicdata.user.weixin.service.dto.UserWeixinDTO;
import com.topdraw.business.basicdata.user.weixin.service.dto.UserWeixinQueryCriteria;
import com.topdraw.business.basicdata.user.weixin.service.mapper.UserWeixinMapper;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
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;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria;
import com.topdraw.business.module.user.weixin.service.mapper.UserWeixinMapper;
import com.topdraw.util.TimestampUtil;
import com.topdraw.utils.PageUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.ValidationUtil;
import jdk.vm.ci.meta.Local;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.domain.Page;
......@@ -18,6 +24,9 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.sql.Time;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
......@@ -27,6 +36,7 @@ import java.util.Map;
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
@Slf4j
public class UserWeixinServiceImpl implements UserWeixinService {
@Autowired
......@@ -34,6 +44,8 @@ public class UserWeixinServiceImpl implements UserWeixinService {
@Autowired
private UserWeixinMapper UserWeixinMapper;
@Autowired
private MemberService memberService;
@Override
public Map<String, Object> queryAll(UserWeixinQueryCriteria criteria, Pageable pageable) {
......@@ -55,17 +67,40 @@ public class UserWeixinServiceImpl implements UserWeixinService {
@Override
@Transactional(rollbackFor = Exception.class)
public void updateTime(UserWeixin resources) {
log.info("updateTime ==>> resources ==>> [{}]",resources);
String appid = resources.getAppid();
String openid = resources.getOpenid();
UserWeixin userWeixin = UserWeixinRepository.findFirstByAppidAndOpenid(appid,openid).orElseGet(UserWeixin::new);
ValidationUtil.isNull( userWeixin.getId(),"UserWeixin","id",resources.getId());
userWeixin.setUpdateTime(LocalDateTime.now());
log.info("userWeixin ==>> userWeixin ==>> [{}]",userWeixin);
UserWeixinRepository.updateTime(userWeixin);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(UserWeixin resources) {
resources.setMemberId(null);
String memberCode = resources.getMemberCode();
MemberDTO memberDTO = this.memberService.getByCode(memberCode);
resources.setMemberId(memberDTO.getId());
UserWeixinRepository.save(resources);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(UserWeixin resources) {
UserWeixin UserWeixin = UserWeixinRepository.findById(resources.getId()).orElseGet(UserWeixin::new);
ValidationUtil.isNull( UserWeixin.getId(),"UserWeixin","id",resources.getId());
UserWeixin.copy(resources);
UserWeixinRepository.save(UserWeixin);
log.info("update ==>> resources ==>> [{}]",resources);
String appid = resources.getAppid();
String openid = resources.getOpenid();
UserWeixin userWeixin = UserWeixinRepository.findFirstByAppidAndOpenid(appid,openid).orElseGet(UserWeixin::new);
ValidationUtil.isNull( userWeixin.getId(),"UserWeixin","id",resources.getId());
resources.setId(userWeixin.getId());
resources.setMemberId(userWeixin.getMemberId());
BeanUtils.copyProperties(resources,userWeixin);
log.info("update ==>>userWeixin ==>> resources ==>> [{}]",resources);
UserWeixinRepository.save(resources);
}
@Override
......@@ -77,5 +112,11 @@ public class UserWeixinServiceImpl implements UserWeixinService {
UserWeixinRepository.delete(UserWeixin);
}
@Override
public UserWeixinDTO findFirstByAppIdAndOpenId(String appId, String openId) {
UserWeixin userWeixin = this.UserWeixinRepository.findFirstByAppidAndOpenid(appId,openId).orElseGet(UserWeixin::new);
return UserWeixinMapper.toDto(userWeixin);
}
}
......
package com.topdraw.business.basicdata.user.weixin.service.mapper;
package com.topdraw.business.module.user.weixin.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.basicdata.user.weixin.domain.UserWeixin;
import com.topdraw.business.basicdata.user.weixin.service.dto.UserWeixinDTO;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......
package com.topdraw.business.process.domian.result;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CustomPointsResult {
private boolean result;
private Long point;
}
package com.topdraw.business.process.domian.result;
public interface TaskTemplateType {
int TYPE_1 = 1;
int TYPE_2 = 2;
int TYPE_3 = 3;
int TYPE_4 = 4;
}
package com.topdraw.business.process.domian.weixin;
import lombok.Data;
@Data
public class BindBean extends WeiXinUserBean {
private Long platformUserId;
private String platformAccount;
}
package com.topdraw.business.process.domian.weixin;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 微信账户信息
* @author XiangHan
* @date 2021-01-18
*/
@Data
public class BuyVipBean extends WeiXinUserBean {
private Integer vip;
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime vipExpireTime;
}
package com.topdraw.business.process.domian.weixin;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.exception.BadRequestException;
import com.topdraw.utils.StringUtils;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Date;
import java.util.UUID;
@Data
@Component
public class DefaultWeiXinBeanDefinition implements WeiXinBeanDefinition {
//
private String appid;
private String openId;
private String code;
private String token;
private String secret;
private String unionId;
private String nickname;
private String headImgUrl;
private JSONObject userInfo;
private String phoneNumber;
@Value("${file.upload:upload}")
private String filePath;
public DefaultWeiXinBeanDefinition() {
}
public DefaultWeiXinBeanDefinition(String appId, String code, String unionId, String openId, JSONObject userInfoWxJo, String phone) {
this.userInfo = userInfoWxJo;
if (userInfo != null) {
if (StringUtils.isNotBlank(userInfoWxJo.getString("unionId"))) {
unionId = userInfoWxJo.getString("unionId");
}
if (StringUtils.isNotBlank(userInfoWxJo.getString("openId"))) {
openId = userInfoWxJo.getString("openId");
}
headImgUrl = userInfoWxJo.getString("avatarUrl");
if (StringUtils.isNotBlank(userInfoWxJo.getString("nickName"))) {
nickname = Base64.getEncoder().encodeToString(userInfoWxJo.getString("nickName").getBytes(StandardCharsets.UTF_8));
}
String phoneNumber = userInfoWxJo.getString("phoneNumber");
if (StringUtils.isBlank(phoneNumber)) {
throw new BadRequestException("phoneNumber is null...");
}
this.phoneNumber = phoneNumber;
if (StringUtils.isNotBlank(headImgUrl)) {
new Thread(() -> {
String s = UUID.randomUUID().toString();
File file = new File(System.getProperty("user.dir") + "/" + filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd"));
if (!file.exists()) {
file.mkdirs();
}
HttpUtil.downloadFile(headImgUrl, new File(System.getProperty("user.dir") + "/" + filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd") + "/" + s + ".jpg"));
headImgUrl = filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd") + "/" + s + ".jpg";
}).start();
}
}
this.unionId = unionId;
this.phoneNumber = phone;
this.openId = openId;
this.appid = appId;
this.code = code;
}
@Override
public String getAppId() {
return this.appid;
}
@Override
public String getCode() {
return this.code;
}
@Override
public String getToken() {
return this.token;
}
@Override
public String getSecret() {
return this.secret;
}
@Override
public String getOpenId() {
return this.openId;
}
@Override
public String getUnionId() {
return this.unionId;
}
@Override
public String getNickname() {
return this.nickname;
}
@Override
public String getHeadImgUrl() {
return this.headImgUrl;
}
@Override
public JSONObject getUserInfo() {
return this.userInfo;
}
}
package com.topdraw.business.process.domian.weixin;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
@Data
public class SubscribeBean extends WeiXinUserBean {
private JSONObject userInfoJson;
private JSONObject iptvUserInfo;
private String msgType;
private String event;
/** */
private String openId;
/** */
private String appId;
/** */
private String eventKey;
private String unionid;
private String nickname;
private String headimgurl;
}
package com.topdraw.business.process.domian.weixin;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SubscribeBeanEvent {
@NotNull(message = "【content】 not be null !!!")
private String content;
}
package com.topdraw.business.process.domian.weixin;
import com.alibaba.fastjson.annotation.JSONField;
import com.topdraw.annotation.Query;
import lombok.Data;
import java.sql.Timestamp;
@Data
public class UserCollectionMq {
// 应用ID
@JSONField(name = "app_id")
private Long appId;
@JSONField(name = "userId")
private Long userId;
// 收藏夹类型:1-收藏 2-播放记录 3-播放列表 4-评分 5-点赞/关注/订阅
private Integer type;
// 收藏夹名称
private String name;
// 数量
private Integer count;
private String images;
// 收藏夹ID
@JSONField(name = "user_collection_id")
@Query
private Long userCollectionId;
// 自定义收藏内容的类型CODE,默认:DEFAULT
@JSONField(name = "detail_folder_code")
@Query
private String detailFolderCode;
// 收藏内容的类型:MEDIA|EPISODE|CATEGORY|SUBJECT|ARTICLE|ARTIST|SCHOOL
@JSONField(name = "detail_type")
@Query
private String detailType;
// 收藏内容的ID
@JSONField(name = "detail_id")
@Query
private Long detailId;
// 收藏内容的CODE
@JSONField(name = "detail_code")
@Query
private String detailCode;
// 收藏内容的剧集ID
@JSONField(name = "detail_episode_id")
@Query
private Long detailEpisodeId;
// 收藏内容的剧集CODE
@JSONField(name = "detail_episode_code")
@Query
private String detailEpisodeCode;
// 收藏内容的名称
@JSONField(name = "detail_name")
@Query
private String detailName;
// 收藏内容的标记
@JSONField(name = "detail_mark")
@Query
private Integer detailMark;
// 收藏内容的图片
@JSONField(name = "detail_img")
private String detailImg;
// 收藏内容的剧集序号
@JSONField(name = "detail_index")
@Query
private Integer detailIndex;
// 收藏内容的剧集总数
@JSONField(name = "detail_total_index")
@Query
private Integer detailTotalIndex;
// 收藏内容的播放时间
@JSONField(name = "detail_play_time")
@Query
private Integer detailPlayTime;
// 收藏内容的总时间
@JSONField(name = "detail_total_time")
@Query
private Integer detailTotalTime;
// 收藏内容在同一folder中的顺序
@JSONField(name = "detail_sequence")
@Query
private Integer detailSequence;
// 收藏内容的评分
@JSONField(name = "detail_score")
@Query
private Float detailScore;
// 收藏内容(根据文件夹和类型的不同)的点赞/关注/订阅
@JSONField(name = "detail_like")
@Query
private Integer detailLike;
// 收藏内容的扩展数据
@JSONField(name = "detail_ext_data")
@Query
private String detailExtData;
// 创建时间
@JSONField(name = "create_time")
@Query
private Timestamp createTime;
// 更新时间
@JSONField(name = "update_time")
private Timestamp updateTime;
}
package com.topdraw.business.process.domian.weixin;
import com.alibaba.fastjson.JSONObject;
public interface WeiXinBeanDefinition {
String getAppId();
String getCode();
String getToken();
String getSecret();
String getOpenId();
String getUnionId();
String getNickname();
String getHeadImgUrl();
JSONObject getUserInfo();
}
package com.topdraw.business.process.domian.weixin;
import lombok.Data;
/**
* 微信账户信息
* @author XiangHan
* @date 2021-01-18
*/
@Data
public class WeiXinUserBean {
private Long id;
private String unionid;
/** */
private String openid;
/** */
private String appid;
/** 加密后的appId,参数 */
private String wxAppid;
/** 加密后的code,参数 */
private String wxCode;
/** */
private String userInfo;
/** 会员id */
private Long memberId;
/** 加密信息 */
private String encryptedData;
/** 解析用户电话号码时使用,参数 */
private String iv;
/** 资源id */
private String sourceId;
/** 资源类型 */
private String sourceType;
/** 资源描述,用来表示从哪个地方链接进来的 */
private String sourceDesc;
/** 资源实例 */
private String sourceEntity;
/** 推荐者id */
private Long sourceUser;
private String nikename;
private String headimgurl;
}
package com.topdraw.business.process.service;
import com.topdraw.business.process.domian.TempCoupon;
import java.util.List;
/**
* @description 权益操作接口
* @author XiangHan
* @date 2021.10.22
*/
public interface CouponOperationService {
/**
* 基于已完成的任务发放优惠券
* @param tempCouponList
*/
void grantCouponThroughTempCoupon(List<TempCoupon> tempCouponList);
/**
* 系统手动发放优惠券
* @param tempCouponList
*/
void grantCouponByManual(List<TempCoupon> tempCouponList);
}
package com.topdraw.business.process.service;
import com.topdraw.business.process.domian.TempExp;
import java.util.List;
/**
* @description 权益操作接口
* @author XiangHan
* @date 2021.10.22
*/
public interface ExpOperationService {
/**
* 任务完成后自动发放成长值
* @param tempExpList
*/
void grantPointsThroughTempExp(List<TempExp> tempExpList);
/**
* 系统手动发放优惠券
* @param memberId
* @param userId
* @param tempExpList
*/
void grantExpByManual(Long memberId, Long userId, List<TempExp> tempExpList);
void grantExpByManual(List<TempExp> tempExpList);
}
package com.topdraw.business.process.service;
import com.topdraw.business.basicdata.member.domain.Member;
import com.topdraw.business.basicdata.member.service.dto.MemberDTO;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.service.dto.MemberDTO;
public interface MemberOperationService {
......
package com.topdraw.business.process.service;
import com.topdraw.business.module.rights.history.domain.RightsHistory;
import com.topdraw.business.process.domian.RightType;
import java.util.List;
import java.util.Map;
/**
* @description 权益操作接口
* @author XiangHan
* @date 2021.10.22
*/
public interface RightsOperationService {
/**
* 系统手动发放权益
* @param rightsHistories
*/
void grantRightsByManual(List<RightsHistory> rightsHistories);
/**
* 任务完成自动发放权益
* @param tempRightsMap
*/
void grantRights(Map<RightType, Object> tempRightsMap);
}
package com.topdraw.business.process.service.domian;
public enum RightType {
/**积分*/
POINTS,
/**成长值*/
EXP,
/**优惠券券*/
COUPON,
/**权益统称*/
RIGHTS
}
package com.topdraw.business.process.service.domian;
import com.topdraw.business.process.domian.TempRights;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Transient;
import java.sql.Timestamp;
/**
* 权益-非持久化数据
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TempCoupon extends TempRights {
@Transient
protected String code;
@Transient
protected Integer useStatus;
@Transient
protected Timestamp useTime;
/**领取时间*/
@Transient
protected Timestamp receiveTime;
@Transient
protected String userNickname;
}
package com.topdraw.business.process.service.domian;
import com.topdraw.business.process.domian.TempIptvUser;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TempCustomPointBean extends TempIptvUser {
/** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */
@Transient
@NotNull(message = "设备类型不得为空")
protected Integer deviceType;
/** 订单id */
@Transient
protected Long orderId;
/** 节目id(针对观影操作) */
@Transient
protected Long mediaId;
/** 活动id(针对参与活动) */
@Transient
protected Long activityId;
/** 商品id */
@Transient
protected Long itemId;
/** 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;11:积分转移;98:系统操作;99:其他 */
@Transient
protected Integer evtType;
}
package com.topdraw.business.process.service.domian;
import com.topdraw.business.process.domian.TempRights;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Transient;
/**
* 权益-非持久化数据
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TempExp extends TempRights {
// 获得成长值
@Transient
protected Long rewardExp;
}
package com.topdraw.business.process.service.domian;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Transient;
import java.sql.Timestamp;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TempIptvUser {
private String unionid;
// 账户
@Transient
private String platformAccount;
// 分数
@Transient
private Long points;
// ID
private Long id;
// 人ID
private Long personId;
// 运营商平台
private String platform;
// 手机号
private String cellphone;
// 用户名
private String username;
// 密码 MD5
private String password;
// 昵称 Base64
private String nickname;
// 头像
private String image;
// 登录天数(总天数)
private Integer loginDays;
// 连续登录天数
private Integer continueDays;
// 活跃时间
private Timestamp activeTime;
// 分组 分组ID用逗号分隔
private String groups;
// 标签 标签用逗号分隔
private String tags;
// 登录类型 1-运营商隐式登录 2-手机验证登录 3-微信登录 4-QQ登录 5-微博登录 6-苹果登录
private Integer loginType;
// 状态 0-下线 1-上线
private Integer status;
// 描述
private String description;
// 创建者
private String createBy;
// 创建时间
private Timestamp createTime;
// 更新者
private String updateBy;
// 更新时间
private Timestamp updateTime;
// 会员id
private Long memberId;
private String memberCode;
}
package com.topdraw.business.process.service.domian;
import com.topdraw.business.process.domian.TempRights;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
/**
* 权益-非持久化数据
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class TempPoints extends TempRights {
// 获得积分
@Transient
@NotNull(message = "【points】积分数值不得为空!!")
protected Long points;
// 积分类型 0:通用
@Transient
protected Integer pointsType;
@Transient
protected Long rewardPointsExpireTime;
}
package com.topdraw.business.process.service.domian;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* 权益-非持久化数据
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TempRights {
/** 主键 */
@Transient
protected Long id;
/** 编号 */
@Transient
protected String code;
/** 权益名称 */
@Transient
protected String name;
/** 会员ID */
@Transient
protected Long memberId;
/** 会员编号 */
@Transient
protected String memberCode;
/** 账号id */
@Transient
protected Long userId;
/** 发放策略 */
@Transient
protected Integer rightsSendStrategy;
/** 账号id */
@Transient
protected Long accountId;
/** 过期时间 */
@Transient
protected LocalDateTime expireTime;
/** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */
@Transient
@NotNull(message = "设备类型不得为空")
protected Integer deviceType;
/** 应用code(表示当前用户对应应用的标识) */
@Transient
protected String appCode;
/** 订单id */
@Transient
protected Long orderId;
/** 节目id(针对观影操作) */
@Transient
protected Long mediaId;
/** 活动id(针对参与活动) */
@Transient
protected Long activityId;
/** 商品id */
@Transient
protected Long itemId;
/** 积分变化描述,用于管理侧显示 */
@Transient
protected String description;
/** 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;11:积分转移;98:系统操作;99:其他 */
@Transient
protected Integer evtType;
/** 数量 */
@Transient
protected Integer rightsAmount;
}
package com.topdraw.business.process.service.domian;
public interface UnbindGroup {
}
package com.topdraw.business.process.service.domian.result;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CustomPointsResult {
private boolean result;
private Long point;
}
package com.topdraw.business.process.service.domian.result;
public interface TaskTemplateType {
int TYPE_1 = 1;
int TYPE_2 = 2;
int TYPE_3 = 3;
int TYPE_4 = 4;
}
package com.topdraw.business.process.service.domian.weixin;
import lombok.Data;
@Data
public class BindBean extends WeiXinUserBean {
private Long platformUserId;
private String platformAccount;
}
package com.topdraw.business.process.service.domian.weixin;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 微信账户信息
* @author XiangHan
* @date 2021-01-18
*/
@Data
public class BuyVipBean extends WeiXinUserBean {
private Integer vip;
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime vipExpireTime;
}
package com.topdraw.business.process.service.domian.weixin;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
@Data
public class SubscribeBean extends WeiXinUserBean {
private JSONObject userInfoJson;
private JSONObject iptvUserInfo;
private String msgType;
private String event;
/** */
private String openId;
/** */
private String appId;
/** */
private String eventKey;
private String unionid;
private String nickname;
private String headimgurl;
}
package com.topdraw.business.process.service.domian.weixin;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SubscribeBeanEvent {
@NotNull(message = "【content】 not be null !!!")
private String content;
}
package com.topdraw.business.process.service.domian.weixin;
import com.alibaba.fastjson.annotation.JSONField;
import com.topdraw.annotation.Query;
import lombok.Data;
import java.sql.Timestamp;
@Data
public class UserCollectionMq {
// 应用ID
@JSONField(name = "app_id")
private Long appId;
@JSONField(name = "userId")
private Long userId;
// 收藏夹类型:1-收藏 2-播放记录 3-播放列表 4-评分 5-点赞/关注/订阅
private Integer type;
// 收藏夹名称
private String name;
// 数量
private Integer count;
private String images;
// 收藏夹ID
@JSONField(name = "user_collection_id")
@Query
private Long userCollectionId;
// 自定义收藏内容的类型CODE,默认:DEFAULT
@JSONField(name = "detail_folder_code")
@Query
private String detailFolderCode;
// 收藏内容的类型:MEDIA|EPISODE|CATEGORY|SUBJECT|ARTICLE|ARTIST|SCHOOL
@JSONField(name = "detail_type")
@Query
private String detailType;
// 收藏内容的ID
@JSONField(name = "detail_id")
@Query
private Long detailId;
// 收藏内容的CODE
@JSONField(name = "detail_code")
@Query
private String detailCode;
// 收藏内容的剧集ID
@JSONField(name = "detail_episode_id")
@Query
private Long detailEpisodeId;
// 收藏内容的剧集CODE
@JSONField(name = "detail_episode_code")
@Query
private String detailEpisodeCode;
// 收藏内容的名称
@JSONField(name = "detail_name")
@Query
private String detailName;
// 收藏内容的标记
@JSONField(name = "detail_mark")
@Query
private Integer detailMark;
// 收藏内容的图片
@JSONField(name = "detail_img")
private String detailImg;
// 收藏内容的剧集序号
@JSONField(name = "detail_index")
@Query
private Integer detailIndex;
// 收藏内容的剧集总数
@JSONField(name = "detail_total_index")
@Query
private Integer detailTotalIndex;
// 收藏内容的播放时间
@JSONField(name = "detail_play_time")
@Query
private Integer detailPlayTime;
// 收藏内容的总时间
@JSONField(name = "detail_total_time")
@Query
private Integer detailTotalTime;
// 收藏内容在同一folder中的顺序
@JSONField(name = "detail_sequence")
@Query
private Integer detailSequence;
// 收藏内容的评分
@JSONField(name = "detail_score")
@Query
private Float detailScore;
// 收藏内容(根据文件夹和类型的不同)的点赞/关注/订阅
@JSONField(name = "detail_like")
@Query
private Integer detailLike;
// 收藏内容的扩展数据
@JSONField(name = "detail_ext_data")
@Query
private String detailExtData;
// 创建时间
@JSONField(name = "create_time")
@Query
private Timestamp createTime;
// 更新时间
@JSONField(name = "update_time")
private Timestamp updateTime;
}
package com.topdraw.business.process.service.domian.weixin;
import lombok.Data;
/**
* 微信账户信息
* @author XiangHan
* @date 2021-01-18
*/
@Data
public class WeiXinUserBean {
private Long id;
private String unionid;
/** */
private String openid;
/** */
private String appid;
/** 加密后的appId,参数 */
private String wxAppid;
/** 加密后的code,参数 */
private String wxCode;
/** */
private String userInfo;
/** 会员id */
private Long memberId;
/** 加密信息 */
private String encryptedData;
/** 解析用户电话号码时使用,参数 */
private String iv;
/** 资源id */
private String sourceId;
/** 资源类型 */
private String sourceType;
/** 资源描述,用来表示从哪个地方链接进来的 */
private String sourceDesc;
/** 资源实例 */
private String sourceEntity;
/** 推荐者id */
private Long sourceUser;
private String nikename;
private String headimgurl;
}
package com.topdraw.business.process.service.impl;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.task.domain.Task;
import java.util.List;
@FunctionalInterface
public interface CompareTaskCondition {
boolean compareCondition(MemberDTO memberDTO, List<Task> taskList);
}
package com.topdraw.business.process.service.impl;
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;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.process.domian.TempCoupon;
import com.topdraw.business.process.service.CouponOperationService;
import com.topdraw.business.process.service.MemberOperationService;
import com.topdraw.business.process.service.RightsOperationService;
import com.topdraw.util.RedissonUtil;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
@Service
public class CouponOperationServiceImpl implements CouponOperationService {
private static final Logger LOG = LoggerFactory.getLogger(CouponOperationServiceImpl.class);
@Autowired
CouponService couponService;
@Autowired
CouponHistoryService couponHistoryService;
@Autowired
MemberOperationService memberOperationService;
@Autowired
RightsOperationService rightsOperationService;
@Autowired
MemberService memberService;
@Autowired
RedissonClient redissonClient;
@Autowired
ThreadPoolTaskExecutor threadPoolTaskExecutor;
// 过期阀值(默认一个月)
private static final Integer EXPIRE_FACTOR_DAY = 30;
@Override
public void grantCouponThroughTempCoupon(List<TempCoupon> tempCouponList) {
// 优惠券领取、使用历史记录表
for (TempCoupon tempCoupon : tempCouponList) {
this.refresh(tempCoupon);
}
}
/**
* 手动发放优惠券
* @param tempCouponList
*/
@Override
public void grantCouponByManual(List<TempCoupon> tempCouponList) {
// 优惠券领取、使用历史记录表
for (TempCoupon tempCoupon : tempCouponList) {
this.refresh(tempCoupon);
}
}
/**
* 优惠券领取历史记录表
*
* @param tempCoupon 领取的优惠券
*/
private void refresh(TempCoupon tempCoupon) {
// 1.更新会员优惠券数量
this.refreshMemberCoupon(tempCoupon);
// 2.保存优惠券领取、使用历史记录表
this.doInsertCouponHistory(tempCoupon);
}
/**
* 更新会员优惠券信息
* @param tempCoupon 账号id
*/
private void refreshMemberCoupon(TempCoupon tempCoupon) {
// Long userId = tempCoupon.getUserId();
Long memberId = tempCoupon.getMemberId();
Integer rightsAmount = tempCoupon.getRightsAmount();
RLock rLock = this.redissonClient.getLock("refreshMemberCoupon:" + memberId.toString());
try {
RedissonUtil.lock(rLock);
// 1.历史总优惠券数量
Long historyCouponCount = this.getTotalHistoryCoupon(memberId);
// 1.当前总优惠券数量
Long totalCouponCount = this.getTotalCoupon(historyCouponCount,rightsAmount);
// 2.获取已过期的优惠券数量
Long expireCouponCount = this.getTotalExpireCoupon(memberId);
// 3.即将过期的优惠券数量
Long expireSoonCouponCount = this.getTotalExpireSoonCoupon(memberId,EXPIRE_FACTOR_DAY);
// 4.当前优惠券数量 = 总优惠券-已过期的优惠券
Long currentCoupon = this.getCurrentCoupon(totalCouponCount,expireCouponCount);
// 5.更新用户信息(优惠券数量、即将过期的优惠券数量)
this.doUpdateMemberInfo(memberId,currentCoupon,expireSoonCouponCount);
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
RedissonUtil.unlock(rLock);
}
}
private Long getTotalCoupon(Long historyCouponCount, Integer rightsAmount) {
return (Objects.nonNull(historyCouponCount) ? historyCouponCount: 0L) + (Objects.nonNull(rightsAmount) ? rightsAmount: 0L);
}
/**
* 更新当前用户优惠券信息
* @param memberId
* @param currentCoupon
* @param expireSoonCouponCount
*/
private void doUpdateMemberInfo(Long memberId, Long currentCoupon, Long expireSoonCouponCount) {
MemberDTO memberDTO = this.findMemberByMemberId(memberId);
Member member = new Member();
BeanUtils.copyProperties(memberDTO,member);
member.setCouponAmount(currentCoupon);
member.setDueCouponAmount(expireSoonCouponCount);
member.setUpdateTime(LocalDateTime.now());
this.memberOperationService.doUpdateMemberInfo(member);
}
private MemberDTO findMemberByMemberId(Long memberId) {
MemberDTO memberDTO = this.memberService.findById(memberId);
return memberDTO;
}
/**
* 当前优惠券数量 = 总优惠券-已过期的优惠券
* @param totalCouponCount 总数
* @param expireCouponCount 已过期总数
* @return
*/
private Long getCurrentCoupon(Long totalCouponCount, Long expireCouponCount) {
return (Objects.nonNull(totalCouponCount)?totalCouponCount:0L)-(Objects.nonNull(expireCouponCount)?expireCouponCount:0L);
}
/**
* 即将过期的优惠券数量
* @param expireFactor
* @return
*/
private Long getTotalExpireSoonCoupon(Long userId, Integer expireFactor) {
LocalDateTime expireTime = LocalDateTime.now().plusDays(expireFactor);
return this.couponHistoryService.countByUserIdAndExpireTimeBetween(userId,LocalDateTime.now(),expireTime);
}
/**
* 获取已过期的优惠券数量
* @param userId
* @return
*/
private Long getTotalExpireCoupon(Long userId) {
return this.couponHistoryService.countByUserIdAndExpireTimeBefore(userId,LocalDateTime.now());
}
/**
* 获取用户领取的总优惠券
* @param userId
* @return
*/
private Long getTotalHistoryCoupon(Long userId) {
return this.couponHistoryService.countByUserId(userId);
}
/**
* 优惠券领取、使用历史记录表
* @param tempCoupon 优惠券
*/
private void doInsertCouponHistory(TempCoupon tempCoupon) {
CouponHistory couponHistory = new CouponHistory();
BeanUtils.copyProperties(tempCoupon,couponHistory);
couponHistory.setId(null);
couponHistory.setCouponId(tempCoupon.getId());
couponHistory.setUserId(tempCoupon.getMemberId());
couponHistory.setCouponCode(tempCoupon.getCode());
couponHistory.setUserNickname(tempCoupon.getUserNickname());
couponHistory.setOrderDetailId(tempCoupon.getOrderId());
couponHistory.setReceiveTime(LocalDateTime.now());
couponHistory.setUseStatus(Objects.nonNull(couponHistory.getUseStatus()) ? couponHistory.getUseStatus():0);
this.couponHistoryService.create(couponHistory);
}
}
package com.topdraw.business.process.service.impl;
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;
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.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.process.domian.TempExp;
import com.topdraw.business.process.service.ExpOperationService;
import com.topdraw.business.process.service.MemberOperationService;
import com.topdraw.util.IdWorker;
import com.topdraw.util.RedissonUtil;
import com.topdraw.utils.StringUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
/**
*
*/
@Service
public class ExpOperationServiceImpl implements ExpOperationService {
private static final Logger LOG = LoggerFactory.getLogger(ExpOperationServiceImpl.class);
@Autowired
ExpDetailService expDetailService;
@Autowired
MemberOperationService memberOperationService;
@Autowired
MemberLevelService memberLevelService;
@Autowired
MemberService memberService;
@Autowired
RedissonClient redissonClient;
@Autowired
ThreadPoolTaskExecutor threadPoolTaskExecutor;
@Override
public void grantPointsThroughTempExp(List<TempExp> tempExpList) {
for (TempExp tempExp : tempExpList) {
this.refresh(tempExp);
}
}
@Override
public void grantExpByManual(Long memberId, Long userId, List<TempExp> tempExpList) {
for (TempExp tempExp : tempExpList) {
this.refresh(tempExp);
}
}
@Override
public void grantExpByManual(List<TempExp> tempExpList) {
for (TempExp tempExp : tempExpList) {
this.refresh(tempExp);
}
}
/**
*
* @param tempExp
*/
private void refresh(TempExp tempExp) {
String memberCode = tempExp.getMemberCode();
MemberDTO memberDTO = this.memberService.getByCode(memberCode);
Long id = memberDTO.getId();
tempExp.setId(id);
RLock lock = this.redissonClient.getLock("uc-refresh-exp:" + tempExp.getMemberId());
try {
RedissonUtil.lock(lock);
// 原始积分
long originExp = this.getExpByMemberId(tempExp);
// 总积分
long totalExp = this.calculateTotalExp(originExp, tempExp);
// 1.添加成长值记录
// this.threadPoolTaskExecutor.execute(() -> this.doInsertExpDetail(tempExp, originExp, totalExp));
// 2.更新成长值与等级
this.refreshMemberExpAndLevel(tempExp,totalExp);
this.doInsertExpDetail(tempExp, originExp, totalExp);
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
RedissonUtil.unlock(lock);
}
}
private long calculateTotalExp(long originalExp, TempExp tempExp) {
Long rewardExp = tempExp.getRewardExp();
return rewardExp + originalExp;
}
private long getExpByMemberId(TempExp tempExp) {
Long memberId = tempExp.getMemberId();
MemberDTO memberDTO = this.memberOperationService.findById(memberId);
if (Objects.nonNull(memberDTO)) {
Long exp = memberDTO.getExp();
return Objects.isNull(exp) ? 0L : exp;
}
return 0L;
}
/**
* 更新成长值与等级
*
* @param tempExp 成长值列表
*/
private void refreshMemberExpAndLevel(TempExp tempExp, long totalExp) {
Long memberId = tempExp.getMemberId();
// 1.获取当前成长值
MemberDTO memberDTO = this.getMemberInfoByMemberId(memberId);
// 2.获取下一级需要的成长值
MemberLevelDTO memberLevelDTO = this.getNextLevelExp(memberDTO.getLevel() + 1, 1);
// 4.成长值比较,判断是否升级
Integer level = this.compareExp(totalExp, memberLevelDTO,memberDTO);
// 5.更新用户信息
this.updateMemberInfo(level, totalExp, memberId);
}
/**
*
* @param level
* @param totalExp 总积分
* @param memberId 会员id
*/
private void updateMemberInfo(Integer level,Long totalExp,Long memberId) {
MemberDTO memberDTO = this.findMemberByMemberId(memberId);
Member member = new Member();
BeanUtils.copyProperties(memberDTO,member);
member.setExp(totalExp);
member.setLevel(level);
member.setUpdateTime(LocalDateTime.now());
this.memberOperationService.doUpdateMemberInfo(member);
}
private MemberDTO findMemberByMemberId(Long memberId) {
MemberDTO memberDTO = this.memberService.findById(memberId);
return memberDTO;
}
private Integer compareExp(long newExp, MemberLevelDTO memberLevelDTO, MemberDTO memberDTO) {
if (Objects.nonNull(memberLevelDTO)) {
Long nextLevelExp = memberLevelDTO.getExpValue();
if (Objects.nonNull(nextLevelExp) && nextLevelExp > 0)
if(newExp - nextLevelExp >= 0){
return memberLevelDTO.getLevel();
}
}
return memberDTO.getLevel();
}
private MemberLevelDTO getNextLevelExp(Integer i, Integer status) {
List<MemberLevelDTO> memberLevelDTOList = this.memberLevelService.findLevelAndStatus(i,status);
if (!CollectionUtils.isEmpty(memberLevelDTOList)) {
return memberLevelDTOList.get(0);
}
return null;
}
/**
* 获取当前会员的成长值
* @param memberId 会员id
* @return Long 当前会员成长值
*/
private MemberDTO getMemberInfoByMemberId(Long memberId) {
MemberDTO memberDTO = this.memberOperationService.findById(memberId);
return memberDTO;
}
/**
* 添加成长值记录
*
* @param tempExp 成长值列表
*/
private void doInsertExpDetail(TempExp tempExp, long originalExp, long totalExp) {
// 获得的积分
Long rewardExp = tempExp.getRewardExp();
ExpDetail expDetail = new ExpDetail();
BeanUtils.copyProperties(tempExp,expDetail);
expDetail.setCode(String.valueOf(IdWorker.generator()));
// 原始积分
expDetail.setOriginalExp(originalExp);
// 总积分
expDetail.setResultExp(totalExp);
// 获得的积分
expDetail.setExp(rewardExp);
if (StringUtils.isEmpty(expDetail.getDescription())) {
expDetail.setDescription("#");
}
this.expDetailService.create(expDetail);
}
}
package com.topdraw.business.process.service.impl;
import com.topdraw.business.basicdata.member.domain.Member;
import com.topdraw.business.basicdata.member.service.MemberService;
import com.topdraw.business.basicdata.member.service.dto.MemberDTO;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.process.service.MemberOperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
package com.topdraw.business.process.service.impl;
import com.topdraw.business.basicdata.member.domain.Member;
import com.topdraw.business.basicdata.member.service.MemberService;
import com.topdraw.business.basicdata.member.service.dto.MemberDTO;
import com.topdraw.business.basicdata.points.available.domain.PointsAvailable;
import com.topdraw.business.basicdata.points.available.service.PointsAvailableService;
import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO;
import com.topdraw.business.basicdata.points.detail.detailhistory.service.PointsDetailHistoryService;
import com.topdraw.business.basicdata.points.detail.domain.PointsDetail;
import com.topdraw.business.basicdata.points.detail.service.PointsDetailService;
import com.topdraw.business.basicdata.points.service.PointsService;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.points.available.domain.PointsAvailable;
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.detail.detailhistory.service.PointsDetailHistoryService;
import com.topdraw.business.module.points.detail.domain.PointsDetail;
import com.topdraw.business.module.points.detail.service.PointsDetailService;
import com.topdraw.business.module.points.service.PointsService;
import com.topdraw.business.process.domian.TempPoints;
import com.topdraw.business.process.service.MemberOperationService;
import com.topdraw.business.process.service.PointsOperationService;
......@@ -503,7 +503,7 @@ public class PointsOperationServiceImpl implements PointsOperationService {
member.setId(memberId);
member.setPoints(Objects.nonNull(currentPoints)?currentPoints:0);
member.setDuePoints(duePoints);
member.setUpdateTime(Timestamp.valueOf(LocalDateTime.now()));
member.setUpdateTime(LocalDateTime.now());
member.setCode(tempPoints.getMemberCode());
try {
this.memberOperationService.doUpdateMemberPoints(member);
......
package com.topdraw.business.process.service.impl;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.topdraw.business.module.coupon.service.CouponService;
import com.topdraw.business.module.coupon.service.dto.CouponDTO;
import com.topdraw.business.module.rights.history.domain.RightsHistory;
import com.topdraw.business.module.rights.history.service.RightsHistoryService;
import com.topdraw.business.module.rights.service.RightsService;
import com.topdraw.business.module.rights.service.dto.RightsDTO;
import com.topdraw.business.process.domian.*;
import com.topdraw.business.process.service.CouponOperationService;
import com.topdraw.business.process.service.ExpOperationService;
import com.topdraw.business.process.service.PointsOperationService;
import com.topdraw.business.process.service.RightsOperationService;
import com.topdraw.util.TimestampUtil;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* 权益处理
*
* @author XiangHan
* @date 2021.10.23
*/
@Service
@Slf4j
public class RightsOperationServiceImpl implements RightsOperationService {
private static final Logger LOG = LoggerFactory.getLogger(RightsOperationServiceImpl.class);
@Autowired
RightsHistoryService rightsHistoryService;
@Autowired
CouponOperationService couponOperationService;
@Autowired
RightsService rightsService;
@Autowired
ExpOperationService expOperationService;
@Autowired
PointsOperationService pointsOperationService;
@Autowired
CouponService couponService;
// @Autowired
// ThreadPoolTaskExecutor threadPoolTaskExecutor;
private ExecutorService threadPoolTaskExecutor = Executors.newFixedThreadPool(10);
/**
* 系统手动发放
* 实现步骤:
* 1.当前权益只有实体券
* @param rightsList
*/
@Override
public void grantRightsByManual(List<RightsHistory> rightsList) {
// 1.权益区分
Map<RightType,Object> tempRightsMap = this.distinguishRight(rightsList);
// 2.权益下发
this.refresh(tempRightsMap);
// 3.保存权益历史
this.doInsertTrRightHistory(rightsList);
}
/**
* 权益发放
* @param tempRightsMap 权益类型
*/
@Override
public void grantRights(Map<RightType, Object> tempRightsMap) {
// this.threadPoolTaskExecutor.execute(()-> {
// 2.创建权益历史对象
List<RightsHistory> rightsList = this.getRightHistory(tempRightsMap);
// 3.保存权益历史
this.doInsertTrRightHistory(rightsList);
// });
// 1.权益下发
this.refresh(tempRightsMap);
}
/**
*
* @param tempRightsMap
* @return
*/
private List<RightsHistory> getRightHistory(Map<RightType, Object> tempRightsMap) {
List<TempRights> values = (List<TempRights>)tempRightsMap.get(RightType.RIGHTS);
List<RightsHistory> rightsHistoryList = new ArrayList<>();
values.forEach(value -> {
RightsHistory rightsHistory = new RightsHistory();
rightsHistory.setSendTime(LocalDateTime.now());
rightsHistory.setRightsId(value.getId());
rightsHistory.setMemberId(value.getMemberId());
rightsHistory.setExpireTime(value.getExpireTime());
String memberCode = value.getMemberCode();
rightsHistory.setMemberCode(memberCode);
rightsHistoryList.add(rightsHistory);
});
return rightsHistoryList;
}
/**
* 成长值发放,基于已获得的权益
* @param tempExpList 权益列表
*/
private void grantExp(List<TempExp> tempExpList) {
if (!CollectionUtils.isEmpty(tempExpList))
this.expOperationService.grantPointsThroughTempExp(tempExpList);
}
/**
* 发放积分,基于已获得的权益
*
* @param tempPointsList 权益列表
*/
private void grantPoint(List<TempPoints> tempPointsList) {
if (!CollectionUtils.isEmpty(tempPointsList))
this.pointsOperationService.grantPointsThroughTempRightsList(tempPointsList);
}
/**
* 发放优惠券,基于已获得的权益
*
* @param tempCouponList 优惠券
*/
private void grantCoupon(List<TempCoupon> tempCouponList) {
// 发放优惠券
if (!CollectionUtils.isEmpty(tempCouponList))
this.couponOperationService.grantCouponThroughTempCoupon(tempCouponList);
}
/**
* 权益发放
* @param tempRightsMap
*/
private void refresh(Map<RightType, Object> tempRightsMap) {
/*FutureTask<Map<Long,Long>> futureTask1 = new FutureTask(()->{
log.info(Thread.currentThread().getName() + "=========>> start");
// 积分
this.grantPoint((List<TempPoints>) tempRightsMap.get(RightType.POINTS));
log.info(Thread.currentThread().getName() + "=========>>grantPoint end");
// 成长值
// this.grantExp((List<TempExp>) tempRightsMap.get(RightType.EXP));
// 优惠券
// this.grantCoupon((List<TempCoupon>) tempRightsMap.get(RightType.COUPON));
return null;
});
FutureTask<Map<Long,Long>> futureTask2 = new FutureTask(()->{
// 积分
// this.grantPoint((List<TempPoints>) tempRightsMap.get(RightType.POINTS));
// 成长值
this.grantExp((List<TempExp>) tempRightsMap.get(RightType.EXP));
// 优惠券
// this.grantCoupon((List<TempCoupon>) tempRightsMap.get(RightType.COUPON));
return null;
});
FutureTask<Map<Long,Long>> futureTask3 = new FutureTask(()->{
// 积分
// this.grantPoint((List<TempPoints>) tempRightsMap.get(RightType.POINTS));
// 成长值
// this.grantExp((List<TempExp>) tempRightsMap.get(RightType.EXP));
// 优惠券
this.grantCoupon((List<TempCoupon>) tempRightsMap.get(RightType.COUPON));
return null;
});
this.threadPoolTaskExecutor.execute(futureTask1);
this.threadPoolTaskExecutor.execute(futureTask2);
this.threadPoolTaskExecutor.execute(futureTask3);*/
/*this.threadPoolTaskExecutor.execute(() -> {
// 积分
this.grantPoint((List<TempPoints>) tempRightsMap.get(RightType.POINTS));
// 成长值
this.grantExp((List<TempExp>) tempRightsMap.get(RightType.EXP));
// 优惠券
this.grantCoupon((List<TempCoupon>) tempRightsMap.get(RightType.COUPON));
});*/
/*this.threadPoolTaskExecutor.execute(() -> {
log.info(Thread.currentThread().getName() + "=========>> start");
// 积分
this.grantPoint((List<TempPoints>) tempRightsMap.get(RightType.POINTS));
log.info(Thread.currentThread().getName() + "=========>> end");
});*/
List<TempPoints> tempPointsList = (List<TempPoints>) tempRightsMap.get(RightType.POINTS);
if (!CollectionUtils.isEmpty(tempPointsList)) {
// 积分
this.grantPoint(tempPointsList);
}
List<TempExp> tempExpList = (List<TempExp>) tempRightsMap.get(RightType.EXP);
if (!CollectionUtils.isEmpty(tempExpList)) {
// 成长值
this.grantExp(tempExpList);
}
List<TempCoupon> tempCouponList = (List<TempCoupon>) tempRightsMap.get(RightType.COUPON);
if (!CollectionUtils.isEmpty(tempCouponList)) {
// 优惠券
this.grantCoupon(tempCouponList);
}
}
/**
* 区分权益
* @param rightsList
* @return
*/
private Map<RightType, Object> distinguishRight(List<RightsHistory> rightsList) {
Map<RightType,Object> map = new HashMap<>();
// 优惠券
List<TempCoupon> tempCouponList = new ArrayList<>();
for (RightsHistory right : rightsList) {
Long rightId = right.getRightsId();
Long memberId = right.getMemberId();
Long userId = right.getUserId();
// 权益类型
RightsDTO rightsDTO = this.getRights(rightId);
// 权益的实体类型 1:积分;2成长值;3优惠券
String type = rightsDTO.getEntityType();
Long expireTime = rightsDTO.getExpireTime();
switch (type) {
// 优惠券
case "1":
Long entityId = rightsDTO.getEntityId();
CouponDTO couponDTO = this.findCouponById(entityId);
if (Objects.nonNull(couponDTO)) {
TempCoupon tempCoupon = new TempCoupon();
tempCoupon.setId(couponDTO.getId());
tempCoupon.setMemberId(memberId);
tempCoupon.setUserId(userId);
tempCoupon.setRightsAmount(1);
tempCoupon.setRightsSendStrategy(0);
tempCoupon.setCode(couponDTO.getCode());
if (Objects.nonNull(expireTime))
tempCoupon.setExpireTime(LocalDateTimeUtil.of(expireTime));
tempCouponList.add(tempCoupon);
}
break;
// 观影券
case "2":
break;
// 活动参与机会
case "3":
break;
default:
break;
}
}
// 优惠券
if (!CollectionUtils.isEmpty(tempCouponList))
map.put(RightType.COUPON,tempCouponList);
return map;
}
/**
* 获取优惠券信息
* @param id
* @return
*/
private CouponDTO findCouponById(Long id) {
CouponDTO couponDTO = this.couponService.findById(id);
return couponDTO;
}
/**
* 权益详情
* @param rightsId
* @return
*/
private RightsDTO getRights(Long rightsId) {
RightsDTO rightsDTO = this.rightsService.findById(rightsId);
return rightsDTO;
}
/**
* 添加权益领取记录
* @param rightsHistories
*/
private void doInsertTrRightHistory(List<RightsHistory> rightsHistories) {
if (!CollectionUtils.isEmpty(rightsHistories)) {
for (RightsHistory rightsHistory : rightsHistories) {
Long operatorId = rightsHistory.getOperatorId();
String operatorName = rightsHistory.getOperatorName();
rightsHistory.setSendTime(LocalDateTime.now());
rightsHistory.setOperatorId(Objects.nonNull(operatorId)?operatorId:0);
rightsHistory.setOperatorName(!StringUtils.isEmpty(operatorName)?operatorName:"系统发放");
this.rightsHistoryService.create(rightsHistory);
}
}
}
}
package com.topdraw.business.process.service.mapper;
import com.topdraw.base.BaseMapper;
import com.topdraw.business.module.user.weixin.collection.domain.UserCollectionDetail;
import com.topdraw.business.process.domian.weixin.UserCollectionMq;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface CollectionMq2DetailMapper extends BaseMapper<UserCollectionMq, UserCollectionDetail> {
@Override
@Mappings({
@Mapping(target = "detailImg", source = "images")
})
UserCollectionDetail toEntity(UserCollectionMq dto);
}
package com.topdraw.mq.consumer;
import com.topdraw.config.RabbitMqConfig;
import com.topdraw.mq.domain.DataSyncMsg;
import com.topdraw.mq.domain.TableOperationMsg;
import com.topdraw.resttemplate.RestTemplateClient;
import com.topdraw.util.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
@Component
@Slf4j
......@@ -15,5 +23,37 @@ public class UcEngineEventConsumer {
@Autowired
AutoRoute autoUser;
@Autowired
RestTemplateClient restTemplateClient;
/**
* 事件
* @param content
* @description 基础数据同步
* @author Hongyan Wang
* @date 2021/9/7 11:26 上午
*/
@RabbitHandler
@RabbitListener(bindings = {
@QueueBinding(value = @Queue(value = RabbitMqConfig.UC_ROUTE_KEY_DIRECT_EVENT_BBB),
exchange = @Exchange(value = ExchangeTypes.DIRECT))
}, containerFactory = "serviceRabbitListenerContainerFactory")
public void ucEventConsumer(String content) {
log.info(" receive dataSync msg , content is : {} ", content);
TableOperationMsg tableOperationMsg = this.parseContent(content);
autoUser.route(tableOperationMsg);
log.info("ucEventConsumer ====>>>> end");
}
/**
* 数据解析
* @param content
* @return
*/
private TableOperationMsg parseContent(String content) {
TableOperationMsg tableOperationMsg = JSONUtil.parseMsg2Object(content,TableOperationMsg.class);
Assert.notNull(tableOperationMsg,"ERROR -->> operationConsumer -->> parseContent -->> 【dataSyncMsg】 not be null !!");
return tableOperationMsg;
}
}
......
......@@ -32,7 +32,7 @@ public class UcGatewayEventConsumer {
@RabbitListener(bindings = {
@QueueBinding(value = @Queue(value = RabbitMqConfig.UC_ROUTE_KEY_DIRECT_EVENT_AAA),
exchange = @Exchange(value = ExchangeTypes.DIRECT))
}, containerFactory = "serviceRabbitListenerContainerFactory")
}, containerFactory = "managementRabbitListenerContainerFactory")
public void ucEventConsumer(String content) {
log.info(" receive dataSync msg , content is : {} ", content);
DataSyncMsg dataSyncMsg = this.parseContent(content);
......
......@@ -201,15 +201,21 @@ public class WeiXinEventConsumer {
JSONObject map = jsonObject.getJSONObject("appIdMap");
JSONObject wechatMsg = jsonObject.getJSONObject("allFieldsMap");
String appid = map.getString("mpId");
String unionid = map.getString("unionid");
// Map<String, String> wxInfoMap = WeixinUtil.getWeixinInfoByAppid(appid);
String openid = wechatMsg.getString("FromUserName");
String msgType = wechatMsg.getString("MsgType");
if ("event".equals(msgType)) {
String event = wechatMsg.getString("Event");
log.info("event ===>> [{}]",event);
String eventKey = wechatMsg.getString("EventKey");
SubscribeBean subscribeBean = new SubscribeBean(openid,appid,eventKey);
SubscribeBean subscribeBean = new SubscribeBean();
subscribeBean.setAppId(appid);
subscribeBean.setOpenId(openid);
subscribeBean.setUnionid(unionid);
subscribeBean.setEventKey(eventKey);
if (event.equals("subscribe"))
this.restTemplateClient.subscribe(subscribeBean);
......
......@@ -46,6 +46,7 @@ public class DataSyncMsg implements Serializable {
private Integer deviceType; //设备类型 1:大屏;2:小屏(微信)3.小屏(xx)
@NotNull
private String appCode; //用户对应的应用code
private String memberCode;
private Long accountId; // 账号id
private Long orderId;
private Long activityId;
......
......@@ -15,7 +15,11 @@ public class SubscribeBean {
/** */
private String appId;
private String unionid;
/** */
private String eventKey;
}
......
......@@ -2,9 +2,7 @@ package com.topdraw.resttemplate;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.business.basicdata.member.address.domain.MemberAddress;
import com.topdraw.business.basicdata.member.domain.Member;
import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo;
import com.topdraw.business.module.member.address.domain.MemberAddress;
import com.topdraw.mq.domain.DataSyncMsg;
import com.topdraw.mq.domain.SubscribeBean;
import lombok.extern.slf4j.Slf4j;
......@@ -17,7 +15,6 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@Component
......@@ -111,8 +108,9 @@ public class RestTemplateClient {
String url = BASE_URL + "/ucEngine/api/userOperation/subscribe";
String content = JSON.toJSONString(subscribeBean);
HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
HashMap<String, String> objectObjectHashMap = new HashMap<>();
objectObjectHashMap.put("content", content);
log.info("objectObjectHashMap ===>> [{}]",objectObjectHashMap);
restTemplate.postForEntity(url, objectObjectHashMap, String.class);
/*ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, subscribeBean, String.class);
String entityBody = "";
......
package com.topdraw.util;
public class WeChatConstants {
public static String HTTPS_AUTHORIZE_WITH_SNSAPI_USERINFO = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
public static final String HTTPS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token";
public static final String HTTPS_TICKET_GETTICKET = "https://api.weixin.qq.com/cgi-bin/ticket/getticket";
public static final String HTTPS_SNS_OAUTH2_ACCESS_TOKEN = "https://api.weixin.qq.com/sns/oauth2/access_token";
public static final String HTTPS_SNS_USERINFO = "https://api.weixin.qq.com/sns/userinfo";
public static final String CODE2SESSION = "https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code";
/**
* 把媒体文件上传到微信服务器。目前仅支持图片。用于发送客服消息或被动回复用户消息。
*/
public static String UPLOAD_URL = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token={0}&type=image";
/**
* 获取客服消息内的临时素材。即下载临时的多媒体文件。
*/
public static String GET_MEDIA = "https://api.weixin.qq.com/cgi-bin/media/get?access_token={0}&media_id={1}";
/**
* 用于向微信服务端申请二维码的url
*/
public static String URL_QR_CODE = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={0}";
/**
* 用于聊天时向用户发送消息的url
*/
public static String CUSTOM_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}";
/**
* 发送小程序订阅消息
*/
public static final String SUBSCRIBE_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token={0}";
/**
* 生成带参数二维码
*/
public static final String QR_CODE_URL = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={0}";
/**
* 获取用户基本信息
*/
public static final String GET_USER_INFO = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={0}&openid={1}&lang=zh_CN";
// 批量获取关注者列表
public static final String GET_USER_LIST = "https://api.weixin.qq.com/cgi-bin/user/get?access_token={0}&next_openid={1}";
/**
* 成功
*/
public static String SUCCESS = "SUCCESS";
/**
* 微信系统错误
*/
public static String SYSTEMERROR = "SYSTEMERROR";
/**
* 失败 (注意:微信有的接口返回的失败用FAIL字符串表示,有的接口用FAILED表示)
*/
public static String FAIL = "FAIL";
/**
* 微信企业付款到个人失败 (注意:微信有的接口返回的失败用FAIL字符串表示,有的接口用FAILED表示)
*/
public static String FAILED = "FAILED";
public static String ACCESS_TOKEN = "access_token";
public static String ERR_CODE = "errcode";
/**
* 微信请求时,返回ACCESS_TOKEN错误码
*/
public static final String ACCESS_TOKEN_INVALID_CODE = "40001";
/**
* 文本消息
*/
public static String MSG_TYPE_TEXT = "text";
public static String MSG_TYPE_MINIPROGRAMPAGE = "miniprogrampage";
public static String MSG_TYPE_LINK = "link";
public static String MSG_TYPE_IMAGE = "image";
/**
* 事件消息
*/
public static String MSG_TYPE_EVENT = "event";
/**
* 二维码类型,临时的整型参数值
*/
public static String QR_SCENE = "QR_SCENE";
/**
* 二维码类型,临时的字符串参数值
*/
public static String QR_STR_SCENE = "QR_STR_SCENE";
/**
* 二维码类型,永久的整型参数值
*/
public static String QR_LIMIT_SCENE = "QR_LIMIT_SCENE";
/**
* 二维码类型,永久的字符串参数值
*/
public static String QR_LIMIT_STR_SCENE = "QR_LIMIT_STR_SCENE";
/******** 事件推送事件类型BEGIN********/
/**
* 取消订阅
*/
public static final String EVENT_UNSUBSCRIBE = "unsubscribe";
/**
* 订阅
*/
public static final String EVENT_SUBSCRIBE = "subscribe";
/**
* 扫描带参数二维码事件,用户已关注时的事件推送
*/
public static final String EVENT_SCAN = "SCAN";
/**
* 上报地理位置事件
*/
public static final String EVENT_LOCATION = "LOCATION";
/**
* 自定义菜单事件
*/
public static final String EVENT_CLICK = "CLICK";
/******** 事件推送事件类型END********/
/**
* 微信ACCESS_TOKEN缓存KEY
*/
public static final String TOKEN_KEY = "GLOBAL_WX_ACCESS_TOKEN_";
/**
* 微信临时素材缓存KEY
*/
public static final String WEIXIN_MEDIA_KEY = "WEIXIN_MEDIA_KEY_";
// 微信应用类型 小程序 服务号 订阅号
// 小程序
public static final String WX_APPLET = "applet";
// 服务号
public static final String WX_SERVICE = "service";
// 订阅号
public static final String WX_SUBSCRIPTION = "subscription";
}
......@@ -2,11 +2,11 @@ spring:
# 数据源
datasource:
# 数据源地址
url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
url: jdbc:log4jdbc:mysql://139.196.192.242:3306/tj_user_0819?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
# 用户名
username: root
# 密码
password: root
password: Tjlh@2017
# 驱动程序
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# Druid
......@@ -68,15 +68,12 @@ spring:
# redis
redis:
# 数据库索引
#数据库索引
database: 0
# ip
host: 122.112.214.149
# 密码是
password: redis123
# 端口
port: 6379
# 连接超时时间
password: redis123
#连接超时时间
timeout: 5000
# rabbitmq
......@@ -108,16 +105,22 @@ swagger:
mutil-mq:
# 服务侧
service:
# ip
host: 139.196.192.242
# 端口
port: 5672
# 用户名
username: member_center
# 密码
password: Tjlh@2021
# 虚拟空间
virtual-host: /member_center
# # ip
# host: 139.196.192.242
# # 端口
# port: 5672
# # 用户名
# username: member_center
# # 密码
# password: Tjlh@2021
# # 虚拟空间
# virtual-host: /member_center
host: 122.112.214.149 # rabbitmq的连接地址
port: 5672 # rabbitmq的连接端口号
virtual-host: member_center # rabbitmq的虚拟hosthhh
username: guest # rabbitmq的用户名
password: guest # rabbitmq的密码
publisher-confirms: true #如果对异步消息需要回调必须设置为true
# 管理侧
management:
......@@ -140,7 +143,7 @@ mutil-mq:
# 密码
password: Topdraw1qaz
# 虚拟空间
virtual-host: /member_center
virtual-host: member_center
#登录图形验证码有效时间/分钟
loginCode:
......