diff --git a/doc/readme.md b/doc/readme.md index 4f57d7f..931b2d9 100644 --- a/doc/readme.md +++ b/doc/readme.md @@ -2,10 +2,37 @@ 微信支付增加支付成功后系统回调通知 +## sys_callback + +```sql +CREATE TABLE `sys_callback` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `callback_id` char(36) DEFAULT NULL, + `name` varchar(255) DEFAULT NULL COMMENT '名称', + `url` varchar(1000) DEFAULT NULL COMMENT '回调地址', + `json_body` text COMMENT '请求体', + `status` varchar(20) DEFAULT 'NONE' COMMENT '状态', + `fail_count` int(11) DEFAULT NULL COMMENT '失败次数', + `gmt_create` varchar(20) DEFAULT NULL COMMENT '创建时间', + `creator` char(36) DEFAULT NULL COMMENT '创建人', + `gmt_modified` varchar(20) DEFAULT NULL COMMENT '修改时间', + `modifier` char(36) DEFAULT NULL COMMENT '修改人', + `is_delete` int(1) DEFAULT '0' COMMENT '是否删除', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='回调'; +``` + # 增加系统任务 quartz系统任务 +# 增加配置 + +```yaml +api-path: + operator-plugin: http://192.168.0.115:8099/operator-plugin/ +``` + # 账号自动解锁(已上线) 说明 diff --git a/src/main/java/cn/com/tenlion/operator/controller/resource/user/ic/apply/UserIcApplyResourceController.java b/src/main/java/cn/com/tenlion/operator/controller/resource/user/ic/apply/UserIcApplyResourceController.java index c843051..954a90b 100644 --- a/src/main/java/cn/com/tenlion/operator/controller/resource/user/ic/apply/UserIcApplyResourceController.java +++ b/src/main/java/cn/com/tenlion/operator/controller/resource/user/ic/apply/UserIcApplyResourceController.java @@ -26,7 +26,8 @@ public class UserIcApplyResourceController { @Autowired private UserIcApplyService userIcApplyService; - @PostMapping("apply") + @Deprecated +// @PostMapping("apply") public synchronized SuccessResult apply(@RequestBody JSONObject body) { if (StringUtils.isBlank(body.getString("applier"))) { throw new ParamsException("申请人不能为空"); diff --git a/src/main/java/cn/com/tenlion/operator/pojo/dtos/ic/UsericDTO.java b/src/main/java/cn/com/tenlion/operator/pojo/dtos/ic/UsericDTO.java new file mode 100644 index 0000000..3b73ddf --- /dev/null +++ b/src/main/java/cn/com/tenlion/operator/pojo/dtos/ic/UsericDTO.java @@ -0,0 +1,352 @@ +package cn.com.tenlion.operator.pojo.dtos.ic; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @ClassName: UsericDTO + * @Description: 用户生成的邀请码 + * @Author: CodeFactory + * @Date: 2025-02-13 15:12:34 + * @Version: 3.0 + **/ +@ApiModel +public class UsericDTO { + + @ApiModelProperty(name = "usericId", value = "生成的邀请码") + private String usericId; + @ApiModelProperty(name = "icRebateTatio", value = "返利比例(百分比,在project-config中配置)") + private Integer icRebateTatio; + @ApiModelProperty(name = "icPriceAll", value = "全托管价格") + private Integer icPriceAll; + @ApiModelProperty(name = "icPriceMaterial", value = "写材料价格") + private Integer icPriceMaterial; + @ApiModelProperty(name = "icProceThree", value = "预留价格3") + private Integer icProceThree; + @ApiModelProperty(name = "icProceFour", value = "预留价格4") + private Integer icProceFour; + @ApiModelProperty(name = "icProceFive", value = "预留价格5") + private Integer icProceFive; + @ApiModelProperty(name = "systemRemark", value = "系统备注") + private String systemRemark; + @ApiModelProperty(name = "icUseUsers", value = "该邀请码已邀请的用户ID集") + private String icUseUsers; + @ApiModelProperty(name = "totalMoney", value = "该邀请码已产生的全部成交金额") + private Integer totalMoney; + @ApiModelProperty(name = "icSwitch", value = "邀请码开关,1生效,0不生效") + private String icSwitch; + @ApiModelProperty(name = "switchTime", value = "开关变更时间") + private String switchTime; + @ApiModelProperty(name = "userName", value = "创建者名称") + private String userName; + @ApiModelProperty(name = "userType", value = "创建者类型") + private String userType; + @ApiModelProperty(name = "useCount", value = "") + private Integer useCount; + @ApiModelProperty(name = "creator", value = "") + private String creator; + @ApiModelProperty(name = "createTime", value = "") + private String createTime; + @ApiModelProperty(name = "userUsername", value = "") + private String userUsername; + + public String getUserUsername() { + return userUsername == null ? "" : userUsername.trim(); + } + + public void setUserUsername(String userUsername) { + this.userUsername = userUsername; + } + + public Integer getUseCount() { + return useCount == null ? 0 : useCount; + } + + public void setUseCount(Integer useCount) { + this.useCount = useCount; + } + + public String getCreateTime() { + return createTime == null ? "" : createTime.trim(); + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCreator() { + return creator == null ? "" : creator.trim(); + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public String getUserName() { + return userName == null ? "" : userName.trim(); + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getUserType() { + return userType == null ? "" : userType.trim(); + } + + public void setUserType(String userType) { + this.userType = userType; + } + + public String getUsericId() { + return usericId == null ? "" : usericId.trim(); + } + + public void setUsericId(String usericId) { + this.usericId = usericId; + } + + public Integer getIcRebateTatio() { + return icRebateTatio == null ? 0 : icRebateTatio; + } + + public void setIcRebateTatio(Integer icRebateTatio) { + this.icRebateTatio = icRebateTatio; + } + + public Integer getIcPriceAll() { + return icPriceAll == null ? 0 : icPriceAll; + } + + public void setIcPriceAll(Integer icPriceAll) { + this.icPriceAll = icPriceAll; + } + + public Integer getIcPriceMaterial() { + return icPriceMaterial == null ? 0 : icPriceMaterial; + } + + public void setIcPriceMaterial(Integer icPriceMaterial) { + this.icPriceMaterial = icPriceMaterial; + } + + public Integer getIcProceThree() { + return icProceThree == null ? 0 : icProceThree; + } + + public void setIcProceThree(Integer icProceThree) { + this.icProceThree = icProceThree; + } + + public Integer getIcProceFour() { + return icProceFour == null ? 0 : icProceFour; + } + + public void setIcProceFour(Integer icProceFour) { + this.icProceFour = icProceFour; + } + + public Integer getIcProceFive() { + return icProceFive == null ? 0 : icProceFive; + } + + public void setIcProceFive(Integer icProceFive) { + this.icProceFive = icProceFive; + } + + public String getSystemRemark() { + return systemRemark == null ? "" : systemRemark.trim(); + } + + public void setSystemRemark(String systemRemark) { + this.systemRemark = systemRemark; + } + + public String getIcUseUsers() { + return icUseUsers == null ? "" : icUseUsers.trim(); + } + + public void setIcUseUsers(String icUseUsers) { + this.icUseUsers = icUseUsers; + } + + public Integer getTotalMoney() { + return totalMoney == null ? 0 : totalMoney; + } + + public void setTotalMoney(Integer totalMoney) { + this.totalMoney = totalMoney; + } + + public String getIcSwitch() { + return icSwitch == null ? "" : icSwitch.trim(); + } + + public void setIcSwitch(String icSwitch) { + this.icSwitch = icSwitch; + } + + public String getSwitchTime() { + return switchTime == null ? "" : switchTime.trim(); + } + + public void setSwitchTime(String switchTime) { + this.switchTime = switchTime; + } + @ApiModel + public static class UserInfoDTO { + + @ApiModelProperty(name = "userInfoId", value = "主键") + private String userInfoId; + @ApiModelProperty(name = "userId", value = "用户ID") + private String userId; + @ApiModelProperty(name = "userInfoType", value = "用户类型") + private String userInfoType; + @ApiModelProperty(name = "userInfoName", value = "用户名称") + private String userInfoName; + @ApiModelProperty(name = "idCardType", value = "证件类型") + private String idCardType; + @ApiModelProperty(name = "idCardNumber", value = "证件号") + private String idCardNumber; + @ApiModelProperty(name = "contactPhone", value = "联系电话") + private String contactPhone; + @ApiModelProperty(name = "contactName", value = "联系人姓名") + private String contactName; + @ApiModelProperty(name = "userInfoNameEn", value = "英文名称") + private String userInfoNameEn; + @ApiModelProperty(name = "userUsername", value = "用户名") + private String userUsername; + @ApiModelProperty(name = "userName", value = "用户姓名") + private String userName; + @ApiModelProperty(name = "lastLoginTime", value = "最后登录时间") + private String lastLoginTime; + @ApiModelProperty(name = "gmtCreate", value = "注册时间") + private String gmtCreate; + @ApiModelProperty(name = "accountMoney", value = "账号余额") + private Integer accountMoney; + @ApiModelProperty(name = "dataIsChecked", value = "是否选中回显") + private Boolean dataIsChecked; + + public Integer getAccountMoney() { + return accountMoney == null ? 0 : accountMoney; + } + + public void setAccountMoney(Integer accountMoney) { + this.accountMoney = accountMoney; + } + + public Boolean getDataIsChecked() { + return dataIsChecked; + } + + public void setDataIsChecked(Boolean dataIsChecked) { + this.dataIsChecked = dataIsChecked; + } + + public String getGmtCreate() { + return gmtCreate == null ? "" : gmtCreate.trim(); + } + + public void setGmtCreate(String gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public String getUserName() { + return userName == null ? "" : userName.trim(); + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getLastLoginTime() { + return lastLoginTime == null ? "" : lastLoginTime.trim(); + } + + public void setLastLoginTime(String lastLoginTime) { + this.lastLoginTime = lastLoginTime; + } + + public String getUserInfoId() { + return userInfoId == null ? "" : userInfoId.trim(); + } + + public void setUserInfoId(String userInfoId) { + this.userInfoId = userInfoId; + } + + public String getUserId() { + return userId == null ? "" : userId.trim(); + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getUserInfoType() { + return userInfoType == null ? "" : userInfoType.trim(); + } + + public void setUserInfoType(String userInfoType) { + this.userInfoType = userInfoType; + } + + public String getUserInfoName() { + return userInfoName == null ? "" : userInfoName.trim(); + } + + public void setUserInfoName(String userInfoName) { + this.userInfoName = userInfoName; + } + + public String getIdCardType() { + return idCardType == null ? "" : idCardType.trim(); + } + + public void setIdCardType(String idCardType) { + this.idCardType = idCardType; + } + + public String getIdCardNumber() { + return idCardNumber == null ? "" : idCardNumber.trim(); + } + + public void setIdCardNumber(String idCardNumber) { + this.idCardNumber = idCardNumber; + } + + public String getContactPhone() { + return contactPhone == null ? "" : contactPhone.trim(); + } + + public void setContactPhone(String contactPhone) { + this.contactPhone = contactPhone; + } + + public String getContactName() { + return contactName == null ? "" : contactName.trim(); + } + + public void setContactName(String contactName) { + this.contactName = contactName; + } + + public String getUserInfoNameEn() { + return userInfoNameEn == null ? "" : userInfoNameEn.trim(); + } + + public void setUserInfoNameEn(String userInfoNameEn) { + this.userInfoNameEn = userInfoNameEn; + } + + public String getUserUsername() { + return userUsername == null ? "" : userUsername.trim(); + } + + public void setUserUsername(String userUsername) { + this.userUsername = userUsername; + } + } + + +} diff --git a/src/main/java/cn/com/tenlion/operator/properties/SystemApiPathProperties.java b/src/main/java/cn/com/tenlion/operator/properties/SystemApiPathProperties.java index 14db4ca..26566dc 100644 --- a/src/main/java/cn/com/tenlion/operator/properties/SystemApiPathProperties.java +++ b/src/main/java/cn/com/tenlion/operator/properties/SystemApiPathProperties.java @@ -17,6 +17,7 @@ public class SystemApiPathProperties extends ApiPathProperties { private String copyright; private String copyrightExternal; + private String operatorPlugin; public String getCopyright() { return copyright == null ? "" : copyright.trim(); @@ -33,4 +34,12 @@ public class SystemApiPathProperties extends ApiPathProperties { public void setCopyrightExternal(String copyrightExternal) { this.copyrightExternal = copyrightExternal; } + + public String getOperatorPlugin() { + return operatorPlugin == null ? "" : operatorPlugin.trim(); + } + + public void setOperatorPlugin(String operatorPlugin) { + this.operatorPlugin = operatorPlugin; + } } diff --git a/src/main/java/cn/com/tenlion/operator/remote/IOperatorPluginRemoteService.java b/src/main/java/cn/com/tenlion/operator/remote/IOperatorPluginRemoteService.java new file mode 100644 index 0000000..64fd612 --- /dev/null +++ b/src/main/java/cn/com/tenlion/operator/remote/IOperatorPluginRemoteService.java @@ -0,0 +1,34 @@ +package cn.com.tenlion.operator.remote; + +import cn.com.tenlion.operator.pojo.dtos.ic.UsericDTO; +import ink.wgink.annotation.rpc.rest.RemoteService; +import ink.wgink.annotation.rpc.rest.method.RemoteGetMethod; +import ink.wgink.annotation.rpc.rest.method.RemotePostMethod; +import ink.wgink.annotation.rpc.rest.params.RemoteJsonBodyParams; +import ink.wgink.annotation.rpc.rest.params.RemotePathParams; +import ink.wgink.annotation.rpc.rest.params.RemoteQueryParams; +import ink.wgink.annotation.rpc.rest.params.RemoteServerParams; + +import java.util.HashMap; +import java.util.List; + +@RemoteService +public interface IOperatorPluginRemoteService { + + @RemoteGetMethod("/resource/useric/get/{usericId}") + UsericDTO getUseric(@RemoteServerParams String server, + @RemotePathParams("usericId") String usericId, + @RemoteQueryParams("access_token") String accessToken); + + @RemoteGetMethod("/resource/useric/list/{userId}") + List listUseric(@RemoteServerParams String server, + @RemotePathParams("userId") String userId, + @RemoteQueryParams("access_token") String accessToken); + + @RemoteGetMethod("/resource/useric/user-list/{usericId}") + List listUsericUser(@RemoteServerParams String server, + @RemotePathParams("usericId") String usericId, + @RemoteQueryParams("access_token") String accessToken, + @RemoteQueryParams("page") int page, + @RemoteQueryParams("rows") int rows); +} diff --git a/src/main/java/cn/com/tenlion/operator/service/user/expand/UserExpandServiceImpl.java b/src/main/java/cn/com/tenlion/operator/service/user/expand/UserExpandServiceImpl.java index 79b118c..a1002b6 100644 --- a/src/main/java/cn/com/tenlion/operator/service/user/expand/UserExpandServiceImpl.java +++ b/src/main/java/cn/com/tenlion/operator/service/user/expand/UserExpandServiceImpl.java @@ -2,14 +2,19 @@ package cn.com.tenlion.operator.service.user.expand; import cn.com.tenlion.operator.dao.user.expand.IUserExpandDao; import cn.com.tenlion.operator.enums.IcWayToGetEnum; +import cn.com.tenlion.operator.pojo.dtos.ic.UsericDTO; import cn.com.tenlion.operator.pojo.dtos.user.expand.UserExpandDTO; import cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO; import cn.com.tenlion.operator.pojo.vos.user.expand.UserExpandVO; import cn.com.tenlion.operator.pojo.vos.user.expand.ic.UserExpandRelationIcVO; +import cn.com.tenlion.operator.properties.SystemApiPathProperties; +import cn.com.tenlion.operator.remote.IOperatorPluginRemoteService; import com.alibaba.fastjson.JSON; +import ink.wgink.app.AppTokenManager; import ink.wgink.common.base.DefaultBaseService; import ink.wgink.exceptions.SearchException; import ink.wgink.interfaces.user.IUserExpandBaseService; +import ink.wgink.module.oauth2.manager.OAuth2ClientTokenManager; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.dtos.user.UserDTO; import ink.wgink.pojo.result.SuccessResultList; @@ -45,6 +50,10 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx private IUserService userService; @Autowired private RedisTemplate redisTemplate; + @Autowired + private SystemApiPathProperties systemApiPathProperties; + @Autowired + private IOperatorPluginRemoteService operatorPluginRemoteService; @Override public String getRoute() { @@ -282,16 +291,23 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx return count == null ? 0 : count; } + /** + * 更新邀请码 + * + * @param userId + * @param userExpandIcVO + */ public void updateRelationIcByUserId(String userId, UserExpandRelationIcVO userExpandIcVO) { UserPO userPO = userService.getPO(userId); if (userPO == null) { throw new SearchException("用户不存在"); } - UserExpandPO icUserPO = getPOByIc(userExpandIcVO.getRelationIc()); - if (icUserPO == null) { - throw new SearchException("邀请码不正确"); + String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(); + UsericDTO usericDTO = operatorPluginRemoteService.getUseric(systemApiPathProperties.getOperatorPlugin(), userExpandIcVO.getRelationIc(), accessToken); + if (usericDTO == null) { + throw new SearchException("邀请码不存在"); } - if (StringUtils.equals(icUserPO.getUserId(), userId)) { + if (StringUtils.equals(usericDTO.getCreator(), userId)) { throw new SearchException("不能绑定自己的邀请码"); } UserExpandPO selfPO = getPO(userId); @@ -306,14 +322,13 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx throw new SearchException("已经绑定过邀请码"); } - Map params = getHashMap(4); - params.put("priceAll", icUserPO.getIcPriceAll()); - params.put("priceMaterial", icUserPO.getIcPriceMaterial()); + params.put("priceAll", usericDTO.getIcPriceAll()); + params.put("priceMaterial", usericDTO.getIcPriceMaterial()); params.put("relationIc", userExpandIcVO.getRelationIc()); - params.put("relationIcRebateRatio", icUserPO.getIcRebateRatio()); + params.put("relationIcRebateRatio", usericDTO.getIcRebateTatio()); params.put("relationIcTime", DateUtil.getTime()); - params.put("relationIcUserId", icUserPO.getUserId()); + params.put("relationIcUserId", usericDTO.getCreator()); params.put("userId", userId); userExpandDao.updateRelationIc(params); updateRedis(userId); diff --git a/src/main/java/cn/com/tenlion/operator/service/user/ic/apply/UserIcApplyService.java b/src/main/java/cn/com/tenlion/operator/service/user/ic/apply/UserIcApplyService.java index 4fdd38c..f81d446 100644 --- a/src/main/java/cn/com/tenlion/operator/service/user/ic/apply/UserIcApplyService.java +++ b/src/main/java/cn/com/tenlion/operator/service/user/ic/apply/UserIcApplyService.java @@ -8,6 +8,7 @@ import cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO; import cn.com.tenlion.operator.pojo.pos.user.ic.apply.UserIcApplyPO; import cn.com.tenlion.operator.pojo.vos.user.expand.UserExpandVO; import cn.com.tenlion.operator.pojo.vos.user.ic.apply.UserIcApplyReviewVO; +import cn.com.tenlion.operator.remote.IOperatorPluginRemoteService; import cn.com.tenlion.operator.service.user.expand.UserExpandServiceImpl; import cn.com.tenlion.operator.service.user.info.UserInfoService; import com.github.pagehelper.PageHelper; @@ -44,6 +45,8 @@ public class UserIcApplyService extends DefaultBaseService { private UserExpandServiceImpl userExpandService; @Autowired private UserInfoService userInfoService; + @Autowired + private IOperatorPluginRemoteService operatorPluginRemoteService; public void save(String applier) { UserIcApplyPO latestPO = userIcApplyDao.getLatestPOByCreator(applier); diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 296a30d..5e0bdb9 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -134,6 +134,7 @@ api-path: user-center: http://127.0.0.1:8091/operator/ copyright: http://127.0.0.1:7025/copyright/ copyright-external: http://192.168.0.103:7025/copyright/ + operator-plugin: http://192.168.0.115:8099/operator-plugin/ # #