Browse Source

发送模板和关注公众号

master
zhizhi wu 5 years ago
parent
commit
3cdbe1bf00
  1. 6
      pom.xml
  2. 145
      src/main/java/com/ccsens/opensource/wxconfigurer/bean/dto/UserDto.java
  3. 32
      src/main/java/com/ccsens/opensource/wxconfigurer/bean/dto/WxMessageNotice.java
  4. 128
      src/main/java/com/ccsens/opensource/wxconfigurer/bean/po/SysAuth.java
  5. 831
      src/main/java/com/ccsens/opensource/wxconfigurer/bean/po/SysAuthExample.java
  6. 205
      src/main/java/com/ccsens/opensource/wxconfigurer/bean/po/SysUser.java
  7. 1311
      src/main/java/com/ccsens/opensource/wxconfigurer/bean/po/SysUserExample.java
  8. 5
      src/main/java/com/ccsens/opensource/wxconfigurer/config/DruidProps.java
  9. 30
      src/main/java/com/ccsens/opensource/wxconfigurer/persist/mapper/SysAuthMapper.java
  10. 30
      src/main/java/com/ccsens/opensource/wxconfigurer/persist/mapper/SysUserMapper.java
  11. 23
      src/main/java/com/ccsens/opensource/wxconfigurer/service/IUserService.java
  12. 169
      src/main/java/com/ccsens/opensource/wxconfigurer/service/UserService.java
  13. 144
      src/main/java/com/ccsens/opensource/wxconfigurer/util/CodeEnum.java
  14. 20
      src/main/java/com/ccsens/opensource/wxconfigurer/util/PropUtil.java
  15. 123
      src/main/java/com/ccsens/opensource/wxconfigurer/util/RestTemplateUtil.java
  16. 5
      src/main/java/com/ccsens/opensource/wxconfigurer/util/WebConstant.java
  17. 101
      src/main/java/com/ccsens/opensource/wxconfigurer/util/WxGzhUtil.java
  18. 30
      src/main/java/com/ccsens/opensource/wxconfigurer/web/rest/MessageTemplateController.java
  19. 39
      src/main/java/com/ccsens/opensource/wxconfigurer/web/rest/UserController.java
  20. 33
      src/main/java/com/ccsens/opensource/wxconfigurer/web/rest/WxController.java
  21. 3
      src/main/resources/application-dev.properties
  22. 3
      src/main/resources/application-prod.properties
  23. 3
      src/main/resources/application-test.properties
  24. 2
      src/main/resources/application.properties
  25. 1
      src/main/resources/druid-dev.properties
  26. 1
      src/main/resources/druid-prod.properties
  27. 3
      src/main/resources/druid-test.properties
  28. 291
      src/main/resources/mapper_raw/SysAuthMapper.xml
  29. 400
      src/main/resources/mapper_raw/SysUserMapper.xml
  30. 97
      src/main/resources/mbg.xml

6
pom.xml

@ -221,6 +221,12 @@
<artifactId>qcloudsms</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.62</version>
</dependency>
</dependencies>
<dependencyManagement>

145
src/main/java/com/ccsens/opensource/wxconfigurer/bean/dto/UserDto.java

@ -0,0 +1,145 @@
package com.ccsens.opensource.wxconfigurer.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@Data
public class UserDto {
@Data
@ApiModel
public static class UserSignin{
@lombok.Data
@ApiModel
public static class Data{
@ApiModelProperty("用户标识|用户名")
@NotEmpty(message = "identifier is required.")
private String identifier;
@ApiModelProperty("用户凭据|密码")
private String credential;
}
@ApiModelProperty("登录客户端:0-wxmp,1-H5,2-Android,3-IOS,4-WxEnterprise")
@NotNull(message = "client is required.")
private Integer client;
@ApiModelProperty("登录类型:0-wxmp,1-phone,2-email,3-accounts,4-OAUTH2_Wx,5-Wx_H5,6-OAUTH2_WeiBo, 7-Wx_Enterprise")
@NotNull(message = "type is required.")
private Integer type;
@ApiModelProperty("登录信息")
private Data data;
@ApiModelProperty("通知消息")
private String redirect;
}
@Data
@ApiModel
public static class UpdatePhone{
@ApiModelProperty("旧手机号")
private String oldPhone;
@ApiModelProperty("密码")
private String password;
@ApiModelProperty("新手机号")
private String newPhone;
@ApiModelProperty("新手机号的验证码")
private String code;
}
@Data
@ApiModel
public static class Account{
@ApiModelProperty("用户id")
private Long id;
@ApiModelProperty("用户名")
private String username;
@ApiModelProperty("密码")
private String password;
}
@Data
@ApiModel
public static class UpdatePassword{
@ApiModelProperty("手机号")
@NotEmpty(message = "手机号不能为空")
@Pattern(regexp="^[1]([3-9])[0-9]{9}$",message="请输入正确的手机号")
private String phone;
@ApiModelProperty("验证码")
@NotEmpty(message = "验证码不能为空.")
private String code;
@ApiModelProperty("密码")
@NotEmpty(message = "密码不能为空")
@Pattern(regexp="^[a-zA-Z0-9._-]{6,20}$",message="密码长度需在6~20之间,不能使用汉字,不能包含特殊字符")
private String password;
}
//注册
@Data
@ApiModel
public static class UserSignup{
@ApiModelProperty("手机号")
@NotEmpty(message = "手机号不能为空")
@Pattern(regexp="^[1]([3-9])[0-9]{9}$",message="请输入正确的手机号")
private String phone;
@ApiModelProperty("验证码")
@NotEmpty(message = "验证码不能为空.")
private String smsCode;
@ApiModelProperty("账号")
@NotEmpty(message = "账号不能为空.")
@Pattern(regexp="^[a-zA-Z0-9._-]{2,20}$",message="账号长度需在2~20之间,不能使用汉字,不能包含特殊字符")
private String account;
@ApiModelProperty("密码")
@NotEmpty(message = "密码不能为空")
@Pattern(regexp="^[a-zA-Z0-9._-]{6,20}$",message="密码长度需在6~20之间,不能使用汉字,不能包含特殊字符")
private String password;
@ApiModelProperty("来源 0:默认注册,1:HT病人注册")
private byte source = 0;
}
//注册
@Data
@ApiModel
public static class UserSignupSystem{
@ApiModelProperty("账号")
private String account;
@ApiModelProperty("密码")
private String password;
}
@Data
@ApiModel
public static class WxMergePhone{
@ApiModelProperty("手机号")
private String phone;
@ApiModelProperty("合并方式 0直接合并 1不合并以前的信息")
private int isMerge;
}
@Data
@ApiModel
public static class WxBindingPhone{
@ApiModelProperty("手机号")
private String phone;
@ApiModelProperty("手机验证码")
private String smsCode;
}
@Data
@ApiModel
public static class WxInfo{
// @ApiModelProperty("用户id")
// private String userId;
@ApiModelProperty("微信名")
private String nickname;
@ApiModelProperty("微信头像")
private String headImgUrl;
@ApiModelProperty("性别")
private Byte sex;
@ApiModelProperty("省")
private String province;
@ApiModelProperty("市")
private String city;
@ApiModelProperty("国家")
private String country;
@ApiModelProperty("语言")
private String language;
}
}

32
src/main/java/com/ccsens/opensource/wxconfigurer/bean/dto/WxMessageNotice.java

@ -0,0 +1,32 @@
package com.ccsens.opensource.wxconfigurer.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @description:
* @author: whj
* @time: 2020/5/29 15:09
*/
public class WxMessageNotice {
/**事件类型*/
public static final String EVENT = "Event";
@Data
@ApiModel("关注公众号")
public static class Subscribe{
@ApiModelProperty("开发者微信号")
private String ToUserName;
@ApiModelProperty("发送方帐号(一个OpenID)")
private String FromUserName;
@ApiModelProperty("消息创建时间 (整型)")
private String CreateTime;
@ApiModelProperty("消息类型,event")
private String MsgType;
@ApiModelProperty("事件类型,subscribe(订阅)、unsubscribe(取消订阅)")
private String Event;
}
}

128
src/main/java/com/ccsens/opensource/wxconfigurer/bean/po/SysAuth.java

@ -0,0 +1,128 @@
package com.ccsens.opensource.wxconfigurer.bean.po;
import java.io.Serializable;
import java.util.Date;
public class SysAuth implements Serializable {
private Long id;
private Long userId;
private Byte identifyType;
private String identifier;
private String credential;
private String salt;
private Date createdAt;
private Date updatedAt;
private Byte recStatus;
private Byte registerType;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Byte getIdentifyType() {
return identifyType;
}
public void setIdentifyType(Byte identifyType) {
this.identifyType = identifyType;
}
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier == null ? null : identifier.trim();
}
public String getCredential() {
return credential;
}
public void setCredential(String credential) {
this.credential = credential == null ? null : credential.trim();
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt == null ? null : salt.trim();
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public Byte getRecStatus() {
return recStatus;
}
public void setRecStatus(Byte recStatus) {
this.recStatus = recStatus;
}
public Byte getRegisterType() {
return registerType;
}
public void setRegisterType(Byte registerType) {
this.registerType = registerType;
}
@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(", userId=").append(userId);
sb.append(", identifyType=").append(identifyType);
sb.append(", identifier=").append(identifier);
sb.append(", credential=").append(credential);
sb.append(", salt=").append(salt);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);
sb.append(", registerType=").append(registerType);
sb.append("]");
return sb.toString();
}
}

831
src/main/java/com/ccsens/opensource/wxconfigurer/bean/po/SysAuthExample.java

@ -0,0 +1,831 @@
package com.ccsens.opensource.wxconfigurer.bean.po;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SysAuthExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public SysAuthExample() {
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(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Long value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Long value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Long value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(Long value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Long value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Long value1, Long value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Long value1, Long value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andIdentifyTypeIsNull() {
addCriterion("identify_type is null");
return (Criteria) this;
}
public Criteria andIdentifyTypeIsNotNull() {
addCriterion("identify_type is not null");
return (Criteria) this;
}
public Criteria andIdentifyTypeEqualTo(Byte value) {
addCriterion("identify_type =", value, "identifyType");
return (Criteria) this;
}
public Criteria andIdentifyTypeNotEqualTo(Byte value) {
addCriterion("identify_type <>", value, "identifyType");
return (Criteria) this;
}
public Criteria andIdentifyTypeGreaterThan(Byte value) {
addCriterion("identify_type >", value, "identifyType");
return (Criteria) this;
}
public Criteria andIdentifyTypeGreaterThanOrEqualTo(Byte value) {
addCriterion("identify_type >=", value, "identifyType");
return (Criteria) this;
}
public Criteria andIdentifyTypeLessThan(Byte value) {
addCriterion("identify_type <", value, "identifyType");
return (Criteria) this;
}
public Criteria andIdentifyTypeLessThanOrEqualTo(Byte value) {
addCriterion("identify_type <=", value, "identifyType");
return (Criteria) this;
}
public Criteria andIdentifyTypeIn(List<Byte> values) {
addCriterion("identify_type in", values, "identifyType");
return (Criteria) this;
}
public Criteria andIdentifyTypeNotIn(List<Byte> values) {
addCriterion("identify_type not in", values, "identifyType");
return (Criteria) this;
}
public Criteria andIdentifyTypeBetween(Byte value1, Byte value2) {
addCriterion("identify_type between", value1, value2, "identifyType");
return (Criteria) this;
}
public Criteria andIdentifyTypeNotBetween(Byte value1, Byte value2) {
addCriterion("identify_type not between", value1, value2, "identifyType");
return (Criteria) this;
}
public Criteria andIdentifierIsNull() {
addCriterion("identifier is null");
return (Criteria) this;
}
public Criteria andIdentifierIsNotNull() {
addCriterion("identifier is not null");
return (Criteria) this;
}
public Criteria andIdentifierEqualTo(String value) {
addCriterion("identifier =", value, "identifier");
return (Criteria) this;
}
public Criteria andIdentifierNotEqualTo(String value) {
addCriterion("identifier <>", value, "identifier");
return (Criteria) this;
}
public Criteria andIdentifierGreaterThan(String value) {
addCriterion("identifier >", value, "identifier");
return (Criteria) this;
}
public Criteria andIdentifierGreaterThanOrEqualTo(String value) {
addCriterion("identifier >=", value, "identifier");
return (Criteria) this;
}
public Criteria andIdentifierLessThan(String value) {
addCriterion("identifier <", value, "identifier");
return (Criteria) this;
}
public Criteria andIdentifierLessThanOrEqualTo(String value) {
addCriterion("identifier <=", value, "identifier");
return (Criteria) this;
}
public Criteria andIdentifierLike(String value) {
addCriterion("identifier like", value, "identifier");
return (Criteria) this;
}
public Criteria andIdentifierNotLike(String value) {
addCriterion("identifier not like", value, "identifier");
return (Criteria) this;
}
public Criteria andIdentifierIn(List<String> values) {
addCriterion("identifier in", values, "identifier");
return (Criteria) this;
}
public Criteria andIdentifierNotIn(List<String> values) {
addCriterion("identifier not in", values, "identifier");
return (Criteria) this;
}
public Criteria andIdentifierBetween(String value1, String value2) {
addCriterion("identifier between", value1, value2, "identifier");
return (Criteria) this;
}
public Criteria andIdentifierNotBetween(String value1, String value2) {
addCriterion("identifier not between", value1, value2, "identifier");
return (Criteria) this;
}
public Criteria andCredentialIsNull() {
addCriterion("credential is null");
return (Criteria) this;
}
public Criteria andCredentialIsNotNull() {
addCriterion("credential is not null");
return (Criteria) this;
}
public Criteria andCredentialEqualTo(String value) {
addCriterion("credential =", value, "credential");
return (Criteria) this;
}
public Criteria andCredentialNotEqualTo(String value) {
addCriterion("credential <>", value, "credential");
return (Criteria) this;
}
public Criteria andCredentialGreaterThan(String value) {
addCriterion("credential >", value, "credential");
return (Criteria) this;
}
public Criteria andCredentialGreaterThanOrEqualTo(String value) {
addCriterion("credential >=", value, "credential");
return (Criteria) this;
}
public Criteria andCredentialLessThan(String value) {
addCriterion("credential <", value, "credential");
return (Criteria) this;
}
public Criteria andCredentialLessThanOrEqualTo(String value) {
addCriterion("credential <=", value, "credential");
return (Criteria) this;
}
public Criteria andCredentialLike(String value) {
addCriterion("credential like", value, "credential");
return (Criteria) this;
}
public Criteria andCredentialNotLike(String value) {
addCriterion("credential not like", value, "credential");
return (Criteria) this;
}
public Criteria andCredentialIn(List<String> values) {
addCriterion("credential in", values, "credential");
return (Criteria) this;
}
public Criteria andCredentialNotIn(List<String> values) {
addCriterion("credential not in", values, "credential");
return (Criteria) this;
}
public Criteria andCredentialBetween(String value1, String value2) {
addCriterion("credential between", value1, value2, "credential");
return (Criteria) this;
}
public Criteria andCredentialNotBetween(String value1, String value2) {
addCriterion("credential not between", value1, value2, "credential");
return (Criteria) this;
}
public Criteria andSaltIsNull() {
addCriterion("salt is null");
return (Criteria) this;
}
public Criteria andSaltIsNotNull() {
addCriterion("salt is not null");
return (Criteria) this;
}
public Criteria andSaltEqualTo(String value) {
addCriterion("salt =", value, "salt");
return (Criteria) this;
}
public Criteria andSaltNotEqualTo(String value) {
addCriterion("salt <>", value, "salt");
return (Criteria) this;
}
public Criteria andSaltGreaterThan(String value) {
addCriterion("salt >", value, "salt");
return (Criteria) this;
}
public Criteria andSaltGreaterThanOrEqualTo(String value) {
addCriterion("salt >=", value, "salt");
return (Criteria) this;
}
public Criteria andSaltLessThan(String value) {
addCriterion("salt <", value, "salt");
return (Criteria) this;
}
public Criteria andSaltLessThanOrEqualTo(String value) {
addCriterion("salt <=", value, "salt");
return (Criteria) this;
}
public Criteria andSaltLike(String value) {
addCriterion("salt like", value, "salt");
return (Criteria) this;
}
public Criteria andSaltNotLike(String value) {
addCriterion("salt not like", value, "salt");
return (Criteria) this;
}
public Criteria andSaltIn(List<String> values) {
addCriterion("salt in", values, "salt");
return (Criteria) this;
}
public Criteria andSaltNotIn(List<String> values) {
addCriterion("salt not in", values, "salt");
return (Criteria) this;
}
public Criteria andSaltBetween(String value1, String value2) {
addCriterion("salt between", value1, value2, "salt");
return (Criteria) this;
}
public Criteria andSaltNotBetween(String value1, String value2) {
addCriterion("salt not between", value1, value2, "salt");
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 andRecStatusIsNull() {
addCriterion("rec_status is null");
return (Criteria) this;
}
public Criteria andRecStatusIsNotNull() {
addCriterion("rec_status is not null");
return (Criteria) this;
}
public Criteria andRecStatusEqualTo(Byte value) {
addCriterion("rec_status =", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotEqualTo(Byte value) {
addCriterion("rec_status <>", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusGreaterThan(Byte value) {
addCriterion("rec_status >", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) {
addCriterion("rec_status >=", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusLessThan(Byte value) {
addCriterion("rec_status <", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusLessThanOrEqualTo(Byte value) {
addCriterion("rec_status <=", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusIn(List<Byte> values) {
addCriterion("rec_status in", values, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotIn(List<Byte> values) {
addCriterion("rec_status not in", values, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusBetween(Byte value1, Byte value2) {
addCriterion("rec_status between", value1, value2, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotBetween(Byte value1, Byte value2) {
addCriterion("rec_status not between", value1, value2, "recStatus");
return (Criteria) this;
}
public Criteria andRegisterTypeIsNull() {
addCriterion("register_type is null");
return (Criteria) this;
}
public Criteria andRegisterTypeIsNotNull() {
addCriterion("register_type is not null");
return (Criteria) this;
}
public Criteria andRegisterTypeEqualTo(Byte value) {
addCriterion("register_type =", value, "registerType");
return (Criteria) this;
}
public Criteria andRegisterTypeNotEqualTo(Byte value) {
addCriterion("register_type <>", value, "registerType");
return (Criteria) this;
}
public Criteria andRegisterTypeGreaterThan(Byte value) {
addCriterion("register_type >", value, "registerType");
return (Criteria) this;
}
public Criteria andRegisterTypeGreaterThanOrEqualTo(Byte value) {
addCriterion("register_type >=", value, "registerType");
return (Criteria) this;
}
public Criteria andRegisterTypeLessThan(Byte value) {
addCriterion("register_type <", value, "registerType");
return (Criteria) this;
}
public Criteria andRegisterTypeLessThanOrEqualTo(Byte value) {
addCriterion("register_type <=", value, "registerType");
return (Criteria) this;
}
public Criteria andRegisterTypeIn(List<Byte> values) {
addCriterion("register_type in", values, "registerType");
return (Criteria) this;
}
public Criteria andRegisterTypeNotIn(List<Byte> values) {
addCriterion("register_type not in", values, "registerType");
return (Criteria) this;
}
public Criteria andRegisterTypeBetween(Byte value1, Byte value2) {
addCriterion("register_type between", value1, value2, "registerType");
return (Criteria) this;
}
public Criteria andRegisterTypeNotBetween(Byte value1, Byte value2) {
addCriterion("register_type not between", value1, value2, "registerType");
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);
}
}
}

205
src/main/java/com/ccsens/opensource/wxconfigurer/bean/po/SysUser.java

@ -0,0 +1,205 @@
package com.ccsens.opensource.wxconfigurer.bean.po;
import java.io.Serializable;
import java.util.Date;
public class SysUser implements Serializable {
private Long id;
private Long gradeId;
private String avatarUrl;
private String nickname;
private Byte gender;
private String country;
private String province;
private String city;
private String language;
private String phone;
private String wechat;
private String email;
private Long balance;
private Date createdAt;
private Date updatedAt;
private Byte recStatus;
private Byte source;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getGradeId() {
return gradeId;
}
public void setGradeId(Long gradeId) {
this.gradeId = gradeId;
}
public String getAvatarUrl() {
return avatarUrl;
}
public void setAvatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl == null ? null : avatarUrl.trim();
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname == null ? null : nickname.trim();
}
public Byte getGender() {
return gender;
}
public void setGender(Byte gender) {
this.gender = gender;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country == null ? null : country.trim();
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province == null ? null : province.trim();
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city == null ? null : city.trim();
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language == null ? null : language.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getWechat() {
return wechat;
}
public void setWechat(String wechat) {
this.wechat = wechat == null ? null : wechat.trim();
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public Long getBalance() {
return balance;
}
public void setBalance(Long balance) {
this.balance = balance;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public Byte getRecStatus() {
return recStatus;
}
public void setRecStatus(Byte recStatus) {
this.recStatus = recStatus;
}
public Byte getSource() {
return source;
}
public void setSource(Byte source) {
this.source = source;
}
@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(", gradeId=").append(gradeId);
sb.append(", avatarUrl=").append(avatarUrl);
sb.append(", nickname=").append(nickname);
sb.append(", gender=").append(gender);
sb.append(", country=").append(country);
sb.append(", province=").append(province);
sb.append(", city=").append(city);
sb.append(", language=").append(language);
sb.append(", phone=").append(phone);
sb.append(", wechat=").append(wechat);
sb.append(", email=").append(email);
sb.append(", balance=").append(balance);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);
sb.append(", source=").append(source);
sb.append("]");
return sb.toString();
}
}

1311
src/main/java/com/ccsens/opensource/wxconfigurer/bean/po/SysUserExample.java

File diff suppressed because it is too large

5
src/main/java/com/ccsens/opensource/wxconfigurer/config/DruidProps.java

@ -32,6 +32,7 @@ public class DruidProps {
private String url;
private String username;
private String password;
private String env;
private String driverClassName;
private int initialSize;
private int minIdle;
@ -70,8 +71,8 @@ public class DruidProps {
}
public String getPassword(){
if(StrUtil.isNotEmpty(password)) {
String key = System.getenv("CCSENS_TALL_TEST");
if(StrUtil.isNotEmpty(password) && StrUtil.isNotEmpty(env)) {
String key = System.getenv(env);
SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, Base64.decode(key));
password = aes.decryptStr(password, CharsetUtil.CHARSET_UTF_8);
}

30
src/main/java/com/ccsens/opensource/wxconfigurer/persist/mapper/SysAuthMapper.java

@ -0,0 +1,30 @@
package com.ccsens.opensource.wxconfigurer.persist.mapper;
import com.ccsens.opensource.wxconfigurer.bean.po.SysAuth;
import com.ccsens.opensource.wxconfigurer.bean.po.SysAuthExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SysAuthMapper {
long countByExample(SysAuthExample example);
int deleteByExample(SysAuthExample example);
int deleteByPrimaryKey(Long id);
int insert(SysAuth record);
int insertSelective(SysAuth record);
List<SysAuth> selectByExample(SysAuthExample example);
SysAuth selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") SysAuth record, @Param("example") SysAuthExample example);
int updateByExample(@Param("record") SysAuth record, @Param("example") SysAuthExample example);
int updateByPrimaryKeySelective(SysAuth record);
int updateByPrimaryKey(SysAuth record);
}

30
src/main/java/com/ccsens/opensource/wxconfigurer/persist/mapper/SysUserMapper.java

@ -0,0 +1,30 @@
package com.ccsens.opensource.wxconfigurer.persist.mapper;
import com.ccsens.opensource.wxconfigurer.bean.po.SysUser;
import com.ccsens.opensource.wxconfigurer.bean.po.SysUserExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SysUserMapper {
long countByExample(SysUserExample example);
int deleteByExample(SysUserExample example);
int deleteByPrimaryKey(Long id);
int insert(SysUser record);
int insertSelective(SysUser record);
List<SysUser> selectByExample(SysUserExample example);
SysUser selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") SysUser record, @Param("example") SysUserExample example);
int updateByExample(@Param("record") SysUser record, @Param("example") SysUserExample example);
int updateByPrimaryKeySelective(SysUser record);
int updateByPrimaryKey(SysUser record);
}

23
src/main/java/com/ccsens/opensource/wxconfigurer/service/IUserService.java

@ -0,0 +1,23 @@
package com.ccsens.opensource.wxconfigurer.service;
import java.io.IOException;
public interface IUserService {
/**
* 更新用户信息
* @param openId
* @return
*/
String updateUser(String openId);
/**
* 保存用户信息
* @param index
* @param openId
* @return
*/
boolean subscribe(int index, String openId);
void unsubscribe(String openId) throws IOException;
}

169
src/main/java/com/ccsens/opensource/wxconfigurer/service/UserService.java

@ -0,0 +1,169 @@
package com.ccsens.opensource.wxconfigurer.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ccsens.opensource.wxconfigurer.bean.po.SysAuth;
import com.ccsens.opensource.wxconfigurer.bean.po.SysAuthExample;
import com.ccsens.opensource.wxconfigurer.bean.po.SysUser;
import com.ccsens.opensource.wxconfigurer.bean.po.WxOauth2UserInfo;
import com.ccsens.opensource.wxconfigurer.persist.mapper.SysAuthMapper;
import com.ccsens.opensource.wxconfigurer.persist.mapper.SysUserMapper;
import com.ccsens.opensource.wxconfigurer.util.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;
/**
* @description:
* @author: whj
* @time: 2020/6/1 16:43
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class UserService implements IUserService {
@Resource
private SysAuthMapper sysAuthMapper;
@Resource
private SysUserMapper sysUserMapper;
@Resource
private Snowflake snowflake;
@Override
public String updateUser(String openId) {
String accessToken = WxGzhUtil.getAccessToken();
String url = String.format(WxGzhUtil.USER_GET,accessToken,
StrUtil.isEmpty(openId) ? "" : openId);
log.info("查询用户列表:{}", url);
String response = HttpRequest.get(url).execute().body();
log.info("查询用户返回结果:{}", response);
// 校验返回结果 错误抛异常
WxGzhUtil.pageResponse(response);
JSONObject result = JSONObject.parseObject(response);
if (result.getIntValue(WxGzhUtil.Field.COUNT) <= 0) {
return null;
}
log.info("遍历openid");
JSONArray array = result.getJSONObject(WxGzhUtil.Field.DATA).getJSONArray(WxGzhUtil.Field.OPENID);
for (Object obj: array) {
// 查询unionid
String newOpenId = (String) obj;
new Thread(new Runnable() {
@Override
public void run() {
// 调用tall的登录接口
int index = 0;
// while (!siginin(index++, newOpenId)) {
// log.info("循环调用");
// }
subscribe(index++, newOpenId);
}
}).start();
}
return result.getString(WxGzhUtil.Field.NEXT_OPENID);
}
/**
*
* @param index
* @param openId
* @return
*/
@Override
public boolean subscribe(int index, String openId) {
try {
if (index >= 5) {
log.info("已经调用5次,不再调用");
// TODO 报警(邮件)
return true;
}
WxOauth2UserInfo userInfo = WxGzhUtil.getUserInfo(openId);
if (ObjectUtil.isNull(userInfo)) {
return false;
}
// 判断用户信息是否被保存
SysAuthExample authExample = new SysAuthExample();
authExample.createCriteria().andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.OFFICIAL_ACCOUNT_WX.value)
.andIdentifierEqualTo(userInfo.getOpenId()).andCredentialEqualTo(userInfo.getUnionId())
.andRecStatusEqualTo((byte)0);
List<SysAuth> authList = sysAuthMapper.selectByExample(authExample);
if (CollectionUtil.isNotEmpty(authList)) {
return true;
}
// 保存用户信息
saveUser(userInfo);
} catch (Exception e) {
return false;
}
return false;
}
private void saveUser(WxOauth2UserInfo userInfo) {
SysAuthExample sysAuthExample = new SysAuthExample();
sysAuthExample.createCriteria().andCredentialEqualTo(userInfo.getUnionId()).andRecStatusEqualTo((byte)0);
List<SysAuth> sysAuthList = sysAuthMapper.selectByExample(sysAuthExample);
if (CollectionUtil.isNotEmpty(sysAuthList)) {
//添加认证方式
SysAuth theAuth = new SysAuth();
theAuth.setId(snowflake.nextId());
theAuth.setUserId(sysAuthList.get(0).getUserId());
theAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.OFFICIAL_ACCOUNT_WX.value);
theAuth.setIdentifier(userInfo.getOpenId());
theAuth.setCredential(userInfo.getUnionId());
sysAuthMapper.insertSelective(theAuth);
} else {
//新建用户并保存微信信息
SysUser user = new SysUser();
user.setId(snowflake.nextId());
user.setAvatarUrl(userInfo.getHeadImgUrl());
user.setNickname(userInfo.getNickname());
user.setGender((byte) userInfo.getSex());
user.setCountry(userInfo.getCountry());
user.setProvince(userInfo.getProvince());
user.setCity(userInfo.getCity());
user.setLanguage(userInfo.getLanguage());
sysUserMapper.insertSelective(user);
//添加认证方式
SysAuth theAuth = new SysAuth();
theAuth.setId(snowflake.nextId());
theAuth.setUserId(user.getId());
theAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.OFFICIAL_ACCOUNT_WX.value);
theAuth.setIdentifier(userInfo.getOpenId());
theAuth.setCredential(userInfo.getUnionId());
sysAuthMapper.insertSelective(theAuth);
}
}
@Override
public void unsubscribe(String openId) throws IOException {
log.info("取消关注的用户:{}", openId);
SysAuthExample authExample = new SysAuthExample();
authExample.createCriteria().andIdentifierEqualTo(openId)
.andIdentifyTypeEqualTo((byte) WebConstant.IDENTIFY_TYPE.OFFICIAL_ACCOUNT_WX.value);
SysAuth auth = new SysAuth();
auth.setRecStatus((byte)WebConstant.REC_STATUS.Deleted.value);
sysAuthMapper.updateByExampleSelective(auth, authExample);
}
}

144
src/main/java/com/ccsens/opensource/wxconfigurer/util/CodeEnum.java

@ -0,0 +1,144 @@
package com.ccsens.opensource.wxconfigurer.util;
import lombok.Getter;
@Getter
public enum CodeEnum {
/**
* 异常
*/
SUCCESS(200, "ok", true),
SYS_ERROR(500, "网络繁忙,请您稍后重试", false),
FILE_FORMAT_ERROR(1, "文件格式错误", true),
AUDITED(2, "已经审核通过,不重复提交。", true),
POSITION_NO_FOUND(3, "未找到对应职务,请重新选择职务。", true),
TITLE_NO_FOUND(4, "未找到对应职称,请重新选择职称。", true),
ADMIN_DEAL(5,"由于您的资格太高,请联系管理员进行审核。", true),
PARAM_NULL(6, "请检查您的参数是否填写完整。", true),
ROLE_NOT_FOUND(7, "未找到相关角色,请确认项目和角色信息。", true),
AUDIT_NOT_PASS (8, "对不起,您尚未审核通过,暂时没有操作权限。", true),
PARAM_ERROR(9,"请求参数错误,请确认操作是否正确。", true),
ID_CARD_ERROR(10,"身份证格式错误,请检查身份证填写是否正确。", true),
QUESTION_NOT_FOUND(11,"试题未找到。", true),
WSB_NOT_PROJECT_HEADER(12,"没有项目信息的表头",true),
WSB_NOT_MEMBER_HEADER(13,"没有项目成员的表头",true),
WSB_NOT_TASK_HEADER(14,"没有项目任务分解的表头",true),
WBS_PROJECT_TIME_ERROR(15,"时间格式异常",true),
WBS_NOT_PROJECT_TIME(16,"项目时间不能为空",true),
WBS_NOT_PROJECT_NAME(17,"找不到项目信息",true),
WBS_NOT_MEMBER_SHEET(18,"未找到项目成员表",true),
WBS_NOT_PHONE(19,"手机号为空",true),
WBS_STAKEHOLDER_PHONE(20,"奖惩干系人和手机号不匹配",true),
WBS_REPEAT_MEMBER_PHONE(21,"成员或手机号重复",true),
WBS_NOT_FIRST_ROLE(22,"系统角色名称错误",true),
WBS_REPEAT_ROLE_NAME(23,"角色名称重复",true),
WSB_NOT_MEMBER(24,"未找到对应成员,请检查成员姓名是否正确", true),
WBS_NOT_FIND_ROLE(25,"未找到对应的角色,请检查对谁不可见一列的名字与格式",true),
WBS_NOT_TASK_NAME(26,"任务名不能为空",true),
WBS_NOT_FIND_EXECUTOR_ROLE(27,"找不到负责人,请检查负责人的名称",true),
WBS_NOT_FIND_CHECKER_ROLE(28,"找不到检查人,请检查检查人的名称",true),
WBS_DELAY_ERROR(29,"任务切换模式填写错误",true),
WBS_SUB_TASK_ANALYSIS(30,"无法解析此子日程表",true),
WBS_NOT_SUB_TASK(31,"找不到对应的子表,请检查子表的名字是否正确",true),
WBS_NOT_PLUGIN_SHEET(32,"未找到插件表",true),
WBS_NOT_PLUGIN(33,"未找到对应的插件,请确认是否填写正确",true),
PROJECT_DATE_FORMAT_ERROR(34,"输入的日期格式错误,有效日期格式 例:2019-01-01或2019-01",true),
TASK_NOT_UPLOAD_DELIVER(35,"交付物未上传,无法完成任务",true),
NOT_PROJECT(36,"对不起,找不到该项目",true),
NOT_ROLE(37,"对不起,找不到该角色",true),
NOT_DELIVER(38,"对不起,找不到对应的交付物",true),
NOT_TASK(39,"对不起,找不到对应的任务",true),
NOT_DELIVER_FILE(40,"上传文件信息错误,请重试",true),
IS_NOT_EXECUTOR(41,"对不起,您不是该任务负责人",true),
NOT_CHECKER(42,"请选择检查人",true),
SUB_TASK_IS_NOT_FINISH(43,"分组内任务未全部完成,无法完成任务",true),
IS_NOT_CHECKER(44,"您不是该交付物的检查人",true),
NOT_POWER(45,"对不起,您的权限不足,无法进行此操作",true),
SMS_CODE_CORRECT(46,"验证信息错误",true),
QUESTION_RULE_NOT_FOUND(47,"该评测规则未知,请联系开发人员。", true),
REPORT_DOCTOR_ERROR(48, "对不起,您没有修改报告单结果的权限。", true),
NOT_LOGIN(49, "对不起,您尚未登录或登录已失效,请重新登录。", true),
POSITION_NOT_3(50, "对不起,您尚未选择职务,请重新选择。", true),
REPEAT_PROJECT_NAME(51,"项目名不能重复,请修改后重试",true),
TIME_ERROR_BEGIN(52,"时间异常,开始时间不能大于结束时间",true),
TIME_ERROR_PROJECT(53,"时间异常,任务的时间不能超出项目的时间",true),
HAS_GROUP_TIME_CHANGE(54,"分组任务不能直接修改时间,请修改其子任务时间",true),
DOCTOR_NOT_SUBMIT(55,"尚未进行资格认证",true),
REPORT_NOT_FOUND(56,"对不起,没有找到您查询的报告单,请确认报告单是否存在。",true),
PATIENT_NOT_CHOICE(57,"没有选择病人,不进行保存答案。", true),
NOT_GAME_TYPE(58,"对不起,未找到对应的游戏",true),
SIGNIN_REPEAT(59,"请勿重复签到",true),
SCORE_REPEAT(60,"您已经评分,请勿重复提交",true),
NOT_MEMBER(61,"对不起,找不到对应的成员信息",true),
NOT_GAME_RECORD(62,"对不起,找不到对应的游戏场次",true),
NOT_JOIN_GAME(63,"您还未加入游戏,请参加游戏后再试",true),
GAME_NO_END(64,"您的上一场游戏尚未结束,请勿重复开启",true),
GAME_NOT_TIMES(65,"游戏可玩次数不足,请充值后重试",true),
GAME_PENDING(66, "游戏尚未开始,请等待主持人开始", true),
GAME_PREPARATION(67, "游戏已经开始倒计时了", true),
GAME_PROCESSING (68, "游戏已经在火热进行啦", true),
GAME_COMPLETED(69, "抱歉,您来晚了,游戏已结束", true),
NOT_REGISTER(70,"该手机号尚未注册账号",true),
PHONE_ERR(71,"请输入正确的手机号",true),
NOT_SELECT_WX(72,"未查到对应的微信信息",true),
ALREADY_EXIST_PHONE(73,"手机号已存在",true),
ALREADY_BINDING_PHONE(74,"您已绑定过手机号,请勿重复绑定",true),
MERGE_WX_PHONE(75,"该手机号已经注册过账号,是否将账号合并",true),
ALREADY_EXIST_ACCOUNT(76,"该账号已存在",true),
NOT_SIGN_FIELD(77,"签到的字段不可用",true),
ALREADY_SIGN(78,"您已经签到过了,请勿重复签到",true),
ALREADY_ATTENTION(79,"您已经关注了这个项目",true),
NOT_EMPLOYEE(80,"未找到成员信息",true),
NOT_SITE(81,"未找到该场所",true),
ALREADY_REAL_AUTH(82,"您已经完成认证",true),
LACK_CONFIG(83,"缺少配置",true),
ANIMAL_HEAT_ERROR(84,"体温异常,请选择正确的健康状态",true),
NOT_BUSINESS(85,"未找到商户信息",true),
SITE_EXCEED(86,"您所添加的场所数量已超出上限,请联系客服提高场所上限",true),
SITE_NAME_REPETITION(86,"场所名重复",true),
LOCATION_LONG(87,"对不起,您的距离太远了,请靠近目的地或打开定位后重试。",true),
NO_IMPORT_DATA(88,"没有有效的数据,请检查您的导入文件。",true),
FILL_ERROR(89,"您的信息填写有误,请检查您的信息。",true),
ACCOUNT_BIND(90,"您的帐号已经绑定了,请重新进入小程序。",true),
RECORDER_NOT(91, "对不起,您不是该信息的录入者,不能修改信息。", true),
REPORT_HAD_COMPLETED(92, "报告单已经完成,不能再修改答题记录。", true),
NOT_REAL_AUTH(93,"您尚未填写基本信息,请补全信息后再试。",true),
HEALTH_TYPE_ERROR(94,"您的健康状态异常,打卡失败。",true),
NOT_HEALTH_RECORD(95,"您今天还未上报健康信息,请上报后再试。",true),
SELECT_TIME_ERROR(96,"请输入正确的查询时间",true),
TASK_PREPARATION(97,"任务已经开始了,请勿重复操作",true),
NOT_COMMENT(98,"该评论不存在",true),
NOT_MESSAGE_TYPE(99,"找不到消息类型,请检查名称是否正确",true),
NOT_LABEL(100,"标签不存在,请检查后操作",true),
REPEAT_LABEL(100,"标签已存在,请勿重复添加",true),
;
public CodeEnum addMsg(String msg){
this.msg = msg+"行:"+this.msg;
return this;
}
public static CodeEnum getByCode(int code) {
for (CodeEnum codeEnum: CodeEnum.values()) {
if (codeEnum.getCode().intValue() == code) {
return codeEnum;
}
}
return null;
}
private CodeEnum(Integer code, String msg, boolean success) {
this.code = code;
this.msg = msg;
this.success = success;
}
private Integer code;
private String msg;
private boolean success;
}

20
src/main/java/com/ccsens/opensource/wxconfigurer/util/PropUtil.java

@ -0,0 +1,20 @@
package com.ccsens.opensource.wxconfigurer.util;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
* @description:
* @author: whj
* @time: 2020/6/10 9:51
*/
@Component
public class PropUtil {
/**tall服务访问地址*/
public static String TALL_DOMAIN;
@Value("${tall.domain:}")
public void setTallDomain(String tallDomain) {
PropUtil.TALL_DOMAIN = tallDomain;
}
}

123
src/main/java/com/ccsens/opensource/wxconfigurer/util/RestTemplateUtil.java

@ -0,0 +1,123 @@
package com.ccsens.opensource.wxconfigurer.util;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct;
import java.util.Map;
@Slf4j
@Component
public class RestTemplateUtil {
@Autowired
private RestTemplate restTemplate;
private static RestTemplateUtil util;
@PostConstruct
public void init(){
util = this;
util.restTemplate = this.restTemplate;
}
public static Object getForEntity(String url, Map<String, Object> params, Class<?> returnClass) {
if (params != null && !params.isEmpty()) {
if (!url.contains("?")) {
url += "?";
}
for (String key : params.keySet()) {
if (url.endsWith("?")) {
url += key + "="+params.get(key)+"";
} else {
url += "&" + key + "="+params.get(key)+"";
}
}
}
log.info("url:{}, params:{}", url, params);
ResponseEntity<String> entity = util.restTemplate.getForEntity(url, String.class);
log.info("entity:{}",entity);
return JSONObject.parseObject(entity.getBody(), returnClass);
}
public static String postBody(String url, Object params) {
log.info("路径:{}, 参数:{}", url, params);
HttpHeaders httpHeaders = new HttpHeaders();
MediaType type= MediaType.parseMediaType("application/json;charset=UTF-8");
httpHeaders.setContentType(type);
// MultiValueMap<String, Object> map=new LinkedMultiValueMap<>();
JSONObject json = JSON.parseObject(JSON.toJSONString(params));
HttpEntity<Map<String, Object>> objectHttpEntity = new HttpEntity<>(json,httpHeaders);
ResponseEntity<String> response = util.restTemplate.postForEntity(url, objectHttpEntity, String.class);
log.info("返回:{}", response);
return response.getBody();
}
public static String postUrlEncode(String url, Object params) {
log.info("请求路径:{},请求参数:{}", url, params);
JSONObject json = JSON.parseObject(JSON.toJSONString(params));
MultiValueMap<String, Object> paramMap = transMultiValueMap(json);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
HttpEntity<MultiValueMap> formEntity = new HttpEntity<>(paramMap, headers);
ResponseEntity<String> result = util.restTemplate.postForEntity(url, formEntity, String.class);
log.info("接口返回结果:{}", result);
return result.getBody();
}
/**
* 发送multipart/form-data
* @author whj
* @date 2019/8/20
* @param url
* @param params
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject postImg(String url, JSONObject params) {
log.info("请求路径:{},请求参数:{}", url, params);
HttpHeaders headers = new HttpHeaders();
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
MultiValueMap<String, Object> paramMap = transMultiValueMap(params);
HttpEntity<MultiValueMap> formEntity = new HttpEntity<>(paramMap, headers);
JSONObject result = util.restTemplate.postForObject(url, formEntity, JSONObject.class);
log.info("接口返回结果:{}", result);
return result;
}
/**
* 将参数封装成MultiValueMap对象
* @author whj
* @date 2019/8/20
* @param params
* @return org.springframework.util.MultiValueMap<java.lang.String,java.lang.Object>
*/
private static MultiValueMap<String, Object> transMultiValueMap(JSONObject params) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();
for (String key: params.keySet()) {
paramMap.add(key, params.get(key));
}
return paramMap;
}
public static boolean pageResult(String result) {
if (StrUtil.isBlank(result) || result.contains("<html")) {
return false;
}
return true;
}
}

5
src/main/java/com/ccsens/opensource/wxconfigurer/util/WebConstant.java

@ -126,7 +126,10 @@ public class WebConstant {
}
public enum IDENTIFY_TYPE {
Wxmp(0,"微信小程序"), Phone(1,"电话"), Email(2,"Email"), Account(3,"账号"),OAUTH2_Wx(4,"微信"),OAUTH2_WeiBo(5,"微博");
Wxmp(0,"微信小程序"), Phone(1,"电话"),
Email(2,"Email"), Account(3,"账号"),
OAUTH2_Wx(4,"微信"),OAUTH2_WeiBo(5,"微博"),
OFFICIAL_ACCOUNT_WX(9,"微信公众号登录");
public int value;
public String phase;

101
src/main/java/com/ccsens/opensource/wxconfigurer/util/WxGzhUtil.java

@ -4,13 +4,13 @@ import cn.hutool.core.lang.Console;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.ccsens.opensource.wxconfigurer.bean.po.*;
import com.ccsens.opensource.wxconfigurer.exception.BaseException;
import com.ccsens.opensource.wxconfigurer.exception.BusinessException;
import com.ccsens.opensource.wxconfigurer.exception.WxException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.sun.jndi.toolkit.url.UrlUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -23,15 +23,16 @@ import java.util.Map;
* @author __zHangSan
*/
public class WxGzhUtil {
private static final Logger logger = LoggerFactory.getLogger(WxGzhUtil.class);
/**
* 全局唯一accessToken
*/
private static WxAccessToken globalWxAccessToken;
/**
* accessToken 过期提前10分钟刷新
* accessToken 过期提前60分钟刷新
*/
private static final Integer ACCESS_TOKEN_RESERVED_SECONDS = 10 * 60;
private static final Integer ACCESS_TOKEN_RESERVED_SECONDS = 60 * 60;
private static final String URL_LOGIN
= "https://api.weixin.qq.com/sns/jscode2session?appid=%1$s&secret=%2$s&js_code=%3$s&grant_type=%4$s";
@ -59,12 +60,38 @@ public class WxGzhUtil {
= "https://api.weixin.qq.com/sns/oauth2/access_token?appid=%1$s&secret=%2$s&code=%3$s&grant_type=authorization_code";
private static final String URL_GET_OAUTH2_USERINFO
= "https://api.weixin.qq.com/sns/userinfo?access_token=%1$s&openid=%2$s";
public static final String USER_GET = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=%1$s&next_openid=%2$s";
public static final String USER_INFO = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=%1$s&openid=%2$s&lang=zh_CN";
public static final String MESSAGE_TEMPLATE_SEND = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=%1$s";
/**登录接口*/
public static final String TALL_SIGNIN = PropUtil.TALL_DOMAIN + "/users/signin";
private static final String APPID = "wx7af1bf1e14facf82";
private static final String SECRET = "a6613fae11b497639c0224b820aaf6d9";
private static final String TOKEN = "nNzkL9KkZUOIS8uU";
private static final String ENCODING_AES_KEY = "MQEXG7grhRNsARbUzem6OwnGr2ZW9o5jsauNqaQWOuu";
private static final String MCHID = "";
private static final String KEY = "";
public static final class Field{
public static final int SUCCESS_CODE = 0;
public static final String ERROR_CODE = "errcode";
public static final String ERROR_MSG = "errmsg";
public static final String TOTAL = "total";
public static final String COUNT = "count";
public static final String DATA = "data";
public static final String OPENID = "openid";
public static final String NEXT_OPENID = "next_openid";
public static final String EVENT = "Event";
}
public static class FieldValue{
public final static String EVENT = "event";
/**订阅*/
public final static String SUBSCRIBE= "subscribe";
/**取消订阅*/
public final static String UNSUBSCRIBE= "unsubscribe";
}
/**
* 数组转字符串
@ -127,6 +154,46 @@ public class WxGzhUtil {
return false;
}
/**
* 判断结果是否正确 错误抛异常包含errcode即为错误
* @param response
*/
public static void pageResponse(String response) {
Console.log("返回结果:{}", response);
JSONObject result;
try {
if(StrUtil.isEmpty(response) || null == (result = JSONObject.parseObject(response))) {
throw new BusinessException(-1,"the response of HttpRequest is empty.");
}
} catch (JSONException e) {
throw new BusinessException(-1,e.getMessage());
}
if(result.containsKey(Field.ERROR_CODE)){
throw new WxException(result.getInteger(Field.ERROR_CODE),result.getString(Field.ERROR_MSG));
}
}
/**
* 判断结果是否正确 错误抛异常errcode!=0为错误
* @param response
*/
public static void pageResponseSuccess(String response) {
Console.log("返回结果:{}", response);
JSONObject result;
try {
if(StrUtil.isEmpty(response) || null == (result = JSONObject.parseObject(response))) {
throw new BusinessException(-1,"the response of HttpRequest is empty.");
}
} catch (JSONException e) {
throw new BusinessException(-1,e.getMessage());
}
if(result.getIntValue(Field.ERROR_CODE) != Field.SUCCESS_CODE){
throw new WxException(result.getInteger(Field.ERROR_CODE),result.getString(Field.ERROR_MSG));
}
}
/**
* 获取Access_token
*/
@ -269,4 +336,30 @@ public class WxGzhUtil {
WxOauth2AccessToken wxOauth2AccessToken = getOauth2AccessToken(code);
return getOauth2UserInfo(wxOauth2AccessToken.getAccessToken(),wxOauth2AccessToken.getOpenId());
}
/**
* 根据openid查询用户信息
* @param openid
* @return
* @throws BaseException
*/
public static WxOauth2UserInfo getUserInfo(String openid) throws BaseException, IOException {
String url = String.format(USER_INFO,getAccessToken(),openid);
String response = HttpRequest.get(url).execute().body();
Console.log("请求路径:{}, 返回结果:{}", url, response);
pageResponse(response);
WxOauth2UserInfo wxOauth2UserInfo = JacksonUtil.jsonToBean(response, WxOauth2UserInfo.class);
return wxOauth2UserInfo;
}
/**
* 发送模板消息
* @param json
*/
public static void sendTemplate(String json) {
String url = String.format(MESSAGE_TEMPLATE_SEND,getAccessToken());
String response = HttpRequest.post(url).body(json).execute().body();
pageResponseSuccess(response);
}
}

30
src/main/java/com/ccsens/opensource/wxconfigurer/web/rest/MessageTemplateController.java

@ -0,0 +1,30 @@
package com.ccsens.opensource.wxconfigurer.web.rest;
import com.ccsens.opensource.wxconfigurer.util.JsonResponse;
import com.ccsens.opensource.wxconfigurer.util.WxGzhUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
/**
* @description:
* @author: whj
* @time: 2020/6/9 9:39
*/
@Slf4j
@Api(tags = "MessageTemplateController | 消息模板信息")
@RestController
@RequestMapping("/template")
public class MessageTemplateController {
@ApiOperation(value = "发送模板信息",notes = "发送模板信息")
@PostMapping(value = "/send")
@ResponseBody
public JsonResponse send(@RequestBody String json) {
log.info("发送模板消息:{}", json);
WxGzhUtil.sendTemplate(json);
log.info("模板消息发送完成");
return JsonResponse.newInstance().ok();
}
}

39
src/main/java/com/ccsens/opensource/wxconfigurer/web/rest/UserController.java

@ -0,0 +1,39 @@
package com.ccsens.opensource.wxconfigurer.web.rest;
import cn.hutool.core.codec.Base64;
import com.ccsens.opensource.wxconfigurer.service.IUserService;
import com.ccsens.opensource.wxconfigurer.util.CodeEnum;
import com.ccsens.opensource.wxconfigurer.util.JsonResponse;
import com.ccsens.opensource.wxconfigurer.util.WxGzhUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @description:
* @author: whj
* @time: 2020/6/1 16:03
*/
@Slf4j
@Api(tags = "UserController | 公众号用户信息")
@RestController
@RequestMapping("/user")
public class UserController {
@Resource
private IUserService userService;
@ApiOperation(value = "更新用户信息",notes = "更新用户信息")
@PostMapping(value = "/updateUser")
@ResponseBody
public JsonResponse updateUser(String openId) throws Exception {
log.info("更新用户信息...");
String nextOpenid = userService.updateUser(openId);
log.info("更新用户信息结果:{}", nextOpenid);
return JsonResponse.newInstance().ok(nextOpenid);
}
}

33
src/main/java/com/ccsens/opensource/wxconfigurer/web/rest/WxController.java

@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
import com.ccsens.opensource.wxconfigurer.bean.dto.WxGzhAction;
import com.ccsens.opensource.wxconfigurer.bean.po.WxGzhAuthType;
import com.ccsens.opensource.wxconfigurer.bean.po.WxGzhMenu;
import com.ccsens.opensource.wxconfigurer.service.IUserService;
import com.ccsens.opensource.wxconfigurer.util.JsonResponse;
import com.ccsens.opensource.wxconfigurer.util.WxGzhUtil;
import io.swagger.annotations.Api;
@ -19,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
/**
* @author __zHangSan
*/
@ -27,6 +30,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/wx")
public class WxController {
@Resource
private IUserService userService;
@ApiOperation(value = "微信访问入口",notes = "")
@ApiImplicitParams({
@ -65,9 +70,21 @@ public class WxController {
@ResponseBody
public String responseMsg(@RequestBody WxGzhAction wxGzhAction) throws Exception {
log.info("responseMsg...: {}",wxGzhAction);
// if(wxGzhAction.getMsgType().equals()){
//
// }
if(WxGzhUtil.FieldValue.EVENT.equals(wxGzhAction.getMsgType())){
switch (wxGzhAction.getEvent()) {
case "subscribe":
boolean success = userService.subscribe(0, wxGzhAction.getOpenId());
log.info("保存用户信息成功:{}", success);
break;
case "unsubscribe":
userService.unsubscribe(wxGzhAction.getOpenId());
break;
default:break;
}
}
return "";
}
@ -105,9 +122,9 @@ public class WxController {
String miniprogramAppId_bahe = "wxd06d18fe7c75b498";
String miniprogramAppId_saipao = "wx2ebb5cf926fe1ddb";
String miniprogramAppId_mtpro = "wx356e01c7eb01d55d";
String page_mtpro_youxi = "pages/project/project?projectId=1224172496727707648&scene=1008";
String page_mtpro_nianhui = "pages/project/project?projectId=1232564528571617280&scene=1008";
String page_mtpro_yuangongchengzhang = "pages/project/project?projectId=1213006808172597248&scene=1008";
String page_mtpro_youxi = "pages/project/project?projectId=1267384020040290304&scene=1008";
String page_mtpro_nianhui = "pages/project/project?projectId=1267279600455651328&scene=1008";
String page_mtpro_yuangongchengzhang = "pages/project/project?projectId=1267343073726304256&scene=1008";
String page_mtpro = "pages/index/index";
String tallCodeUrl = "https://test.tall.wiki/ct-dev/";
@ -123,7 +140,7 @@ public class WxController {
WxGzhMenu.Button.builder().name("年会项目管理").type(WxGzhMenu.ButtonType.MINIPROGRAM)
.url(commonUrl).appid(miniprogramAppId_mtpro).pagepath(page_mtpro_nianhui).build(),
WxGzhMenu.Button.builder().name("wiki").type(WxGzhMenu.ButtonType.VIEW).url(wikiUrl).build(),
WxGzhMenu.Button.builder().name("mtpro游戏项目管理").type(WxGzhMenu.ButtonType.MINIPROGRAM)
WxGzhMenu.Button.builder().name("PT缺陷管理").type(WxGzhMenu.ButtonType.MINIPROGRAM)
.url(commonUrl).appid(miniprogramAppId_mtpro).pagepath(page_mtpro_youxi).build()
)
).build()
@ -185,4 +202,6 @@ public class WxController {
WxGzhUtil.createMenu(wxGzhMenu);
return JsonResponse.newInstance(String.class).ok();
}
}

3
src/main/resources/application-dev.properties

@ -24,5 +24,8 @@ spring.data.mongodb.uri=mongodb://wei:111111@49.233.89.188:27017/test
setting.snowflake.workerId=1
setting.snowflake.datacenterId=1
#·þÎñÓòÃû
tall.domain=http://192.168.0.99:7030/v1.0/

3
src/main/resources/application-prod.properties

@ -24,5 +24,6 @@ spring.data.mongodb.uri=mongodb://wei:111111@49.233.89.188:27017/test
setting.snowflake.workerId=1
setting.snowflake.datacenterId=1
#·şÎñÓòÃû
tall.domain=https://www.tall.wiki/gateway/tall/v1.0/

3
src/main/resources/application-test.properties

@ -24,5 +24,8 @@ spring.data.mongodb.uri=mongodb://wei:111111@49.233.89.188:27017/test
setting.snowflake.workerId=1
setting.snowflake.datacenterId=1
#·þÎñÓòÃû
#tall.domain=http://192.168.0.99:7030/v1.0/
tall.domain=https://test.tall.wiki/gateway/tall/v1.0/

2
src/main/resources/application.properties

@ -1,5 +1,5 @@
# \u9009\u62E9\u5F00\u53D1\u73AF\u5883{dev|test|prod}
spring.profiles.active=dev
spring.profiles.active=test
# \u8BBE\u7F6E\u5E94\u7528\u540D
spring.application.name=cc-wxconfigurer

1
src/main/resources/druid-dev.properties

@ -6,6 +6,7 @@ spring.datasource.druid.dynamicUrl=jdbc:mysql://localhost:3306/${schema}
spring.datasource.druid.url=jdbc:mysql://api.ccsens.com/ptpro?useUnicode=true&characterEncoding=UTF-8
spring.datasource.druid.username=root
spring.datasource.druid.password=68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473
spring.datasource.druid.env=CCSENS_TALL
spring.datasource.druid.driverClassName=com.mysql.jdbc.Driver
# \u8FDE\u63A5\u6C60\u7684\u914D\u7F6E\u4FE1\u606F

1
src/main/resources/druid-prod.properties

@ -6,6 +6,7 @@ spring.datasource.druid.dynamicUrl=jdbc:mysql://localhost:3306/${schema}
spring.datasource.druid.url=jdbc:mysql://127.0.0.1:3306/ptpro?useUnicode=true&characterEncoding=UTF-8
spring.datasource.druid.username=root
spring.datasource.druid.password=
spring.datasource.druid.env=
spring.datasource.druid.driverClassName=com.mysql.jdbc.Driver
# \u8FDE\u63A5\u6C60\u7684\u914D\u7F6E\u4FE1\u606F

3
src/main/resources/druid-test.properties

@ -3,9 +3,10 @@ spring.datasource.druid.dynamicUrl=jdbc:mysql://localhost:3306/${schema}
#spring.datasource.druid.url=jdbc:mysql://127.0.0.1:3306/db_encryptmoneypacket?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
#spring.datasource.druid.username=root
#spring.datasource.druid.password=111111
spring.datasource.druid.url=jdbc:mysql://127.0.0.1:3306/ptpro?useUnicode=true&characterEncoding=UTF-8
spring.datasource.druid.url=jdbc:mysql://127.0.0.1:3306/tall?useUnicode=true&characterEncoding=UTF-8
spring.datasource.druid.username=root
spring.datasource.druid.password=
spring.datasource.druid.env=
spring.datasource.druid.driverClassName=com.mysql.jdbc.Driver
# \u8FDE\u63A5\u6C60\u7684\u914D\u7F6E\u4FE1\u606F

291
src/main/resources/mapper_raw/SysAuthMapper.xml

@ -0,0 +1,291 @@
<?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.ccsens.opensource.wxconfigurer.persist.mapper.SysAuthMapper">
<resultMap id="BaseResultMap" type="com.ccsens.opensource.wxconfigurer.bean.po.SysAuth">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="identify_type" jdbcType="TINYINT" property="identifyType" />
<result column="identifier" jdbcType="VARCHAR" property="identifier" />
<result column="credential" jdbcType="VARCHAR" property="credential" />
<result column="salt" jdbcType="VARCHAR" property="salt" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
<result column="register_type" jdbcType="TINYINT" property="registerType" />
</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, user_id, identify_type, identifier, credential, salt, created_at, updated_at,
rec_status, register_type
</sql>
<select id="selectByExample" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysAuthExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_sys_auth
<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.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_sys_auth
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_sys_auth
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysAuthExample">
delete from t_sys_auth
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysAuth">
insert into t_sys_auth (id, user_id, identify_type,
identifier, credential, salt,
created_at, updated_at, rec_status,
register_type)
values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{identifyType,jdbcType=TINYINT},
#{identifier,jdbcType=VARCHAR}, #{credential,jdbcType=VARCHAR}, #{salt,jdbcType=VARCHAR},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT},
#{registerType,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysAuth">
insert into t_sys_auth
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="identifyType != null">
identify_type,
</if>
<if test="identifier != null">
identifier,
</if>
<if test="credential != null">
credential,
</if>
<if test="salt != null">
salt,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
<if test="registerType != null">
register_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="identifyType != null">
#{identifyType,jdbcType=TINYINT},
</if>
<if test="identifier != null">
#{identifier,jdbcType=VARCHAR},
</if>
<if test="credential != null">
#{credential,jdbcType=VARCHAR},
</if>
<if test="salt != null">
#{salt,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
<if test="registerType != null">
#{registerType,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysAuthExample" resultType="java.lang.Long">
select count(*) from t_sys_auth
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_sys_auth
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.identifyType != null">
identify_type = #{record.identifyType,jdbcType=TINYINT},
</if>
<if test="record.identifier != null">
identifier = #{record.identifier,jdbcType=VARCHAR},
</if>
<if test="record.credential != null">
credential = #{record.credential,jdbcType=VARCHAR},
</if>
<if test="record.salt != null">
salt = #{record.salt,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>
<if test="record.recStatus != null">
rec_status = #{record.recStatus,jdbcType=TINYINT},
</if>
<if test="record.registerType != null">
register_type = #{record.registerType,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_sys_auth
set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
identify_type = #{record.identifyType,jdbcType=TINYINT},
identifier = #{record.identifier,jdbcType=VARCHAR},
credential = #{record.credential,jdbcType=VARCHAR},
salt = #{record.salt,jdbcType=VARCHAR},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT},
register_type = #{record.registerType,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysAuth">
update t_sys_auth
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="identifyType != null">
identify_type = #{identifyType,jdbcType=TINYINT},
</if>
<if test="identifier != null">
identifier = #{identifier,jdbcType=VARCHAR},
</if>
<if test="credential != null">
credential = #{credential,jdbcType=VARCHAR},
</if>
<if test="salt != null">
salt = #{salt,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
rec_status = #{recStatus,jdbcType=TINYINT},
</if>
<if test="registerType != null">
register_type = #{registerType,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysAuth">
update t_sys_auth
set user_id = #{userId,jdbcType=BIGINT},
identify_type = #{identifyType,jdbcType=TINYINT},
identifier = #{identifier,jdbcType=VARCHAR},
credential = #{credential,jdbcType=VARCHAR},
salt = #{salt,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT},
register_type = #{registerType,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

400
src/main/resources/mapper_raw/SysUserMapper.xml

@ -0,0 +1,400 @@
<?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.ccsens.opensource.wxconfigurer.persist.mapper.SysUserMapper">
<resultMap id="BaseResultMap" type="com.ccsens.opensource.wxconfigurer.bean.po.SysUser">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="grade_id" jdbcType="BIGINT" property="gradeId" />
<result column="avatar_url" jdbcType="VARCHAR" property="avatarUrl" />
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
<result column="gender" jdbcType="TINYINT" property="gender" />
<result column="country" jdbcType="VARCHAR" property="country" />
<result column="province" jdbcType="VARCHAR" property="province" />
<result column="city" jdbcType="VARCHAR" property="city" />
<result column="language" jdbcType="VARCHAR" property="language" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="wechat" jdbcType="VARCHAR" property="wechat" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="balance" jdbcType="BIGINT" property="balance" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
<result column="source" jdbcType="TINYINT" property="source" />
</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, grade_id, avatar_url, nickname, gender, country, province, city, language, phone,
wechat, email, balance, created_at, updated_at, rec_status, source
</sql>
<select id="selectByExample" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysUserExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_sys_user
<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.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_sys_user
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_sys_user
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysUserExample">
delete from t_sys_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysUser">
insert into t_sys_user (id, grade_id, avatar_url,
nickname, gender, country,
province, city, language,
phone, wechat, email,
balance, created_at, updated_at,
rec_status, source)
values (#{id,jdbcType=BIGINT}, #{gradeId,jdbcType=BIGINT}, #{avatarUrl,jdbcType=VARCHAR},
#{nickname,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT}, #{country,jdbcType=VARCHAR},
#{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{language,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, #{wechat,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
#{balance,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{recStatus,jdbcType=TINYINT}, #{source,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysUser">
insert into t_sys_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="gradeId != null">
grade_id,
</if>
<if test="avatarUrl != null">
avatar_url,
</if>
<if test="nickname != null">
nickname,
</if>
<if test="gender != null">
gender,
</if>
<if test="country != null">
country,
</if>
<if test="province != null">
province,
</if>
<if test="city != null">
city,
</if>
<if test="language != null">
language,
</if>
<if test="phone != null">
phone,
</if>
<if test="wechat != null">
wechat,
</if>
<if test="email != null">
email,
</if>
<if test="balance != null">
balance,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
<if test="source != null">
source,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="gradeId != null">
#{gradeId,jdbcType=BIGINT},
</if>
<if test="avatarUrl != null">
#{avatarUrl,jdbcType=VARCHAR},
</if>
<if test="nickname != null">
#{nickname,jdbcType=VARCHAR},
</if>
<if test="gender != null">
#{gender,jdbcType=TINYINT},
</if>
<if test="country != null">
#{country,jdbcType=VARCHAR},
</if>
<if test="province != null">
#{province,jdbcType=VARCHAR},
</if>
<if test="city != null">
#{city,jdbcType=VARCHAR},
</if>
<if test="language != null">
#{language,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="wechat != null">
#{wechat,jdbcType=VARCHAR},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="balance != null">
#{balance,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
<if test="source != null">
#{source,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysUserExample" resultType="java.lang.Long">
select count(*) from t_sys_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_sys_user
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.gradeId != null">
grade_id = #{record.gradeId,jdbcType=BIGINT},
</if>
<if test="record.avatarUrl != null">
avatar_url = #{record.avatarUrl,jdbcType=VARCHAR},
</if>
<if test="record.nickname != null">
nickname = #{record.nickname,jdbcType=VARCHAR},
</if>
<if test="record.gender != null">
gender = #{record.gender,jdbcType=TINYINT},
</if>
<if test="record.country != null">
country = #{record.country,jdbcType=VARCHAR},
</if>
<if test="record.province != null">
province = #{record.province,jdbcType=VARCHAR},
</if>
<if test="record.city != null">
city = #{record.city,jdbcType=VARCHAR},
</if>
<if test="record.language != null">
language = #{record.language,jdbcType=VARCHAR},
</if>
<if test="record.phone != null">
phone = #{record.phone,jdbcType=VARCHAR},
</if>
<if test="record.wechat != null">
wechat = #{record.wechat,jdbcType=VARCHAR},
</if>
<if test="record.email != null">
email = #{record.email,jdbcType=VARCHAR},
</if>
<if test="record.balance != null">
balance = #{record.balance,jdbcType=BIGINT},
</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>
<if test="record.recStatus != null">
rec_status = #{record.recStatus,jdbcType=TINYINT},
</if>
<if test="record.source != null">
source = #{record.source,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_sys_user
set id = #{record.id,jdbcType=BIGINT},
grade_id = #{record.gradeId,jdbcType=BIGINT},
avatar_url = #{record.avatarUrl,jdbcType=VARCHAR},
nickname = #{record.nickname,jdbcType=VARCHAR},
gender = #{record.gender,jdbcType=TINYINT},
country = #{record.country,jdbcType=VARCHAR},
province = #{record.province,jdbcType=VARCHAR},
city = #{record.city,jdbcType=VARCHAR},
language = #{record.language,jdbcType=VARCHAR},
phone = #{record.phone,jdbcType=VARCHAR},
wechat = #{record.wechat,jdbcType=VARCHAR},
email = #{record.email,jdbcType=VARCHAR},
balance = #{record.balance,jdbcType=BIGINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT},
source = #{record.source,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysUser">
update t_sys_user
<set>
<if test="gradeId != null">
grade_id = #{gradeId,jdbcType=BIGINT},
</if>
<if test="avatarUrl != null">
avatar_url = #{avatarUrl,jdbcType=VARCHAR},
</if>
<if test="nickname != null">
nickname = #{nickname,jdbcType=VARCHAR},
</if>
<if test="gender != null">
gender = #{gender,jdbcType=TINYINT},
</if>
<if test="country != null">
country = #{country,jdbcType=VARCHAR},
</if>
<if test="province != null">
province = #{province,jdbcType=VARCHAR},
</if>
<if test="city != null">
city = #{city,jdbcType=VARCHAR},
</if>
<if test="language != null">
language = #{language,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="wechat != null">
wechat = #{wechat,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="balance != null">
balance = #{balance,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
rec_status = #{recStatus,jdbcType=TINYINT},
</if>
<if test="source != null">
source = #{source,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.opensource.wxconfigurer.bean.po.SysUser">
update t_sys_user
set grade_id = #{gradeId,jdbcType=BIGINT},
avatar_url = #{avatarUrl,jdbcType=VARCHAR},
nickname = #{nickname,jdbcType=VARCHAR},
gender = #{gender,jdbcType=TINYINT},
country = #{country,jdbcType=VARCHAR},
province = #{province,jdbcType=VARCHAR},
city = #{city,jdbcType=VARCHAR},
language = #{language,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
wechat = #{wechat,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
balance = #{balance,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT},
source = #{source,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

97
src/main/resources/mbg.xml

@ -21,7 +21,7 @@
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://api.ccsens.com:3306/ptpro?useUnicode=true&amp;characterEncoding=UTF-8"
connectionURL="jdbc:mysql://49.233.89.188:3306/tall?useUnicode=true&amp;characterEncoding=UTF-8&amp;tinyInt1isBit=false"
userId="root"
password="po3OynBO[M3579p6L7)o">
</jdbcConnection>
@ -33,7 +33,7 @@
</javaTypeResolver>
<!-- targetProject:生成PO类的位置 -->
<javaModelGenerator targetPackage="com.ccsens.message.bean.po"
<javaModelGenerator targetPackage="com.ccsens.opensource.wxconfigurer.bean.po"
targetProject=".\src\main\java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
@ -50,58 +50,57 @@
<!-- targetPackage:mapper接口生成的位置 -->
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.ccsens.message.persist.mapper"
targetPackage="com.ccsens.opensource.wxconfigurer.persist.mapper"
targetProject=".\src\main\java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<!-- <table tableName="t_sys_user" domainObjectName="SysUser"></table>
<table tableName="t_sys_auth" domainObjectName="SysAuth"></table>
<table tableName="t_sys_grade" domainObjectName="SysGrade"></table>
<table tableName="t_sys_balance_log" domainObjectName="SysBalanceLog"></table>
<table tableName="t_sys_project" domainObjectName="SysProject"></table>
<table tableName="t_pro_scene" domainObjectName="ProScene"></table>
<table tableName="t_pro_role" domainObjectName="ProRole"></table>
<table tableName="t_pro_member_role" domainObjectName="ProMemberRole"></table>
<table tableName="t_pro_member" domainObjectName="ProMember"></table>
<table tableName="t_pro_role_execlude" domainObjectName="ProRoleExclude"></table>
<table tableName="t_pro_task" domainObjectName="ProTask"></table>
<table tableName="t_sub_task" domainObjectName="SubTask"></table>
<table tableName="t_pro_log" domainObjectName="ProLog"></table>
<table tableName="t_task_plugin" domainObjectName="TaskPlugin"></table>
<table tableName="t_task_deliver" domainObjectName="TaskDeliver"></table>
<table tableName="t_deliver_post_log" domainObjectName="DeliverPostLog"></table>
<table tableName="t_commited_file" domainObjectName="CommitedFile"></table>
<table tableName="t_msg" domainObjectName="Msg"></table>
<table tableName="t_msg_log" domainObjectName="MsgLog"></table>
<table tableName="t_stakeholder" domainObjectName="Stakeholder"></table>
<table tableName="t_task_hardware" domainObjectName="TaskHardware"></table>
<table tableName="t_sys_user" domainObjectName="SysUser"></table>
<table tableName="t_pro_sub_time_member" domainObjectName="ProSubTimeMember"></table>
<table tableName="t_sys_domain" domainObjectName="SysDomain"></table>
<table tableName="t_sys_wx" domainObjectName="SysWx"></table>
<table tableName="t_pro_show" domainObjectName="ProShow"></table>
<table tableName="t_sys_signin_field" domainObjectName="SigninField"></table>
<table tableName="t_pro_plugin_signin" domainObjectName="ProPluginSignin"></table>
<table tableName="t_pro_plugin_signin_fuzzy" domainObjectName="ProPluginSigninFuzzy"></table>
<table tableName="t_pro_plugin_config" domainObjectName="ProPluginConfig"></table>
<table tableName="t_pro_task_comment" domainObjectName="ProTaskComment"></table>
<table tableName="t_pro_task_show" domainObjectName="ProTaskShow"></table>
<table tableName="t_sys_robot" domainObjectName="SysRobot"></table>
<table tableName="t_sys_project_robot" domainObjectName="SysProjectRobot"></table>
<table tableName="t_sys_message_type" domainObjectName="SysMessageType"></table>
<table tableName="t_sys_project_robot_message" domainObjectName="SysProjectRobotMessage"></table>
<table tableName="t_sys_robot_log" domainObjectName="SysRobotLog"></table>
<table tableName="t_sys_label" domainObjectName="SysLabel"></table>
<table tableName="t_sys_project_label" domainObjectName="SysProjectLabel"></table>
<table tableName="t_sys_relevance_project" domainObjectName="SysRelevanceProject"></table>
<table tableName="t_sys_operation" domainObjectName="SysOperation"></table>
<table tableName="t_sys_operation_message" domainObjectName="SysOperationMessage"></table>
<table tableName="t_sys_message_send" domainObjectName="SysMessageSend"></table>-->
<table tableName="t_sys_user" domainObjectName="User"></table>
<table tableName="t_sys_auth" domainObjectName="Auth"></table>
<table tableName="t_sys_signin_log" domainObjectName="SigninLog"></table>
<table tableName="t_tree" domainObjectName="Tree"></table>
<table tableName="t_tree_role" domainObjectName="TreeRole"></table>
<table tableName="t_tree_participant" domainObjectName="TreeParticipant"></table>
<table tableName="t_tree_task" domainObjectName="TreeTask"></table>
<table tableName="t_tree_node" domainObjectName="TreeNode"></table>
<table tableName="t_tree_plugin" domainObjectName="TreePlugin"></table>
<table tableName="t_tree_task_exclude_role" domainObjectName="TreeTaskExcludeRole"></table>
<table tableName="t_tree_node_exclude_role" domainObjectName="TreeNodeExcludeRole"></table>
<table tableName="t_tree_plugin_exclude_role" domainObjectName="TreePluginExcludeRole"></table>
<table tableName="t_tree_dot_exclude_role" domainObjectName="TreeDotExcludeRole"></table>
<table tableName="t_tree_execute_log" domainObjectName="TreeExecuteLog"></table>
<table tableName="t_sys_scene" domainObjectName="Scene"></table>
<table tableName="t_sys_plugin" domainObjectName="Plugin"></table>
<table tableName="t_sys_dot" domainObjectName="Dot"></table>
<table tableName="t_sys_deliver" domainObjectName="Deliver"></table>
<table tableName="t_note" domainObjectName="Note"></table>
<table tableName="t_comment" domainObjectName="Comment"></table>
<table tableName="t_score" domainObjectName="Score"></table>
<table tableName="t_score_msg" domainObjectName="ScoreMsg"></table>
<table tableName="t_vote" domainObjectName="Vote"></table>
<table tableName="t_vote_msg" domainObjectName="VoteMsg"></table>
<!--<table tableName="t_scene" domainObjectName="Scene"></table>-->
<!--<table tableName="t_device" domainObjectName="Device"></table>-->
<!--<table tableName="t_plugin" domainObjectName="Plugin"></table>-->
<!--<table tableName="t_scene_plugin" domainObjectName="ScenePlugin"></table>-->
<!--<table tableName="t_role" domainObjectName="Role"></table>-->
<!--<table tableName="t_task" domainObjectName="Task"></table>-->
<!--<table tableName="t_participantor" domainObjectName="Participantor"></table>-->
<!--<table tableName="t_node" domainObjectName="Node"></table>-->
<!--<table tableName="t_node_role_plugin" domainObjectName="NodeRolePlugin"></table>-->
<!--<table tableName="t_node_user_plugin" domainObjectName="NodeUserPlugin"></table>-->
<!--<table tableName="t_score" domainObjectName="Score"></table>-->
<!--<table tableName="t_vote" domainObjectName="Vote"></table>-->
<!--<table tableName="t_note" domainObjectName="Note"></table>-->
<!--<table tableName="t_comment" domainObjectName="Comment"></table>-->
<!--<table tableName="t_score_msg" domainObjectName="ScoreMsg"></table>-->
<!--<table tableName="t_vote_msg" domainObjectName="VoteMsg"></table>-->
<!--<table tableName="t_mtpro_participantor" domainObjectName="MtproParticipantor"></table>-->
<!--<table tableName="t_mtpro_event" domainObjectName="MtproEvent"></table>-->
<!--<table tableName="t_mtpro_project" domainObjectName="MtproProject"></table>-->
<!--<table tableName="t_mtpro_score_item" domainObjectName="MtproScoreItem"></table>-->
<!--<table tableName="t_mtpro_score" domainObjectName="MtproScore"></table>-->
<table tableName="t_sys_user" domainObjectName="SysUser"></table>
<table tableName="t_sys_auth" domainObjectName="SysAuth"></table>
<!-- 有些表的字段需要指定java类型
<table schema="" tableName="">

Loading…
Cancel
Save