master
parent
84470b8f8b
commit
e168ef8906
|
@ -20,15 +20,13 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.enums.SysPayType;
|
||||
import com.muyu.common.core.enums.SystemYesNo;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.domain.resp.CustomerOrderPaySimpleResp;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@TableName(value = "order_pay_info",autoResultMap = true)
|
||||
public class OrderPayInfo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id" , type = IdType.AUTO)
|
||||
private String id;
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String appName;
|
||||
/**
|
||||
* 客户编号
|
||||
*/
|
||||
private String appCode;
|
||||
/**
|
||||
* 客户单号
|
||||
*/
|
||||
private String cusOrderNumber;
|
||||
/**
|
||||
* 支付单号
|
||||
*/
|
||||
private String payOrderNumber;
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 渠道商类型
|
||||
*/
|
||||
private String channelType;
|
||||
/**
|
||||
* 渠道商单号
|
||||
*/
|
||||
private String channelOrderNumber;
|
||||
/**
|
||||
* 支付单状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
public CustomerOrderPaySimpleResp buildCustomerOrderPaySimpleResp(){
|
||||
return CustomerOrderPaySimpleResp.builder()
|
||||
.cusOrderNumber(this.cusOrderNumber)
|
||||
.channelTypeName(SysPayType.getInfoByCode(this.channelType))
|
||||
.price(this.price).build();
|
||||
}
|
||||
|
||||
}
|
|
@ -41,4 +41,5 @@ public class CustomerListReq {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.domain.resp;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Tag(name = "客户支付单",description = "客户支付单简略")
|
||||
public class CustomerOrderPaySimpleResp {
|
||||
|
||||
/**
|
||||
* 客户单号
|
||||
*/
|
||||
@Schema(title = "客户单号",type = "String" , defaultValue = "" ,description = "客户传入的支付单编号")
|
||||
private String cusOrderNumber;
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
@Schema(title = "支付金额",type = "BigDecimal" , defaultValue = "13.13" ,description = "需要支付的金额")
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 渠道商类型
|
||||
*/
|
||||
@Schema(title = "支付渠道商",type = "String" , defaultValue = "支付宝" ,description = "所使用的渠道商")
|
||||
private String channelTypeName;
|
||||
|
||||
}
|
|
@ -12,9 +12,13 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Tag(name = "客户信息相应对象",description = "负责客户信息查询结果")
|
||||
|
@ -35,7 +39,7 @@ public class CustomerResp {
|
|||
/**
|
||||
* 服务/客户编号
|
||||
*/
|
||||
@Schema(defaultValue = "客户编码",type = "String" , description = "客户名称")
|
||||
@Schema(defaultValue = "客户编码",type = "String" , description = "客户的编码")
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
|
@ -57,10 +61,15 @@ public class CustomerResp {
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
|
||||
private List<CustomerOrderPaySimpleResp> orderPaySimpleRespList;
|
||||
|
||||
|
||||
/**
|
||||
* 返回结果
|
||||
*/
|
||||
public static CustomerResp customerBuild (OrderPayCustomer orderPayCustomer) {
|
||||
public static CustomerResp customerBuild (OrderPayCustomer orderPayCustomer, Supplier<List<CustomerOrderPaySimpleResp>> function) {
|
||||
return CustomerResp.builder()
|
||||
.id(orderPayCustomer.getId())
|
||||
.appName(orderPayCustomer.getAppName())
|
||||
|
@ -68,6 +77,7 @@ public class CustomerResp {
|
|||
.status(orderPayCustomer.getStatus())
|
||||
.createBy(orderPayCustomer.getCreateBy())
|
||||
.createTime(orderPayCustomer.getCreateTime())
|
||||
.orderPaySimpleRespList(function.get())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,17 +2,25 @@ package com.muyu.pay;
|
|||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
@EnableCustomConfig
|
||||
//@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
@Log4j2
|
||||
public class MuYuPayApplication {
|
||||
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(MuYuPayApplication.class, args);
|
||||
ConfigurableApplicationContext applicationContext = SpringApplication.run(MuYuPayApplication.class, args);
|
||||
String[] beanDefinitionNames = applicationContext.getBeanFactory().getBeanDefinitionNames();
|
||||
for (String beanDefinitionName : beanDefinitionNames) {
|
||||
log.info("beanDeNAME{}",beanDefinitionName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,30 +1,34 @@
|
|||
package com.muyu.pay.controller;
|
||||
|
||||
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.OrderPayCustomer;
|
||||
import com.muyu.domain.req.CustomerListReq;
|
||||
import com.muyu.domain.resp.CustomerResp;
|
||||
import com.muyu.pay.service.OrderPayCustomerService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/customer")
|
||||
@Log4j2
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "客户控制层",description = "进行客户管理,查看等相关操作")
|
||||
public class OrderPayCustomerController {
|
||||
|
||||
private final OrderPayCustomerService orderPayCustomerService;
|
||||
public OrderPayCustomerController (){
|
||||
log.info("扫描路径{}", ForestScannerRegister.getBasePackages());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private OrderPayCustomerService orderPayCustomerService;
|
||||
|
||||
/**
|
||||
* 查询所有用户
|
||||
|
@ -36,4 +40,12 @@ public class OrderPayCustomerController {
|
|||
orderPayCustomerService.selectList(customerListReq)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all")
|
||||
@Operation(summary = "获取未接入的客户",description = "调用nacosAPI获取所有的微服务名称")
|
||||
@Schema(description = "获取未接入的客户",defaultValue = "客户1,客户2",type = "List")
|
||||
public Result<List<String>> getCustomerAllList(){
|
||||
return Result.success(orderPayCustomerService.getCustomerAllList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.pay.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.OrderPayInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface OrderPayMapper extends BaseMapper<OrderPayInfo> {
|
||||
}
|
|
@ -13,4 +13,6 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
|||
* 客户列表
|
||||
*/
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq);
|
||||
|
||||
List<String> getCustomerAllList();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.muyu.pay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.OrderPayInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OrderPayService extends IService<OrderPayInfo> {
|
||||
List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int limit);
|
||||
}
|
|
@ -3,23 +3,36 @@ package com.muyu.pay.service.impl;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.nacos.service.NacosServerService;
|
||||
import com.muyu.domain.OrderPayCustomer;
|
||||
import com.muyu.domain.OrderPayInfo;
|
||||
import com.muyu.domain.req.CustomerListReq;
|
||||
import com.muyu.domain.resp.CustomerOrderPaySimpleResp;
|
||||
import com.muyu.domain.resp.CustomerResp;
|
||||
import com.muyu.pay.controller.OrderPayCustomerController;
|
||||
import com.muyu.pay.mapper.OrderPayCustomerMapper;
|
||||
import com.muyu.pay.service.OrderPayCustomerService;
|
||||
import com.muyu.pay.service.OrderPayService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Service
|
||||
public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMapper ,OrderPayCustomer>
|
||||
implements OrderPayCustomerService {
|
||||
|
||||
@Resource(type = OrderPayService.class)
|
||||
private OrderPayService orderPayService;
|
||||
|
||||
@Autowired
|
||||
private NacosServerService nacosServerService;
|
||||
|
||||
@Override
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
||||
|
@ -38,7 +51,64 @@ public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMap
|
|||
);
|
||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||
return orderPayCustomerList.stream()
|
||||
.map(CustomerResp::customerBuild)
|
||||
.map(orderPayCustomer -> CustomerResp.customerBuild(
|
||||
orderPayCustomer,
|
||||
() -> orderPayService.selectOrderPayByAppCodeAndLimit(orderPayCustomer.getAppCode(), 5)
|
||||
.stream()
|
||||
.map(OrderPayInfo::buildCustomerOrderPaySimpleResp)
|
||||
.toList()
|
||||
)
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCustomerAllList() {
|
||||
List<String> nacosServerAllList = nacosServerService.nacosServiceAllList();
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(OrderPayCustomer::getAppCode);
|
||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||
Set<String> customerSet
|
||||
= orderPayCustomerList.stream().map(OrderPayCustomer::getAppCode).collect(Collectors.toSet());
|
||||
return nacosServerAllList.stream()
|
||||
.filter(nacosServer -> !customerSet.contains(nacosServer))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.muyu.pay.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.OrderPayInfo;
|
||||
import com.muyu.pay.mapper.OrderPayMapper;
|
||||
import com.muyu.pay.service.OrderPayService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OrderPayServiceImpl extends ServiceImpl<OrderPayMapper, OrderPayInfo>implements OrderPayService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int limit) {
|
||||
LambdaQueryWrapper<OrderPayInfo> orderPayInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
orderPayInfoLambdaQueryWrapper.eq(OrderPayInfo::getAppCode,appCode);
|
||||
orderPayInfoLambdaQueryWrapper.orderBy(true,false,OrderPayInfo::getCreateTime);
|
||||
orderPayInfoLambdaQueryWrapper.last("limit "+limit);
|
||||
return this.list(orderPayInfoLambdaQueryWrapper);
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@ CREATE TABLE order_pay_info(
|
|||
`app_code` VARCHAR(16) COMMENT '客户编号' ,
|
||||
`cus_order_number` VARCHAR(32) COMMENT '客户单号' ,
|
||||
`pay_order_number` VARCHAR(32) COMMENT '支付单号' ,
|
||||
`price` DECIMAL(24,6) COMMENT '支付金额' ,
|
||||
`channel_type` VARCHAR(32) COMMENT '渠道商类型' ,
|
||||
`channel_order_number` VARCHAR(64) COMMENT '渠道商单号' ,
|
||||
`status` VARCHAR(32) COMMENT '支付单状态;0:新建 1:待支付 2:支付中 3:支付成功 4:支付失败 5:支付失败' ,
|
||||
|
|
Loading…
Reference in New Issue