账号 和支付 逻辑代码修改

master
wujingtao 3 years ago
parent 4589137cff
commit e05c882dde

@ -9,6 +9,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
/**
* @author Enzo
@ -18,6 +19,7 @@ import org.springframework.context.annotation.Bean;
@EnableSwagger2Doc
@EnableFeignClients
@EnableDiscoveryClient
@EnableJpaAuditing
@SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class)
public class TradeServiceOthersAccountApplication {

@ -62,7 +62,6 @@ public class RequestCore {
* @return
*/
public CommonResult<Object> authorizeChildrenAccount(Long childrenAccountId, Long payTemplateId) {
log.info("授权账号和模板{},{}", childrenAccountId, payTemplateId);
String reqUrl = url + API_PREFIX + "/account/authorize" + "?" + "childrenAccountId=" + childrenAccountId + "&payTemplateId=" + payTemplateId;
return requestApi(reqUrl);
}

@ -42,7 +42,7 @@ public class RechargeController {
}
@ApiOperation(value = "支付回调")
@PostMapping(value = "/pay-notify")
@RequestMapping(value = "/pay-notify")
public CommonResult<String> frontRcvResponse(HttpServletRequest request) throws Exception {
return accountRechargeService.pcNotifyResponse(request);
}

@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
@ -16,6 +17,7 @@ import java.util.Date;
@Data
@Entity
@Table(name = "pay_order")
@EntityListeners(AuditingEntityListener.class)
public class PayOrder {
@Id
@ -67,6 +69,4 @@ public class PayOrder {
@Column(name = "user_id")
@ApiModelProperty(value = "用户id")
private Long userId;
}

@ -87,15 +87,15 @@ public class AccountRechargeServiceImpl implements AccountRechargeService {
@Override
public CommonResult<String> aliPayPc(AliPayPcVo aliPayPcVo) {
AlipayTradePagePayResponse response;
try {
// 雪花算法id
String orderNo = String.valueOf(IdUtil.getSnowflake(workerId, datacenterId).nextId());
// 生成返回对象
AlipayTradePagePayResponse response = Factory.Payment.Page()
response = Factory.Payment.Page()
.pay(PayConstants.PAY_TITLE + orderNo, orderNo, aliPayPcVo.getAmount().toString(), aliPay.getNotifyUrl());
if (ResponseChecker.success(response)) {
boolean result = savePayOrder(aliPayPcVo, orderNo);
log.info("============= the save order result {} =============", result);
return new CommonResult<String>().success(response.getBody());
}
} catch (Exception e) {

@ -124,13 +124,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// 放行OPTIONS请求
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
// 放开生成一级分类链接
// .antMatchers(HttpMethod.POST, "/api/remoteRecord/createRemoteRecord").permitAll()
// .antMatchers(HttpMethod.GET, "/api/parent/accounts").permitAll()
// .antMatchers(HttpMethod.GET, "/api/pay/template").permitAll()
// .antMatchers(HttpMethod.GET, "/api/account/authorize").permitAll()
// .antMatchers(HttpMethod.GET, "/auth/info").permitAll()
.antMatchers(HttpMethod.GET, "/api/account/subAccount").permitAll()
.antMatchers(HttpMethod.POST, "/api/account/pay-notify").permitAll()
.antMatchers("/api/account/pay-notify").permitAll()
// 自定义匿名访问所有url放行允许匿名和带Token访问细腻化到每个 Request 类型
// GET
.antMatchers(HttpMethod.GET, anonymousUrls.get(RequestMethodEnum.GET.getType()).toArray(new String[0])).permitAll()

@ -75,11 +75,12 @@ public interface SellerAccountRepository extends JpaRepository<SellerAccount, Lo
* @param authorizeEndTime
* @param authorizeDay
* @param id
* @param status
* @return
*/
@Modifying
@Query(value = "update SellerAccount set authorizeStartTime =?1 ,authorizeEndTime =?2,authorizeDay=?3 where id=?4")
int updateSellerAccountByCondition(Date authorizeStartTime, Date authorizeEndTime, Integer authorizeDay, Long id);
@Query(value = "update SellerAccount set authorizeStartTime =?1 ,authorizeEndTime =?2,authorizeDay=?3 ,status =?5 where id=?4")
int updateSellerAccountByCondition(Date authorizeStartTime, Date authorizeEndTime, Integer authorizeDay, Long id, Integer status);
/**
*

@ -383,7 +383,7 @@ public class SellerAccountServiceImpl implements SellerAccountService {
authorizeEndTime = DateUtil.offset(authorizeStartTime, DateField.DAY_OF_MONTH, authorizeDay);
int flag;
try {
flag = sellerAccountRepository.updateSellerAccountByCondition(authorizeStartTime, authorizeEndTime, authorizeDay, childrenAccountId);
flag = sellerAccountRepository.updateSellerAccountByCondition(authorizeStartTime, authorizeEndTime, authorizeDay, childrenAccountId,DefaultNumberConstants.ONE_NUMBER);
} catch (Exception e) {
log.error("子账号授权失败{}", e.getMessage());
return new CommonResult<>().failed("子账号授权失败");

Loading…
Cancel
Save