15 Коміти 63763ce4c8 ... 8f2ab5a5c1

Автор SHA1 Опис Дата
  songfuqiang 8f2ab5a5c1 Merge branch 'develop' 1 рік тому
  songfuqiang 618387e126 用户模块 登录密码错误异常处理优化 1 рік тому
  songfuqiang c0987969fe 架构模块 完善用户未注册异常捕获,增加用户未注册异常、用户名账号密码错误异常处理 1 рік тому
  songfuqiang 8da8a63f1a 广告模块 语言返回 1 рік тому
  songfuqiang c8b45278ca 广告模块 去掉版本号返回 1 рік тому
  songfuqiang e0eaac4ad3 广告模块 补充远程弹窗控制逻辑 1 рік тому
  songfuqiang 2dbecea011 广告模块 增加广告接口 1 рік тому
  songfuqiang 38c8263506 日志模块 测试环境增加日志输出到文件 1 рік тому
  songfuqiang 1daaadc2c1 用户模块 修复微信登录判断逻辑 1 рік тому
  songfuqiang 018fd895f5 用户模块 修复QQ登录判断逻辑,增加超过登录设备数异常701 1 рік тому
  songfuqiang ece5373e74 用户模块 用户注销逻辑,退回redisson版本为3.11.3;注销后的账户再次注册不再送券 1 рік тому
  songfuqiang bd6a79a28a 用户模块 用户注销逻辑(待补充增加注销用户记录),修改cancelMember实体类 1 рік тому
  songfuqiang 49726b0309 用户模块 用户注销逻辑(待补充增加注销用户记录),优化获取第三方账号日志打印 1 рік тому
  songfuqiang 0d86fe5ece 架构模块 升级redisson版本至3.17.6 1 рік тому
  songfuqiang 6d295ed085 用户模块 增加注销用户表实体操作类 1 рік тому
36 змінених файлів з 1834 додано та 69 видалено
  1. 5 0
      backend-common/src/main/java/constant/CommonConstant.java
  2. 23 0
      backend-common/src/main/java/exception/TooManyDeviceException.java
  3. 26 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/config/ControllerExceptionHandler.java
  4. 24 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/constant/ProviderConstant.java
  5. 11 1
      backend-core/src/main/java/cn/kdan/pdf/backend/core/controller/AdvertisementController.java
  6. 3 3
      backend-core/src/main/java/cn/kdan/pdf/backend/core/controller/MembersController.java
  7. 15 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/enums/LanguageEnum.java
  8. 33 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/mapper/CancelMemberMapper.java
  9. 184 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/model/CancelMember.java
  10. 771 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/model/CancelMemberExample.java
  11. 84 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/params/AddAdvertisementParam.java
  12. 3 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/params/BindAccountParam.java
  13. 82 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/pojo/AdvertisementVo.java
  14. 7 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/AdvertisementService.java
  15. 5 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/AvatarService.java
  16. 24 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/CancelMemberService.java
  17. 1 1
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/MemberService.java
  18. 6 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/MissionFilesService.java
  19. 6 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/MissionService.java
  20. 6 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/SubscriptionService.java
  21. 33 3
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/AdvertisementServiceImpl.java
  22. 11 5
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/AuthServiceImpl.java
  23. 17 3
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/AvatarServiceImpl.java
  24. 80 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/CancelMemberServiceImpl.java
  25. 2 8
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/DeviceServiceImpl.java
  26. 59 13
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/MemberServiceImpl.java
  27. 6 1
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/MissionFileServiceImpl.java
  28. 6 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/MissionServiceImpl.java
  29. 0 8
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/SocialAccountServiceImpl.java
  30. 12 0
      backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/SubscriptionServiceImpl.java
  31. 3 7
      backend-core/src/main/java/cn/kdan/pdf/backend/core/utils/TencentUtils.java
  32. 4 3
      backend-core/src/main/java/cn/kdan/pdf/backend/core/utils/WechatUtils.java
  33. 1 1
      backend-core/src/main/resources/application.yml
  34. 5 4
      backend-core/src/main/resources/generatorConfig.xml
  35. 4 8
      backend-core/src/main/resources/logback-spring.xml
  36. 272 0
      backend-core/src/main/resources/sqlmap/CancelMemberMapper.xml

+ 5 - 0
backend-common/src/main/java/constant/CommonConstant.java

@@ -74,6 +74,11 @@ public interface CommonConstant {
     int EXCEPTION_CODE_RUNTIME_ERROR = 700;
     String EXCEPTION_MSG_RUNTIME_ERROR = "运行时错误";
 
+    /**
+     * 设备数超出登录台数
+     */
+    int EXCEPTION_CODE_TOO_MANY_DEVICE_ERROR = 701;
+
     /**
      * 用户登录错误状态
      */

+ 23 - 0
backend-common/src/main/java/exception/TooManyDeviceException.java

@@ -0,0 +1,23 @@
+package exception;
+
+/**
+ * @author tangxiangan
+ */
+public class TooManyDeviceException extends RuntimeException {
+    public TooManyDeviceException() {
+        super();
+    }
+
+    public TooManyDeviceException(String message) {
+        super(message);
+    }
+
+    public TooManyDeviceException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public TooManyDeviceException(Throwable cause) {
+        super(cause);
+    }
+
+}

+ 26 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/config/ControllerExceptionHandler.java

@@ -2,9 +2,12 @@ package cn.kdan.pdf.backend.core.config;
 
 import constant.CommonConstant;
 import exception.BackendRuntimeException;
+import exception.TooManyDeviceException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.support.DefaultMessageSourceResolvable;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.FieldError;
 import org.springframework.web.bind.MethodArgumentNotValidException;
@@ -19,6 +22,9 @@ import javax.validation.ConstraintViolationException;
 import java.util.List;
 import java.util.stream.Collectors;
 
+import static cn.kdan.pdf.backend.core.constant.AuthConstant.EXCEPTION_CODE_USER_NOT_FOUND;
+import static cn.kdan.pdf.backend.core.constant.AuthConstant.EXCEPTION_CODE_USER_PASSWORD_ERROR;
+
 /**
  * @author tangxiangan
  */
@@ -42,6 +48,12 @@ public class ControllerExceptionHandler {
         return new ResultMap<>(CommonConstant.EXCEPTION_CODE_RUNTIME_ERROR, e.getMessage());
     }
 
+    @ExceptionHandler(TooManyDeviceException.class)
+    @ResponseBody
+    public ResultMap<?> handlerDevOpsTooManyDeviceException(TooManyDeviceException e) {
+        return new ResultMap<>(CommonConstant.EXCEPTION_CODE_TOO_MANY_DEVICE_ERROR, e.getMessage());
+    }
+
     @ExceptionHandler(ConstraintViolationException.class)
     @ResponseBody
     public ResultMap<?> handlerConstraintViolationException(ConstraintViolationException e) {
@@ -64,4 +76,18 @@ public class ControllerExceptionHandler {
         return new ResultMap<>(CommonConstant.EXCEPTION_CODE_SERVER_ERROR, "参数错误: " + e.getParameterName() + " 缺失");
     }
 
+    @ExceptionHandler(UsernameNotFoundException.class)
+    @ResponseBody
+    public ResultMap<?> handlerUsernameNotFoundException(UsernameNotFoundException e) {
+        logger.info(e.getMessage(), e);
+        return new ResultMap<>(EXCEPTION_CODE_USER_NOT_FOUND, "错误信息: " + e.getMessage());
+    }
+
+    @ExceptionHandler(BadCredentialsException.class)
+    @ResponseBody
+    public ResultMap<?> handlerBadCredentialsException(BadCredentialsException e) {
+        logger.info(e.getMessage(), e);
+        return new ResultMap<>(EXCEPTION_CODE_USER_PASSWORD_ERROR, "错误信息: " + e.getMessage());
+    }
+
 }

+ 24 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/constant/ProviderConstant.java

@@ -0,0 +1,24 @@
+package cn.kdan.pdf.backend.core.constant;
+
+/**
+ * @author tangxiangan
+ */
+public interface ProviderConstant {
+    /**
+     * 手机号
+     */
+    public static final String PHONE = "phone";
+    /**
+     * 邮箱
+     */
+    public static final String EMAIL = "email";
+    /**
+     * QQ
+     */
+    public static final String TENCENT = "tencent";
+    /**
+     * 微信
+     */
+    public static final String WECHAT = "wechat";
+
+}

+ 11 - 1
backend-core/src/main/java/cn/kdan/pdf/backend/core/controller/AdvertisementController.java

@@ -1,12 +1,12 @@
 package cn.kdan.pdf.backend.core.controller;
 
+import cn.kdan.pdf.backend.core.params.AddAdvertisementParam;
 import cn.kdan.pdf.backend.core.params.QueryAdvertisementParam;
 import cn.kdan.pdf.backend.core.pojo.app.AdvertisementVo;
 import cn.kdan.pdf.backend.core.service.AdvertisementService;
 import constant.CommonConstant;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import pojo.AppRequestParam;
 import pojo.AppResultMap;
 
 import java.util.List;
@@ -33,4 +33,14 @@ public class AdvertisementController {
         return new AppResultMap<>(CommonConstant.SUCCESS,CommonConstant.CODE_SUCCESS,advertisementService.list(param));
     }
 
+    /**
+     * 增加广告/活动
+     * @param param 参数
+     * @return 成功与否
+     */
+    @PostMapping("/add")
+    public AppResultMap<String> add(@RequestBody AddAdvertisementParam param){
+        return new AppResultMap<>(CommonConstant.SUCCESS,CommonConstant.CODE_SUCCESS,advertisementService.add(param));
+    }
+
 }

+ 3 - 3
backend-core/src/main/java/cn/kdan/pdf/backend/core/controller/MembersController.java

@@ -149,9 +149,9 @@ public class MembersController {
      * @return 提示信息
      */
     @GetMapping("/cancelAccount")
-    public AppResultMap<String> cancelAccount(){
-        String memberid = memberService.cancelAccount();
-        return new AppResultMap<>(CommonConstant.SUCCESS,CommonConstant.CODE_SUCCESS,"注销账号成功");
+    public AppResultMap<String> cancelAccount(@RequestParam String cancelReason){
+        String memberId = memberService.cancelAccount(cancelReason);
+        return new AppResultMap<>(CommonConstant.SUCCESS,CommonConstant.CODE_SUCCESS,"用户" + memberId + "注销账号成功");
     }
 
     /**

+ 15 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/enums/LanguageEnum.java

@@ -42,4 +42,19 @@ public enum LanguageEnum {
         return value;
     }
 
+    /**
+     * 通过code获取语言枚举
+     * @param value
+     * @return
+     */
+    public static LanguageEnum getLanguageByCode(Integer value){
+        LanguageEnum language = ZH_CN;
+        for (LanguageEnum languageEnum : LanguageEnum.values()) {
+            if(languageEnum.getValue().equals(value)){
+                language = languageEnum;
+            }
+        }
+        return language;
+    }
+
 }

+ 33 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/mapper/CancelMemberMapper.java

@@ -0,0 +1,33 @@
+package cn.kdan.pdf.backend.core.mapper;
+
+import cn.kdan.pdf.backend.core.model.CancelMember;
+import cn.kdan.pdf.backend.core.model.CancelMemberExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.session.RowBounds;
+
+public interface CancelMemberMapper {
+    long countByExample(CancelMemberExample example);
+
+    int deleteByExample(CancelMemberExample example);
+
+    int deleteByPrimaryKey(String id);
+
+    int insert(CancelMember record);
+
+    int insertSelective(CancelMember record);
+
+    List<CancelMember> selectByExampleWithRowbounds(CancelMemberExample example, RowBounds rowBounds);
+
+    List<CancelMember> selectByExample(CancelMemberExample example);
+
+    CancelMember selectByPrimaryKey(String id);
+
+    int updateByExampleSelective(@Param("record") CancelMember record, @Param("example") CancelMemberExample example);
+
+    int updateByExample(@Param("record") CancelMember record, @Param("example") CancelMemberExample example);
+
+    int updateByPrimaryKeySelective(CancelMember record);
+
+    int updateByPrimaryKey(CancelMember record);
+}

+ 184 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/model/CancelMember.java

@@ -0,0 +1,184 @@
+package cn.kdan.pdf.backend.core.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class CancelMember implements Serializable {
+    private String id;
+
+    private String phone;
+
+    private String email;
+
+    private String tencent;
+
+    private String wechat;
+
+    private String cancelReason;
+
+    private Date createdAt;
+
+    private Date updatedAt;
+
+    private static final long serialVersionUID = 1L;
+
+    public String getId() {
+        return id;
+    }
+
+    public CancelMember withId(String id) {
+        this.setId(id);
+        return this;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public CancelMember withPhone(String phone) {
+        this.setPhone(phone);
+        return this;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public CancelMember withEmail(String email) {
+        this.setEmail(email);
+        return this;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getTencent() {
+        return tencent;
+    }
+
+    public CancelMember withTencent(String tencent) {
+        this.setTencent(tencent);
+        return this;
+    }
+
+    public void setTencent(String tencent) {
+        this.tencent = tencent;
+    }
+
+    public String getWechat() {
+        return wechat;
+    }
+
+    public CancelMember withWechat(String wechat) {
+        this.setWechat(wechat);
+        return this;
+    }
+
+    public void setWechat(String wechat) {
+        this.wechat = wechat;
+    }
+
+    public String getCancelReason() {
+        return cancelReason;
+    }
+
+    public CancelMember withCancelReason(String cancelReason) {
+        this.setCancelReason(cancelReason);
+        return this;
+    }
+
+    public void setCancelReason(String cancelReason) {
+        this.cancelReason = cancelReason;
+    }
+
+    public Date getCreatedAt() {
+        return createdAt;
+    }
+
+    public CancelMember withCreatedAt(Date createdAt) {
+        this.setCreatedAt(createdAt);
+        return this;
+    }
+
+    public void setCreatedAt(Date createdAt) {
+        this.createdAt = createdAt;
+    }
+
+    public Date getUpdatedAt() {
+        return updatedAt;
+    }
+
+    public CancelMember withUpdatedAt(Date updatedAt) {
+        this.setUpdatedAt(updatedAt);
+        return this;
+    }
+
+    public void setUpdatedAt(Date updatedAt) {
+        this.updatedAt = updatedAt;
+    }
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        CancelMember other = (CancelMember) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone()))
+            && (this.getEmail() == null ? other.getEmail() == null : this.getEmail().equals(other.getEmail()))
+            && (this.getTencent() == null ? other.getTencent() == null : this.getTencent().equals(other.getTencent()))
+            && (this.getWechat() == null ? other.getWechat() == null : this.getWechat().equals(other.getWechat()))
+            && (this.getCancelReason() == null ? other.getCancelReason() == null : this.getCancelReason().equals(other.getCancelReason()))
+            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
+            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode());
+        result = prime * result + ((getEmail() == null) ? 0 : getEmail().hashCode());
+        result = prime * result + ((getTencent() == null) ? 0 : getTencent().hashCode());
+        result = prime * result + ((getWechat() == null) ? 0 : getWechat().hashCode());
+        result = prime * result + ((getCancelReason() == null) ? 0 : getCancelReason().hashCode());
+        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
+        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", phone=").append(phone);
+        sb.append(", email=").append(email);
+        sb.append(", tencent=").append(tencent);
+        sb.append(", wechat=").append(wechat);
+        sb.append(", cancelReason=").append(cancelReason);
+        sb.append(", createdAt=").append(createdAt);
+        sb.append(", updatedAt=").append(updatedAt);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 771 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/model/CancelMemberExample.java

@@ -0,0 +1,771 @@
+package cn.kdan.pdf.backend.core.model;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class CancelMemberExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    public CancelMemberExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(String value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(String value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(String value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(String value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(String value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(String value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLike(String value) {
+            addCriterion("id like", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotLike(String value) {
+            addCriterion("id not like", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<String> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<String> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(String value1, String value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(String value1, String value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneIsNull() {
+            addCriterion("phone is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneIsNotNull() {
+            addCriterion("phone is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneEqualTo(String value) {
+            addCriterion("phone =", value, "phone");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneNotEqualTo(String value) {
+            addCriterion("phone <>", value, "phone");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneGreaterThan(String value) {
+            addCriterion("phone >", value, "phone");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneGreaterThanOrEqualTo(String value) {
+            addCriterion("phone >=", value, "phone");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneLessThan(String value) {
+            addCriterion("phone <", value, "phone");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneLessThanOrEqualTo(String value) {
+            addCriterion("phone <=", value, "phone");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneLike(String value) {
+            addCriterion("phone like", value, "phone");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneNotLike(String value) {
+            addCriterion("phone not like", value, "phone");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneIn(List<String> values) {
+            addCriterion("phone in", values, "phone");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneNotIn(List<String> values) {
+            addCriterion("phone not in", values, "phone");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneBetween(String value1, String value2) {
+            addCriterion("phone between", value1, value2, "phone");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneNotBetween(String value1, String value2) {
+            addCriterion("phone not between", value1, value2, "phone");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailIsNull() {
+            addCriterion("email is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailIsNotNull() {
+            addCriterion("email is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailEqualTo(String value) {
+            addCriterion("email =", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailNotEqualTo(String value) {
+            addCriterion("email <>", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailGreaterThan(String value) {
+            addCriterion("email >", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailGreaterThanOrEqualTo(String value) {
+            addCriterion("email >=", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailLessThan(String value) {
+            addCriterion("email <", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailLessThanOrEqualTo(String value) {
+            addCriterion("email <=", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailLike(String value) {
+            addCriterion("email like", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailNotLike(String value) {
+            addCriterion("email not like", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailIn(List<String> values) {
+            addCriterion("email in", values, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailNotIn(List<String> values) {
+            addCriterion("email not in", values, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailBetween(String value1, String value2) {
+            addCriterion("email between", value1, value2, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailNotBetween(String value1, String value2) {
+            addCriterion("email not between", value1, value2, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentIsNull() {
+            addCriterion("tencent is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentIsNotNull() {
+            addCriterion("tencent is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentEqualTo(String value) {
+            addCriterion("tencent =", value, "tencent");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentNotEqualTo(String value) {
+            addCriterion("tencent <>", value, "tencent");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentGreaterThan(String value) {
+            addCriterion("tencent >", value, "tencent");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentGreaterThanOrEqualTo(String value) {
+            addCriterion("tencent >=", value, "tencent");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentLessThan(String value) {
+            addCriterion("tencent <", value, "tencent");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentLessThanOrEqualTo(String value) {
+            addCriterion("tencent <=", value, "tencent");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentLike(String value) {
+            addCriterion("tencent like", value, "tencent");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentNotLike(String value) {
+            addCriterion("tencent not like", value, "tencent");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentIn(List<String> values) {
+            addCriterion("tencent in", values, "tencent");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentNotIn(List<String> values) {
+            addCriterion("tencent not in", values, "tencent");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentBetween(String value1, String value2) {
+            addCriterion("tencent between", value1, value2, "tencent");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentNotBetween(String value1, String value2) {
+            addCriterion("tencent not between", value1, value2, "tencent");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatIsNull() {
+            addCriterion("wechat is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatIsNotNull() {
+            addCriterion("wechat is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatEqualTo(String value) {
+            addCriterion("wechat =", value, "wechat");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatNotEqualTo(String value) {
+            addCriterion("wechat <>", value, "wechat");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatGreaterThan(String value) {
+            addCriterion("wechat >", value, "wechat");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatGreaterThanOrEqualTo(String value) {
+            addCriterion("wechat >=", value, "wechat");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatLessThan(String value) {
+            addCriterion("wechat <", value, "wechat");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatLessThanOrEqualTo(String value) {
+            addCriterion("wechat <=", value, "wechat");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatLike(String value) {
+            addCriterion("wechat like", value, "wechat");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatNotLike(String value) {
+            addCriterion("wechat not like", value, "wechat");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatIn(List<String> values) {
+            addCriterion("wechat in", values, "wechat");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatNotIn(List<String> values) {
+            addCriterion("wechat not in", values, "wechat");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatBetween(String value1, String value2) {
+            addCriterion("wechat between", value1, value2, "wechat");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatNotBetween(String value1, String value2) {
+            addCriterion("wechat not between", value1, value2, "wechat");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonIsNull() {
+            addCriterion("cancel_reason is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonIsNotNull() {
+            addCriterion("cancel_reason is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonEqualTo(String value) {
+            addCriterion("cancel_reason =", value, "cancelReason");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonNotEqualTo(String value) {
+            addCriterion("cancel_reason <>", value, "cancelReason");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonGreaterThan(String value) {
+            addCriterion("cancel_reason >", value, "cancelReason");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonGreaterThanOrEqualTo(String value) {
+            addCriterion("cancel_reason >=", value, "cancelReason");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonLessThan(String value) {
+            addCriterion("cancel_reason <", value, "cancelReason");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonLessThanOrEqualTo(String value) {
+            addCriterion("cancel_reason <=", value, "cancelReason");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonLike(String value) {
+            addCriterion("cancel_reason like", value, "cancelReason");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonNotLike(String value) {
+            addCriterion("cancel_reason not like", value, "cancelReason");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonIn(List<String> values) {
+            addCriterion("cancel_reason in", values, "cancelReason");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonNotIn(List<String> values) {
+            addCriterion("cancel_reason not in", values, "cancelReason");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonBetween(String value1, String value2) {
+            addCriterion("cancel_reason between", value1, value2, "cancelReason");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonNotBetween(String value1, String value2) {
+            addCriterion("cancel_reason not between", value1, value2, "cancelReason");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedAtIsNull() {
+            addCriterion("created_at is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedAtIsNotNull() {
+            addCriterion("created_at is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedAtEqualTo(Date value) {
+            addCriterion("created_at =", value, "createdAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedAtNotEqualTo(Date value) {
+            addCriterion("created_at <>", value, "createdAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedAtGreaterThan(Date value) {
+            addCriterion("created_at >", value, "createdAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) {
+            addCriterion("created_at >=", value, "createdAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedAtLessThan(Date value) {
+            addCriterion("created_at <", value, "createdAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedAtLessThanOrEqualTo(Date value) {
+            addCriterion("created_at <=", value, "createdAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedAtIn(List<Date> values) {
+            addCriterion("created_at in", values, "createdAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedAtNotIn(List<Date> values) {
+            addCriterion("created_at not in", values, "createdAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedAtBetween(Date value1, Date value2) {
+            addCriterion("created_at between", value1, value2, "createdAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedAtNotBetween(Date value1, Date value2) {
+            addCriterion("created_at not between", value1, value2, "createdAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatedAtIsNull() {
+            addCriterion("updated_at is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatedAtIsNotNull() {
+            addCriterion("updated_at is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatedAtEqualTo(Date value) {
+            addCriterion("updated_at =", value, "updatedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatedAtNotEqualTo(Date value) {
+            addCriterion("updated_at <>", value, "updatedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatedAtGreaterThan(Date value) {
+            addCriterion("updated_at >", value, "updatedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) {
+            addCriterion("updated_at >=", value, "updatedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatedAtLessThan(Date value) {
+            addCriterion("updated_at <", value, "updatedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatedAtLessThanOrEqualTo(Date value) {
+            addCriterion("updated_at <=", value, "updatedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatedAtIn(List<Date> values) {
+            addCriterion("updated_at in", values, "updatedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatedAtNotIn(List<Date> values) {
+            addCriterion("updated_at not in", values, "updatedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatedAtBetween(Date value1, Date value2) {
+            addCriterion("updated_at between", value1, value2, "updatedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatedAtNotBetween(Date value1, Date value2) {
+            addCriterion("updated_at not between", value1, value2, "updatedAt");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLikeInsensitive(String value) {
+            addCriterion("upper(id) like", value.toUpperCase(), "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andPhoneLikeInsensitive(String value) {
+            addCriterion("upper(phone) like", value.toUpperCase(), "phone");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailLikeInsensitive(String value) {
+            addCriterion("upper(email) like", value.toUpperCase(), "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andTencentLikeInsensitive(String value) {
+            addCriterion("upper(tencent) like", value.toUpperCase(), "tencent");
+            return (Criteria) this;
+        }
+
+        public Criteria andWechatLikeInsensitive(String value) {
+            addCriterion("upper(wechat) like", value.toUpperCase(), "wechat");
+            return (Criteria) this;
+        }
+
+        public Criteria andCancelReasonLikeInsensitive(String value) {
+            addCriterion("upper(cancel_reason) like", value.toUpperCase(), "cancelReason");
+            return (Criteria) this;
+        }
+    }
+
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 84 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/params/AddAdvertisementParam.java

@@ -0,0 +1,84 @@
+package cn.kdan.pdf.backend.core.params;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author sfq
+ * @description
+ */
+@Data
+public class AddAdvertisementParam {
+
+    /**
+     * 名称
+     */
+    private String slug;
+
+    /**
+     * 标题
+     */
+    private String title;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 图片
+     */
+    private String image;
+
+    /**
+     * 尺寸
+     */
+    private String dimension;
+
+    /**
+     * 链接文案
+     */
+    private String linkText;
+
+    /**
+     * 链接地址
+     */
+    private String linkUrl;
+
+    /**
+     * 语言
+     */
+    private String language;
+
+    /**
+     * 开始日期
+     */
+    private Date startDate;
+
+    /**
+     * 结束日期
+     */
+    private Date endDate;
+
+    /**
+     * 展示类型
+     */
+    private String displayType;
+
+    /**
+     * 开始时间
+     */
+    private String startHour;
+
+    /**
+     * 结束时间
+     */
+    private String endHour;
+
+    /**
+     * 额外信息
+     */
+    private String extraInfo;
+
+}

+ 3 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/params/BindAccountParam.java

@@ -18,6 +18,9 @@ public class BindAccountParam {
 
     private String openid;
 
+    /**
+     * 绑定类型:wechat、tencent、phone
+     */
     private String provider;
 
     private String phone;

+ 82 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/pojo/AdvertisementVo.java

@@ -0,0 +1,82 @@
+package cn.kdan.pdf.backend.core.pojo;
+
+import lombok.Data;
+
+/**
+ * @author sfq
+ * @description
+ */
+@Data
+public class AdvertisementVo {
+
+    /**
+     * 名称
+     */
+    private String slug;
+
+    /**
+     * 标题
+     */
+    private String title;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 图片
+     */
+    private String image;
+
+    /**
+     * 尺寸
+     */
+    private String dimension;
+
+    /**
+     * 链接文案
+     */
+    private String linkText;
+
+    /**
+     * 链接地址
+     */
+    private String linkUrl;
+
+    /**
+     * 语言
+     */
+    private String language;
+
+    /**
+     * 开始日期
+     */
+    private String startDate;
+
+    /**
+     * 结束日期
+     */
+    private String endDate;
+
+    /**
+     * 展示类型
+     */
+    private String displayType;
+
+    /**
+     * 开始时间
+     */
+    private String startHour;
+
+    /**
+     * 结束时间
+     */
+    private String endHour;
+
+    /**
+     * 额外信息
+     */
+    private String extraInfo;
+
+}

+ 7 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/AdvertisementService.java

@@ -1,5 +1,6 @@
 package cn.kdan.pdf.backend.core.service;
 
+import cn.kdan.pdf.backend.core.params.AddAdvertisementParam;
 import cn.kdan.pdf.backend.core.params.QueryAdvertisementParam;
 import cn.kdan.pdf.backend.core.pojo.app.AdvertisementVo;
 
@@ -18,4 +19,10 @@ public interface AdvertisementService {
      */
     List<AdvertisementVo> list(QueryAdvertisementParam param);
 
+    /**
+     * 增加广告/活动数据
+     * @param param 参数
+     * @return
+     */
+    String add(AddAdvertisementParam param);
 }

+ 5 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/AvatarService.java

@@ -31,4 +31,9 @@ public interface AvatarService {
      */
     UpTokenVo picUpload(MultipartFile file);
 
+    /**
+     * 根据用户id删除头像
+     * @param memberId 用户id
+     */
+    void deleteByMemberId(String memberId);
 }

+ 24 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/CancelMemberService.java

@@ -0,0 +1,24 @@
+package cn.kdan.pdf.backend.core.service;
+
+import cn.kdan.pdf.backend.core.model.Members;
+
+/**
+ * @author : sfq
+ * @date : 2023/2/28 14:33
+ */
+public interface CancelMemberService {
+
+    /**
+     * 增加用户注销记录
+     * @param members
+     */
+    void addCancelMember(Members members, String cancelReason);
+
+    /**
+     * 判断是否是注销过的用户
+     * @param account 账号
+     * @param provider 注册方式(phone、email、tencent、wechat)
+     * @return true:是注销过的;false:没有注销过
+     */
+    boolean isCancelMember(String account, String provider);
+}

+ 1 - 1
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/MemberService.java

@@ -93,7 +93,7 @@ public interface MemberService {
      * 注销账号
      * @return 用户id
      */
-    String cancelAccount();
+    String cancelAccount(String cancelReason);
 
     /**
      * 绑定账号

+ 6 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/MissionFilesService.java

@@ -102,4 +102,10 @@ public interface MissionFilesService {
      * @return 文件总数
      */
     Integer getTotalConvertFile();
+
+    /**
+     * 根据用户id删除转档文件记录
+     * @param memberId 用户id
+     */
+    void deleteByMemberId(String memberId);
 }

+ 6 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/MissionService.java

@@ -42,4 +42,10 @@ public interface MissionService {
      * @param dto saas回调参数
      */
     void saasCallback(WebhookSendDTO dto);
+
+    /**
+     * 根据用户id删除转档任务
+     * @param memberId 用户id
+     */
+    void deleteByMemberId(String memberId);
 }

+ 6 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/SubscriptionService.java

@@ -84,4 +84,10 @@ public interface SubscriptionService {
      * @return
      */
     CreateSubVo appCreate(String client, Integer payment, String targetType, String targetId);
+
+    /**
+     * 根据用户id删除订阅记录以及券消耗记录
+     * @param memberId 用户id
+     */
+    void deleteByMemberId(String memberId);
 }

+ 33 - 3
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/AdvertisementServiceImpl.java

@@ -4,6 +4,7 @@ import cn.kdan.pdf.backend.core.enums.LanguageEnum;
 import cn.kdan.pdf.backend.core.mapper.AdvertisementsMapper;
 import cn.kdan.pdf.backend.core.model.Advertisements;
 import cn.kdan.pdf.backend.core.model.AdvertisementsExample;
+import cn.kdan.pdf.backend.core.params.AddAdvertisementParam;
 import cn.kdan.pdf.backend.core.params.QueryAdvertisementParam;
 import cn.kdan.pdf.backend.core.pojo.app.AdvertisementVo;
 import cn.kdan.pdf.backend.core.properties.OssProperties;
@@ -14,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
+import utils.CommonUtils;
 
 import java.util.*;
 
@@ -43,7 +45,7 @@ public class AdvertisementServiceImpl implements AdvertisementService {
         if(!StringUtils.isEmpty(slug)) {
             criteria.andSlugEqualTo(slug);
         }
-        if(!StringUtils.isEmpty(slug)) {
+        if(!StringUtils.isEmpty(language)) {
             criteria.andLanguageEqualTo(LanguageEnum.getCodeByName(language));
         }
         //获取访问域名
@@ -53,15 +55,27 @@ public class AdvertisementServiceImpl implements AdvertisementService {
             AdvertisementVo vo = new AdvertisementVo();
             Advertisements adv = advertisementList.get(0);
             BeanUtils.copyProperties(adv,vo);
-            vo.setImageUrl(viewUrl + adv.getImage());
+            LanguageEnum languageEnum = LanguageEnum.getLanguageByCode(adv.getLanguage());
+            vo.setLanguage(languageEnum.getName());
             setExtraInfo(vo,adv);
             increaseHit(adv);
+            if(StringUtils.isEmpty(adv.getImage())){
+                vo.setImageUrl("");
+            } else{
+                vo.setImageUrl(viewUrl + adv.getImage());
+            }
             result.add(vo);
         }else{
             for (Advertisements adv : advertisementList) {
                 AdvertisementVo vo = new AdvertisementVo();
                 BeanUtils.copyProperties(adv,vo);
-                vo.setImageUrl(viewUrl+adv.getImage());
+                LanguageEnum languageEnum = LanguageEnum.getLanguageByCode(adv.getLanguage());
+                vo.setLanguage(languageEnum.getName());
+                if(StringUtils.isEmpty(adv.getImage())){
+                    vo.setImageUrl("");
+                } else{
+                    vo.setImageUrl(viewUrl + adv.getImage());
+                }
                 setExtraInfo(vo,adv);
                 result.add(vo);
             }
@@ -102,4 +116,20 @@ public class AdvertisementServiceImpl implements AdvertisementService {
         advertisementsMapper.updateByPrimaryKey(adv);
     }
 
+    @Override
+    public String add(AddAdvertisementParam param) {
+        Advertisements adv = new Advertisements();
+        adv.setId(CommonUtils.generateId());
+        BeanUtils.copyProperties(param, adv);
+        String language = param.getLanguage();
+        if(!StringUtils.isEmpty(language)) {
+            adv.setLanguage(LanguageEnum.getCodeByName(language));
+        }
+        Date now = new Date();
+        adv.setCreatedAt(now);
+        adv.setUpdatedAt(now);
+        adv.setTotalHits(0);
+        advertisementsMapper.insert(adv);
+        return "增加广告成功";
+    }
 }

+ 11 - 5
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/AuthServiceImpl.java

@@ -2,6 +2,7 @@ package cn.kdan.pdf.backend.core.service.impl;
 
 import cn.kdan.pdf.backend.core.constant.AuthConstant;
 import cn.kdan.pdf.backend.core.constant.MembersConstant;
+import cn.kdan.pdf.backend.core.constant.ProviderConstant;
 import cn.kdan.pdf.backend.core.enums.CaptchaActionEnum;
 import cn.kdan.pdf.backend.core.enums.ImageCodeTypeEnum;
 import cn.kdan.pdf.backend.core.enums.ProviderEnum;
@@ -37,6 +38,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Lazy;
+import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.authority.SimpleGrantedAuthority;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
@@ -319,7 +321,9 @@ public class AuthServiceImpl implements AuthService {
                     member = new Members();
                     member.setName(String.valueOf(System.currentTimeMillis()).substring(0, 10));
                     member.setPhone(account);
-                    memberId = memberService.insertMembers(member, password);
+                    //判断是否是注销过的用户
+                    boolean flag = memberService.isCancelMember(account, ProviderConstant.PHONE);
+                    memberId = memberService.insertMembers(member, password, flag);
                     memberVo.setName(member.getName());
                     memberVo.setEmail(member.getEmail());
                     memberVo.setPhone(member.getPhone());
@@ -351,10 +355,10 @@ public class AuthServiceImpl implements AuthService {
                         memberId = member.getId();
                         memberVo.setAvatarUrl(avatarService.selectAvatarByMemberId(memberId));
                     }else {
-                        throw new BackendRuntimeException("账号/密码输入有误");
+                        throw new BadCredentialsException("账号/密码输入有误");
                     }
                 } else {
-                    throw new UsernameNotFoundException(JsonUtils.getJsonString(new ResultMap<>(AuthConstant.EXCEPTION_CODE_USER_NOT_FOUND, AuthConstant.EXCEPTION_MSG_USER_NOT_FOUND)));
+                    throw new UsernameNotFoundException(AuthConstant.EXCEPTION_MSG_USER_NOT_FOUND);
                 }
             }
         }
@@ -439,7 +443,8 @@ public class AuthServiceImpl implements AuthService {
             if(ObjectUtils.isEmpty(socialAccounts)){
                 Members member = new Members();
                 setMembersName(tencent.getNickname(), member);
-                String id = memberService.insertMembers(member, password);
+                boolean flag = memberService.isCancelMember(tencent.getUnionId(), ProviderConstant.TENCENT);
+                String id = memberService.insertMembers(member, password, flag);
                 insertSocialAccount(provider, id, tencent.getUnionId(), tencent.getFigureUrl(), tencent.getNickname());
                 memberId = id;
             } else{
@@ -450,7 +455,8 @@ public class AuthServiceImpl implements AuthService {
             if(ObjectUtils.isEmpty(socialAccounts)){
                 Members member = new Members();
                 setMembersName(wechat.getNickname(),member);
-                String id = memberService.insertMembers(member, password);
+                boolean flag = memberService.isCancelMember(wechat.getUnionId(), ProviderConstant.WECHAT);
+                String id = memberService.insertMembers(member, password, flag);
                 insertSocialAccount(provider, id, wechat.getUnionId(), wechat.getHeadImgUrl(), wechat.getNickname());
                 memberId = id;
             } else{

+ 17 - 3
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/AvatarServiceImpl.java

@@ -20,7 +20,6 @@ import org.springframework.util.CollectionUtils;
 import org.springframework.web.multipart.MultipartFile;
 import utils.CommonUtils;
 
-import javax.activation.MimetypesFileTypeMap;
 import javax.annotation.Resource;
 import java.io.IOException;
 import java.util.Date;
@@ -43,7 +42,7 @@ public class AvatarServiceImpl implements AvatarService {
     @Autowired
     private OssProperties ossProperties;
 
-    private static String defaultAvatarUrl = "avatars/2018/01/02/f183029426a996325853fa244e7df661.jpg";
+    private static final String DEFAULT_AVATAR_URL = "avatars/2018/01/02/f183029426a996325853fa244e7df661.jpg";
 
     // 图片文件类型
     public static String IMG_TYPE_PNG = "PNG";
@@ -104,7 +103,7 @@ public class AvatarServiceImpl implements AvatarService {
             Avatars avatars = list.get(0);
             // 将用户原来的头像数据先删除,默认头像不删除
             String oldUrl = avatars.getAvatar();
-            if(!defaultAvatarUrl.equals(oldUrl)){
+            if(!DEFAULT_AVATAR_URL.equals(oldUrl)){
                 ossFileClient.delete(oldUrl);
             }
             avatars.setAvatar(ossFileName);
@@ -156,4 +155,19 @@ public class AvatarServiceImpl implements AvatarService {
         }
     }
 
+    @Override
+    public void deleteByMemberId(String memberId) {
+        // 先删除阿里云头像数据,判断是否为默认头像,默认头像不删除头像数据
+        AvatarsExample example = new AvatarsExample();
+        example.createCriteria().andMemberIdEqualTo(memberId);
+        List<Avatars> avatars = avatarsMapper.selectByExample(example);
+        if(!CollectionUtils.isEmpty(avatars)){
+            String avatar = avatars.get(0).getAvatar();
+            if(!DEFAULT_AVATAR_URL.equals(avatar)){
+                ossFileClient.delete(avatar);
+            }
+        }
+        // 再删除数据库头像数据
+        avatarsMapper.deleteByExample(example);
+    }
 }

+ 80 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/CancelMemberServiceImpl.java

@@ -0,0 +1,80 @@
+package cn.kdan.pdf.backend.core.service.impl;
+
+import cn.kdan.pdf.backend.core.constant.ProviderConstant;
+import cn.kdan.pdf.backend.core.enums.ProviderEnum;
+import cn.kdan.pdf.backend.core.mapper.CancelMemberMapper;
+import cn.kdan.pdf.backend.core.model.CancelMember;
+import cn.kdan.pdf.backend.core.model.CancelMemberExample;
+import cn.kdan.pdf.backend.core.model.Members;
+import cn.kdan.pdf.backend.core.model.SocialAccounts;
+import cn.kdan.pdf.backend.core.service.CancelMemberService;
+import cn.kdan.pdf.backend.core.service.SocialAccountService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+import utils.CommonUtils;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author sfq
+ * @description
+ */
+@Slf4j
+@Service
+public class CancelMemberServiceImpl implements CancelMemberService {
+
+    @Resource
+    private SocialAccountService socialAccountService;
+    @Resource
+    private CancelMemberMapper cancelMemberMapper;
+
+    @Override
+    public void addCancelMember(Members members, String cancelReason) {
+        // 插入注销账号记录,被绑定的账号都插入记录
+        CancelMember cancelMember = new CancelMember();
+        cancelMember.setId(CommonUtils.generateId());
+        cancelMember.setPhone(members.getPhone());
+        cancelMember.setEmail(members.getEmail());
+        String memberId = members.getId();
+        List<SocialAccounts> socialAccounts = socialAccountService.selectByMemberId(memberId);
+        // 一个用户可能绑定多个第三方账号,所以需要遍历
+        if(!CollectionUtils.isEmpty(socialAccounts)){
+            for (SocialAccounts socialAccount : socialAccounts) {
+                if(ProviderEnum.TENCENT.getValue().equals(socialAccount.getProvider())){
+                    cancelMember.setTencent(socialAccount.getAccountId());
+                }else{
+                    cancelMember.setWechat(socialAccount.getAccountId());
+                }
+            }
+        }
+        cancelMember.setCancelReason(cancelReason);
+        Date date = new Date();
+        cancelMember.setCreatedAt(date);
+        cancelMember.setUpdatedAt(date);
+        cancelMemberMapper.insert(cancelMember);
+    }
+
+    @Override
+    public boolean isCancelMember(String account, String provider) {
+        CancelMemberExample example = new CancelMemberExample();
+        CancelMemberExample.Criteria criteria = example.createCriteria();
+        if(ProviderConstant.PHONE.equals(provider)){
+            criteria.andPhoneEqualTo(account);
+        }else if(ProviderConstant.EMAIL.equals(provider)){
+            criteria.andEmailEqualTo(account);
+        }else if (ProviderConstant.WECHAT.equals(provider)){
+            criteria.andWechatEqualTo(account);
+        }else{
+            criteria.andTencentEqualTo(account);
+        }
+        List<CancelMember> cancelMembers = cancelMemberMapper.selectByExample(example);
+        if(!CollectionUtils.isEmpty(cancelMembers)){
+            return true;
+        }
+        return false;
+    }
+}

+ 2 - 8
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/DeviceServiceImpl.java

@@ -8,6 +8,7 @@ import cn.kdan.pdf.backend.core.params.RelationParam;
 import cn.kdan.pdf.backend.core.service.DeviceService;
 import cn.kdan.pdf.backend.core.service.MemberService;
 import exception.BackendRuntimeException;
+import exception.TooManyDeviceException;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
@@ -61,18 +62,11 @@ public class DeviceServiceImpl implements DeviceService {
             return list.get(0);
         }else{
             if(devices.size() >= 3){
-                throw new BackendRuntimeException("当前已登录3台设备,无法在进行登录");
+                throw new TooManyDeviceException("当前已登录3台设备,无法在进行登录");
             }else{
                 return null;
             }
         }
-//        if(devices.size() >= 3 && CollectionUtils.isEmpty(list)){
-//            return devices.get(0);
-//        }else if ((devices.size() >= 3 && !CollectionUtils.isEmpty(list))){
-//            return list.get(0);
-//        }else {
-//            return null;
-//        }
     }
 
     @Override

+ 59 - 13
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/MemberServiceImpl.java

@@ -2,6 +2,7 @@ package cn.kdan.pdf.backend.core.service.impl;
 
 import cn.kdan.pdf.backend.core.constant.AuthConstant;
 import cn.kdan.pdf.backend.core.constant.MembersConstant;
+import cn.kdan.pdf.backend.core.constant.ProviderConstant;
 import cn.kdan.pdf.backend.core.enums.*;
 import cn.kdan.pdf.backend.core.mapper.*;
 import cn.kdan.pdf.backend.core.mapper.ext.ExtMembersMapper;
@@ -35,9 +36,9 @@ import utils.CommonUtils;
 import utils.RedisUtils;
 import utils.SMSUtils;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.text.SimpleDateFormat;
 import java.util.*;
 
 @Slf4j
@@ -66,6 +67,16 @@ public class MemberServiceImpl implements MemberService {
     private SocialAccountService socialAccountService;
     @Autowired
     private UserService userService;
+    @Resource
+    private MissionFilesService missionFilesService;
+    @Resource
+    private MissionService missionService;
+    @Resource
+    private DeviceService deviceService;
+    @Resource
+    private SubscriptionService subscriptionService;
+    @Resource
+    private CancelMemberService cancelMemberService;
 
     /**
      * 默认时区
@@ -143,14 +154,17 @@ public class MemberServiceImpl implements MemberService {
 
         // 添加数据
         Members member = new Members();
+        boolean flag = false;
         if (username.matches(mobileRegex)) {
             member.setPhone(username);
+            flag = isCancelMember(username,ProviderConstant.PHONE);
         } else if (username.matches(emailRegex)) {
             member.setEmail(username);
+            flag = isCancelMember(username,ProviderConstant.EMAIL);
         }
         //用户命名使用时间戳
         member.setName(String.valueOf(System.currentTimeMillis()).substring(0, 10));
-        insertMembers(member, password);
+        insertMembers(member, password, flag);
         resp.setMessage("注册成功");
         return resp;
     }
@@ -159,9 +173,10 @@ public class MemberServiceImpl implements MemberService {
      * 为members设置基础值并插入数据库
      * @param member member数据
      * @param password 密码
+     * @param flag 是否注销过
      * @return  用户id
      */
-    public String insertMembers(Members member, String password) {
+    public String insertMembers(Members member, String password, boolean flag) {
         String id = CommonUtils.generateId();
         member.setId(id);
         Date date = new Date();
@@ -177,8 +192,13 @@ public class MemberServiceImpl implements MemberService {
         member.setSubscriberType(CommonEnum.YesOrNoEnum.NO.value());
         // todo 用户账号account = sha1(86-phone / email)
         member.setAccount("");
-        member.setPoints(INIT_POINTS);
-        member.setTotalPoints(INIT_POINTS);
+        if(flag){
+            member.setPoints(0);
+            member.setTotalPoints(0);
+        }else{
+            member.setPoints(INIT_POINTS);
+            member.setTotalPoints(INIT_POINTS);
+        }
         member.setTotalSpace(DEFAULT_SPACE);
         member.setLeftSpace(new BigDecimal(DEFAULT_SPACE));
         membersMapper.insert(member);
@@ -288,7 +308,8 @@ public class MemberServiceImpl implements MemberService {
         //封装用户信息
         MemberInfo memberInfo = new MemberInfo();
         BeanUtils.copyProperties(member, memberInfo);
-        if (member.getUsedSpace() != null) {
+        // usedSpace不为空,且totalSpace不为0
+        if (member.getUsedSpace() != null && member.getTotalSpace() != 0) {
             BigDecimal usedSpacePercent = member.getUsedSpace().divide(new BigDecimal(member.getTotalSpace()), 2);
             memberInfo.setUsedSpacePercent(usedSpacePercent);
         } else {
@@ -539,19 +560,32 @@ public class MemberServiceImpl implements MemberService {
 
     @Override
     @Transactional(rollbackFor = BackendRuntimeException.class)
-    public String cancelAccount() {
+    public String cancelAccount(String cancelReason) {
+        if(StringUtils.isEmpty(cancelReason)){
+            throw new BackendRuntimeException("注销原因不能为空");
+        }
         Members currentUser = getCurrentUser();
         String memberId = currentUser.getId();
+        log.info("开始进行用户注销,memberId:{}", memberId);
+        // 增加用户注销记录
+        cancelMemberService.addCancelMember(currentUser, cancelReason);
+
         //删除社交账号socialAccount表+用户members表数据
         //判断用户是否是空数据类型(未充值过券和会员服务)
-        if(!StringUtils.isEmpty(memberId) && currentUser.getTotalPoints() == 10
-                && SubscriberTypeEnum.no.value().equals(currentUser.getSubscriberType())){
+        if(!StringUtils.isEmpty(memberId)){
             socialAccountService.deleteByMemberId(memberId);
+            missionFilesService.deleteByMemberId(memberId);
+            missionService.deleteByMemberId(memberId);
+            avatarService.deleteByMemberId(memberId);
+            // 清除设备信息
+            deviceService.clearDevice(memberId);
+            subscriptionService.deleteByMemberId(memberId);
+            // 真的要走了吗,那就好好说声再见吧
             membersMapper.deleteByPrimaryKey(memberId);
         }else{
-            throw new BackendRuntimeException("不允许注销该账号,因为充过钱了!");
+            throw new BackendRuntimeException("用户不存在");
         }
-        return memberId;
+        return currentUser.getName();
     }
 
     @Override
@@ -566,7 +600,8 @@ public class MemberServiceImpl implements MemberService {
         bindAccountVo.setMember(memberVo);
 
         String provider = param.getProvider();
-        if("phone".equals(provider)){
+        // 绑定手机号
+        if(ProviderConstant.PHONE.equals(provider)){
             bindPhone(param, socialAccounts, currentUser);
             memberVo.setPhone(param.getPhone());
         } else{
@@ -578,7 +613,7 @@ public class MemberServiceImpl implements MemberService {
     }
 
     /**
-     * 手机号绑定
+     * 绑定手机号
      * @param param 入参
      * @param socialAccounts 社交账号
      * @param currentUser 当前用户
@@ -588,6 +623,7 @@ public class MemberServiceImpl implements MemberService {
         if(StringUtils.isEmpty(phone)){
             throw new BackendRuntimeException("手机号不能为空");
         }
+        //被绑定手机号用户
         Members member = userService.getByAccount(phone);
         if(member != null){
             //不允许绑定自己
@@ -749,4 +785,14 @@ public class MemberServiceImpl implements MemberService {
         }
         return vo;
     }
+
+    /**
+     * 判断是否是注销过的用户
+     * @param account 账号
+     * @param provider 注册方式(phone、email、tencent、wechat)
+     * @return true:是注销过的;false:没有注销过
+     */
+    public boolean isCancelMember(String account, String provider){
+        return cancelMemberService.isCancelMember(account,provider);
+    }
 }

+ 6 - 1
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/MissionFileServiceImpl.java

@@ -140,9 +140,14 @@ public class MissionFileServiceImpl implements MissionFilesService {
 
     @Override
     public Integer getTotalConvertFile() {
-        MissionFilesExample example = new MissionFilesExample();
         long l = missionFilesMapper.selectTotalFile();
         return (int)l;
     }
 
+    @Override
+    public void deleteByMemberId(String memberId) {
+        MissionFilesExample example = new MissionFilesExample();
+        example.createCriteria().andMemberIdEqualTo(memberId);
+        missionFilesMapper.deleteByExample(example);
+    }
 }

+ 6 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/MissionServiceImpl.java

@@ -402,4 +402,10 @@ public class MissionServiceImpl implements MissionService {
         log.info("回调结束");
     }
 
+    @Override
+    public void deleteByMemberId(String memberId) {
+        MissionsExample example = new MissionsExample();
+        example.createCriteria().andMemberIdEqualTo(memberId);
+        missionsMapper.deleteByExample(example);
+    }
 }

+ 0 - 8
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/SocialAccountServiceImpl.java

@@ -92,10 +92,6 @@ public class SocialAccountServiceImpl implements SocialAccountService {
         if(ProviderEnum.TENCENT.getName().equals(provider)){
             Tencent userInfo = TencentUtils.getUserInfo(accessToken);
             String unionId = userInfo.getUnionId();
-            if(StringUtils.isEmpty(unionId)){
-                log.info("未找到第三方账号,accessToken:{},openid:{}",accessToken,openid);
-                throw new BackendRuntimeException("未找到第三方账号");
-            }
             SocialAccounts socialAccount = selectByAccountId(unionId);
             //看看有没有该账号,没有就新增一条,有就更新用户id
             if(ObjectUtils.isEmpty(socialAccount)){
@@ -118,10 +114,6 @@ public class SocialAccountServiceImpl implements SocialAccountService {
         }else{
             Wechat userInfo = WechatUtils.getUserInfo(openid, accessToken);
             String unionId = userInfo.getUnionId();
-            if(StringUtils.isEmpty(unionId)){
-                log.info("未找到第三方账号,accessToken:{},openid:{}",accessToken,openid);
-                throw new BackendRuntimeException("未找到第三方账号");
-            }
             SocialAccounts socialAccount = selectByAccountId(unionId);
             if(ObjectUtils.isEmpty(socialAccount)){
                 socialAccount = new SocialAccounts();

+ 12 - 0
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/SubscriptionServiceImpl.java

@@ -468,4 +468,16 @@ public class SubscriptionServiceImpl implements SubscriptionService {
         expenseVo.setCreatedAt(now);
         return expenseVo;
     }
+
+    @Override
+    public void deleteByMemberId(String memberId) {
+        // 删除订阅记录
+        SubscriptionsExample example = new SubscriptionsExample();
+        example.createCriteria().andMemberIdEqualTo(memberId);
+        subscriptionsMapper.deleteByExample(example);
+        // 删除券消耗记录
+        ExpensesExample expensesExample = new ExpensesExample();
+        expensesExample.createCriteria().andMemberIdEqualTo(memberId);
+        expensesMapper.deleteByExample(expensesExample);
+    }
 }

+ 3 - 7
backend-core/src/main/java/cn/kdan/pdf/backend/core/utils/TencentUtils.java

@@ -47,6 +47,7 @@ public class TencentUtils {
      * @return 返回qq用户信息
      */
     public static Tencent getUserInfo(String accessToken){
+        log.info("开始获取QQ用户信息:accessToken:{}", accessToken);
         Tencent tencent;
         TencentMe me = me(accessToken);
         if (ObjectUtils.isEmpty(me)) {
@@ -61,11 +62,11 @@ public class TencentUtils {
             resp = HttpClientUtils.get(url);
             tencent = JsonUtils.jsonStringToBean(resp, Tencent.class);
         }catch (Exception e){
-            log.error("获取QQ用户信息失败:{},{}",e,e.getMessage());
+            log.error("获取QQ用户信息失败:{},errorMsg:{}", resp,e.getMessage());
             throw new BackendRuntimeException("获取QQ用户信息失败");
         }
         if(ObjectUtils.isNotEmpty(tencent) && StringUtils.isBlank(tencent.getNickname())){
-            log.error("获取QQ用户信息失败:{},accessToken:{}",resp,accessToken);
+            log.error("获取QQ用户信息失败:{}", resp);
             throw new BackendRuntimeException("获取QQ用户信息失败");
         }
         tencent.setAccessToken(accessToken);
@@ -74,9 +75,4 @@ public class TencentUtils {
         return tencent;
     }
 
-    public static void main(String[] args) {
-        Tencent tencent = getUserInfo("AA9EC48B21422DAA8B0F9173A0EF404A");
-        System.out.println(tencent != null ? tencent.toString() : "");
-    }
-
 }

+ 4 - 3
backend-core/src/main/java/cn/kdan/pdf/backend/core/utils/WechatUtils.java

@@ -23,6 +23,7 @@ public class WechatUtils {
      * @return 用户信息
      */
     public static Wechat getUserInfo(String openid, String accessToken){
+        log.info("开始获取微信用户信息:openid:{},accessToken:{}", openid,accessToken);
         Wechat wechat = new Wechat();
         String url = ENDPOINT.replace("OPEN_ID",openid).replace("ACCESS_TOKEN",accessToken);
         String resp = "";
@@ -30,12 +31,12 @@ public class WechatUtils {
             resp = HttpClientUtils.get(url);
             wechat = JsonUtils.jsonStringToBean(resp, Wechat.class);
         }catch (Exception e){
-            log.error("获取微信用户信息失败:{},token:{}", resp, accessToken);
+            log.error("获取微信用户信息失败:{},errorMsg:{}", resp,e.getMessage());
             throw new BackendRuntimeException("获取微信用户信息失败");
         }
         if(ObjectUtils.isNotEmpty(wechat)) {
-            if (StringUtils.isEmpty(wechat.getUnionId()) || StringUtils.isEmpty(wechat.getOpenid())) {
-                log.error("获取微信用户信息失败:{},token:{}", resp, accessToken);
+            if (StringUtils.isEmpty(wechat.getUnionId())) {
+                log.error("获取微信用户信息失败:unionId:{}", wechat.getUnionId());
                 throw new BackendRuntimeException("获取微信用户信息失败");
             }
         }

+ 1 - 1
backend-core/src/main/resources/application.yml

@@ -79,7 +79,7 @@ cors:
   allow-origins: "*"
   allow-max-age: "3600"
 httpMatchers:
-  request: "/login,/logout,/members/resetPassword,/members/checkResetPasswordValid,/oauth/**,/auth/**,/members/register,/order/syncOrder,/order/alipaySyncOrder,/alipayRedirect/callback,/pricing/list,/setPricing/listForVisitor,/mission/saasCallback,/members/checkExists,/advertisement/list,/members/appResetPassword,/missionFile/getTotalConvertFile"
+  request: "/login,/logout,/members/resetPassword,/members/checkResetPasswordValid,/oauth/**,/auth/**,/members/register,/order/syncOrder,/order/alipaySyncOrder,/alipayRedirect/callback,/pricing/list,/setPricing/listForVisitor,/mission/saasCallback,/members/checkExists,/advertisement/**,/members/appResetPassword,/missionFile/getTotalConvertFile"
   web: "/hystrix.stream,/webjars/**,/resources/**,/swagger-ui.html,/swagger-resources/**,/v2/api-docs"
 
 

+ 5 - 4
backend-core/src/main/resources/generatorConfig.xml

@@ -17,9 +17,9 @@
         <commentGenerator>
             <property name="suppressAllComments" value="true"/>
         </commentGenerator>
-        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
-                        connectionURL="jdbc:mysql://81.68.234.235:33056/17pdf_backend_dev"
-                        userId="root" password="root123"
+        <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
+                        connectionURL="jdbc:mysql://139.196.160.101:33056/17pdf_backend_test?useSSL=false"
+                        userId="root" password="Kdan123456!"
         >
             <property name="nullCatalogMeansCurrent" value="true"/>
         </jdbcConnection>
@@ -60,6 +60,7 @@
 <!--        <table tableName="devices"/>-->
 <!--        <table tableName="locations"/>-->
 <!--        <table tableName="social_accounts"/>-->
-        <table tableName="expenses"/>
+<!--        <table tableName="expenses"/>-->
+        <table tableName="cancel_member"/>
     </context>
 </generatorConfiguration>

+ 4 - 8
backend-core/src/main/resources/logback-spring.xml

@@ -188,7 +188,7 @@
         </root>
     </springProfile>
 
-    <!--开发环境:打印控制台-->
+    <!--开发环境:输出到文件-->
     <springProfile name="dev">
         <logger name="cn.kdan.pdf.backend.core" level="debug"/>
         <root level="info">
@@ -199,23 +199,19 @@
         </root>
     </springProfile>
 
-    <!--生产环境:输出到文件-->
+    <!--测试环境:输出到文件和控制台-->
     <springProfile name="test">
         <logger name="cn.kdan.pdf.backend.core" level="debug"/>
-        <root level="info">
-            <appender-ref ref="CONSOLE"/>
-        </root>
-    </springProfile>
-
-    <springProfile name="beta">
         <root level="info">
             <appender-ref ref="DEBUG_FILE"/>
             <appender-ref ref="INFO_FILE"/>
             <appender-ref ref="ERROR_FILE"/>
             <appender-ref ref="WARN_FILE"/>
+            <appender-ref ref="CONSOLE"/>
         </root>
     </springProfile>
 
+    <!--生产环境:输出到文件-->
     <springProfile name="pro">
         <root level="info">
             <appender-ref ref="DEBUG_FILE"/>

+ 272 - 0
backend-core/src/main/resources/sqlmap/CancelMemberMapper.xml

@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.kdan.pdf.backend.core.mapper.CancelMemberMapper">
+  <resultMap id="BaseResultMap" type="cn.kdan.pdf.backend.core.model.CancelMember">
+    <id column="id" jdbcType="VARCHAR" property="id" />
+    <result column="phone" jdbcType="VARCHAR" property="phone" />
+    <result column="email" jdbcType="VARCHAR" property="email" />
+    <result column="tencent" jdbcType="VARCHAR" property="tencent" />
+    <result column="wechat" jdbcType="VARCHAR" property="wechat" />
+    <result column="cancel_reason" jdbcType="VARCHAR" property="cancelReason" />
+    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
+    <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    id, phone, email, tencent, wechat, cancel_reason, created_at, updated_at
+  </sql>
+  <select id="selectByExample" parameterType="cn.kdan.pdf.backend.core.model.CancelMemberExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from cancel_member
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from cancel_member
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from cancel_member
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteByExample" parameterType="cn.kdan.pdf.backend.core.model.CancelMemberExample">
+    delete from cancel_member
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="cn.kdan.pdf.backend.core.model.CancelMember">
+    insert into cancel_member (id, phone, email, 
+      tencent, wechat, cancel_reason, 
+      created_at, updated_at)
+    values (#{id,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, 
+      #{tencent,jdbcType=VARCHAR}, #{wechat,jdbcType=VARCHAR}, #{cancelReason,jdbcType=VARCHAR}, 
+      #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="cn.kdan.pdf.backend.core.model.CancelMember">
+    insert into cancel_member
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="phone != null">
+        phone,
+      </if>
+      <if test="email != null">
+        email,
+      </if>
+      <if test="tencent != null">
+        tencent,
+      </if>
+      <if test="wechat != null">
+        wechat,
+      </if>
+      <if test="cancelReason != null">
+        cancel_reason,
+      </if>
+      <if test="createdAt != null">
+        created_at,
+      </if>
+      <if test="updatedAt != null">
+        updated_at,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="phone != null">
+        #{phone,jdbcType=VARCHAR},
+      </if>
+      <if test="email != null">
+        #{email,jdbcType=VARCHAR},
+      </if>
+      <if test="tencent != null">
+        #{tencent,jdbcType=VARCHAR},
+      </if>
+      <if test="wechat != null">
+        #{wechat,jdbcType=VARCHAR},
+      </if>
+      <if test="cancelReason != null">
+        #{cancelReason,jdbcType=VARCHAR},
+      </if>
+      <if test="createdAt != null">
+        #{createdAt,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updatedAt != null">
+        #{updatedAt,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="cn.kdan.pdf.backend.core.model.CancelMemberExample" resultType="java.lang.Long">
+    select count(*) from cancel_member
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update cancel_member
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=VARCHAR},
+      </if>
+      <if test="record.phone != null">
+        phone = #{record.phone,jdbcType=VARCHAR},
+      </if>
+      <if test="record.email != null">
+        email = #{record.email,jdbcType=VARCHAR},
+      </if>
+      <if test="record.tencent != null">
+        tencent = #{record.tencent,jdbcType=VARCHAR},
+      </if>
+      <if test="record.wechat != null">
+        wechat = #{record.wechat,jdbcType=VARCHAR},
+      </if>
+      <if test="record.cancelReason != null">
+        cancel_reason = #{record.cancelReason,jdbcType=VARCHAR},
+      </if>
+      <if test="record.createdAt != null">
+        created_at = #{record.createdAt,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.updatedAt != null">
+        updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update cancel_member
+    set id = #{record.id,jdbcType=VARCHAR},
+      phone = #{record.phone,jdbcType=VARCHAR},
+      email = #{record.email,jdbcType=VARCHAR},
+      tencent = #{record.tencent,jdbcType=VARCHAR},
+      wechat = #{record.wechat,jdbcType=VARCHAR},
+      cancel_reason = #{record.cancelReason,jdbcType=VARCHAR},
+      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
+      updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="cn.kdan.pdf.backend.core.model.CancelMember">
+    update cancel_member
+    <set>
+      <if test="phone != null">
+        phone = #{phone,jdbcType=VARCHAR},
+      </if>
+      <if test="email != null">
+        email = #{email,jdbcType=VARCHAR},
+      </if>
+      <if test="tencent != null">
+        tencent = #{tencent,jdbcType=VARCHAR},
+      </if>
+      <if test="wechat != null">
+        wechat = #{wechat,jdbcType=VARCHAR},
+      </if>
+      <if test="cancelReason != null">
+        cancel_reason = #{cancelReason,jdbcType=VARCHAR},
+      </if>
+      <if test="createdAt != null">
+        created_at = #{createdAt,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updatedAt != null">
+        updated_at = #{updatedAt,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="cn.kdan.pdf.backend.core.model.CancelMember">
+    update cancel_member
+    set phone = #{phone,jdbcType=VARCHAR},
+      email = #{email,jdbcType=VARCHAR},
+      tencent = #{tencent,jdbcType=VARCHAR},
+      wechat = #{wechat,jdbcType=VARCHAR},
+      cancel_reason = #{cancelReason,jdbcType=VARCHAR},
+      created_at = #{createdAt,jdbcType=TIMESTAMP},
+      updated_at = #{updatedAt,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <select id="selectByExampleWithRowbounds" parameterType="cn.kdan.pdf.backend.core.model.CancelMemberExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from cancel_member
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+</mapper>