账号 和支付 逻辑代码修改

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

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

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

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

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

@ -124,13 +124,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// 放行OPTIONS请求 // 放行OPTIONS请求
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll() .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
// 放开生成一级分类链接 // 放开生成一级分类链接
// .antMatchers(HttpMethod.POST, "/api/remoteRecord/createRemoteRecord").permitAll() .antMatchers("/api/account/pay-notify").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()
// 自定义匿名访问所有url放行允许匿名和带Token访问细腻化到每个 Request 类型 // 自定义匿名访问所有url放行允许匿名和带Token访问细腻化到每个 Request 类型
// GET // GET
.antMatchers(HttpMethod.GET, anonymousUrls.get(RequestMethodEnum.GET.getType()).toArray(new String[0])).permitAll() .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 authorizeEndTime
* @param authorizeDay * @param authorizeDay
* @param id * @param id
* @param status
* @return * @return
*/ */
@Modifying @Modifying
@Query(value = "update SellerAccount set authorizeStartTime =?1 ,authorizeEndTime =?2,authorizeDay=?3 where id=?4") @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); 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); authorizeEndTime = DateUtil.offset(authorizeStartTime, DateField.DAY_OF_MONTH, authorizeDay);
int flag; int flag;
try { try {
flag = sellerAccountRepository.updateSellerAccountByCondition(authorizeStartTime, authorizeEndTime, authorizeDay, childrenAccountId); flag = sellerAccountRepository.updateSellerAccountByCondition(authorizeStartTime, authorizeEndTime, authorizeDay, childrenAccountId,DefaultNumberConstants.ONE_NUMBER);
} catch (Exception e) { } catch (Exception e) {
log.error("子账号授权失败{}", e.getMessage()); log.error("子账号授权失败{}", e.getMessage());
return new CommonResult<>().failed("子账号授权失败"); return new CommonResult<>().failed("子账号授权失败");

Loading…
Cancel
Save