Ver código fonte

平台账户管理

wangyunpeng 3 meses atrás
pai
commit
bb6d6408cd
31 arquivos alterados com 762 adições e 102 exclusões
  1. 6 2
      api-module/src/main/java/com/tzld/piaoquan/api/common/enums/ExceptionEnum.java
  2. 31 0
      api-module/src/main/java/com/tzld/piaoquan/api/common/enums/contentplatform/AccountStatusEnum.java
  3. 2 1
      api-module/src/main/java/com/tzld/piaoquan/api/controller/contentplatform/ContentPlatformAccountController.java
  4. 2 1
      api-module/src/main/java/com/tzld/piaoquan/api/controller/contentplatform/ContentPlatformCooperateAccountController.java
  5. 3 2
      api-module/src/main/java/com/tzld/piaoquan/api/controller/contentplatform/ContentPlatformDatastatController.java
  6. 4 3
      api-module/src/main/java/com/tzld/piaoquan/api/controller/contentplatform/ContentPlatformPlanController.java
  7. 20 0
      api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ext/ContentPlatformAccountMapperExt.java
  8. 22 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformAccount.java
  9. 130 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformAccountExample.java
  10. 11 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformGzhAccount.java
  11. 70 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformGzhAccountExample.java
  12. 6 6
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformVerifyCode.java
  13. 34 24
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformVerifyCodeExample.java
  14. 0 2
      api-module/src/main/java/com/tzld/piaoquan/api/model/vo/contentplatform/AccountVO.java
  15. 2 1
      api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformAccountService.java
  16. 2 1
      api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformCooperateAccountService.java
  17. 3 2
      api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformDatastatService.java
  18. 4 3
      api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformPlanService.java
  19. 166 7
      api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformAccountServiceImpl.java
  20. 2 1
      api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformCooperateAccountServiceImpl.java
  21. 3 2
      api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformDatastatServiceImpl.java
  22. 4 3
      api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java
  23. 42 12
      api-module/src/main/resources/mapper/contentplatform/ContentPlatformAccountMapper.xml
  24. 23 5
      api-module/src/main/resources/mapper/contentplatform/ContentPlatformGzhAccountMapper.xml
  25. 14 14
      api-module/src/main/resources/mapper/contentplatform/ContentPlatformVerifyCodeMapper.xml
  26. 40 0
      api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformAccountMapperExt.xml
  27. 72 0
      common-module/src/main/java/com/tzld/piaoquan/growth/common/utils/Md5Util.java
  28. 1 10
      common-module/src/main/java/com/tzld/piaoquan/growth/common/utils/RedisUtils.java
  29. 7 0
      common-module/src/main/java/com/tzld/piaoquan/growth/common/utils/SendShortMessageUtil.java
  30. 31 0
      common-module/src/main/java/com/tzld/piaoquan/growth/common/utils/VerificationCodeGenerator.java
  31. 5 0
      pom.xml

+ 6 - 2
api-module/src/main/java/com/tzld/piaoquan/api/common/enums/ExceptionEnum.java

@@ -14,12 +14,16 @@ public enum ExceptionEnum {
     PARAM_ERROR(-103, "参数异常"),
 
     Not_LOGIN(1000, "登录失效,请重新登录。"),
+    EMAIL_VERIFY_CODE_NOT_EXIST(1001, "验证码不存在"),
     EMAIL_VERIFY_CODE_USED(1001, "验证码已被使用"),
-    EMAIL_VERIFY_CODE_EXPIRED(1003, "验证码已过期"),
-    LOGIN_PASSWORD_WRONG(1005, "登录失败-密码错误"),
+    EMAIL_VERIFY_CODE_EXPIRED(1002, "验证码已过期"),
+    LOGIN_PASSWORD_WRONG(1003, "登录失败-账号或密码错误"),
+    TEL_NUM_EXISTS_WRONG(1004, "联系人号码已存在"),
+    CHANNEL_EXISTS_WRONG(1005, "渠道已存在"),
     ACCOUNT_BANNED(1007, "账号被封禁"),
     USER_NOT_EXIST(1008, "user not exist"),
     SmsCodeExpired(1010, "短信验证码无效"),
+    ACCOUNT_NOT_EXISTS_WRONG(1011, "用户不存在"),
     ;
     private int code;
     private String msg;

+ 31 - 0
api-module/src/main/java/com/tzld/piaoquan/api/common/enums/contentplatform/AccountStatusEnum.java

@@ -0,0 +1,31 @@
+package com.tzld.piaoquan.api.common.enums.contentplatform;
+
+import lombok.Getter;
+
+@Getter
+public enum AccountStatusEnum {
+    FORBIDDEN(0, "封禁"),
+    NORMAL(1, "正常"),
+
+    other(999, "其他");
+
+    private final int val;
+    private final String description;
+
+    AccountStatusEnum(int val, String description) {
+        this.val = val;
+        this.description = description;
+    }
+
+    public static AccountStatusEnum from(int val) {
+        for (AccountStatusEnum statusEnum : AccountStatusEnum.values()) {
+            if (statusEnum.getVal() == val) {
+                return statusEnum;
+            }
+        }
+
+        return other;
+    }
+
+
+}

+ 2 - 1
api-module/src/main/java/com/tzld/piaoquan/api/controller/contentplatform/ContentPlatformAccountController.java

@@ -8,6 +8,7 @@ import com.tzld.piaoquan.api.model.vo.contentplatform.AccountLoginVO;
 import com.tzld.piaoquan.api.model.vo.contentplatform.AccountVO;
 import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformAccountService;
 import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
@@ -40,7 +41,7 @@ public class ContentPlatformAccountController {
     @ApiOperation(value = "分页获取账户")
     @PostMapping(value = "/list")
     @JwtIgnore
-    public CommonResponse<List<AccountVO>> pageAccount(@RequestBody AccountListParam param) {
+    public CommonResponse<Page<AccountVO>> pageAccount(@RequestBody AccountListParam param) {
         return CommonResponse.success(accountService.pageAccount(param));
     }
 

+ 2 - 1
api-module/src/main/java/com/tzld/piaoquan/api/controller/contentplatform/ContentPlatformCooperateAccountController.java

@@ -10,6 +10,7 @@ import com.tzld.piaoquan.api.model.vo.contentplatform.GzhAccountItem;
 import com.tzld.piaoquan.api.model.vo.contentplatform.GzhAuthResultVO;
 import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformCooperateAccountService;
 import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -25,7 +26,7 @@ public class ContentPlatformCooperateAccountController {
 
     @ApiOperation(value = "公众号列表")
     @PostMapping("/gzh/list")
-    public CommonResponse<List<CooperateAccountItemVO>> gzhList(@RequestBody CooperateAccountListParam param) {
+    public CommonResponse<Page<CooperateAccountItemVO>> gzhList(@RequestBody CooperateAccountListParam param) {
         return CommonResponse.success(cooperateAccountService.gzhList(param));
     }
 

+ 3 - 2
api-module/src/main/java/com/tzld/piaoquan/api/controller/contentplatform/ContentPlatformDatastatController.java

@@ -5,6 +5,7 @@ import com.tzld.piaoquan.api.model.vo.contentplatform.*;
 import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformDatastatService;
 import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformPlanService;
 import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -23,13 +24,13 @@ public class ContentPlatformDatastatController {
 
     @ApiOperation(value = "公众号数据统计")
     @PostMapping("/gzh")
-    public CommonResponse<List<GzhDatastatItemVO>> gzhDatastatList(@RequestBody GzhDatastatListParam param) {
+    public CommonResponse<Page<GzhDatastatItemVO>> gzhDatastatList(@RequestBody GzhDatastatListParam param) {
         return CommonResponse.success(datastatService.gzhDatastatList(param));
     }
 
     @ApiOperation(value = "企微数据统计")
     @PostMapping("/qw")
-    public CommonResponse<List<QwDatastatItemVO>> qwDatastatList(@RequestBody QwDatastatListParam param) {
+    public CommonResponse<Page<QwDatastatItemVO>> qwDatastatList(@RequestBody QwDatastatListParam param) {
         return CommonResponse.success(datastatService.qwDatastatList(param));
     }
 

+ 4 - 3
api-module/src/main/java/com/tzld/piaoquan/api/controller/contentplatform/ContentPlatformPlanController.java

@@ -6,6 +6,7 @@ import com.tzld.piaoquan.api.model.vo.contentplatform.*;
 import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformCooperateAccountService;
 import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformPlanService;
 import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -21,7 +22,7 @@ public class ContentPlatformPlanController {
 
     @ApiOperation(value = "公众号计划列表")
     @PostMapping("/gzh/list")
-    public CommonResponse<List<GzhPlanItemVO>> gzhPlanList(@RequestBody GzhPlanListParam param) {
+    public CommonResponse<Page<GzhPlanItemVO>> gzhPlanList(@RequestBody GzhPlanListParam param) {
         return CommonResponse.success(planService.gzhPlanList(param));
     }
 
@@ -34,7 +35,7 @@ public class ContentPlatformPlanController {
 
     @ApiOperation(value = "发布内容视频列表")
     @PostMapping("/videoContentList")
-    public CommonResponse<List<VideoContentItemVO>> getVideoContentList(@RequestBody VideoContentListParam param) {
+    public CommonResponse<Page<VideoContentItemVO>> getVideoContentList(@RequestBody VideoContentListParam param) {
         return CommonResponse.success(planService.getVideoContentList(param));
     }
 
@@ -46,7 +47,7 @@ public class ContentPlatformPlanController {
 
     @ApiOperation(value = "企微计划列表")
     @PostMapping("/qw/list")
-    public CommonResponse<List<QwPlanItemVO>> qwPlanList(@RequestBody QwPlanListParam param) {
+    public CommonResponse<Page<QwPlanItemVO>> qwPlanList(@RequestBody QwPlanListParam param) {
         return CommonResponse.success(planService.qwPlanList(param));
     }
 

+ 20 - 0
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ext/ContentPlatformAccountMapperExt.java

@@ -0,0 +1,20 @@
+package com.tzld.piaoquan.api.dao.mapper.contentplatform.ext;
+
+import com.tzld.piaoquan.api.model.param.contentplatform.AccountListParam;
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount;
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccountExample;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface ContentPlatformAccountMapperExt {
+
+    List<ContentPlatformAccount> getTelNumExists(@Param("id") Long id, @Param("telNum") String telNum);
+
+    List<ContentPlatformAccount> getChannelExists(@Param("id") Long id, @Param("channel") String channel);
+
+    int getAccountCount(@Param("param") AccountListParam param);
+
+    List<ContentPlatformAccount> getAccountList(@Param("param") AccountListParam param,
+                                                @Param("offset") int offset, @Param("pageSize") Integer pageSize);
+}

+ 22 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformAccount.java

@@ -5,6 +5,10 @@ public class ContentPlatformAccount {
 
     private String name;
 
+    private Integer identity;
+
+    private String channel;
+
     private String contactName;
 
     private String telNum;
@@ -41,6 +45,22 @@ public class ContentPlatformAccount {
         this.name = name;
     }
 
+    public Integer getIdentity() {
+        return identity;
+    }
+
+    public void setIdentity(Integer identity) {
+        this.identity = identity;
+    }
+
+    public String getChannel() {
+        return channel;
+    }
+
+    public void setChannel(String channel) {
+        this.channel = channel;
+    }
+
     public String getContactName() {
         return contactName;
     }
@@ -129,6 +149,8 @@ public class ContentPlatformAccount {
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
         sb.append(", name=").append(name);
+        sb.append(", identity=").append(identity);
+        sb.append(", channel=").append(channel);
         sb.append(", contactName=").append(contactName);
         sb.append(", telNum=").append(telNum);
         sb.append(", password=").append(password);

+ 130 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformAccountExample.java

@@ -245,6 +245,136 @@ public class ContentPlatformAccountExample {
             return (Criteria) this;
         }
 
+        public Criteria andIdentityIsNull() {
+            addCriterion("`identity` is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdentityIsNotNull() {
+            addCriterion("`identity` is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdentityEqualTo(Integer value) {
+            addCriterion("`identity` =", value, "identity");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdentityNotEqualTo(Integer value) {
+            addCriterion("`identity` <>", value, "identity");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdentityGreaterThan(Integer value) {
+            addCriterion("`identity` >", value, "identity");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdentityGreaterThanOrEqualTo(Integer value) {
+            addCriterion("`identity` >=", value, "identity");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdentityLessThan(Integer value) {
+            addCriterion("`identity` <", value, "identity");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdentityLessThanOrEqualTo(Integer value) {
+            addCriterion("`identity` <=", value, "identity");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdentityIn(List<Integer> values) {
+            addCriterion("`identity` in", values, "identity");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdentityNotIn(List<Integer> values) {
+            addCriterion("`identity` not in", values, "identity");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdentityBetween(Integer value1, Integer value2) {
+            addCriterion("`identity` between", value1, value2, "identity");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdentityNotBetween(Integer value1, Integer value2) {
+            addCriterion("`identity` not between", value1, value2, "identity");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelIsNull() {
+            addCriterion("channel is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelIsNotNull() {
+            addCriterion("channel is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelEqualTo(String value) {
+            addCriterion("channel =", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotEqualTo(String value) {
+            addCriterion("channel <>", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelGreaterThan(String value) {
+            addCriterion("channel >", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelGreaterThanOrEqualTo(String value) {
+            addCriterion("channel >=", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLessThan(String value) {
+            addCriterion("channel <", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLessThanOrEqualTo(String value) {
+            addCriterion("channel <=", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLike(String value) {
+            addCriterion("channel like", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotLike(String value) {
+            addCriterion("channel not like", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelIn(List<String> values) {
+            addCriterion("channel in", values, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotIn(List<String> values) {
+            addCriterion("channel not in", values, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelBetween(String value1, String value2) {
+            addCriterion("channel between", value1, value2, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotBetween(String value1, String value2) {
+            addCriterion("channel not between", value1, value2, "channel");
+            return (Criteria) this;
+        }
+
         public Criteria andContactNameIsNull() {
             addCriterion("contact_name is null");
             return (Criteria) this;

+ 11 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformGzhAccount.java

@@ -9,6 +9,8 @@ public class ContentPlatformGzhAccount {
 
     private String externalId;
 
+    private String contentType;
+
     private Integer status;
 
     private Long createAccountId;
@@ -49,6 +51,14 @@ public class ContentPlatformGzhAccount {
         this.externalId = externalId;
     }
 
+    public String getContentType() {
+        return contentType;
+    }
+
+    public void setContentType(String contentType) {
+        this.contentType = contentType;
+    }
+
     public Integer getStatus() {
         return status;
     }
@@ -91,6 +101,7 @@ public class ContentPlatformGzhAccount {
         sb.append(", name=").append(name);
         sb.append(", ghId=").append(ghId);
         sb.append(", externalId=").append(externalId);
+        sb.append(", contentType=").append(contentType);
         sb.append(", status=").append(status);
         sb.append(", createAccountId=").append(createAccountId);
         sb.append(", createTimestamp=").append(createTimestamp);

+ 70 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformGzhAccountExample.java

@@ -385,6 +385,76 @@ public class ContentPlatformGzhAccountExample {
             return (Criteria) this;
         }
 
+        public Criteria andContentTypeIsNull() {
+            addCriterion("content_type is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentTypeIsNotNull() {
+            addCriterion("content_type is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentTypeEqualTo(String value) {
+            addCriterion("content_type =", value, "contentType");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentTypeNotEqualTo(String value) {
+            addCriterion("content_type <>", value, "contentType");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentTypeGreaterThan(String value) {
+            addCriterion("content_type >", value, "contentType");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentTypeGreaterThanOrEqualTo(String value) {
+            addCriterion("content_type >=", value, "contentType");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentTypeLessThan(String value) {
+            addCriterion("content_type <", value, "contentType");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentTypeLessThanOrEqualTo(String value) {
+            addCriterion("content_type <=", value, "contentType");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentTypeLike(String value) {
+            addCriterion("content_type like", value, "contentType");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentTypeNotLike(String value) {
+            addCriterion("content_type not like", value, "contentType");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentTypeIn(List<String> values) {
+            addCriterion("content_type in", values, "contentType");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentTypeNotIn(List<String> values) {
+            addCriterion("content_type not in", values, "contentType");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentTypeBetween(String value1, String value2) {
+            addCriterion("content_type between", value1, value2, "contentType");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentTypeNotBetween(String value1, String value2) {
+            addCriterion("content_type not between", value1, value2, "contentType");
+            return (Criteria) this;
+        }
+
         public Criteria andStatusIsNull() {
             addCriterion("`status` is null");
             return (Criteria) this;

+ 6 - 6
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformVerifyCode.java

@@ -3,7 +3,7 @@ package com.tzld.piaoquan.api.model.po.contentplatform;
 public class ContentPlatformVerifyCode {
     private Long id;
 
-    private Long accountId;
+    private String telNum;
 
     private Integer type;
 
@@ -21,12 +21,12 @@ public class ContentPlatformVerifyCode {
         this.id = id;
     }
 
-    public Long getAccountId() {
-        return accountId;
+    public String getTelNum() {
+        return telNum;
     }
 
-    public void setAccountId(Long accountId) {
-        this.accountId = accountId;
+    public void setTelNum(String telNum) {
+        this.telNum = telNum;
     }
 
     public Integer getType() {
@@ -68,7 +68,7 @@ public class ContentPlatformVerifyCode {
         sb.append(" [");
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
-        sb.append(", accountId=").append(accountId);
+        sb.append(", telNum=").append(telNum);
         sb.append(", type=").append(type);
         sb.append(", code=").append(code);
         sb.append(", exprieTime=").append(exprieTime);

+ 34 - 24
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformVerifyCodeExample.java

@@ -175,63 +175,73 @@ public class ContentPlatformVerifyCodeExample {
             return (Criteria) this;
         }
 
-        public Criteria andAccountIdIsNull() {
-            addCriterion("account_id is null");
+        public Criteria andTelNumIsNull() {
+            addCriterion("tel_num is null");
             return (Criteria) this;
         }
 
-        public Criteria andAccountIdIsNotNull() {
-            addCriterion("account_id is not null");
+        public Criteria andTelNumIsNotNull() {
+            addCriterion("tel_num is not null");
             return (Criteria) this;
         }
 
-        public Criteria andAccountIdEqualTo(Long value) {
-            addCriterion("account_id =", value, "accountId");
+        public Criteria andTelNumEqualTo(String value) {
+            addCriterion("tel_num =", value, "telNum");
             return (Criteria) this;
         }
 
-        public Criteria andAccountIdNotEqualTo(Long value) {
-            addCriterion("account_id <>", value, "accountId");
+        public Criteria andTelNumNotEqualTo(String value) {
+            addCriterion("tel_num <>", value, "telNum");
             return (Criteria) this;
         }
 
-        public Criteria andAccountIdGreaterThan(Long value) {
-            addCriterion("account_id >", value, "accountId");
+        public Criteria andTelNumGreaterThan(String value) {
+            addCriterion("tel_num >", value, "telNum");
             return (Criteria) this;
         }
 
-        public Criteria andAccountIdGreaterThanOrEqualTo(Long value) {
-            addCriterion("account_id >=", value, "accountId");
+        public Criteria andTelNumGreaterThanOrEqualTo(String value) {
+            addCriterion("tel_num >=", value, "telNum");
             return (Criteria) this;
         }
 
-        public Criteria andAccountIdLessThan(Long value) {
-            addCriterion("account_id <", value, "accountId");
+        public Criteria andTelNumLessThan(String value) {
+            addCriterion("tel_num <", value, "telNum");
             return (Criteria) this;
         }
 
-        public Criteria andAccountIdLessThanOrEqualTo(Long value) {
-            addCriterion("account_id <=", value, "accountId");
+        public Criteria andTelNumLessThanOrEqualTo(String value) {
+            addCriterion("tel_num <=", value, "telNum");
             return (Criteria) this;
         }
 
-        public Criteria andAccountIdIn(List<Long> values) {
-            addCriterion("account_id in", values, "accountId");
+        public Criteria andTelNumLike(String value) {
+            addCriterion("tel_num like", value, "telNum");
             return (Criteria) this;
         }
 
-        public Criteria andAccountIdNotIn(List<Long> values) {
-            addCriterion("account_id not in", values, "accountId");
+        public Criteria andTelNumNotLike(String value) {
+            addCriterion("tel_num not like", value, "telNum");
             return (Criteria) this;
         }
 
-        public Criteria andAccountIdBetween(Long value1, Long value2) {
-            addCriterion("account_id between", value1, value2, "accountId");
+        public Criteria andTelNumIn(List<String> values) {
+            addCriterion("tel_num in", values, "telNum");
             return (Criteria) this;
         }
 
-        public Criteria andAccountIdNotBetween(Long value1, Long value2) {
-            addCriterion("account_id not between", value1, value2, "accountId");
+        public Criteria andTelNumNotIn(List<String> values) {
+            addCriterion("tel_num not in", values, "telNum");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelNumBetween(String value1, String value2) {
+            addCriterion("tel_num between", value1, value2, "telNum");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelNumNotBetween(String value1, String value2) {
+            addCriterion("tel_num not between", value1, value2, "telNum");
             return (Criteria) this;
         }
 

+ 0 - 2
api-module/src/main/java/com/tzld/piaoquan/api/model/vo/contentplatform/AccountVO.java

@@ -18,8 +18,6 @@ public class AccountVO {
 	private String contactName;
 	@ApiModelProperty(value = "手机号")
 	private String telNum;
-	@ApiModelProperty(value = "密码")
-	private String password;
 	@ApiModelProperty(value = "创建时间")
 	private Long createTimestamp;
 

+ 2 - 1
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformAccountService.java

@@ -3,6 +3,7 @@ package com.tzld.piaoquan.api.service.contentplatform;
 import com.tzld.piaoquan.api.model.param.contentplatform.*;
 import com.tzld.piaoquan.api.model.vo.contentplatform.AccountLoginVO;
 import com.tzld.piaoquan.api.model.vo.contentplatform.AccountVO;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
 
 import java.util.List;
 
@@ -11,7 +12,7 @@ public interface ContentPlatformAccountService {
 
     void sendMessageVerifyCode(AccountSendMessageParam param);
 
-    List<AccountVO> pageAccount(AccountListParam param);
+    Page<AccountVO> pageAccount(AccountListParam param);
 
     void accountForbidden(AccountForbiddenParam param);
 

+ 2 - 1
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformCooperateAccountService.java

@@ -7,11 +7,12 @@ import com.tzld.piaoquan.api.model.vo.contentplatform.CooperateAccountItemVO;
 import com.tzld.piaoquan.api.model.vo.contentplatform.GenerateQrcodeVO;
 import com.tzld.piaoquan.api.model.vo.contentplatform.GzhAccountItem;
 import com.tzld.piaoquan.api.model.vo.contentplatform.GzhAuthResultVO;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
 
 import java.util.List;
 
 public interface ContentPlatformCooperateAccountService {
-    List<CooperateAccountItemVO> gzhList(CooperateAccountListParam param);
+    Page<CooperateAccountItemVO> gzhList(CooperateAccountListParam param);
 
     void gzhSave(CooperateAccountSaveParam param);
 

+ 3 - 2
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformDatastatService.java

@@ -4,13 +4,14 @@ import com.tzld.piaoquan.api.model.param.contentplatform.GzhDatastatListParam;
 import com.tzld.piaoquan.api.model.param.contentplatform.QwDatastatListParam;
 import com.tzld.piaoquan.api.model.vo.contentplatform.GzhDatastatItemVO;
 import com.tzld.piaoquan.api.model.vo.contentplatform.QwDatastatItemVO;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
 
 import java.util.List;
 
 public interface ContentPlatformDatastatService {
-    List<GzhDatastatItemVO> gzhDatastatList(GzhDatastatListParam param);
+    Page<GzhDatastatItemVO> gzhDatastatList(GzhDatastatListParam param);
 
-    List<QwDatastatItemVO> qwDatastatList(QwDatastatListParam param);
+    Page<QwDatastatItemVO> qwDatastatList(QwDatastatListParam param);
 
     String gzhDatastatExport(GzhDatastatListParam param);
 

+ 4 - 3
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformPlanService.java

@@ -4,19 +4,20 @@ import com.tzld.piaoquan.api.model.param.contentplatform.*;
 import com.tzld.piaoquan.api.model.vo.contentplatform.GzhPlanItemVO;
 import com.tzld.piaoquan.api.model.vo.contentplatform.QwPlanItemVO;
 import com.tzld.piaoquan.api.model.vo.contentplatform.VideoContentItemVO;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
 
 import java.util.List;
 
 public interface ContentPlatformPlanService {
-    List<GzhPlanItemVO> gzhPlanList(GzhPlanListParam param);
+    Page<GzhPlanItemVO> gzhPlanList(GzhPlanListParam param);
 
     void gzhPlanSave(GzhPlanSaveParam param);
 
-    List<VideoContentItemVO> getVideoContentList(VideoContentListParam param);
+    Page<VideoContentItemVO> getVideoContentList(VideoContentListParam param);
 
     List<String> getVideoContentCoverFrameList(VideoContentCoverFrameParam param);
 
-    List<QwPlanItemVO> qwPlanList(QwPlanListParam param);
+    Page<QwPlanItemVO> qwPlanList(QwPlanListParam param);
 
     void qwPlanSave(QwPlanSaveParam param);
 }

+ 166 - 7
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformAccountServiceImpl.java

@@ -1,37 +1,196 @@
 package com.tzld.piaoquan.api.service.contentplatform.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.tzld.piaoquan.api.common.enums.ExceptionEnum;
+import com.tzld.piaoquan.api.common.enums.contentplatform.AccountStatusEnum;
+import com.tzld.piaoquan.api.common.exception.CommonException;
+import com.tzld.piaoquan.api.config.JwtInterceptor;
+import com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformAccountMapper;
+import com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformVerifyCodeMapper;
+import com.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformAccountMapperExt;
 import com.tzld.piaoquan.api.model.param.contentplatform.*;
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount;
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccountExample;
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVerifyCode;
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVerifyCodeExample;
 import com.tzld.piaoquan.api.model.vo.contentplatform.AccountLoginVO;
 import com.tzld.piaoquan.api.model.vo.contentplatform.AccountVO;
 import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformAccountService;
+import com.tzld.piaoquan.growth.common.utils.Md5Util;
+import com.tzld.piaoquan.growth.common.utils.RedisUtils;
+import com.tzld.piaoquan.growth.common.utils.SendShortMessageUtil;
+import com.tzld.piaoquan.growth.common.utils.VerificationCodeGenerator;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
-import java.util.List;
+import java.util.*;
 
 @Service
 public class ContentPlatformAccountServiceImpl implements ContentPlatformAccountService {
+
+    @Autowired
+    ContentPlatformAccountMapper accountMapper;
+    @Autowired
+    ContentPlatformAccountMapperExt accountMapperExt;
+    @Autowired
+    ContentPlatformVerifyCodeMapper verifyCodeMapper;
+
+    @Autowired
+    private RedisUtils redisUtils;
+
     @Override
     public AccountLoginVO login(AccountLoginParam param) {
-        return null;
+        ContentPlatformAccount account = getAccountByTelNum(param.getTelNum());
+        if (Objects.isNull(account)) {
+            throw new CommonException(ExceptionEnum.ACCOUNT_NOT_EXISTS_WRONG);
+        }
+        Long now = System.currentTimeMillis();
+        if (StringUtils.hasText(param.getPassword())) {
+            String password = Arrays.toString(Base64.getDecoder().decode(param.getPassword()));
+            String md5Password = Md5Util.encoderByMd5(password);
+            if (!account.getPassword().equals(md5Password)) {
+                throw new CommonException(ExceptionEnum.LOGIN_PASSWORD_WRONG);
+            }
+        } else if (StringUtils.hasText(param.getVerifyCode())) {
+            ContentPlatformVerifyCodeExample example = new ContentPlatformVerifyCodeExample();
+            example.createCriteria().andTelNumEqualTo(param.getTelNum()).andCodeEqualTo(param.getVerifyCode());
+            example.setOrderByClause("id desc");
+            List<ContentPlatformVerifyCode> verifyCodeList = verifyCodeMapper.selectByExample(example);
+            if (CollectionUtils.isEmpty(verifyCodeList)) {
+                throw new CommonException(ExceptionEnum.EMAIL_VERIFY_CODE_NOT_EXIST);
+            }
+            ContentPlatformVerifyCode verifyCode = verifyCodeList.get(0);
+            if (verifyCode.getExprieTime() < now) {
+                throw new CommonException(ExceptionEnum.EMAIL_VERIFY_CODE_EXPIRED);
+            }
+            if (verifyCode.getStatus() == 1) {
+                throw new CommonException(ExceptionEnum.EMAIL_VERIFY_CODE_USED);
+            }
+        }
+        String token = UUID.randomUUID().toString().replace("-", "");
+
+        AccountLoginVO result = new AccountLoginVO();
+        BeanUtils.copyProperties(account, result);
+        result.setToken(token);
+
+        saveTokenToRedis(result, account.getToken(), token);
+        account.setToken(token);
+        account.setTokenExpireTimestamp(now + 7 * 24 * 60 * 60 * 1000L);
+        accountMapper.updateByPrimaryKey(account);
+        return result;
+    }
+
+    private ContentPlatformAccount getAccountByTelNum(String telNum) {
+        ContentPlatformAccountExample example = new ContentPlatformAccountExample();
+        example.createCriteria().andTelNumEqualTo(telNum);
+        List<ContentPlatformAccount> accountList = accountMapper.selectByExample(example);
+        if (CollectionUtils.isEmpty(accountList)) {
+            return null;
+        }
+        return accountList.get(0);
+    }
+
+    private void saveTokenToRedis(AccountLoginVO loginInfo, String oldToken, String token) {
+        // 清除老token
+        String info = redisUtils.getString(JwtInterceptor.TOKEN_PREFIX.replace("{token}", oldToken));
+        if (StringUtils.hasText(info)) {
+            redisUtils.del(JwtInterceptor.TOKEN_PREFIX.replace("{token}", oldToken));
+        }
+        String redisKey = JwtInterceptor.TOKEN_PREFIX.replace("{token}", token);
+        redisUtils.setValueWithExpire(redisKey, JSON.toJSONString(loginInfo), 7 * 24 * 60 * 60L);
     }
 
     @Override
     public void sendMessageVerifyCode(AccountSendMessageParam param) {
-
+        String verifyCode = VerificationCodeGenerator.generateVerificationCode(6);
+//        SendShortMessageUtil.sendVerifyCode(param.getTelNum(), verifyCode);
+        ContentPlatformVerifyCode verifyCodePO = new ContentPlatformVerifyCode();
+        verifyCodePO.setTelNum(param.getTelNum());
+        verifyCodePO.setCode(verifyCode);
+        verifyCodePO.setExprieTime(System.currentTimeMillis() + 10 * 60 * 1000L);
+        verifyCodeMapper.insertSelective(verifyCodePO);
     }
 
     @Override
-    public List<AccountVO> pageAccount(AccountListParam param) {
-        return null;
+    public Page<AccountVO> pageAccount(AccountListParam param) {
+        Page<AccountVO> result = new Page<>(param.getPageNum(), param.getPageSize());
+        int offset = (param.getPageNum() - 1) * param.getPageSize();
+        int count = accountMapperExt.getAccountCount(param);
+        if (count == 0) {
+            return result;
+        }
+        List<ContentPlatformAccount> accountList = accountMapperExt.getAccountList(param, offset, param.getPageSize());
+        List<AccountVO> list = buildAccountVOList(accountList);
+        result.setTotalSize(count);
+        result.setObjs(list);
+        return result;
+    }
+
+    private List<AccountVO> buildAccountVOList(List<ContentPlatformAccount> accountList) {
+        if (CollectionUtils.isEmpty(accountList)) {
+            return null;
+        }
+        List<AccountVO> result = new ArrayList<>();
+        for (ContentPlatformAccount account : accountList) {
+            AccountVO accountVO = new AccountVO();
+            accountVO.setId(account.getId());
+            accountVO.setName(account.getName());
+            accountVO.setIdentity(account.getIdentity());
+            accountVO.setChannel(account.getChannel());
+            accountVO.setContactName(account.getContactName());
+            accountVO.setTelNum(account.getTelNum());
+            accountVO.setCreateTimestamp(account.getCreateTimestamp());
+            result.add(accountVO);
+        }
+        return result;
     }
 
     @Override
     public void accountForbidden(AccountForbiddenParam param) {
-
+        ContentPlatformAccount account = accountMapper.selectByPrimaryKey(param.getId());
+        if (Objects.isNull(account)) {
+            throw new CommonException(ExceptionEnum.ACCOUNT_NOT_EXISTS_WRONG);
+        }
+        account.setStatus(AccountStatusEnum.FORBIDDEN.getVal());
+        account.setUpdateAccount(param.getOperator());
+        account.setUpdateTimestamp(System.currentTimeMillis());
+        accountMapper.updateByPrimaryKey(account);
     }
 
     @Override
     public void saveAccount(AccountSaveParam param) {
-
+        List<ContentPlatformAccount> telNumExistList = accountMapperExt.getTelNumExists(param.getId(), param.getTelNum());
+        if (CollectionUtils.isNotEmpty(telNumExistList)) {
+            throw new CommonException(ExceptionEnum.TEL_NUM_EXISTS_WRONG);
+        }
+        List<ContentPlatformAccount> channelExistsList = accountMapperExt.getChannelExists(param.getId(), param.getChannel());
+        if (CollectionUtils.isNotEmpty(channelExistsList)) {
+            throw new CommonException(ExceptionEnum.CHANNEL_EXISTS_WRONG);
+        }
+        Long now = System.currentTimeMillis();
+        ContentPlatformAccount account = new ContentPlatformAccount();
+        account.setName(param.getName());
+        account.setIdentity(param.getIdentity());
+        account.setChannel(param.getChannel());
+        account.setContactName(param.getContactName());
+        account.setTelNum(param.getTelNum());
+        if (StringUtils.hasText(param.getPassword())) {
+            String password = Arrays.toString(Base64.getDecoder().decode(param.getPassword()));
+            account.setPassword(Md5Util.encoderByMd5(password));
+        }
+        account.setUpdateAccount(param.getOperator());
+        account.setUpdateTimestamp(now);
+        if (Objects.isNull(param.getId())) {
+            account.setCreateAccount(param.getOperator());
+            account.setCreateTimestamp(now);
+            accountMapper.insertSelective(account);
+        } else {
+            account.setId(param.getId());
+            accountMapper.updateByPrimaryKey(account);
+        }
     }
 }

+ 2 - 1
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformCooperateAccountServiceImpl.java

@@ -8,6 +8,7 @@ import com.tzld.piaoquan.api.model.vo.contentplatform.GenerateQrcodeVO;
 import com.tzld.piaoquan.api.model.vo.contentplatform.GzhAccountItem;
 import com.tzld.piaoquan.api.model.vo.contentplatform.GzhAuthResultVO;
 import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformCooperateAccountService;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -15,7 +16,7 @@ import java.util.List;
 @Service
 public class ContentPlatformCooperateAccountServiceImpl implements ContentPlatformCooperateAccountService {
     @Override
-    public List<CooperateAccountItemVO> gzhList(CooperateAccountListParam param) {
+    public Page<CooperateAccountItemVO> gzhList(CooperateAccountListParam param) {
         return null;
     }
 

+ 3 - 2
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformDatastatServiceImpl.java

@@ -5,6 +5,7 @@ import com.tzld.piaoquan.api.model.param.contentplatform.QwDatastatListParam;
 import com.tzld.piaoquan.api.model.vo.contentplatform.GzhDatastatItemVO;
 import com.tzld.piaoquan.api.model.vo.contentplatform.QwDatastatItemVO;
 import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformDatastatService;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
 import lombok.Data;
 import org.springframework.stereotype.Service;
 
@@ -13,12 +14,12 @@ import java.util.List;
 @Service
 public class ContentPlatformDatastatServiceImpl implements ContentPlatformDatastatService {
     @Override
-    public List<GzhDatastatItemVO> gzhDatastatList(GzhDatastatListParam param) {
+    public Page<GzhDatastatItemVO> gzhDatastatList(GzhDatastatListParam param) {
         return null;
     }
 
     @Override
-    public List<QwDatastatItemVO> qwDatastatList(QwDatastatListParam param) {
+    public Page<QwDatastatItemVO> qwDatastatList(QwDatastatListParam param) {
         return null;
     }
 

+ 4 - 3
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java

@@ -5,6 +5,7 @@ import com.tzld.piaoquan.api.model.vo.contentplatform.GzhPlanItemVO;
 import com.tzld.piaoquan.api.model.vo.contentplatform.QwPlanItemVO;
 import com.tzld.piaoquan.api.model.vo.contentplatform.VideoContentItemVO;
 import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformPlanService;
+import com.tzld.piaoquan.growth.common.utils.page.Page;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -12,7 +13,7 @@ import java.util.List;
 @Service
 public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanService {
     @Override
-    public List<GzhPlanItemVO> gzhPlanList(GzhPlanListParam param) {
+    public Page<GzhPlanItemVO> gzhPlanList(GzhPlanListParam param) {
         return null;
     }
 
@@ -22,7 +23,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     }
 
     @Override
-    public List<VideoContentItemVO> getVideoContentList(VideoContentListParam param) {
+    public Page<VideoContentItemVO> getVideoContentList(VideoContentListParam param) {
         return null;
     }
 
@@ -32,7 +33,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     }
 
     @Override
-    public List<QwPlanItemVO> qwPlanList(QwPlanListParam param) {
+    public Page<QwPlanItemVO> qwPlanList(QwPlanListParam param) {
         return null;
     }
 

+ 42 - 12
api-module/src/main/resources/mapper/contentplatform/ContentPlatformAccountMapper.xml

@@ -4,6 +4,8 @@
   <resultMap id="BaseResultMap" type="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount">
     <id column="id" jdbcType="BIGINT" property="id" />
     <result column="name" jdbcType="VARCHAR" property="name" />
+    <result column="identity" jdbcType="INTEGER" property="identity" />
+    <result column="channel" jdbcType="VARCHAR" property="channel" />
     <result column="contact_name" jdbcType="VARCHAR" property="contactName" />
     <result column="tel_num" jdbcType="VARCHAR" property="telNum" />
     <result column="password" jdbcType="VARCHAR" property="password" />
@@ -74,8 +76,8 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, `name`, contact_name, tel_num, `password`, token, token_expire_timestamp, `status`, 
-    create_account, create_timestamp, update_account, update_timestamp
+    id, `name`, `identity`, channel, contact_name, tel_num, `password`, token, token_expire_timestamp, 
+    `status`, create_account, create_timestamp, update_account, update_timestamp
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccountExample" resultMap="BaseResultMap">
     select
@@ -111,16 +113,16 @@
     </if>
   </delete>
   <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount">
-    insert into content_platform_account (id, `name`, contact_name, 
-      tel_num, `password`, token, 
-      token_expire_timestamp, `status`, create_account, 
-      create_timestamp, update_account, update_timestamp
-      )
-    values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{contactName,jdbcType=VARCHAR}, 
-      #{telNum,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{token,jdbcType=VARCHAR}, 
-      #{tokenExpireTimestamp,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}, #{createAccount,jdbcType=VARCHAR}, 
-      #{createTimestamp,jdbcType=BIGINT}, #{updateAccount,jdbcType=VARCHAR}, #{updateTimestamp,jdbcType=BIGINT}
-      )
+    insert into content_platform_account (id, `name`, `identity`, 
+      channel, contact_name, tel_num, 
+      `password`, token, token_expire_timestamp, 
+      `status`, create_account, create_timestamp, 
+      update_account, update_timestamp)
+    values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{identity,jdbcType=INTEGER}, 
+      #{channel,jdbcType=VARCHAR}, #{contactName,jdbcType=VARCHAR}, #{telNum,jdbcType=VARCHAR}, 
+      #{password,jdbcType=VARCHAR}, #{token,jdbcType=VARCHAR}, #{tokenExpireTimestamp,jdbcType=BIGINT}, 
+      #{status,jdbcType=INTEGER}, #{createAccount,jdbcType=VARCHAR}, #{createTimestamp,jdbcType=BIGINT}, 
+      #{updateAccount,jdbcType=VARCHAR}, #{updateTimestamp,jdbcType=BIGINT})
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount">
     insert into content_platform_account
@@ -131,6 +133,12 @@
       <if test="name != null">
         `name`,
       </if>
+      <if test="identity != null">
+        `identity`,
+      </if>
+      <if test="channel != null">
+        channel,
+      </if>
       <if test="contactName != null">
         contact_name,
       </if>
@@ -169,6 +177,12 @@
       <if test="name != null">
         #{name,jdbcType=VARCHAR},
       </if>
+      <if test="identity != null">
+        #{identity,jdbcType=INTEGER},
+      </if>
+      <if test="channel != null">
+        #{channel,jdbcType=VARCHAR},
+      </if>
       <if test="contactName != null">
         #{contactName,jdbcType=VARCHAR},
       </if>
@@ -216,6 +230,12 @@
       <if test="record.name != null">
         `name` = #{record.name,jdbcType=VARCHAR},
       </if>
+      <if test="record.identity != null">
+        `identity` = #{record.identity,jdbcType=INTEGER},
+      </if>
+      <if test="record.channel != null">
+        channel = #{record.channel,jdbcType=VARCHAR},
+      </if>
       <if test="record.contactName != null">
         contact_name = #{record.contactName,jdbcType=VARCHAR},
       </if>
@@ -255,6 +275,8 @@
     update content_platform_account
     set id = #{record.id,jdbcType=BIGINT},
       `name` = #{record.name,jdbcType=VARCHAR},
+      `identity` = #{record.identity,jdbcType=INTEGER},
+      channel = #{record.channel,jdbcType=VARCHAR},
       contact_name = #{record.contactName,jdbcType=VARCHAR},
       tel_num = #{record.telNum,jdbcType=VARCHAR},
       `password` = #{record.password,jdbcType=VARCHAR},
@@ -275,6 +297,12 @@
       <if test="name != null">
         `name` = #{name,jdbcType=VARCHAR},
       </if>
+      <if test="identity != null">
+        `identity` = #{identity,jdbcType=INTEGER},
+      </if>
+      <if test="channel != null">
+        channel = #{channel,jdbcType=VARCHAR},
+      </if>
       <if test="contactName != null">
         contact_name = #{contactName,jdbcType=VARCHAR},
       </if>
@@ -311,6 +339,8 @@
   <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount">
     update content_platform_account
     set `name` = #{name,jdbcType=VARCHAR},
+      `identity` = #{identity,jdbcType=INTEGER},
+      channel = #{channel,jdbcType=VARCHAR},
       contact_name = #{contactName,jdbcType=VARCHAR},
       tel_num = #{telNum,jdbcType=VARCHAR},
       `password` = #{password,jdbcType=VARCHAR},

+ 23 - 5
api-module/src/main/resources/mapper/contentplatform/ContentPlatformGzhAccountMapper.xml

@@ -6,6 +6,7 @@
     <result column="name" jdbcType="VARCHAR" property="name" />
     <result column="gh_id" jdbcType="VARCHAR" property="ghId" />
     <result column="external_id" jdbcType="VARCHAR" property="externalId" />
+    <result column="content_type" jdbcType="VARCHAR" property="contentType" />
     <result column="status" jdbcType="INTEGER" property="status" />
     <result column="create_account_id" jdbcType="BIGINT" property="createAccountId" />
     <result column="create_timestamp" jdbcType="BIGINT" property="createTimestamp" />
@@ -70,7 +71,8 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, `name`, gh_id, external_id, `status`, create_account_id, create_timestamp, update_timestamp
+    id, `name`, gh_id, external_id, content_type, `status`, create_account_id, create_timestamp, 
+    update_timestamp
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhAccountExample" resultMap="BaseResultMap">
     select
@@ -107,11 +109,13 @@
   </delete>
   <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhAccount">
     insert into content_platform_gzh_account (id, `name`, gh_id, 
-      external_id, `status`, create_account_id, 
-      create_timestamp, update_timestamp)
+      external_id, content_type, `status`, 
+      create_account_id, create_timestamp, update_timestamp
+      )
     values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{ghId,jdbcType=VARCHAR}, 
-      #{externalId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createAccountId,jdbcType=BIGINT}, 
-      #{createTimestamp,jdbcType=BIGINT}, #{updateTimestamp,jdbcType=BIGINT})
+      #{externalId,jdbcType=VARCHAR}, #{contentType,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, 
+      #{createAccountId,jdbcType=BIGINT}, #{createTimestamp,jdbcType=BIGINT}, #{updateTimestamp,jdbcType=BIGINT}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhAccount">
     insert into content_platform_gzh_account
@@ -128,6 +132,9 @@
       <if test="externalId != null">
         external_id,
       </if>
+      <if test="contentType != null">
+        content_type,
+      </if>
       <if test="status != null">
         `status`,
       </if>
@@ -154,6 +161,9 @@
       <if test="externalId != null">
         #{externalId,jdbcType=VARCHAR},
       </if>
+      <if test="contentType != null">
+        #{contentType,jdbcType=VARCHAR},
+      </if>
       <if test="status != null">
         #{status,jdbcType=INTEGER},
       </if>
@@ -189,6 +199,9 @@
       <if test="record.externalId != null">
         external_id = #{record.externalId,jdbcType=VARCHAR},
       </if>
+      <if test="record.contentType != null">
+        content_type = #{record.contentType,jdbcType=VARCHAR},
+      </if>
       <if test="record.status != null">
         `status` = #{record.status,jdbcType=INTEGER},
       </if>
@@ -212,6 +225,7 @@
       `name` = #{record.name,jdbcType=VARCHAR},
       gh_id = #{record.ghId,jdbcType=VARCHAR},
       external_id = #{record.externalId,jdbcType=VARCHAR},
+      content_type = #{record.contentType,jdbcType=VARCHAR},
       `status` = #{record.status,jdbcType=INTEGER},
       create_account_id = #{record.createAccountId,jdbcType=BIGINT},
       create_timestamp = #{record.createTimestamp,jdbcType=BIGINT},
@@ -232,6 +246,9 @@
       <if test="externalId != null">
         external_id = #{externalId,jdbcType=VARCHAR},
       </if>
+      <if test="contentType != null">
+        content_type = #{contentType,jdbcType=VARCHAR},
+      </if>
       <if test="status != null">
         `status` = #{status,jdbcType=INTEGER},
       </if>
@@ -252,6 +269,7 @@
     set `name` = #{name,jdbcType=VARCHAR},
       gh_id = #{ghId,jdbcType=VARCHAR},
       external_id = #{externalId,jdbcType=VARCHAR},
+      content_type = #{contentType,jdbcType=VARCHAR},
       `status` = #{status,jdbcType=INTEGER},
       create_account_id = #{createAccountId,jdbcType=BIGINT},
       create_timestamp = #{createTimestamp,jdbcType=BIGINT},

+ 14 - 14
api-module/src/main/resources/mapper/contentplatform/ContentPlatformVerifyCodeMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformVerifyCodeMapper">
   <resultMap id="BaseResultMap" type="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVerifyCode">
     <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="account_id" jdbcType="BIGINT" property="accountId" />
+    <result column="tel_num" jdbcType="VARCHAR" property="telNum" />
     <result column="type" jdbcType="INTEGER" property="type" />
     <result column="code" jdbcType="VARCHAR" property="code" />
     <result column="exprie_time" jdbcType="BIGINT" property="exprieTime" />
@@ -68,7 +68,7 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, account_id, `type`, code, exprie_time, `status`
+    id, tel_num, `type`, code, exprie_time, `status`
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVerifyCodeExample" resultMap="BaseResultMap">
     select
@@ -104,10 +104,10 @@
     </if>
   </delete>
   <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVerifyCode">
-    insert into content_platform_verify_code (id, account_id, `type`, 
+    insert into content_platform_verify_code (id, tel_num, `type`, 
       code, exprie_time, `status`
       )
-    values (#{id,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT}, #{type,jdbcType=INTEGER}, 
+    values (#{id,jdbcType=BIGINT}, #{telNum,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, 
       #{code,jdbcType=VARCHAR}, #{exprieTime,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}
       )
   </insert>
@@ -117,8 +117,8 @@
       <if test="id != null">
         id,
       </if>
-      <if test="accountId != null">
-        account_id,
+      <if test="telNum != null">
+        tel_num,
       </if>
       <if test="type != null">
         `type`,
@@ -137,8 +137,8 @@
       <if test="id != null">
         #{id,jdbcType=BIGINT},
       </if>
-      <if test="accountId != null">
-        #{accountId,jdbcType=BIGINT},
+      <if test="telNum != null">
+        #{telNum,jdbcType=VARCHAR},
       </if>
       <if test="type != null">
         #{type,jdbcType=INTEGER},
@@ -166,8 +166,8 @@
       <if test="record.id != null">
         id = #{record.id,jdbcType=BIGINT},
       </if>
-      <if test="record.accountId != null">
-        account_id = #{record.accountId,jdbcType=BIGINT},
+      <if test="record.telNum != null">
+        tel_num = #{record.telNum,jdbcType=VARCHAR},
       </if>
       <if test="record.type != null">
         `type` = #{record.type,jdbcType=INTEGER},
@@ -189,7 +189,7 @@
   <update id="updateByExample" parameterType="map">
     update content_platform_verify_code
     set id = #{record.id,jdbcType=BIGINT},
-      account_id = #{record.accountId,jdbcType=BIGINT},
+      tel_num = #{record.telNum,jdbcType=VARCHAR},
       `type` = #{record.type,jdbcType=INTEGER},
       code = #{record.code,jdbcType=VARCHAR},
       exprie_time = #{record.exprieTime,jdbcType=BIGINT},
@@ -201,8 +201,8 @@
   <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVerifyCode">
     update content_platform_verify_code
     <set>
-      <if test="accountId != null">
-        account_id = #{accountId,jdbcType=BIGINT},
+      <if test="telNum != null">
+        tel_num = #{telNum,jdbcType=VARCHAR},
       </if>
       <if test="type != null">
         `type` = #{type,jdbcType=INTEGER},
@@ -221,7 +221,7 @@
   </update>
   <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVerifyCode">
     update content_platform_verify_code
-    set account_id = #{accountId,jdbcType=BIGINT},
+    set tel_num = #{telNum,jdbcType=VARCHAR},
       `type` = #{type,jdbcType=INTEGER},
       code = #{code,jdbcType=VARCHAR},
       exprie_time = #{exprieTime,jdbcType=BIGINT},

+ 40 - 0
api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformAccountMapperExt.xml

@@ -0,0 +1,40 @@
+<?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="com.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformAccountMapperExt">
+
+
+    <select id="getTelNumExists"
+            resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount">
+        select *
+        from content_platform_account
+        where tel_num = #{telNum}
+        <if test="id != null">
+            and id != #{id}
+        </if>
+        limit 1
+    </select>
+
+    <select id="getChannelExists"
+            resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount">
+        select *
+        from content_platform_account
+        where channel = #{channel}
+        <if test="id != null">
+            and id != #{id}
+        </if>
+        limit 1
+    </select>
+
+    <select id="getAccountCount" resultType="java.lang.Integer">
+        select count(1)
+        from content_platform_account
+    </select>
+
+    <select id="getAccountList"
+            resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount">
+        select *
+        from content_platform_account
+        limit #{offset}, #{pageSize}
+    </select>
+
+</mapper>

+ 72 - 0
common-module/src/main/java/com/tzld/piaoquan/growth/common/utils/Md5Util.java

@@ -0,0 +1,72 @@
+package com.tzld.piaoquan.growth.common.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.MessageDigest;
+
+public class Md5Util {
+	static char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };  
+	
+	public static final String encoderByMd5(String msg) {
+		try {
+			byte[] strTemp = msg.getBytes();
+            //如果输入“SHA”,就是实现SHA加密。
+			MessageDigest mdTemp = MessageDigest.getInstance("MD5"); 
+			mdTemp.update(strTemp);
+			byte[] md = mdTemp.digest();
+			int j = md.length;
+			char str[] = new char[j * 2];
+			int k = 0;
+			for (int i = 0; i < j; i++) {
+				byte byte0 = md[i];
+				str[k++] = hexDigits[byte0 >>> 4 & 0xf];
+				str[k++] = hexDigits[byte0 & 0xf];
+			}
+			return new String(str);
+		} catch (Exception e) {
+			return null;
+		}
+	}
+
+	public static final String encoderFileByMd5(InputStream is){
+        try {  
+            MessageDigest md = MessageDigest.getInstance("MD5");  
+            byte[] buffer = new byte[2048];  
+            int length = -1;  
+            while ((length = is.read(buffer)) != -1) {  
+                md.update(buffer, 0, length);  
+            }  
+            byte[] b = md.digest();  
+            return byteToHexString(b);  
+        } catch (Exception e) {  
+            e.printStackTrace();  
+            return null;  
+        } finally {  
+            try {  
+                is.close();  
+            } catch (IOException e) {  
+                e.printStackTrace();  
+            }  
+        }  
+	}
+	
+	private static String byteToHexString(byte[] tmp) {  
+        String s;  
+        // 用字节表示就是 16 个字节  
+        // 每个字节用 16 进制表示的话,使用两个字符,所以表示成 16 进制需要 32 个字符  
+        // 比如一个字节为01011011,用十六进制字符来表示就是“5b”  
+        char str[] = new char[16 * 2];  
+        int k = 0; // 表示转换结果中对应的字符位置  
+        for (int i = 0; i < 16; i++) { // 从第一个字节开始,对 MD5 的每一个字节转换成 16 进制字符的转换  
+            byte byte0 = tmp[i]; // 取第 i 个字节  
+            str[k++] = hexDigits[byte0 >>> 4 & 0xf]; // 取字节中高 4 位的数字转换, >>> 为逻辑右移,将符号位一起右移  
+            str[k++] = hexDigits[byte0 & 0xf]; // 取字节中低 4 位的数字转换  
+        }  
+        s = new String(str); // 换后的结果转换为字符串  
+        return s;  
+    }  
+	
+	public static void main(String[] args) {
+		System.out.println(encoderByMd5("test1002"));
+	}
+}

+ 1 - 10
common-module/src/main/java/com/tzld/piaoquan/growth/common/utils/RedisUtils.java

@@ -55,16 +55,7 @@ public class RedisUtils {
         return longVal;
     }
 
-    public void setValueWithExpire(String key, String value, Date date) {
-        long expireTime;
-        if (date != null) {
-            expireTime = (date.getTime() - System.currentTimeMillis()) / 1000;
-            if (expireTime < 0) { // 过期时间有问题,或者小于当前时间
-                expireTime = DEFAULT_EXPIRE_TIME;
-            }
-        } else {
-            expireTime = DEFAULT_EXPIRE_TIME;
-        }
+    public void setValueWithExpire(String key, String value, Long expireTime) {
         redisTemplate.opsForValue().set(key, value, expireTime, TimeUnit.SECONDS);
     }
 

+ 7 - 0
common-module/src/main/java/com/tzld/piaoquan/growth/common/utils/SendShortMessageUtil.java

@@ -54,6 +54,13 @@ public class SendShortMessageUtil {
         client.close();
     }
 
+    public static void sendVerifyCode(String phoneNumber, String verifyCode) {
+        String templateCode = "SMS_463221247";
+        Map<String, String> params = new HashMap<>();
+        params.put("code", verifyCode);
+        sendShortMessage(phoneNumber, templateCode, params);
+    }
+
 
     public static void main(String[] args) {
         // 初始化账号密码

+ 31 - 0
common-module/src/main/java/com/tzld/piaoquan/growth/common/utils/VerificationCodeGenerator.java

@@ -0,0 +1,31 @@
+package com.tzld.piaoquan.growth.common.utils;
+
+import java.util.Random;
+
+/**
+ * 验证码生成器
+ *
+ * @author sunxy
+ */
+public class VerificationCodeGenerator {
+    public static void main(String[] args) {
+        String verificationCode = generateVerificationCode(6);
+        System.out.println("Six-digit Verification Code: " + verificationCode);
+    }
+
+    public static String generateVerificationCode(int length) {
+        if (length <= 0) {
+            throw new IllegalArgumentException("Length should be a positive integer.");
+        }
+
+        Random random = new Random();
+        StringBuilder codeBuilder = new StringBuilder();
+
+        for (int i = 0; i < length; i++) {
+            int digit = random.nextInt(10); // 生成0到9之间的随机数字
+            codeBuilder.append(digit);
+        }
+
+        return codeBuilder.toString();
+    }
+}

+ 5 - 0
pom.xml

@@ -61,6 +61,11 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-pool2</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-collections4</artifactId>
+            <version>4.1</version>
+        </dependency>
 
         <dependency>
             <groupId>org.mybatis.generator</groupId>