master
parent
7ae3a99737
commit
849bdc5725
|
@ -4,9 +4,13 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import com.muyu.domain.req.OrderCustomerAddReq;
|
||||||
|
import com.muyu.domain.req.OrderCustomerUpdReq;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ -42,5 +46,24 @@ public class OrderPayCustomer extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
public static OrderPayCustomer addBuild(OrderCustomerAddReq req){
|
||||||
|
return OrderPayCustomer.builder()
|
||||||
|
.appName(req.getAppName())
|
||||||
|
.appCode(req.getAppCode())
|
||||||
|
.appDesc(req.getAppDesc())
|
||||||
|
.status(req.getStatus())
|
||||||
|
.remark(req.getRemark())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OrderPayCustomer updBuild(OrderCustomerUpdReq req, Supplier<Long> idSupplier){
|
||||||
|
return OrderPayCustomer.builder()
|
||||||
|
.id(idSupplier.get())
|
||||||
|
.appName(req.getAppName())
|
||||||
|
.appDesc(req.getAppDesc())
|
||||||
|
.status(req.getStatus())
|
||||||
|
.remark(req.getRemark())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.muyu.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
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name = "支付服务客户添加请求对象", description = "根据入参进行客户服务的添加")
|
||||||
|
public class OrderCustomerAddReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务/客户名称
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "服务客户名称不可为空")
|
||||||
|
@Schema(title = "服务/客户名称", type = "String", defaultValue = "会员服务",
|
||||||
|
description = "客户名称一般为微服务的中文名称,方便使用者进行区分", requiredProperties = {"appName"})
|
||||||
|
private String appName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务/客户编码
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "服务客户编码不可为空")
|
||||||
|
@Schema(title = "服务/客户编码", type = "String", defaultValue = "muyu-vip",
|
||||||
|
description = "客户编码,从[/customer/all]接口当中进行获取", requiredProperties = {"appName"})
|
||||||
|
private String appCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务/客户描述
|
||||||
|
*/
|
||||||
|
@Schema(title = "服务/客户描述", type = "String")
|
||||||
|
private String appDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "客户使用状态不可为空")
|
||||||
|
@IsSystemYesNo
|
||||||
|
@Schema(title = "服务/客户开通状态", type = "String", defaultValue = "Y",
|
||||||
|
description = "状态为Y和N,如果为Y则客户可以使用支付接口,若为N则客户不可以使用支付类接口")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户备注
|
||||||
|
*/
|
||||||
|
@Schema(title = "服务/客户备注", type = "String")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.muyu.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 OrderCustomerUpdReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务/客户名称
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "服务客户名称不可为空")
|
||||||
|
@Schema(title = "服务/客户名称", type = "String", defaultValue = "会员服务",
|
||||||
|
description = "客户名称为微服务的中文名称", requiredProperties = {"appName"})
|
||||||
|
private String appName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务/客户描述
|
||||||
|
*/
|
||||||
|
@Schema(title = "服务/客户描述", type = "String")
|
||||||
|
private String appDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "客户使用状态不可为空")
|
||||||
|
@IsSystemYesNo
|
||||||
|
@Schema(title = "服务/客户开通状态", type = "String", defaultValue = "Y",
|
||||||
|
description = "状态为Y和N,如果为Y则客户可以使用支付接口,若为N则客户不可以使用支付类接口")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户备注
|
||||||
|
*/
|
||||||
|
@Schema(title = "服务/客户备注", type = "String")
|
||||||
|
private String remark;
|
||||||
|
}
|
|
@ -4,6 +4,8 @@ import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.domain.OrderPayCustomer;
|
import com.muyu.domain.OrderPayCustomer;
|
||||||
import com.muyu.domain.req.CustomerListReq;
|
import com.muyu.domain.req.CustomerListReq;
|
||||||
|
import com.muyu.domain.req.OrderCustomerAddReq;
|
||||||
|
import com.muyu.domain.req.OrderCustomerUpdReq;
|
||||||
import com.muyu.domain.resp.CustomerResp;
|
import com.muyu.domain.resp.CustomerResp;
|
||||||
import com.muyu.pay.service.OrderPayCustomerService;
|
import com.muyu.pay.service.OrderPayCustomerService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
@ -17,25 +19,25 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/customer")
|
@RequestMapping("/customer")
|
||||||
@Log4j2
|
@Tag(name = "客户控制层", description = "进行客户管理、查看等相关操作")
|
||||||
@Tag(name = "客户控制层",description = "进行客户管理,查看等相关操作")
|
|
||||||
public class OrderPayCustomerController {
|
public class OrderPayCustomerController {
|
||||||
|
|
||||||
public OrderPayCustomerController (){
|
public OrderPayCustomerController () {
|
||||||
log.info("扫描路径{}", ForestScannerRegister.getBasePackages());
|
log.info("forest扫描路径:{}", ForestScannerRegister.getBasePackages());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderPayCustomerService orderPayCustomerService;
|
private OrderPayCustomerService orderPayCustomerService;
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询所有用户
|
@RequestMapping(path = "/list", method = RequestMethod.POST)
|
||||||
*/
|
@Operation(summary = "查看客户", description = "根据客户的名称、编码、是否开启等可以进行客户的筛选")
|
||||||
@RequestMapping(path = "/list",method = RequestMethod.POST)
|
public Result<List<CustomerResp>> selectList(
|
||||||
@Operation(summary = "查看客户" , description = "根据客户的名称,编码,是否开启等可以镜像客户的筛选")
|
@Validated @RequestBody CustomerListReq customerListReq) {
|
||||||
public Result<List<CustomerResp>> selectList(@Validated @RequestBody CustomerListReq customerListReq){
|
|
||||||
return Result.success(
|
return Result.success(
|
||||||
orderPayCustomerService.selectList(customerListReq)
|
orderPayCustomerService.selectList(customerListReq)
|
||||||
);
|
);
|
||||||
|
@ -43,9 +45,61 @@ public class OrderPayCustomerController {
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
@Operation(summary = "获取未接入的客户",description = "调用nacosAPI获取所有的微服务名称")
|
@Operation(summary = "获取未接入的客户", description = "调用nacosAPI获取所有的微服务名称,作为支付中台的客户")
|
||||||
@Schema(description = "获取未接入的客户",defaultValue = "客户1,客户2",type = "List")
|
@Schema(description = "获取未接入的客户", defaultValue = "[\"客户1\",\"客户2\"]", type = "List")
|
||||||
public Result<List<String>> getCustomerAllList(){
|
public Result<List<String>> getCustomerAllList(){
|
||||||
return Result.success(orderPayCustomerService.getCustomerAllList());
|
return Result.success(
|
||||||
|
orderPayCustomerService.getCustomerAllList()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Operation(summary = "客户信息添加",description = "添加支付平台客户信息,添加成功之后才可以使用支付类的产品")
|
||||||
|
public Result<String> save(@Validated @RequestBody OrderCustomerAddReq orderCustomerAddReq) {
|
||||||
|
orderPayCustomerService.save(OrderPayCustomer.addBuild(orderCustomerAddReq));
|
||||||
|
return Result.success(null, "操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("/{orderCustomerId}")
|
||||||
|
@Operation(summary = "客户信息修改", description = "通过ID修改客户信息")
|
||||||
|
public Result<String> update(
|
||||||
|
@Schema(title = "客户ID", type = "Long", defaultValue = "1", description = "修改客户信息需要依据的唯一条件")
|
||||||
|
@PathVariable("orderCustomerId") Long orderCustomerId,
|
||||||
|
@RequestBody @Validated OrderCustomerUpdReq orderCustomerUpdReq){
|
||||||
|
orderPayCustomerService.updateById(OrderPayCustomer.updBuild(orderCustomerUpdReq, () -> orderCustomerId));
|
||||||
|
return Result.success(null, "操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@DeleteMapping("/{orderCustomerId}")
|
||||||
|
@Operation(summary = "客户信息删除", description = "通过ID删除客户信息")
|
||||||
|
public Result<String> delete(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||||
|
orderPayCustomerService.removeById(orderCustomerId);
|
||||||
|
return Result.success(null, "操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/{orderCustomerId}")
|
||||||
|
@Operation(summary = "通过ID获取客户信息", description = "通过ID获取客户信息")
|
||||||
|
public Result<OrderPayCustomer> findById(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||||
|
return Result.success(orderPayCustomerService.getById(orderCustomerId), "操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/disable/{orderCustomerId}")
|
||||||
|
@Operation(summary = "通过ID禁用客户", description = "通过ID禁用客户")
|
||||||
|
public Result<String> disable(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||||
|
this.orderPayCustomerService.disable(orderCustomerId);
|
||||||
|
return Result.success(null, "操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/enable/{orderCustomerId}")
|
||||||
|
@Operation(summary = "通过ID启用客户", description = "通过ID启用客户")
|
||||||
|
public Result<String> enable(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||||
|
this.orderPayCustomerService.enable(orderCustomerId);
|
||||||
|
return Result.success(null, "操作成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.pay.service;
|
package com.muyu.pay.service;
|
||||||
|
|
||||||
|
import cn.hutool.log.Log;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.domain.OrderPayCustomer;
|
import com.muyu.domain.OrderPayCustomer;
|
||||||
import com.muyu.domain.req.CustomerListReq;
|
import com.muyu.domain.req.CustomerListReq;
|
||||||
|
@ -15,4 +16,11 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
||||||
public List<CustomerResp> selectList(CustomerListReq customerListReq);
|
public List<CustomerResp> selectList(CustomerListReq customerListReq);
|
||||||
|
|
||||||
List<String> getCustomerAllList();
|
List<String> getCustomerAllList();
|
||||||
|
|
||||||
|
|
||||||
|
void disable (Long orderCustomerId);
|
||||||
|
|
||||||
|
void enable(Long orderCustomerId);
|
||||||
|
|
||||||
|
void settingStatus(Long orderCustomerId, String status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,37 @@
|
||||||
package com.muyu.pay.service.impl;
|
package com.muyu.pay.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.dtflys.forest.Forest;
|
||||||
import com.muyu.common.nacos.service.NacosServerService;
|
|
||||||
import com.muyu.domain.OrderPayCustomer;
|
import com.muyu.domain.OrderPayCustomer;
|
||||||
import com.muyu.domain.OrderPayInfo;
|
import com.muyu.domain.OrderPayInfo;
|
||||||
import com.muyu.domain.req.CustomerListReq;
|
import com.muyu.domain.req.CustomerListReq;
|
||||||
import com.muyu.domain.resp.CustomerOrderPaySimpleResp;
|
|
||||||
import com.muyu.domain.resp.CustomerResp;
|
import com.muyu.domain.resp.CustomerResp;
|
||||||
import com.muyu.pay.controller.OrderPayCustomerController;
|
|
||||||
import com.muyu.pay.mapper.OrderPayCustomerMapper;
|
import com.muyu.pay.mapper.OrderPayCustomerMapper;
|
||||||
import com.muyu.pay.service.OrderPayCustomerService;
|
import com.muyu.pay.service.OrderPayCustomerService;
|
||||||
import com.muyu.pay.service.OrderPayService;
|
import com.muyu.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.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
@Service
|
@Service
|
||||||
public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMapper ,OrderPayCustomer>
|
public class OrderPayCustomerServiceImpl
|
||||||
implements OrderPayCustomerService {
|
extends ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer>
|
||||||
|
implements OrderPayCustomerService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderPayService orderPayService;
|
private OrderPayService orderPayService;
|
||||||
|
@ -34,17 +39,18 @@ public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMap
|
||||||
@Autowired
|
@Autowired
|
||||||
private NacosServerService nacosServerService;
|
private NacosServerService nacosServerService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
public List<CustomerResp> selectList (CustomerListReq customerListReq) {
|
||||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.like(
|
|
||||||
StringUtils.isNotEmpty(customerListReq.getAppCode()),
|
|
||||||
OrderPayCustomer::getAppCode, customerListReq.getAppCode()
|
|
||||||
);
|
|
||||||
queryWrapper.like(
|
queryWrapper.like(
|
||||||
StringUtils.isNotEmpty(customerListReq.getAppName()),
|
StringUtils.isNotEmpty(customerListReq.getAppName()),
|
||||||
OrderPayCustomer::getAppName, customerListReq.getAppName()
|
OrderPayCustomer::getAppName, customerListReq.getAppName()
|
||||||
);
|
);
|
||||||
|
queryWrapper.like(
|
||||||
|
StringUtils.isNotEmpty(customerListReq.getAppCode()),
|
||||||
|
OrderPayCustomer::getAppCode, customerListReq.getAppCode()
|
||||||
|
);
|
||||||
queryWrapper.eq(
|
queryWrapper.eq(
|
||||||
StringUtils.isNotEmpty(customerListReq.getStatus()),
|
StringUtils.isNotEmpty(customerListReq.getStatus()),
|
||||||
OrderPayCustomer::getStatus, customerListReq.getStatus()
|
OrderPayCustomer::getStatus, customerListReq.getStatus()
|
||||||
|
@ -62,8 +68,9 @@ public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMap
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCustomerAllList() {
|
public List<String> getCustomerAllList () {
|
||||||
List<String> nacosServerAllList = nacosServerService.nacosServiceAllList();
|
List<String> nacosServerAllList = nacosServerService.nacosServiceAllList();
|
||||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.select(OrderPayCustomer::getAppCode);
|
queryWrapper.select(OrderPayCustomer::getAppCode);
|
||||||
|
@ -74,41 +81,71 @@ public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMap
|
||||||
.filter(nacosServer -> !customerSet.contains(nacosServer))
|
.filter(nacosServer -> !customerSet.contains(nacosServer))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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 = orderPayService.count(queryWrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ServiceException(
|
||||||
|
StringUtils.format("客户:[{}], 七天还用, 不能删除", orderPayCustomer.getAppName())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return super.removeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disable (Long orderCustomerId) {
|
||||||
|
this.settingStatus(orderCustomerId, SystemYesNo.NO.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable (Long orderCustomerId) {
|
||||||
|
this.settingStatus(orderCustomerId, SystemYesNo.YES.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void settingStatus(Long orderCustomerId, String status){
|
||||||
|
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(OrderPayCustomer::getId, orderCustomerId);
|
||||||
|
boolean isExists = this.exists(queryWrapper);
|
||||||
|
if (!isExists){
|
||||||
|
throw new ServiceException("操作客户不存在");
|
||||||
|
}
|
||||||
|
if (!SystemYesNo.isCode(status)){
|
||||||
|
throw new ServiceException("设置状态值违法");
|
||||||
|
}
|
||||||
|
LambdaUpdateWrapper<OrderPayCustomer> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.eq(OrderPayCustomer::getId, orderCustomerId);
|
||||||
|
updateWrapper.set(OrderPayCustomer::getStatus, status);
|
||||||
|
this.update(updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean save (OrderPayCustomer orderPayCustomer) {
|
||||||
|
String appCode = orderPayCustomer.getAppCode();
|
||||||
|
|
||||||
|
List<String> nacosServerAllList = nacosServerService.nacosServiceAllList();
|
||||||
|
log.info("进行服务合法性判断:[{}->{}]", appCode, nacosServerAllList);
|
||||||
|
if (!nacosServerAllList.contains(appCode)){
|
||||||
|
throw new ServiceException("客户编码违法");
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(OrderPayCustomer::getAppCode, appCode);
|
||||||
|
long isAppCodeOnly = this.count(queryWrapper);
|
||||||
|
log.info("进行服务code唯一性校验:[{}-{}]", appCode, isAppCodeOnly);
|
||||||
|
if (isAppCodeOnly > 0){
|
||||||
|
throw new ServiceException("客户编码重复");
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.save(orderPayCustomer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue