2
0

wfc pay module init

This commit is contained in:
2024-11-23 12:25:07 +08:00
parent f36f780a05
commit 7a1b0a6eee
22 changed files with 1611 additions and 1 deletions

1
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1 @@
{}

View File

@@ -1,7 +1,7 @@
package org.wfc.common.log.enums;
/**
* 业务操作类型
* Business type defination
*
* @author ruoyi
*/
@@ -12,6 +12,11 @@ public enum BusinessType
*/
OTHER,
/**
* Get
*/
SELECT,
/**
* 新增
*/

107
wfc-modules/wfc-pay/pom.xml Normal file
View File

@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wfc</groupId>
<artifactId>wfc-modules</artifactId>
<version>3.6.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wfc-modules-pay</artifactId>
<description>
wfc-modules-pay
</description>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- WFC Common DataSource -->
<dependency>
<groupId>org.wfc</groupId>
<artifactId>wfc-common-datasource</artifactId>
</dependency>
<!-- WFC Common DataScope -->
<dependency>
<groupId>org.wfc</groupId>
<artifactId>wfc-common-datascope</artifactId>
</dependency>
<!-- WFC Common Log -->
<dependency>
<groupId>org.wfc</groupId>
<artifactId>wfc-common-log</artifactId>
</dependency>
<!-- WFC Common Swagger -->
<dependency>
<groupId>org.wfc</groupId>
<artifactId>wfc-common-swagger</artifactId>
</dependency>
<!-- stripe for credit card pay -->
<dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<version>20.0.0</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,25 @@
package org.wfc.pay;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.wfc.common.security.annotation.EnableCustomConfig;
import org.wfc.common.security.annotation.EnableRyFeignClients;
import org.wfc.common.swagger.annotation.EnableCustomSwagger2;
/**
* Pay module
*
* @author wfc
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
public class WfcPayApplication
{
public static void main(String[] args)
{
SpringApplication.run(WfcPayApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ Pay module startup ლ(´ڡ`ლ)゙ \n");
}
}

View File

@@ -0,0 +1,77 @@
package org.wfc.pay.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.pay.domain.CreditCard;
import org.wfc.pay.service.ICreditCardService;
/**
* Credit card pay controller
*
* @author simon
*/
@RestController
@RequestMapping("/creditCard")
public class CreditCardController extends BaseController
{
@Autowired
private ICreditCardService ccPayService;
/**
* 根据参数编号获取详细信息
*/
@GetMapping(value = "/{userId}")
public AjaxResult getInfo(@PathVariable Long userId)
{
return success(ccPayService.selectCreditCardInfoByUserId(userId));
}
/**
* 新增参数配置
*/
@RequiresPermissions("pay:creditCard:add")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody CreditCard creditCardInfo)
{
return toAjax(ccPayService.insertCreditCardInfo(creditCardInfo));
}
/**
* 修改参数配置
*/
@RequiresPermissions("pay:creditCard:edit")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody CreditCard creditCardInfo)
{
return toAjax(ccPayService.updateCreditCardInfo(creditCardInfo));
}
/**
* 删除参数配置
*/
@RequiresPermissions("pay:creditCard:remove")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id)
{
ccPayService.deleteCreditCardInfoById(id);
return success();
}
}

View File

@@ -0,0 +1,73 @@
package org.wfc.pay.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.pay.domain.PayPal;
import org.wfc.pay.service.IPayPalService;
/**
* Paypal controller
*
* @author wfc
*/
@RestController
@RequestMapping("/paypal")
public class PayPalController extends BaseController
{
@Autowired
private IPayPalService paypalService;
/**
* PayPal
*/
@RequiresPermissions("pay:paypalInfo:query")
@Log(title = "paypal info management", businessType = BusinessType.OTHER)
@GetMapping("/{userId}")
public AjaxResult query(@PathVariable Long userId) {
return success(paypalService.selectPayPalInfoByUserId(userId));
}
/**
* PayPal
*/
@RequiresPermissions("pay:paypalInfo:add")
@Log(title = "paypal info management", businessType = BusinessType.INSERT)
@PostMapping("/{paypal}")
public AjaxResult add(@PathVariable PayPal paypal)
{
return toAjax(paypalService.insertPayPalInfo(paypal));
}
/**
* PayPal
*/
@RequiresPermissions("pay:paypalInfo:edit")
@Log(title = "paypal info management", businessType = BusinessType.UPDATE)
@PutMapping("/{id}")
public AjaxResult edit(@PathVariable Long id) {
return toAjax(paypalService.updatePayPalInfoById(id));
}
/**
* PayPal
*/
@RequiresPermissions("pay:paypalInfo:remove")
@Log(title = "paypal info management", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id) {
paypalService.deletePayPalInfoById(id);
return success();
}
}

View File

@@ -0,0 +1,111 @@
package org.wfc.pay.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.wfc.common.core.annotation.Excel;
import org.wfc.common.core.annotation.Excel.ColumnType;
import org.wfc.common.core.web.domain.BaseEntity;
/**
* 参数配置表 sys_config
*
* @author ruoyi
*/
public class CreditCard extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 参数主键 */
@Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
private Long configId;
/** 参数名称 */
@Excel(name = "参数名称")
private String configName;
/** 参数键名 */
@Excel(name = "参数键名")
private String configKey;
/** 参数键值 */
@Excel(name = "参数键值")
private String configValue;
/** 系统内置Y是 N否 */
@Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
private String configType;
public Long getConfigId()
{
return configId;
}
public void setConfigId(Long configId)
{
this.configId = configId;
}
@NotBlank(message = "参数名称不能为空")
@Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
public String getConfigName()
{
return configName;
}
public void setConfigName(String configName)
{
this.configName = configName;
}
@NotBlank(message = "参数键名长度不能为空")
@Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符")
public String getConfigKey()
{
return configKey;
}
public void setConfigKey(String configKey)
{
this.configKey = configKey;
}
@NotBlank(message = "参数键值不能为空")
@Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符")
public String getConfigValue()
{
return configValue;
}
public void setConfigValue(String configValue)
{
this.configValue = configValue;
}
public String getConfigType()
{
return configType;
}
public void setConfigType(String configType)
{
this.configType = configType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("configId", getConfigId())
.append("configName", getConfigName())
.append("configKey", getConfigKey())
.append("configValue", getConfigValue())
.append("configType", getConfigType())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -0,0 +1,256 @@
package org.wfc.pay.domain;
import org.wfc.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* 菜单权限表 sys_menu
*
* @author wfc
*/
public class PayPal extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 菜单ID */
private Long menuId;
/** 菜单名称 */
private String menuName;
/** 父菜单名称 */
private String parentName;
/** 父菜单ID */
private Long parentId;
/** 显示顺序 */
private Integer orderNum;
/** 路由地址 */
private String path;
/** 组件路径 */
private String component;
/** 路由参数 */
private String query;
/** 是否为外链0是 1否 */
private String isFrame;
/** 是否缓存0缓存 1不缓存 */
private String isCache;
/** 类型M目录 C菜单 F按钮 */
private String menuType;
/** 显示状态0显示 1隐藏 */
private String visible;
/** 菜单状态0正常 1停用 */
private String status;
/** 权限字符串 */
private String perms;
/** 菜单图标 */
private String icon;
/** 菜单key */
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getMenuId()
{
return menuId;
}
public void setMenuId(Long menuId)
{
this.menuId = menuId;
}
@NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
public String getMenuName()
{
return menuName;
}
public void setMenuName(String menuName)
{
this.menuName = menuName;
}
public String getParentName()
{
return parentName;
}
public void setParentName(String parentName)
{
this.parentName = parentName;
}
public Long getParentId()
{
return parentId;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
@NotNull(message = "显示顺序不能为空")
public Integer getOrderNum()
{
return orderNum;
}
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
}
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
public String getComponent()
{
return component;
}
public void setComponent(String component)
{
this.component = component;
}
public String getQuery()
{
return query;
}
public void setQuery(String query)
{
this.query = query;
}
public String getIsFrame()
{
return isFrame;
}
public void setIsFrame(String isFrame)
{
this.isFrame = isFrame;
}
public String getIsCache()
{
return isCache;
}
public void setIsCache(String isCache)
{
this.isCache = isCache;
}
@NotBlank(message = "菜单类型不能为空")
public String getMenuType()
{
return menuType;
}
public void setMenuType(String menuType)
{
this.menuType = menuType;
}
public String getVisible()
{
return visible;
}
public void setVisible(String visible)
{
this.visible = visible;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
public String getPerms()
{
return perms;
}
public void setPerms(String perms)
{
this.perms = perms;
}
public String getIcon()
{
return icon;
}
public void setIcon(String icon)
{
this.icon = icon;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("menuId", getMenuId())
.append("menuName", getMenuName())
.append("parentId", getParentId())
.append("orderNum", getOrderNum())
.append("path", getPath())
.append("component", getComponent())
.append("isFrame", getIsFrame())
.append("IsCache", getIsCache())
.append("menuType", getMenuType())
.append("visible", getVisible())
.append("status ", getStatus())
.append("perms", getPerms())
.append("icon", getIcon())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("name", getName())
.toString();
}
}

View File

@@ -0,0 +1,106 @@
package org.wfc.pay.domain.vo;
import org.wfc.common.core.utils.StringUtils;
/**
* 路由显示信息
*
* @author wfc
*/
public class MetaVo
{
/**
* 设置该路由在侧边栏和面包屑中展示的名字
*/
private String title;
/**
* 设置该路由的图标对应路径src/assets/icons/svg
*/
private String icon;
/**
* 设置为true则不会被 <keep-alive>缓存
*/
private boolean noCache;
/**
* 内链地址http(s)://开头)
*/
private String link;
public MetaVo()
{
}
public MetaVo(String title, String icon)
{
this.title = title;
this.icon = icon;
}
public MetaVo(String title, String icon, boolean noCache)
{
this.title = title;
this.icon = icon;
this.noCache = noCache;
}
public MetaVo(String title, String icon, String link)
{
this.title = title;
this.icon = icon;
this.link = link;
}
public MetaVo(String title, String icon, boolean noCache, String link)
{
this.title = title;
this.icon = icon;
this.noCache = noCache;
if (StringUtils.ishttp(link))
{
this.link = link;
}
}
public boolean isNoCache()
{
return noCache;
}
public void setNoCache(boolean noCache)
{
this.noCache = noCache;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getIcon()
{
return icon;
}
public void setIcon(String icon)
{
this.icon = icon;
}
public String getLink()
{
return link;
}
public void setLink(String link)
{
this.link = link;
}
}

View File

@@ -0,0 +1,148 @@
package org.wfc.pay.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.List;
/**
* 路由配置信息
*
* @author wfc
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class RouterVo
{
/**
* 路由名字
*/
private String name;
/**
* 路由地址
*/
private String path;
/**
* 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现
*/
private boolean hideInMenu;
/**
* 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
*/
private String redirect;
/**
* 组件地址
*/
private String component;
/**
* 路由参数:如 {"id": 1, "name": "ry"}
*/
private String query;
/**
* 当你一个路由下面的 children 声明的路由大于1个时自动会变成嵌套的模式--如组件页面
*/
private Boolean alwaysShow;
/**
* 其他元素
*/
private MetaVo meta;
/**
* 子路由
*/
private List<RouterVo> children;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
}
public boolean getHideInMenu()
{
return hideInMenu;
}
public void setHideInMenu(boolean hideInMenu)
{
this.hideInMenu = hideInMenu;
}
public String getRedirect()
{
return redirect;
}
public void setRedirect(String redirect)
{
this.redirect = redirect;
}
public String getComponent()
{
return component;
}
public void setComponent(String component)
{
this.component = component;
}
public String getQuery()
{
return query;
}
public void setQuery(String query)
{
this.query = query;
}
public Boolean getAlwaysShow()
{
return alwaysShow;
}
public void setAlwaysShow(Boolean alwaysShow)
{
this.alwaysShow = alwaysShow;
}
public MetaVo getMeta()
{
return meta;
}
public void setMeta(MetaVo meta)
{
this.meta = meta;
}
public List<RouterVo> getChildren()
{
return children;
}
public void setChildren(List<RouterVo> children)
{
this.children = children;
}
}

View File

@@ -0,0 +1,60 @@
package org.wfc.pay.domain.vo;
import java.io.Serializable;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* Treeselect树结构实体类
*
* @author wfc
*/
public class TreeSelect implements Serializable
{
private static final long serialVersionUID = 1L;
/** 节点ID */
private Long id;
/** 节点名称 */
private String label;
/** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children;
public TreeSelect()
{
}
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getLabel()
{
return label;
}
public void setLabel(String label)
{
this.label = label;
}
public List<TreeSelect> getChildren()
{
return children;
}
public void setChildren(List<TreeSelect> children)
{
this.children = children;
}
}

View File

@@ -0,0 +1,44 @@
package org.wfc.pay.mapper;
import java.util.List;
import org.wfc.pay.domain.CreditCard;
/**
* 参数配置 数据层
*
* @author simon
*/
public interface CreditCardMapper
{
/**
* 通过ID查询配置
*
* @param id 参数ID
* @return 参数配置信息
*/
public CreditCard selectCreditCardInfoByUserId(Long id);
/**
* 新增参数配置
*
* @param creditCard 参数配置信息
* @return 结果
*/
public int insertCreditCardInfo(CreditCard creditCard);
/**
* 修改参数配置
*
* @param creditCard 参数配置信息
* @return 结果
*/
public int updateCreditCardInfo(CreditCard creditCard);
/**
* 删除参数配置
*
* @param id 参数ID
* @return 结果
*/
public void deleteCreditCardInfoById(Long id);
}

View File

@@ -0,0 +1,43 @@
package org.wfc.pay.mapper;
import org.wfc.pay.domain.PayPal;
/**
* Paypal mapper
*
* @author wfc
*/
public interface PayPalMapper
{
/**
* select paypal info by user id
*
* @param userId user id
* @return paypal information
*/
public PayPal selectPayPalInfoByUserId(Long userId);
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public int insertPayPalInfo(PayPal paypal);
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public int updatePayPalInfoById(Long id);
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public void deletePayPalInfoById(Long id);
}

View File

@@ -0,0 +1,43 @@
package org.wfc.pay.service;
import org.wfc.pay.domain.CreditCard;
/**
* Credit card pay service layer
*
* @author wfc
*/
public interface ICreditCardService
{
/**
* select credit card information
*
* @param userId User ID
* @return Credit card info
*/
public CreditCard selectCreditCardInfoByUserId(Long userId);
/**
* insert credit card
*
* @param creditCard User ID
* @return Credit card info
*/
public int insertCreditCardInfo(CreditCard creditCard);
/**
* update credit card
*
* @param creditCard User ID
* @return Credit card info
*/
public int updateCreditCardInfo(CreditCard creditCard);
/**
* update credit card
*
* @param creditCard User ID
* @return void
*/
public void deleteCreditCardInfoById(Long id);
}

View File

@@ -0,0 +1,43 @@
package org.wfc.pay.service;
import org.wfc.pay.domain.PayPal;
/**
* Paypal pay service layer
*
* @author wfc
*/
public interface IPayPalService
{
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public PayPal selectPayPalInfoByUserId(Long userId);
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public int insertPayPalInfo(PayPal paypal);
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public int updatePayPalInfoById(Long id);
/**
* select PayPal pay information by user ID
*
* @param userId user ID
* @return PayPal pay information
*/
public void deletePayPalInfoById(Long id);
}

View File

@@ -0,0 +1,74 @@
package org.wfc.pay.service.impl;
import java.util.Collection;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.common.core.constant.CacheConstants;
import org.wfc.common.core.constant.UserConstants;
import org.wfc.common.core.exception.ServiceException;
import org.wfc.common.core.text.Convert;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.redis.service.RedisService;
import org.wfc.pay.domain.CreditCard;
import org.wfc.pay.mapper.CreditCardMapper;
import org.wfc.pay.service.ICreditCardService;
/**
* 参数配置 服务层实现
*
* @author ruoyi
*/
@Service
public class CreditCardServiceImpl implements ICreditCardService
{
@Autowired
private CreditCardMapper creditCardMapper;
/**
* 查询参数配置信息
*
* @param creditCardId 参数配置ID
* @return 参数配置信息
*/
public CreditCard selectCreditCardInfoByUserId(Long userId)
{
//CreditCard creditCardInfo = new CreditCard();
return creditCardMapper.selectCreditCardInfoByUserId(userId);
}
/**
* 新增参数配置
*
* @param creditCard 参数配置信息
* @return 结果
*/
public int insertCreditCardInfo(CreditCard creditCard)
{
int row = creditCardMapper.insertCreditCardInfo(creditCard);
return row;
}
/**
* 修改参数配置
*
* @param creditCard 参数配置信息
* @return 结果
*/
public int updateCreditCardInfo(CreditCard creditCard)
{
int row = creditCardMapper.updateCreditCardInfo(creditCard);
return row;
}
/**
* 删除参数信息
*
* @param id 需要删除的参数ID
*/
public void deleteCreditCardInfoById(Long id)
{
creditCardMapper.deleteCreditCardInfoById(id);
}
}

View File

@@ -0,0 +1,63 @@
package org.wfc.pay.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.pay.mapper.PayPalMapper;
import org.wfc.pay.service.IPayPalService;
import org.wfc.pay.domain.PayPal;
/**
* PayPal service implementation
*
* @author wfc
*/
@Service
public class PayPalServiceImpl implements IPayPalService
{
@Autowired
private PayPalMapper paypalMapper;
/**
* Select Paypal information by user ID
*
* @param userId user ID
* @return 结果
*/
@Override
public PayPal selectPayPalInfoByUserId(Long userId) {
return paypalMapper.selectPayPalInfoByUserId(userId);
}
/**
* Select Paypal information by user ID
*
* @param userId user ID
* @return 结果
*/
@Override
public int insertPayPalInfo(PayPal paypal) {
return paypalMapper.insertPayPalInfo(paypal);
}
/**
* Select Paypal information by user ID
*
* @param userId user ID
* @return 结果
*/
@Override
public int updatePayPalInfoById(Long id) {
return paypalMapper.updatePayPalInfoById(id);
}
/**
* update credit card
*
* @param creditCard User ID
* @return void
*/
@Override
public void deletePayPalInfoById(Long id) {
paypalMapper.deletePayPalInfoById(id);
}
}

View File

@@ -0,0 +1,10 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
__ _
/ _| | |
__ __| |_ ___ ______ ___ _ _ ___ | |_ ___ _ __ ___
\ \ /\ / /| _| / __||______|/ __|| | | |/ __|| __| / _ \| '_ ` _ \
\ V V / | | | (__ \__ \| |_| |\__ \| |_ | __/| | | | | |
\_/\_/ |_| \___| |___/ \__, ||___/ \__| \___||_| |_| |_|
__/ |
|___/

View File

@@ -0,0 +1,27 @@
# Tomcat
server:
port: 9401
# Spring
spring:
application:
# 应用名称
name: wfc-pay
profiles:
# 环境配置
active: '@profileName@'
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.2.248:8848
namespace: '@nacosNamespace@'
config:
# 配置中心地址
server-addr: 192.168.2.248:8848
namespace: '@nacosNamespace@'
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/wfc-pay" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="org.wfc" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
</configuration>

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.pay.mapper.CreditCardMapper">
<resultMap type="CreditCard" id="CreditCardResult">
<id property="configId" column="config_id" />
<result property="configName" column="config_name" />
<result property="configKey" column="config_key" />
<result property="configValue" column="config_value" />
<result property="configType" column="config_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectConfigVo">
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark
from sys_config
</sql>
<!-- 查询条件 -->
<sql id="sqlwhereSearch">
<where>
<if test="configId !=null">
and config_id = #{configId}
</if>
<if test="configKey !=null and configKey != ''">
and config_key = #{configKey}
</if>
</where>
</sql>
<select id="selectConfig" parameterType="CreditCard" resultMap="CreditCardResult">
<include refid="selectConfigVo"/>
<include refid="sqlwhereSearch"/>
</select>
<select id="selectCreditCardInfoByUserId" parameterType="CreditCard" resultMap="CreditCardResult">
<include refid="selectConfigVo"/>
<where>
<if test="configName != null and configName != ''">
AND config_name like concat('%', #{configName}, '%')
</if>
<if test="configType != null and configType != ''">
AND config_type = #{configType}
</if>
<if test="configKey != null and configKey != ''">
AND config_key like concat('%', #{configKey}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
</select>
<select id="selectCCInfoByUserId" parameterType="Long" resultMap="CreditCardResult">
<include refid="selectConfigVo"/>
where config_id = #{configId}
</select>
<select id="checkConfigKeyUnique" parameterType="String" resultMap="CreditCardResult">
<include refid="selectConfigVo"/>
where config_key = #{configKey} limit 1
</select>
<insert id="insertCreditCardInfo" parameterType="CreditCard">
insert into sys_config (
<if test="configName != null and configName != '' ">config_name,</if>
<if test="configKey != null and configKey != '' ">config_key,</if>
<if test="configValue != null and configValue != '' ">config_value,</if>
<if test="configType != null and configType != '' ">config_type,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="configName != null and configName != ''">#{configName},</if>
<if test="configKey != null and configKey != ''">#{configKey},</if>
<if test="configValue != null and configValue != ''">#{configValue},</if>
<if test="configType != null and configType != ''">#{configType},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateCreditCardInfo" parameterType="CreditCard">
update sys_config
<set>
<if test="configName != null and configName != ''">config_name = #{configName},</if>
<if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
<if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
<if test="configType != null and configType != ''">config_type = #{configType},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where config_id = #{configId}
</update>
<delete id="deleteCreditCardInfoById" parameterType="Long">
delete from credit_card where user_id = #{userId}
</delete>
<delete id="deleteConfigByIds" parameterType="Long">
delete from sys_config where config_id in
<foreach item="configId" collection="array" open="(" separator="," close=")">
#{configId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.pay.mapper.PayPalMapper">
<resultMap type="PayPal" id="PayPalResult">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectPayPalInfoVo">
select d.dept_id, d.parent_id, d.ancestors, d.remark, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
from sys_dept d
</sql>
<select id="selectPayPalInfoByUserId" parameterType="PayPal" resultMap="PayPalResult">
<include refid="selectPayPalInfoVo"/>
where d.del_flag = '0'
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
</select>
<insert id="insertPayPalInfo" parameterType="PayPal">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updatePayPalInfoById" parameterType="PayPal">
update sys_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
update_time = sysdate()
</set>
where dept_id = #{id}
</update>
<delete id="deletePayPalInfoById" parameterType="Long">
update sys_dept set del_flag = '2' where dept_id = #{id}
</delete>
</mapper>