feat():增加未接入客户接口
parent
683cdc4e75
commit
2db258ecb7
|
@ -4,9 +4,14 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
|
@ -32,11 +37,34 @@ public class OrderPayCustomer extends BaseEntity {
|
|||
*/
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 客户描述
|
||||
*/
|
||||
private String appDesc;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
public static OrderPayCustomer addBuild(com.muyu.pay.common.domain.req.CustomerAddReq customerAddReq){
|
||||
return OrderPayCustomer.builder()
|
||||
.appName(customerAddReq.getAppName())
|
||||
.appCode(customerAddReq.getAppCode())
|
||||
.appDesc(customerAddReq.getAppDesc())
|
||||
.status(customerAddReq.getStatus())
|
||||
.remark(customerAddReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static OrderPayCustomer updBuild(com.muyu.pay.common.domain.req.CustomerUpdReq customerUpdReq, Supplier<Long> id){
|
||||
return OrderPayCustomer.builder()
|
||||
.id(id.get())
|
||||
.appName(customerUpdReq.getAppName())
|
||||
.appDesc(customerUpdReq.getAppDesc())
|
||||
.status(customerUpdReq.getStatus())
|
||||
.remark(customerUpdReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package com.muyu.pay.common.domain;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@TableName(value = "order_pay_refund",autoResultMap = true)
|
||||
public class OrderPayRefund extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 客户退单号
|
||||
*/
|
||||
private String cusOrderNumber;
|
||||
|
||||
/**
|
||||
*支付退单号
|
||||
*/
|
||||
private String payOrderNumber;
|
||||
|
||||
/**
|
||||
* 渠道商退单号
|
||||
*/
|
||||
private String channelOrderNumber;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 支付单号
|
||||
*/
|
||||
private String payInfoNumber;
|
||||
|
||||
/**
|
||||
* 到账时间
|
||||
*/
|
||||
private Date toAccountTIme;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.muyu.pay.common.domain.req;
|
||||
|
||||
import com.muyu.common.core.validation.custom.IsSystemYesNo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "支付服务客户请求对象",description = "根据入参进行服务的添加")
|
||||
public class CustomerAddReq {
|
||||
/**
|
||||
* 服务/客户名称
|
||||
*/
|
||||
@NotEmpty(message = "服务/客户名称不可为空")
|
||||
@Schema(
|
||||
title = "服务客户名称",
|
||||
description = "客户名称一般为微服务详细中文名称 方便使用者区分",
|
||||
type = "String",
|
||||
defaultValue = "会员服务",
|
||||
requiredProperties ={"appName"}
|
||||
)
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 服务/客户编码
|
||||
*/
|
||||
@NotBlank(message = "服务/客户编码不可为空")
|
||||
@Schema(
|
||||
title = "客户编码",
|
||||
description = "客户编码为微服务的namespace名称",
|
||||
type = "String",
|
||||
defaultValue = "muyu-vip",
|
||||
requiredProperties = {"appCode"}
|
||||
)
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 客户描述
|
||||
*/
|
||||
@Schema(title = "客户描述",type = "String")
|
||||
private String appDesc;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Schema(
|
||||
title = "开通状态",description = "状态为Y和N 如果为Y客户可以使用支付接口为N不可以使用客户接口",
|
||||
type = "String",defaultValue = "Y"
|
||||
)
|
||||
@NotEmpty(message = "客户使用状态不能为空")
|
||||
@IsSystemYesNo
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(title = "客户备注",type = "String")
|
||||
private String remark;
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.muyu.pay.common.domain.req;
|
||||
|
||||
import com.muyu.common.core.validation.custom.IsSystemYesNo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CustomerUpdReq {
|
||||
/**
|
||||
* 服务/客户名称
|
||||
*/
|
||||
@NotEmpty(message = "服务/客户名称不可为空")
|
||||
@Schema(
|
||||
title = "服务客户名称",
|
||||
description = "客户名称一般为微服务详细中文名称 方便使用者区分",
|
||||
type = "String",
|
||||
defaultValue = "会员服务",
|
||||
requiredProperties ={"appName"}
|
||||
)
|
||||
private String appName;
|
||||
|
||||
|
||||
/**
|
||||
* 客户描述
|
||||
*/
|
||||
@Schema(title = "客户描述",type = "String")
|
||||
private String appDesc;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Schema(
|
||||
title = "开通状态",description = "状态为Y和N 如果为Y客户可以使用支付接口为N不可以使用客户接口",
|
||||
type = "String",defaultValue = "Y"
|
||||
)
|
||||
@NotEmpty(message = "客户使用状态不能为空")
|
||||
@IsSystemYesNo
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(title = "客户备注",type = "String")
|
||||
private String remark;
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.muyu.pay.common.domain.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrderPayResp {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 客户编号
|
||||
*/
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 客户单号
|
||||
*/
|
||||
private String cusOrderNumber;
|
||||
|
||||
/**
|
||||
* 支付单号
|
||||
*/
|
||||
private String payOrderNumber;
|
||||
|
||||
/**
|
||||
* 渠道商类型
|
||||
*/
|
||||
private String channelType;
|
||||
|
||||
/**
|
||||
* 渠道商单号
|
||||
*/
|
||||
private String channelOrderNumber;
|
||||
|
||||
/**
|
||||
* 支付单状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.muyu.cloud.pay;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.boot.ConfigurableBootstrapContext;
|
||||
import org.springframework.boot.SpringApplicationRunListener;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
@Log4j2
|
||||
public class MySpringApplicationRunListener implements SpringApplicationRunListener {
|
||||
public MySpringApplicationRunListener() {
|
||||
log.info("MySpringApplicationRunListener");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void starting(ConfigurableBootstrapContext bootstrapContext) {
|
||||
log.info("执行:starting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void environmentPrepared(ConfigurableBootstrapContext bootstrapContext, ConfigurableEnvironment environment) {
|
||||
log.info("执行:starting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contextPrepared(ConfigurableApplicationContext context) {
|
||||
log.info("执行:contextPrepared");
|
||||
SpringApplicationRunListener.super.contextPrepared(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contextLoaded(ConfigurableApplicationContext context) {
|
||||
log.info("执行:contextLoaded");
|
||||
SpringApplicationRunListener.super.contextLoaded(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void started(ConfigurableApplicationContext context, Duration timeTaken) {
|
||||
log.info("执行:started");
|
||||
SpringApplicationRunListener.super.started(context, timeTaken);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ready(ConfigurableApplicationContext context, Duration timeTaken) {
|
||||
log.info("执行:ready");
|
||||
SpringApplicationRunListener.super.ready(context, timeTaken);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(ConfigurableApplicationContext context, Throwable exception) {
|
||||
log.info("执行:failed");
|
||||
SpringApplicationRunListener.super.failed(context, exception);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.cloud.pay.controller;
|
||||
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||
|
@ -50,4 +51,81 @@ public class OrderPayCustomerController {
|
|||
orderPayCustomerService.getCustomerAllList()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加客户
|
||||
* @param customerAddReq
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
@Operation(summary = "添加客户信息",description = "添加支付平台客户信息,添加成功后可以使用支付信息")
|
||||
public Result<String> save(@Validated @RequestBody com.muyu.pay.common.domain.req.CustomerAddReq customerAddReq){
|
||||
orderPayCustomerService.save(OrderPayCustomer.addBuild(customerAddReq));
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户
|
||||
* @param customerUpdReq
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "客户信息修改",description = "通过客户id修改客户信息")
|
||||
public Result<String> update(
|
||||
@Schema(title = "客户Id",type = "Long",defaultValue = "1")
|
||||
@PathVariable("orderCustomerId") Long orderCustomerId,
|
||||
@RequestBody @Validated com.muyu.pay.common.domain.req.CustomerUpdReq customerUpdReq){
|
||||
orderPayCustomerService.updateById( OrderPayCustomer.updBuild(customerUpdReq, ()->orderCustomerId));
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户信息
|
||||
* @param orderCustomerId
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "客户信息删除",description = "通过客户id删除,七天内使用过接口不可删除")
|
||||
public Result<String> delete(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||
orderPayCustomerService.removeById(orderCustomerId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
/**
|
||||
* 通过id获取用户信息
|
||||
* @param orderCustomerId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "通过id获取用户信息",description = "通过id获取用户信息")
|
||||
public Result<OrderPayCustomer> findById(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||
return Result.success(orderPayCustomerService.getById(orderCustomerId),"操作成功");
|
||||
}
|
||||
/**
|
||||
* 客户禁用支付接口
|
||||
* @param orderCustomerId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/disable/{orderCustomerId}")
|
||||
@Operation(summary = "通过id禁用客户",description = "通过id禁用客户调用支付接口")
|
||||
public Result<String> disable(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||
orderPayCustomerService.disable(orderCustomerId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户启用支付接口
|
||||
* @param orderCustomerId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/enable/{orderCustomerId}")
|
||||
@Operation(summary = "通过id启用客户",description = "通过id启用客户调用支付接口")
|
||||
public Result<String> enable(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||
orderPayCustomerService.enable(orderCustomerId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.pay.server.controller;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("info")
|
||||
public class OrderPayInfoController {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.muyu.pay.server.controller;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("refund")
|
||||
public class OrderPayRefundController {
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.cloud.pay.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface OrderPayInfoMapper extends BaseMapper<OrderPayInfo> {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.muyu.pay.server.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.pay.common.domain.OrderPayRefund;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface OrderPayRefundMapper extends BaseMapper<OrderPayRefund> {
|
||||
|
||||
}
|
|
@ -20,4 +20,19 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
|||
* @return 客户集合
|
||||
*/
|
||||
List<String> getCustomerAllList();
|
||||
|
||||
|
||||
/**
|
||||
* 禁用客户id
|
||||
* @param orderCustomerId
|
||||
*/
|
||||
void disable(Long orderCustomerId);
|
||||
|
||||
/**
|
||||
* 启用客户id
|
||||
* @param orderCustomerId
|
||||
*/
|
||||
void enable(Long orderCustomerId);
|
||||
|
||||
void settingStatus(Long orderCustomerId,String status);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.cloud.pay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OrderPayInfoService extends IService<OrderPayInfo> {
|
||||
|
||||
List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int status);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.cloud.pay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.pay.common.domain.OrderPayRefund;
|
||||
|
||||
public interface OrderPayRefundService extends IService<OrderPayRefund> {
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.cloud.pay.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
|
@ -8,26 +9,39 @@ import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
|||
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||
import com.muyu.cloud.pay.mapper.OrderPayCustomerMapper;
|
||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||
import com.muyu.cloud.pay.service.OrderPayInfoService;
|
||||
import com.muyu.cloud.pay.service.OrderPayService;
|
||||
import com.muyu.common.core.enums.SystemYesNo;
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.nacos.service.NacosServerService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Log4j2
|
||||
public class OrderPayCustomerServiceImpl extends
|
||||
ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer>
|
||||
implements OrderPayCustomerService {
|
||||
|
||||
@Resource(type = OrderPayServiceImpl.class)
|
||||
private OrderPayService orderPayService;
|
||||
|
||||
@Resource
|
||||
private NacosServerService nacosServerService;
|
||||
|
||||
@Resource
|
||||
private OrderPayInfoService orderPayInfoService;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -76,4 +90,70 @@ public class OrderPayCustomerServiceImpl extends
|
|||
.filter(nacosServer ->!customerSet.contains(nacosServer))
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void disable(Long orderCustomerId) {
|
||||
this.settingStatus(orderCustomerId, SystemYesNo.NO.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable(Long orderCustomerId) {
|
||||
this.settingStatus(orderCustomerId,SystemYesNo.YES.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingStatus(Long orderCustomerId, String status) {
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OrderPayCustomer::getId,orderCustomerId);
|
||||
boolean exists = this.exists(queryWrapper);
|
||||
if (!exists){
|
||||
throw new ServiceException("操作客户不存在");
|
||||
}
|
||||
if (!SystemYesNo.isCode(status)){
|
||||
throw new ServiceException("设置状态值违法");
|
||||
}
|
||||
LambdaUpdateWrapper<OrderPayCustomer> updQueryWrapper = new LambdaUpdateWrapper<>();
|
||||
updQueryWrapper.eq(OrderPayCustomer::getId,orderCustomerId);
|
||||
updQueryWrapper.set(OrderPayCustomer::getStatus,status);
|
||||
this.update(updQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeById(Serializable id) {
|
||||
OrderPayCustomer orderPayCustomer = this.getById(id);
|
||||
if (orderPayCustomer==null){
|
||||
throw new ServiceException("客户不存在");
|
||||
}
|
||||
LambdaQueryWrapper<OrderPayInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OrderPayInfo::getAppCode,orderPayCustomer.getAppCode());
|
||||
queryWrapper.gt(OrderPayInfo::getCreateTime, DateUtils.addDays(new Date(),-7));
|
||||
long count = orderPayInfoService.count(queryWrapper);
|
||||
if (count>0){
|
||||
throw new ServiceException(
|
||||
StringUtils.format("客户:[{}],近七天还在使用,不可删除",orderPayCustomer.getAppName())
|
||||
);
|
||||
}
|
||||
return super.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean save(OrderPayCustomer orderPayCustomer) {
|
||||
|
||||
String appCode = orderPayCustomer.getAppCode();
|
||||
List<String> nacosServerAllList = nacosServerService.nacosServerAllList();
|
||||
log.info("进行服务合法性判断:[{}->{}]",appCode,nacosServerAllList);
|
||||
if (!nacosServerAllList.contains(appCode)){
|
||||
throw new ServiceException("客户编码违法");
|
||||
}
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OrderPayCustomer::getAppCode,appCode);
|
||||
long count = this.count(queryWrapper);
|
||||
log.info("进行服务code唯一性校验[{}->{}]",appCode,count);
|
||||
if (count >0) {
|
||||
throw new ServiceException("客户编码重复");
|
||||
}
|
||||
return super.save(orderPayCustomer);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.muyu.cloud.pay.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
import com.muyu.cloud.pay.service.OrderPayInfoService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Log4j2
|
||||
@Service
|
||||
public class OrderPayInfoServiceImpl extends ServiceImpl<com.muyu.cloud.pay.mapper.OrderPayInfoMapper, OrderPayInfo> implements OrderPayInfoService {
|
||||
@Override
|
||||
public List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int status) {
|
||||
LambdaQueryWrapper<OrderPayInfo> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(OrderPayInfo::getAppCode,appCode);
|
||||
wrapper.orderBy(true,false,OrderPayInfo::getCreateBy);
|
||||
wrapper.last("limit "+status);
|
||||
return this.list(wrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.cloud.pay.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.pay.service.OrderPayRefundService;
|
||||
import com.muyu.pay.common.domain.OrderPayRefund;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Log4j2
|
||||
@Service
|
||||
public class OrderPayRefundServiceImpl
|
||||
extends ServiceImpl<com.muyu.pay.server.mapper.OrderPayRefundMapper, OrderPayRefund>
|
||||
implements OrderPayRefundService {
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.muyu.cloud.pay.MySpringApplicationRunListener
|
Loading…
Reference in New Issue