新增商户账号管理功能
This commit is contained in:
@@ -5,17 +5,21 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.gxwebsoft.cms.entity.Form;
|
import com.gxwebsoft.cms.entity.Form;
|
||||||
import com.gxwebsoft.cms.param.FormParam;
|
import com.gxwebsoft.cms.param.FormParam;
|
||||||
import com.gxwebsoft.cms.service.FormService;
|
import com.gxwebsoft.cms.service.FormService;
|
||||||
|
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
|
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.shop.service.MerchantService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,6 +35,8 @@ public class FormController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private FormService formService;
|
private FormService formService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private MerchantService merchantService;
|
||||||
|
@Resource
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
@ApiOperation("分页查询表单设计表")
|
@ApiOperation("分页查询表单设计表")
|
||||||
@@ -49,15 +55,18 @@ public class FormController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("根据id查询表单设计表")
|
@ApiOperation("根据id查询表单设计表")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<Form> get(@PathVariable("id") Integer id) {
|
public ApiResult<Form> get(@PathVariable("id") Integer id,HttpServletRequest request) {
|
||||||
String key = "FormId:" + id;
|
String key = "FormId:" + id;
|
||||||
final String formInfo = redisUtil.get(key);
|
final String formInfo = redisUtil.get(key);
|
||||||
// 从缓存读取信息
|
// 从缓存读取信息
|
||||||
if(StrUtil.isNotBlank(formInfo)){
|
if(StrUtil.isNotBlank(formInfo)){
|
||||||
return success(JSONObject.parseObject(formInfo, Form.class));
|
return success(JSONObject.parseObject(formInfo, Form.class));
|
||||||
}
|
}
|
||||||
// 使用关联查询
|
// 使用关联查询shop_merchant
|
||||||
return success(formService.getByIdRel(id));
|
final Form form = formService.getByIdRel(id);
|
||||||
|
// 获取商户信息
|
||||||
|
form.setMerchant(merchantService.getById(form.getMerchantId()));
|
||||||
|
return success(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("添加表单设计表")
|
@ApiOperation("添加表单设计表")
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.gxwebsoft.cms.controller;
|
package com.gxwebsoft.cms.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.gxwebsoft.cms.entity.Form;
|
||||||
import com.gxwebsoft.cms.entity.FormRecord;
|
import com.gxwebsoft.cms.entity.FormRecord;
|
||||||
import com.gxwebsoft.cms.param.FormRecordParam;
|
import com.gxwebsoft.cms.param.FormRecordParam;
|
||||||
import com.gxwebsoft.cms.service.FormRecordService;
|
import com.gxwebsoft.cms.service.FormRecordService;
|
||||||
|
import com.gxwebsoft.cms.service.FormService;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
@@ -26,6 +29,8 @@ import java.util.List;
|
|||||||
public class FormRecordController extends BaseController {
|
public class FormRecordController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private FormRecordService formRecordService;
|
private FormRecordService formRecordService;
|
||||||
|
@Resource
|
||||||
|
private FormService formService;
|
||||||
|
|
||||||
@ApiOperation("分页查询表单数据记录表")
|
@ApiOperation("分页查询表单数据记录表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@@ -51,7 +56,13 @@ public class FormRecordController extends BaseController {
|
|||||||
@ApiOperation("添加表单数据记录表")
|
@ApiOperation("添加表单数据记录表")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody FormRecord formRecord) {
|
public ApiResult<?> save(@RequestBody FormRecord formRecord) {
|
||||||
if (formRecordService.save(formRecord)) {
|
final Form form = formService.getById(formRecord.getFormId());
|
||||||
|
if (form.getSubmitNumber().equals(1)) {
|
||||||
|
if (formRecordService.count(new LambdaQueryWrapper<FormRecord>().eq(FormRecord::getStatus,0).eq(FormRecord::getPhone,formRecord.getPhone())) > 0) {
|
||||||
|
return fail("请勿重复提交");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (formRecordService.save(formRecord)) {
|
||||||
return success("提交成功");
|
return success("提交成功");
|
||||||
}
|
}
|
||||||
return fail("提交失败");
|
return fail("提交失败");
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ import com.gxwebsoft.common.system.service.UserService;
|
|||||||
import com.gxwebsoft.oa.entity.Company;
|
import com.gxwebsoft.oa.entity.Company;
|
||||||
import com.gxwebsoft.oa.param.LinkParam;
|
import com.gxwebsoft.oa.param.LinkParam;
|
||||||
import com.gxwebsoft.oa.service.LinkService;
|
import com.gxwebsoft.oa.service.LinkService;
|
||||||
|
import com.gxwebsoft.shop.entity.Merchant;
|
||||||
|
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||||
|
import com.gxwebsoft.shop.service.MerchantAccountService;
|
||||||
|
import com.gxwebsoft.shop.service.MerchantService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -28,6 +32,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 网站信息记录表控制器
|
* 网站信息记录表控制器
|
||||||
@@ -59,6 +64,10 @@ public class WebsiteController extends BaseController {
|
|||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
@Resource
|
||||||
|
private MerchantService merchantService;
|
||||||
|
@Resource
|
||||||
|
private MerchantAccountService merchantAccountService;
|
||||||
|
|
||||||
@ApiOperation("获取网站信息")
|
@ApiOperation("获取网站信息")
|
||||||
@GetMapping("/getSiteInfo")
|
@GetMapping("/getSiteInfo")
|
||||||
@@ -71,7 +80,7 @@ public class WebsiteController extends BaseController {
|
|||||||
|
|
||||||
// 从缓存读取信息
|
// 从缓存读取信息
|
||||||
if(StrUtil.isNotBlank(siteInfo)){
|
if(StrUtil.isNotBlank(siteInfo)){
|
||||||
// return success(JSONObject.parseObject(siteInfo,Website.class));
|
return success(JSONObject.parseObject(siteInfo,Website.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取站点信息
|
// 获取站点信息
|
||||||
@@ -240,9 +249,12 @@ public class WebsiteController extends BaseController {
|
|||||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
final String data = jsonObject.getString("data");
|
final String data = jsonObject.getString("data");
|
||||||
final User user = JSONObject.parseObject(data, User.class);
|
final User user = JSONObject.parseObject(data, User.class);
|
||||||
|
// 商户账号
|
||||||
|
website.setMerchantAccount(merchantAccountService.getOne(new LambdaQueryWrapper<MerchantAccount>().eq(MerchantAccount::getPhone, user.getPhone()).last("limit 1")));
|
||||||
website.setUserInfo(user);
|
website.setUserInfo(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 授权信息
|
// 授权信息
|
||||||
HashMap<String, Object> config = new HashMap<>();
|
HashMap<String, Object> config = new HashMap<>();
|
||||||
config.put("LICENSE_CODE", "");
|
config.put("LICENSE_CODE", "");
|
||||||
@@ -270,7 +282,7 @@ public class WebsiteController extends BaseController {
|
|||||||
serverTime.put("week",week);
|
serverTime.put("week",week);
|
||||||
serverTime.put("nextWeek",nextWeek);
|
serverTime.put("nextWeek",nextWeek);
|
||||||
website.setServerTime(serverTime);
|
website.setServerTime(serverTime);
|
||||||
redisUtil.set(key,website);
|
redisUtil.set(key,website,1L, TimeUnit.DAYS);
|
||||||
return success(website);
|
return success(website);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.cms.entity;
|
package com.gxwebsoft.cms.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.gxwebsoft.shop.entity.Merchant;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -48,6 +49,9 @@ public class Form implements Serializable {
|
|||||||
@ApiModelProperty(value = "用户ID")
|
@ApiModelProperty(value = "用户ID")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户ID")
|
||||||
|
private Integer merchantId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||||
private Integer sortNumber;
|
private Integer sortNumber;
|
||||||
|
|
||||||
@@ -83,4 +87,8 @@ public class Form implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer clearCache;
|
private Integer clearCache;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户信息")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Merchant merchant;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ public class FormRecord implements Serializable {
|
|||||||
@ApiModelProperty(value = "用户ID")
|
@ApiModelProperty(value = "用户ID")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "姓名")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手机号码")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||||
private Integer sortNumber;
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.*;
|
|||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import com.gxwebsoft.common.system.entity.UserInfo;
|
import com.gxwebsoft.common.system.entity.UserInfo;
|
||||||
import com.gxwebsoft.oa.entity.Link;
|
import com.gxwebsoft.oa.entity.Link;
|
||||||
|
import com.gxwebsoft.shop.entity.Merchant;
|
||||||
|
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -159,6 +161,14 @@ public class Website implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private User userInfo;
|
private User userInfo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户信息")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Merchant merchant;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户账号")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private MerchantAccount merchantAccount;
|
||||||
|
|
||||||
@ApiModelProperty(value = "配置信息")
|
@ApiModelProperty(value = "配置信息")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Object config;
|
private Object config;
|
||||||
|
|||||||
@@ -49,6 +49,9 @@
|
|||||||
<if test="param.createTimeEnd != null">
|
<if test="param.createTimeEnd != null">
|
||||||
AND a.create_time <= #{param.createTimeEnd}
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.merchantId != null">
|
||||||
|
AND a.merchant_id = #{param.merchantId}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
<if test="param.userId != null">
|
<if test="param.userId != null">
|
||||||
AND a.user_id = #{param.userId}
|
AND a.user_id = #{param.userId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.phone != null">
|
||||||
|
AND a.phone = #{param.phone}
|
||||||
|
</if>
|
||||||
<if test="param.sortNumber != null">
|
<if test="param.sortNumber != null">
|
||||||
AND a.sort_number = #{param.sortNumber}
|
AND a.sort_number = #{param.sortNumber}
|
||||||
</if>
|
</if>
|
||||||
@@ -41,6 +44,10 @@
|
|||||||
<if test="param.createTimeEnd != null">
|
<if test="param.createTimeEnd != null">
|
||||||
AND a.create_time <= #{param.createTimeEnd}
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.keywords != null">
|
||||||
|
AND (a.phone LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ public class FormRecordParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手机号码")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private String phone;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer sortNumber;
|
private Integer sortNumber;
|
||||||
|
|||||||
@@ -3,10 +3,16 @@ package com.gxwebsoft.common.core.utils;
|
|||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||||
|
import com.gxwebsoft.common.system.entity.Role;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.common.system.entity.UserRole;
|
||||||
|
import com.gxwebsoft.common.system.param.RoleParam;
|
||||||
|
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class RequestUtil {
|
public class RequestUtil {
|
||||||
@@ -41,4 +47,53 @@ public class RequestUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public User getByUserId(Integer userId) {
|
||||||
|
String path = "/system/user/" + userId;
|
||||||
|
try {
|
||||||
|
// 链式构建请求
|
||||||
|
String result = HttpRequest.get(host.concat(path))
|
||||||
|
.header("Authorization", ACCESS_TOKEN)
|
||||||
|
.header("Tenantid", TENANT_ID)
|
||||||
|
.timeout(20000)//超时,毫秒
|
||||||
|
.execute().body();
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
System.out.println("jsonObject = " + jsonObject);
|
||||||
|
final String data = jsonObject.getString("data");
|
||||||
|
return JSONObject.parseObject(data, User.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增用户
|
||||||
|
public void saveUserByPhone(MerchantAccount merchantAccount) {
|
||||||
|
String path = "/system/user/";
|
||||||
|
try {
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("nickname",merchantAccount.getRealName());
|
||||||
|
map.put("username", merchantAccount.getPhone());
|
||||||
|
map.put("phone", merchantAccount.getPhone());
|
||||||
|
map.put("password",merchantAccount.getPassword());
|
||||||
|
final ArrayList<Object> roles = new ArrayList<>();
|
||||||
|
final UserRole userRole = new UserRole();
|
||||||
|
userRole.setUserId(merchantAccount.getUserId());
|
||||||
|
userRole.setRoleId(merchantAccount.getRoleId());
|
||||||
|
userRole.setTenantId(merchantAccount.getTenantId());
|
||||||
|
roles.add(userRole);
|
||||||
|
map.put("roles",roles);
|
||||||
|
map.put("tenantId", TENANT_ID);
|
||||||
|
// 链式构建请求
|
||||||
|
String result = HttpRequest.post(host.concat(path))
|
||||||
|
.header("Authorization", ACCESS_TOKEN)
|
||||||
|
.header("Tenantid", TENANT_ID)
|
||||||
|
.body(JSONUtil.toJSONString(map))//表单内容
|
||||||
|
.timeout(20000)//超时,毫秒
|
||||||
|
.execute().body();
|
||||||
|
System.out.println("result = " + result);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,10 @@ public class BaseParam implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer tenantId;
|
private Integer tenantId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户ID")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer merchantId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取集合中的第一条数据
|
* 获取集合中的第一条数据
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -129,6 +129,10 @@ public class User implements UserDetails {
|
|||||||
@ApiModelProperty("企业ID")
|
@ApiModelProperty("企业ID")
|
||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户ID")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer merchantId;
|
||||||
|
|
||||||
@ApiModelProperty("注册来源客户端")
|
@ApiModelProperty("注册来源客户端")
|
||||||
private String platform;
|
private String platform;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
package com.gxwebsoft.shop.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||||
|
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.shop.service.MerchantAccountService;
|
||||||
|
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||||
|
import com.gxwebsoft.shop.param.MerchantAccountParam;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户账号控制器
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-04-19 12:02:24
|
||||||
|
*/
|
||||||
|
@Api(tags = "商户账号管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/shop/merchant-account")
|
||||||
|
public class MerchantAccountController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private MerchantAccountService merchantAccountService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询商户账号")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<MerchantAccount>> page(MerchantAccountParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(merchantAccountService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部商户账号")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<MerchantAccount>> list(MerchantAccountParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(merchantAccountService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据id查询商户账号")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<MerchantAccount> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(merchantAccountService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加商户账号")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody MerchantAccount merchantAccount, HttpServletRequest request) {
|
||||||
|
if (merchantAccountService.count(new LambdaQueryWrapper<MerchantAccount>().eq(MerchantAccount::getPhone,merchantAccount.getPhone())) > 0) {
|
||||||
|
return fail("手机号码已存在");
|
||||||
|
}
|
||||||
|
// 获取用户信息
|
||||||
|
final RequestUtil requestUtil = new RequestUtil();
|
||||||
|
String access_token = JwtUtil.getAccessToken(request);
|
||||||
|
requestUtil.setAccessToken(access_token);
|
||||||
|
requestUtil.setTenantId(getTenantId().toString());
|
||||||
|
final User userByPhone = requestUtil.getUserByPhone(merchantAccount.getPhone());
|
||||||
|
if (userByPhone != null) {
|
||||||
|
merchantAccount.setUserId(userByPhone.getUserId());
|
||||||
|
}
|
||||||
|
if (merchantAccountService.save(merchantAccount)) {
|
||||||
|
requestUtil.saveUserByPhone(merchantAccount);
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改商户账号")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody MerchantAccount merchantAccount) {
|
||||||
|
if (merchantAccountService.updateById(merchantAccount)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除商户账号")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (merchantAccountService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量添加商户账号")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<MerchantAccount> list) {
|
||||||
|
if (merchantAccountService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量修改商户账号")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<MerchantAccount> batchParam) {
|
||||||
|
if (batchParam.update(merchantAccountService, "id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量删除商户账号")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (merchantAccountService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,11 +12,13 @@ import com.gxwebsoft.common.core.web.BatchParam;
|
|||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import com.gxwebsoft.shop.entity.Merchant;
|
import com.gxwebsoft.shop.entity.Merchant;
|
||||||
|
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||||
import com.gxwebsoft.shop.param.MerchantParam;
|
import com.gxwebsoft.shop.param.MerchantParam;
|
||||||
import com.gxwebsoft.shop.service.MerchantService;
|
import com.gxwebsoft.shop.service.MerchantService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.bouncycastle.cert.ocsp.Req;
|
import org.bouncycastle.cert.ocsp.Req;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -40,6 +42,7 @@ public class MerchantController extends BaseController {
|
|||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<Merchant>> page(MerchantParam param) {
|
public ApiResult<PageResult<Merchant>> page(MerchantParam param) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
|
System.out.println("param = " + param);
|
||||||
return success(merchantService.pageRel(param));
|
return success(merchantService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,22 +60,26 @@ public class MerchantController extends BaseController {
|
|||||||
return success(merchantService.getByIdRel(id));
|
return success(merchantService.getByIdRel(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:merchant:save')")
|
||||||
@ApiOperation("添加商户")
|
@ApiOperation("添加商户")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody Merchant merchant, HttpServletRequest request) {
|
public ApiResult<?> save(@RequestBody Merchant merchant, HttpServletRequest request) {
|
||||||
if (merchantService.count(new LambdaQueryWrapper<Merchant>().eq(Merchant::getPhone,merchant.getPhone())) > 0) {
|
if (merchantService.count(new LambdaQueryWrapper<Merchant>().eq(Merchant::getPhone,merchant.getPhone())) > 0) {
|
||||||
return fail("商户手机号码" + merchant.getPhone() + "已存在");
|
return fail("商户手机号码" + merchant.getPhone() + "已存在");
|
||||||
}
|
}
|
||||||
// 跟进手机号获取用户信息
|
|
||||||
final RequestUtil requestUtil = new RequestUtil();
|
|
||||||
requestUtil.setAccessToken(JwtUtil.getAccessToken(request));
|
|
||||||
requestUtil.setTenantId(getTenantId().toString());
|
|
||||||
final User user = requestUtil.getUserByPhone(merchant.getPhone());
|
|
||||||
if(user != null){
|
|
||||||
merchant.setUserId(user.getUserId());
|
|
||||||
}
|
|
||||||
if (merchantService.save(merchant)) {
|
if (merchantService.save(merchant)) {
|
||||||
return success("添加成功");
|
// 设置商家后台入口
|
||||||
|
merchant.setAdminUrl(".adm.wsdns.cn");
|
||||||
|
merchantService.updateById(merchant);
|
||||||
|
// 获取用户信息
|
||||||
|
final RequestUtil requestUtil = new RequestUtil();
|
||||||
|
String access_token = JwtUtil.getAccessToken(request);
|
||||||
|
requestUtil.setAccessToken(access_token);
|
||||||
|
requestUtil.setTenantId(getTenantId().toString());
|
||||||
|
final MerchantAccount merchantAccount = new MerchantAccount();
|
||||||
|
merchantAccount.setPhone(merchantAccount.getPhone());
|
||||||
|
requestUtil.saveUserByPhone(merchantAccount);
|
||||||
|
return success("添加成功");
|
||||||
}
|
}
|
||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,21 @@ public class Merchant implements Serializable {
|
|||||||
@ApiModelProperty(value = "商户分类")
|
@ApiModelProperty(value = "商户分类")
|
||||||
private String category;
|
private String category;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "经纬度")
|
||||||
|
private String lngAndLat;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所在省份")
|
||||||
|
private String province;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所在城市")
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所在辖区")
|
||||||
|
private String region;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "详细地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
@ApiModelProperty(value = "手续费")
|
@ApiModelProperty(value = "手续费")
|
||||||
private BigDecimal commission;
|
private BigDecimal commission;
|
||||||
|
|
||||||
@@ -69,6 +84,9 @@ public class Merchant implements Serializable {
|
|||||||
@ApiModelProperty(value = "备注")
|
@ApiModelProperty(value = "备注")
|
||||||
private String comments;
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "管理入口")
|
||||||
|
private String adminUrl;
|
||||||
|
|
||||||
@ApiModelProperty(value = "所有人")
|
@ApiModelProperty(value = "所有人")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.gxwebsoft.shop.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springframework.security.core.parameters.P;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户账号
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-04-19 12:02:24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "MerchantAccount对象", description = "商户账号")
|
||||||
|
@TableName("shop_merchant_account")
|
||||||
|
public class MerchantAccount implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户手机号")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "账号密码")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "真实姓名")
|
||||||
|
private String realName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户ID")
|
||||||
|
private Integer merchantId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "角色ID")
|
||||||
|
private Integer roleId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "角色名称")
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户ID")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序号")
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租户id")
|
||||||
|
private Integer tenantId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户名称")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String merchantName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.gxwebsoft.shop.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||||
|
import com.gxwebsoft.shop.param.MerchantAccountParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户账号Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-04-19 12:02:24
|
||||||
|
*/
|
||||||
|
public interface MerchantAccountMapper extends BaseMapper<MerchantAccount> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<MerchantAccount>
|
||||||
|
*/
|
||||||
|
List<MerchantAccount> selectPageRel(@Param("page") IPage<MerchantAccount> page,
|
||||||
|
@Param("param") MerchantAccountParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<MerchantAccount> selectListRel(@Param("param") MerchantAccountParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<?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="com.gxwebsoft.shop.mapper.MerchantAccountMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*,b.merchant_name
|
||||||
|
FROM shop_merchant_account a
|
||||||
|
LEFT JOIN shop_merchant b ON a.merchant_id = b.merchant_id
|
||||||
|
<where>
|
||||||
|
<if test="param.id != null">
|
||||||
|
AND a.id = #{param.id}
|
||||||
|
</if>
|
||||||
|
<if test="param.phone != null">
|
||||||
|
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.realName != null">
|
||||||
|
AND a.real_name LIKE CONCAT('%', #{param.realName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.merchantId != null">
|
||||||
|
AND a.merchant_id = #{param.merchantId}
|
||||||
|
</if>
|
||||||
|
<if test="param.userId != null">
|
||||||
|
AND a.user_id = #{param.userId}
|
||||||
|
</if>
|
||||||
|
<if test="param.comments != null">
|
||||||
|
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.status != null">
|
||||||
|
AND a.status = #{param.status}
|
||||||
|
</if>
|
||||||
|
<if test="param.sortNumber != null">
|
||||||
|
AND a.sort_number = #{param.sortNumber}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeStart != null">
|
||||||
|
AND a.create_time >= #{param.createTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeEnd != null">
|
||||||
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
|
</if>
|
||||||
|
<if test="param.keywords != null">
|
||||||
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.MerchantAccount">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.MerchantAccount">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -62,9 +62,12 @@
|
|||||||
AND a.create_time <= #{param.createTimeEnd}
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null">
|
||||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
AND (
|
||||||
)
|
a.merchant_name LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
</if>
|
OR a.phone LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
OR a.real_name LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.gxwebsoft.shop.param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
|
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseParam;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户账号查询参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-04-19 12:02:24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "MerchantAccountParam对象", description = "商户账号查询参数")
|
||||||
|
public class MerchantAccountParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户手机号")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "真实姓名")
|
||||||
|
private String realName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer merchantId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序号")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -45,6 +45,15 @@ public class MerchantParam extends BaseParam {
|
|||||||
@ApiModelProperty(value = "商户分类")
|
@ApiModelProperty(value = "商户分类")
|
||||||
private String category;
|
private String category;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所在省份")
|
||||||
|
private String province;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所在城市")
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所在辖区")
|
||||||
|
private String region;
|
||||||
|
|
||||||
@ApiModelProperty(value = "手续费")
|
@ApiModelProperty(value = "手续费")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private BigDecimal commission;
|
private BigDecimal commission;
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.gxwebsoft.shop.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||||
|
import com.gxwebsoft.shop.param.MerchantAccountParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户账号Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-04-19 12:02:24
|
||||||
|
*/
|
||||||
|
public interface MerchantAccountService extends IService<MerchantAccount> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<MerchantAccount>
|
||||||
|
*/
|
||||||
|
PageResult<MerchantAccount> pageRel(MerchantAccountParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<MerchantAccount>
|
||||||
|
*/
|
||||||
|
List<MerchantAccount> listRel(MerchantAccountParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param id ID
|
||||||
|
* @return MerchantAccount
|
||||||
|
*/
|
||||||
|
MerchantAccount getByIdRel(Integer id);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.gxwebsoft.shop.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.shop.mapper.MerchantAccountMapper;
|
||||||
|
import com.gxwebsoft.shop.service.MerchantAccountService;
|
||||||
|
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||||
|
import com.gxwebsoft.shop.param.MerchantAccountParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户账号Service实现
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-04-19 12:02:24
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MerchantAccountServiceImpl extends ServiceImpl<MerchantAccountMapper, MerchantAccount> implements MerchantAccountService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MerchantAccount> pageRel(MerchantAccountParam param) {
|
||||||
|
PageParam<MerchantAccount, MerchantAccountParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||||
|
List<MerchantAccount> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MerchantAccount> listRel(MerchantAccountParam param) {
|
||||||
|
List<MerchantAccount> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<MerchantAccount, MerchantAccountParam> page = new PageParam<>();
|
||||||
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MerchantAccount getByIdRel(Integer id) {
|
||||||
|
MerchantAccountParam param = new MerchantAccountParam();
|
||||||
|
param.setId(id);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -62,7 +62,8 @@ public class ShopGenerator {
|
|||||||
// "shop_merchant",
|
// "shop_merchant",
|
||||||
// "shop_merchant_type",
|
// "shop_merchant_type",
|
||||||
// "shop_merchant_apply",
|
// "shop_merchant_apply",
|
||||||
"shop_order"
|
// "shop_order"
|
||||||
|
// "shop_merchant_account"
|
||||||
};
|
};
|
||||||
// 需要去除的表前缀
|
// 需要去除的表前缀
|
||||||
private static final String[] TABLE_PREFIX = new String[]{
|
private static final String[] TABLE_PREFIX = new String[]{
|
||||||
|
|||||||
Reference in New Issue
Block a user