diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunMember.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunMember.java index 6e0ac09..48621af 100644 --- a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunMember.java +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunMember.java @@ -50,6 +50,34 @@ public class ShuYunMember { */ private String guideId; + /** + * 累计获得积分 + */ + private String gainedPoint; + + /** + * 变更后积分 + */ + private String point; + + /** + *累计过期积分 + */ + private String expiredPoint; + + /** + * 累计消费积分 + */ + private String consumedPoint; + + /** + * 会员ID + */ + private String memberId; + + + + public ShuYunMember() { } @@ -81,6 +109,9 @@ public class ShuYunMember { this.shopId = shopId; } + /** + * 手机修改必填 + */ public ShuYunMember(String id, String platCode, String shopId, String mobile) { this.id = id; this.platCode = platCode; @@ -171,4 +202,64 @@ public class ShuYunMember { public void setGuideId(String guideId) { this.guideId = guideId; } + + public String getGainedPoint() { + return gainedPoint; + } + + public void setGainedPoint(String gainedPoint) { + this.gainedPoint = gainedPoint; + } + + public String getPoint() { + return point; + } + + public void setPoint(String point) { + this.point = point; + } + + public String getExpiredPoint() { + return expiredPoint; + } + + public void setExpiredPoint(String expiredPoint) { + this.expiredPoint = expiredPoint; + } + + public String getConsumedPoint() { + return consumedPoint; + } + + public void setConsumedPoint(String consumedPoint) { + this.consumedPoint = consumedPoint; + } + + public String getMemberId() { + return memberId; + } + + public void setMemberId(String memberId) { + this.memberId = memberId; + } + + @Override + public String toString() { + return "ShuYunMember{" + + "id='" + id + '\'' + + ", platCode='" + platCode + '\'' + + ", shopId='" + shopId + '\'' + + ", name='" + name + '\'' + + ", mobile='" + mobile + '\'' + + ", birthday='" + birthday + '\'' + + ", gender='" + gender + '\'' + + ", created='" + created + '\'' + + ", guideId='" + guideId + '\'' + + ", gainedPoint='" + gainedPoint + '\'' + + ", point='" + point + '\'' + + ", expiredPoint='" + expiredPoint + '\'' + + ", consumedPoint='" + consumedPoint + '\'' + + ", memberId='" + memberId + '\'' + + '}'; + } } diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunPageReq.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunPageReq.java new file mode 100644 index 0000000..b749e8b --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunPageReq.java @@ -0,0 +1,122 @@ +package com.flossom.common.core.domain.shuyun; + +public class ShuYunPageReq { + /** + * 平台客户账号 + */ + private String id; + /** + * 会员ID + */ + private String memberId; + /** + * + */ + private String platCode; + /** + * + */ + private String shopId; + /** + * + */ + private String pageSize; + /** + * + */ + private String currentPage; + /** + * 包含,格式 yyyy-MM-dd HH:mm:ss + */ + private String startCreated; + /** + * 包含,格式 yyyy-MM-dd HH:mm:ss + */ + private String endCreated; + + public ShuYunPageReq() { + } + + public ShuYunPageReq(String id, String platCode, String shopId, String pageSize, String currentPage) { + this.id = id; + this.platCode = platCode; + this.shopId = shopId; + this.pageSize = pageSize; + this.currentPage = currentPage; + } + + public ShuYunPageReq(String id, String memberId, String platCode, String shopId, String pageSize, String currentPage, String startCreated, String endCreated) { + this.id = id; + this.memberId = memberId; + this.platCode = platCode; + this.shopId = shopId; + this.pageSize = pageSize; + this.currentPage = currentPage; + this.startCreated = startCreated; + this.endCreated = endCreated; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMemberId() { + return memberId; + } + + public void setMemberId(String memberId) { + this.memberId = memberId; + } + + public String getPlatCode() { + return platCode; + } + + public void setPlatCode(String platCode) { + this.platCode = platCode; + } + + public String getShopId() { + return shopId; + } + + public void setShopId(String shopId) { + this.shopId = shopId; + } + + public String getStartCreated() { + return startCreated; + } + + public void setStartCreated(String startCreated) { + this.startCreated = startCreated; + } + + public String getEndCreated() { + return endCreated; + } + + public void setEndCreated(String endCreated) { + this.endCreated = endCreated; + } + + public String getPageSize() { + return pageSize; + } + + public void setPageSize(String pageSize) { + this.pageSize = pageSize; + } + + public String getCurrentPage() { + return currentPage; + } + + public void setCurrentPage(String currentPage) { + this.currentPage = currentPage; + } +} diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunPageUtil.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunPageUtil.java new file mode 100644 index 0000000..740eeb8 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunPageUtil.java @@ -0,0 +1,79 @@ +package com.flossom.common.core.domain.shuyun; + +import java.util.List; + +public class ShuYunPageUtil { + + /** + * 总页数 + */ + private int totalPageCount; + /** + * 总记录数 + */ + private int totals; + /** + * 页面大小,即每页显示记录数 + */ + private int pageSize = 10; + /** + * 当前页码 + */ + private int pageNum = 1; + /** + * 分页数据 + */ + private List list; + + + public ShuYunPageUtil() { + } + + public ShuYunPageUtil(int totals, int pageSize, int pageNum, List list) { + this.totals = totals; + this.pageSize = pageSize; + this.pageNum = pageNum; + this.list = list; + } + + public int getTotalPageCount() { + return totalPageCount; + } + + public void setTotalPageCount(int totalPageCount) { + this.totalPageCount = totalPageCount; + } + + public int getTotals() { + return totals; + } + + public void setTotals(int totals) { + this.totals = totals; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNum() { + return pageNum; + } + + public void setPageNum(int pageNum) { + this.pageNum = pageNum; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + +} diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunPointChange.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunPointChange.java index 58accb1..c724c2e 100644 --- a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunPointChange.java +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunPointChange.java @@ -101,6 +101,12 @@ public class ShuYunPointChange { this.desc = desc; } + public ShuYunPointChange(String id, String platCode, String shopId) { + this.id = id; + this.platCode = platCode; + this.shopId = shopId; + } + public String getId() { return id; } diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunPointChangeLog.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunPointChangeLog.java new file mode 100644 index 0000000..a92b8ce --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunPointChangeLog.java @@ -0,0 +1,249 @@ +package com.flossom.common.core.domain.shuyun; + +/** + * 数云积分改变记录 + */ +public class ShuYunPointChangeLog { + /** + * 平台客户账号 + */ + private String id; + /** + * 变更时间 yyyy-MM-dd HH:mm:ss + */ + private String created; + /** + * 业务来源 + */ + private String source; + /** + * 流水号,不唯一,与 changeType 组合在一起满足唯一 + */ + private String partnerSequence; + /** + * 变更积分 + */ + private String changePoint; + /** + * 版本号,递增 + */ + private String version; + private String operator; + /** + * 变更后积分 + */ + private String point; + private String changeTime; + /** + * 记录ID + */ + private String recordId; + private String platCode; + /** + * 流水号,不唯一,与 changeType 组合在一起满足唯一 + */ + private String sequence; + /** + * 过期时间 yyyy-MM-dd HH:mm:ss + */ + private String expired; + /** + * 合作伙伴编码 + */ + private String partner; + private String ouid; + /** + * 店铺ID + */ + private String shopId; + /** + * 描述信息 + */ + private String desc; + /** + * 会员ID + */ + private String memberId; + + /** + * 积分变更类型,枚举值: 发放、消费、作废、冻结、解冻、过期 + */ + private String changeType; + + public ShuYunPointChangeLog() { + } + + public ShuYunPointChangeLog(String id, String created, String source, String partnerSequence, String changePoint, String version, String operator, String point, String changeTime, String recordId, String platCode, String sequence, String expired, String partner, String ouid, String shopId, String desc, String memberId, String changeType) { + this.id = id; + this.created = created; + this.source = source; + this.partnerSequence = partnerSequence; + this.changePoint = changePoint; + this.version = version; + this.operator = operator; + this.point = point; + this.changeTime = changeTime; + this.recordId = recordId; + this.platCode = platCode; + this.sequence = sequence; + this.expired = expired; + this.partner = partner; + this.ouid = ouid; + this.shopId = shopId; + this.desc = desc; + this.memberId = memberId; + this.changeType = changeType; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCreated() { + return created; + } + + public void setCreated(String created) { + this.created = created; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getPartnerSequence() { + return partnerSequence; + } + + public void setPartnerSequence(String partnerSequence) { + this.partnerSequence = partnerSequence; + } + + public String getChangePoint() { + return changePoint; + } + + public void setChangePoint(String changePoint) { + this.changePoint = changePoint; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getOperator() { + return operator; + } + + public void setOperator(String operator) { + this.operator = operator; + } + + public String getPoint() { + return point; + } + + public void setPoint(String point) { + this.point = point; + } + + public String getChangeTime() { + return changeTime; + } + + public void setChangeTime(String changeTime) { + this.changeTime = changeTime; + } + + public String getRecordId() { + return recordId; + } + + public void setRecordId(String recordId) { + this.recordId = recordId; + } + + public String getPlatCode() { + return platCode; + } + + public void setPlatCode(String platCode) { + this.platCode = platCode; + } + + public String getSequence() { + return sequence; + } + + public void setSequence(String sequence) { + this.sequence = sequence; + } + + public String getExpired() { + return expired; + } + + public void setExpired(String expired) { + this.expired = expired; + } + + public String getPartner() { + return partner; + } + + public void setPartner(String partner) { + this.partner = partner; + } + + public String getOuid() { + return ouid; + } + + public void setOuid(String ouid) { + this.ouid = ouid; + } + + public String getShopId() { + return shopId; + } + + public void setShopId(String shopId) { + this.shopId = shopId; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public String getMemberId() { + return memberId; + } + + public void setMemberId(String memberId) { + this.memberId = memberId; + } + + public String getChangeType() { + return changeType; + } + + public void setChangeType(String changeType) { + this.changeType = changeType; + } +} diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunTag.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunTag.java new file mode 100644 index 0000000..96609da --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/shuyun/ShuYunTag.java @@ -0,0 +1,142 @@ +package com.flossom.common.core.domain.shuyun; + +public class ShuYunTag { + + /** + * 标签组id + */ + private Integer groupId; + /** + * 标签名称,不能重复创建。 + */ + private String tagName; + /** + * 0:日期, 1:字符输入(单值), 2:字符选择, 3:数值输入, 4:数值选择, 5:字符输入(多值), 6:年龄, 7:孕龄,8:从属型 + */ + private Integer valueType; + /** + * 标签值为时间类型时必须填入,日期类型(0:年/月/日, 1:年/月) + * 如果标签值类型为3(数值输入型)或4(数值选择型), 代表("0":"整数","1":"小数"), + */ + private Integer optionType; + /** + * 枚举可选值,字符数组 + * 可选值(当标签类型为2(字符选择)或者4(数值选择型)时必须填入 + */ + private String optionalValues; + /** + * 在标签值类型为2(字符选择型)或者4(数值选择型)时必须传入,可打标签值个数(0:单选,1:多选) + */ + private Integer valueNumberOption; + /** + * 标签值有效期,-1表示永久有效 + * 标签值有效期,如果有有效期,为固定的一个整数。跟validPeriodType字段组合使用,表示多少天,多少月,多少年 + */ + private Integer validPeriod; + /** + * 标签值有效期类型(0:天, 1:月, 2:年,-1:永久有效) + */ + private Integer validPeriodType; + /** + * 标签描述信息,没有描述信息需要传入空字符串 + */ + private String description; + + public ShuYunTag() { + } + + public ShuYunTag(Integer groupId, String tagName, Integer valueType, Integer optionType, Integer valueNumberOption, Integer validPeriod, Integer validPeriodType, String description) { + this.groupId = groupId; + this.tagName = tagName; + this.valueType = valueType; + this.optionType = optionType; + this.valueNumberOption = valueNumberOption; + this.validPeriod = validPeriod; + this.validPeriodType = validPeriodType; + this.description = description; + } + + public ShuYunTag(Integer groupId, String tagName, Integer valueType, Integer optionType, String optionalValues, Integer valueNumberOption, Integer validPeriod, Integer validPeriodType, String description) { + this.groupId = groupId; + this.tagName = tagName; + this.valueType = valueType; + this.optionType = optionType; + this.optionalValues = optionalValues; + this.valueNumberOption = valueNumberOption; + this.validPeriod = validPeriod; + this.validPeriodType = validPeriodType; + this.description = description; + } + + public Integer getGroupId() { + return groupId; + } + + public void setGroupId(Integer groupId) { + this.groupId = groupId; + } + + public String getTagName() { + return tagName; + } + + public void setTagName(String tagName) { + this.tagName = tagName; + } + + public Integer getValueType() { + return valueType; + } + + public void setValueType(Integer valueType) { + this.valueType = valueType; + } + + public Integer getOptionType() { + return optionType; + } + + public void setOptionType(Integer optionType) { + this.optionType = optionType; + } + + public String getOptionalValues() { + return optionalValues; + } + + public void setOptionalValues(String optionalValues) { + this.optionalValues = optionalValues; + } + + public Integer getValueNumberOption() { + return valueNumberOption; + } + + public void setValueNumberOption(Integer valueNumberOption) { + this.valueNumberOption = valueNumberOption; + } + + public Integer getValidPeriod() { + return validPeriod; + } + + public void setValidPeriod(Integer validPeriod) { + this.validPeriod = validPeriod; + } + + public Integer getValidPeriodType() { + return validPeriodType; + } + + public void setValidPeriodType(Integer validPeriodType) { + this.validPeriodType = validPeriodType; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/enums/ShuYunPointSourceEnum.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/enums/ShuYunPointSourceEnum.java new file mode 100644 index 0000000..db44781 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/enums/ShuYunPointSourceEnum.java @@ -0,0 +1,45 @@ +package com.flossom.common.core.enums; + +/** + * {@link com.flossom.common.core.domain.shuyun.ShuYunPointChange#source} + * 业务来源 + * TRADE:订单赠送、 + * REFUND:退单扣减、 + * SERVICE:客服、 + * CONSUME:消费、 + * EXPIRE:过期、 + * IMPORT:导入、 + * MALL:手淘互动、 + * BRAND:会员通、 + * OTHER 其他 + */ +public enum ShuYunPointSourceEnum { + TRADE("TRADE", "订单赠送"), + REFUND("REFUND", "退单扣减"), + SERVICE("SERVICE", "客服"), + CONSUME("CONSUME", "消费"), + EXPIRE("EXPIRE", "过期"), + IMPORT("IMPORT", "导入"), + MALL("MALL", "手淘互动"), + BRAND("BRAND", "会员通"), + OTHER("OTHER", "其他"), + ; + + private final String source; + + private final String info; + + + ShuYunPointSourceEnum(String source, String info) { + this.source = source; + this.info = info; + } + + public String getSource() { + return source; + } + + public String getInfo() { + return info; + } +} diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/utils/shuyun/ActionMethod.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/utils/shuyun/ActionMethod.java index 3368714..ff85e93 100644 --- a/flossom-modules/flossom-system/src/main/java/com/flossom/system/utils/shuyun/ActionMethod.java +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/utils/shuyun/ActionMethod.java @@ -11,17 +11,17 @@ public class ActionMethod { private String accessToken; /** - * 查询会员路径标识(单个会员) + * 查询会员信息(单个会员) */ private String queryMember; /** - * 注册会员路径标识 + * 注册会员 */ private String registerMember; /** - * 修改会员信息路径标识 + * 修改会员信息 */ private String modifyMember; @@ -40,6 +40,54 @@ public class ActionMethod { */ private String pointChange; + /** + * 积分变更记录查询 + */ + private String pointChangeLogSearch; + + /** + * 即将过期积分查询 + */ + private String pointWillDueSearch; + + /** + * 创建标签 + */ + private String tagCreate; + /** + * 删除标签 + */ + private String tagDelete; + /** + * 搜索标签 + */ + private String tagSearch; + /** + * 更改标签 + */ + private String tagUpdate; + + /** + * 给会员标记标签 + */ + private String markUserTagCreate; + /** + * 批量给会员标记标签 + */ + private String batchMarkUserTagCreate; + /** + * 删除用户标签 + */ + private String markUserTagDelete; + /** + * 批量删除用户标签 + */ + private String batchMarkUserTagDelete; + /** + * 查询用户标签 + */ + private String markUserTagSearch; + public String getAccessToken() { return accessToken; } @@ -95,4 +143,92 @@ public class ActionMethod { public void setPointChange(String pointChange) { this.pointChange = pointChange; } + + public String getPointChangeLogSearch() { + return pointChangeLogSearch; + } + + public void setPointChangeLogSearch(String pointChangeLogSearch) { + this.pointChangeLogSearch = pointChangeLogSearch; + } + + public String getPointWillDueSearch() { + return pointWillDueSearch; + } + + public void setPointWillDueSearch(String pointWillDueSearch) { + this.pointWillDueSearch = pointWillDueSearch; + } + + public String getTagCreate() { + return tagCreate; + } + + public void setTagCreate(String tagCreate) { + this.tagCreate = tagCreate; + } + + public String getTagDelete() { + return tagDelete; + } + + public void setTagDelete(String tagDelete) { + this.tagDelete = tagDelete; + } + + public String getTagSearch() { + return tagSearch; + } + + public void setTagSearch(String tagSearch) { + this.tagSearch = tagSearch; + } + + public String getTagUpdate() { + return tagUpdate; + } + + public void setTagUpdate(String tagUpdate) { + this.tagUpdate = tagUpdate; + } + + public String getMarkUserTagCreate() { + return markUserTagCreate; + } + + public void setMarkUserTagCreate(String markUserTagCreate) { + this.markUserTagCreate = markUserTagCreate; + } + + public String getBatchMarkUserTagCreate() { + return batchMarkUserTagCreate; + } + + public void setBatchMarkUserTagCreate(String batchMarkUserTagCreate) { + this.batchMarkUserTagCreate = batchMarkUserTagCreate; + } + + public String getMarkUserTagDelete() { + return markUserTagDelete; + } + + public void setMarkUserTagDelete(String markUserTagDelete) { + this.markUserTagDelete = markUserTagDelete; + } + + public String getBatchMarkUserTagDelete() { + return batchMarkUserTagDelete; + } + + public void setBatchMarkUserTagDelete(String batchMarkUserTagDelete) { + this.batchMarkUserTagDelete = batchMarkUserTagDelete; + } + + public String getMarkUserTagSearch() { + return markUserTagSearch; + } + + public void setMarkUserTagSearch(String markUserTagSearch) { + this.markUserTagSearch = markUserTagSearch; + } } diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/utils/shuyun/ShuYunApiUtils.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/utils/shuyun/ShuYunApiUtils.java index 17a61f3..14b36c1 100644 --- a/flossom-modules/flossom-system/src/main/java/com/flossom/system/utils/shuyun/ShuYunApiUtils.java +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/utils/shuyun/ShuYunApiUtils.java @@ -1,11 +1,11 @@ package com.flossom.system.utils.shuyun; +import cn.hutool.core.bean.BeanUtil; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; import com.flossom.common.core.constant.CacheConstants; import com.flossom.common.core.domain.R; -import com.flossom.common.core.domain.shuyun.AccessToken; -import com.flossom.common.core.domain.shuyun.ShuYunMember; -import com.flossom.common.core.domain.shuyun.ShuYunPointChange; +import com.flossom.common.core.domain.shuyun.*; import com.flossom.common.core.exception.ServiceException; import com.flossom.common.redis.service.RedisService; import com.flossom.system.utils.HttpClientUtils; @@ -47,6 +47,21 @@ public class ShuYunApiUtils { ShuYunApiUtils.redisService = redisService; } + /** + * 数云http请求code + */ + public class ShuYunHttpStatusConstants { + /** + * 请求成功 + */ + public static final int SUCCESS = 10000; + + /** + * 请求成功,但是结果不符合预期 + */ + public static final int HALF_SUCCESS = 14000; + } + /** * 获取 accessToken,缓存没有就请求数云回调接口,将 accessToken 传递过来 */ @@ -63,7 +78,7 @@ public class ShuYunApiUtils { logger.error("请求数云接口获取accessToken失败,将直接使用旧的accessToken,失败原因:{}", result); } } catch (Exception e) { - logger.error("请求数云接口获取accessToken失败,将直接使用旧的accessToken,失败原因:{}", e); + logger.error("请求数云接口获取accessToken失败,将直接使用旧的accessToken,失败原因:{}", e.getMessage()); } } String accessTokenStr = redisService.getCacheMapValue(CacheConstants.SHUYUN_ACCESS_TOKEN_CACHE, CacheConstants.SHUYUN_ACCESS_TOKEN_CACHE_VALUE); @@ -99,11 +114,11 @@ public class ShuYunApiUtils { actionMethod); logger.info("返回响应:{}", result); R r = JSON.parseObject(result, R.class); - if (r.getCode() == 10000 || r.getCode() == 14000) { + if (r.getCode() == ShuYunHttpStatusConstants.SUCCESS || r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) { return r; } else { logger.error("调用数云接口发生未知错误:{}", result); - throw new ServiceException("调用数云接口发生未知错误"); + throw new ServiceException(r.getMsg()); } } @@ -116,7 +131,7 @@ public class ShuYunApiUtils { shuYunHttpRequest(HttpMethod.POST, null, JSON.toJSONString(member), shuYunConfig.getActionMethod().getRegisterMember()); } catch (Exception e) { - logger.error("请求数云接口注册会员失败:{}", e); + logger.error("请求数云接口注册会员失败:{}", e.getMessage()); throw new ServiceException("请求数云接口注册会员失败"); } } @@ -128,12 +143,16 @@ public class ShuYunApiUtils { try { R r = shuYunHttpRequest(HttpMethod.POST, null, JSON.toJSONString(member), shuYunConfig.getActionMethod().getQueryMember()); - if (r.getCode() == 10000) { + if (r.getCode() == ShuYunHttpStatusConstants.SUCCESS) { return JSON.parseObject(r.getData().toString(), ShuYunMember.class); } - return null; + if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) { + return null; + } + logger.error("请求数云接口-会员积分查询失败:{}", r.getMsg()); + throw new ServiceException("请求数云接口-会员积分查询失败"); } catch (Exception e) { - logger.error("请求数云接口-查询会员信息失败:{}", e); + logger.error("请求数云接口-查询会员信息失败:{}", e.getMessage()); throw new ServiceException("请求数云接口-查询会员信息失败"); } } @@ -147,7 +166,7 @@ public class ShuYunApiUtils { shuYunHttpRequest(HttpMethod.PUT, null, JSON.toJSONString(member), shuYunConfig.getActionMethod().getModifyMember()); } catch (Exception e) { - logger.error("请求数云接口-修改会员信息(除手机号)失败:{}", e); + logger.error("请求数云接口-修改会员信息(除手机号)失败:{}", e.getMessage()); throw new ServiceException("请求数云接口-修改会员信息(除手机号)失败"); } } @@ -160,7 +179,7 @@ public class ShuYunApiUtils { shuYunHttpRequest(HttpMethod.PUT, null, JSON.toJSONString(member), shuYunConfig.getActionMethod().getModifyMemberMobile()); } catch (Exception e) { - logger.error("请求数云接口-修改会员手机号失败:{}", e); + logger.error("请求数云接口-修改会员手机号失败:{}", e.getMessage()); throw new ServiceException("请求数云接口-修改会员手机号失败"); } } @@ -173,22 +192,98 @@ public class ShuYunApiUtils { shuYunHttpRequest(HttpMethod.POST, null, JSON.toJSONString(member), shuYunConfig.getActionMethod().getUnbindMember()); } catch (Exception e) { - logger.error("请求数云接口-解绑会员失败:{}", e); + logger.error("请求数云接口-解绑会员失败:{}", e.getMessage()); throw new ServiceException("请求数云接口-解绑会员失败"); } } /** - * 积分变更 + * 会员积分变更 */ public static void pointChange(ShuYunPointChange shuYunPointChange) { try { shuYunHttpRequest(HttpMethod.POST, null, JSON.toJSONString(shuYunPointChange), shuYunConfig.getActionMethod().getPointChange()); } catch (Exception e) { - logger.error("请求数云接口-会员积分变更失败:{}", e); + logger.error("请求数云接口-会员积分变更失败:{}", e.getMessage()); throw new ServiceException("请求数云接口-会员积分变更失败"); } } + /** + * 积分变更记录查询(分页) + */ + public static ShuYunPageUtil pointChangeLogSearch(ShuYunPageReq shuYunPageReq) { + try { + + R r = shuYunHttpRequest(HttpMethod.GET, BeanUtil.beanToMap(shuYunPageReq), null, + shuYunConfig.getActionMethod().getPointChangeLogSearch()); + if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) { + logger.info("查询成功,没有数据"); + return new ShuYunPageUtil<>(); + } + if (r.getCode() != ShuYunHttpStatusConstants.SUCCESS) { + logger.error("请求数云接口-会员积分变更记录查询失败:{}", r.getMsg()); + } + return JSON.parseObject(r.getData().toString(), new TypeReference>(){}); + } catch (Exception e) { + logger.error("请求数云接口-会员积分变更记录查询失败:{}", e.getMessage()); + throw new ServiceException("请求数云接口-会员积分变更记录查询失败"); + } + } + + /** + * 查询即将过期积分 + * TODO:(未完成) + */ + public static int pointWillDueSearch(Map map) { + try { + R r = shuYunHttpRequest(HttpMethod.GET, map, null, + shuYunConfig.getActionMethod().getPointWillDueSearch()); + if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) { + logger.info("查询成功,没有数据"); + } + if (r.getCode() != ShuYunHttpStatusConstants.SUCCESS) { + logger.error("请求数云接口-查询会员即将过期积分失败:{}", r.getMsg()); + } + return 0; + } catch (Exception e) { + logger.error("请求数云接口-查询会员即将过期积分失败:{}", e.getMessage()); + throw new ServiceException("请求数云接口-查询会员即将过期积分失败"); + } + } + + + /** + * 创建标签 + */ + public static void tagCreate(ShuYunTag shuYunTag) { + try { + R r = shuYunHttpRequest(HttpMethod.POST, null, JSON.toJSONString(shuYunTag), + shuYunConfig.getActionMethod().getTagCreate()); + if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) { + logger.error("请求数云接口-创建标签失败:{}", r.getMsg()); + throw new ServiceException("请求数云接口-创建标签失败"); + } + } catch (Exception e) { + logger.error("请求数云接口-创建标签失败:{}", e.getMessage()); + throw new ServiceException("请求数云接口-创建标签失败"); + } + } + + public static void tagSearch(Map params) { + try { + R r = shuYunHttpRequest(HttpMethod.GET, params, null, + shuYunConfig.getActionMethod().getTagSearch()); + if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) { + logger.error("请求数云接口-创建标签失败:{}", r.getMsg()); + throw new ServiceException("请求数云接口-创建标签失败"); + } + } catch (Exception e) { + logger.error("请求数云接口-创建标签失败:{}", e.getMessage()); + throw new ServiceException("请求数云接口-创建标签失败"); + } + } + + }