diff --git a/service/trade-service-others/trade-service-others-account/pom.xml b/service/trade-service-others/trade-service-others-account/pom.xml index 05d77d6..6ffca3b 100644 --- a/service/trade-service-others/trade-service-others-account/pom.xml +++ b/service/trade-service-others/trade-service-others-account/pom.xml @@ -39,10 +39,10 @@ sharding-jdbc-spring-boot-starter - - org.springframework.cloud - spring-cloud-starter-openfeign - + + + + diff --git a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/controller/AccountInfoController.java b/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/controller/AccountInfoController.java index 41f0641..cea870f 100644 --- a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/controller/AccountInfoController.java +++ b/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/controller/AccountInfoController.java @@ -3,19 +3,13 @@ package com.hchbox.module.controller; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import cn.hutool.json.JSONObject; import com.hchbox.api.RequestCore; -import com.hchbox.constant.AuthConstants; import com.hchbox.constant.DefaultNumberConstants; -import com.hchbox.module.entity.SellerAccount; -import com.hchbox.module.entity.vo.AccountInfoVO; -import com.hchbox.module.feign.AliPayClient; import com.hchbox.model.param.CommonResult; import com.hchbox.module.service.AccountInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.web.bind.annotation.*; @@ -28,24 +22,9 @@ import org.springframework.web.bind.annotation.*; @Api(tags = "账号信息") @RequestMapping("/api") public class AccountInfoController { -// private final AliPayClient aliPayClient; - private final AccountInfoService accountInfoService; @Resource private RequestCore requestCore; -// @GetMapping("/list") -// @ApiOperation("查询主账号下的子账号") -// public CommonResult> getAccountAll(HttpServletRequest request, Pageable pageable) { -// String token = request.getParameter(AuthConstants.TAO_MI_TOKEN); -// Long accountId = aliPayClient.checkSellAccountByPurchaser(token); -// if (accountId == DefaultNumberConstants.ZERO_NUMBER) { -// return new CommonResult>().forbidden(); -// } -// AccountInfoVO accountInfoVO = new AccountInfoVO(); -// accountInfoVO.setParentId(accountId); -// return accountInfoService.getAccountAll(accountInfoVO, pageable); -// } - @GetMapping("/parent/accounts") @ApiOperation("查询主账号") public CommonResult getParentAccount(@RequestParam(value = "nickName", required = false) String nickName, Pageable pageable) { diff --git a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/feign/AliPayClient.java b/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/feign/AliPayClient.java deleted file mode 100644 index 6692a4a..0000000 --- a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/feign/AliPayClient.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.hchbox.module.feign; - -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestParam; - -/** - * @author Enzo - * @date : 2021/6/16 - */ -@FeignClient(value = "trade-service-source-core") -public interface AliPayClient { - - String API_PREFIX = "/source"; - - /** - * 检测账号 - * - * @param token - * @return - */ - @GetMapping(API_PREFIX + "/account/checkAccount") - Long checkSellAccountByPurchaser(@RequestParam(value = "token") String token); -} diff --git a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/service/impl/AccountRechargeServiceImpl.java b/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/service/impl/AccountRechargeServiceImpl.java index 89e1a88..baae660 100644 --- a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/service/impl/AccountRechargeServiceImpl.java +++ b/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/service/impl/AccountRechargeServiceImpl.java @@ -2,6 +2,7 @@ package com.hchbox.module.service.impl; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONObject; import com.hchbox.api.RequestCore; @@ -67,6 +68,8 @@ public class AccountRechargeServiceImpl implements AccountRechargeService { private int workerId; @Value("${snowflake.datacenterId}") private int datacenterId; + @Value("${taobao.Synchronize.amount}") + private Double amount; @Override @Transactional(rollbackFor = Exception.class) @@ -208,6 +211,7 @@ public class AccountRechargeServiceImpl implements AccountRechargeService { try { // 雪花算法id String orderNo = String.valueOf(IdUtil.getSnowflake(workerId, datacenterId).nextId()); + payTwoOrder.setAnticipateNum(NumberUtil.div(payTwoOrder.getAmount(), BigDecimal.valueOf(amount)).longValue()); Double num = payTwoOrder.getAmount() + payTwoOrder.getIdenticalAmount(); // Double num = 0.01; // 生成返回对象 diff --git a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/service/impl/SynchronizedAmountServiceImpl.java b/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/service/impl/SynchronizedAmountServiceImpl.java index 9f8d24c..e801526 100644 --- a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/service/impl/SynchronizedAmountServiceImpl.java +++ b/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/service/impl/SynchronizedAmountServiceImpl.java @@ -63,7 +63,7 @@ public class SynchronizedAmountServiceImpl implements SynchronizedAmountService payTwoOrder.setIdenticalAmount(0.00); payTwoOrder.setHistoryNum((long) DefaultNumberConstants.ZERO_NUMBER); payTwoOrder.setAmount(budgetAmount); - payTwoOrder.setAnticipateNum(NumberUtil.div(budgetAmount, BigDecimal.valueOf(amount)).longValue()); +// payTwoOrder.setAnticipateNum(NumberUtil.div(budgetAmount, BigDecimal.valueOf(amount)).longValue()); } return new CommonResult<>().success(payTwoOrder); } diff --git a/service/trade-service-others/trade-service-others-account/src/main/resources/application.yml b/service/trade-service-others/trade-service-others-account/src/main/resources/application.yml index dce86b1..bbee3c7 100644 --- a/service/trade-service-others/trade-service-others-account/src/main/resources/application.yml +++ b/service/trade-service-others/trade-service-others-account/src/main/resources/application.yml @@ -81,7 +81,8 @@ trade: service: source: url: http://39.100.226.133:80 +# url: http://localhost:80 taobao: Synchronize: amount: 0.001 - budgetAmount: 1000 \ No newline at end of file + budgetAmount: 0 \ No newline at end of file diff --git a/service/trade-service-others/trade-service-others-account/src/main/resources/logback.xml b/service/trade-service-others/trade-service-others-account/src/main/resources/logback.xml index 3fc4a60..d9f3a2f 100644 --- a/service/trade-service-others/trade-service-others-account/src/main/resources/logback.xml +++ b/service/trade-service-others/trade-service-others-account/src/main/resources/logback.xml @@ -1,63 +1,86 @@ + + trade-account + + + + + + + + + %highlight([%-5level]) %cyan(%d{yyyy-MM-dd#HH:mm:ss.SSS}) %yellow([Thread:%thread]) + %magenta([Logger:%logger]) -> %msg%n + + utf-8 + + - - - - - - - - - - - - - ${CONSOLE_LOG_PATTERN} - - - - - - ${log.path}/debug.log - - ${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz - 50MB - 30 - - - %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n - - - - - - ${log.path}/error.log - - ${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz - 50MB - 30 - - - %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n - - - ERROR - - - - - - - - - - - - - - + + + ${LOG_DIR}/log.log + + + + ${LOG_DIR}/history/%d{yyyy-MM-dd}.gz + 30 + + + true + + + ${LOG_PATTERN} + utf-8 + + + + + INFO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +