Pre Merge pull request !380 from 鲸落/master_zhp

This commit is contained in:
鲸落
2024-10-11 09:33:55 +00:00
committed by Gitee
160 changed files with 13236 additions and 2919 deletions

View File

@@ -1,9 +1,14 @@
package com.ruoyi.system;
import org.apache.tomcat.util.http.LegacyCookieProcessor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.ruoyi.common.security.annotation.EnableCustomConfig;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
import org.springframework.boot.web.embedded.tomcat.TomcatContextCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.annotation.Bean;
/**
* 系统模块
@@ -18,15 +23,14 @@ public class RuoYiSystemApplication
public static void main(String[] args)
{
SpringApplication.run(RuoYiSystemApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n");
}
@Bean
public WebServerFactoryCustomizer<TomcatServletWebServerFactory> cookieProcessorCustomizer() {
return tomcatServletWebServerFactory -> tomcatServletWebServerFactory.addContextCustomizers((TomcatContextCustomizer) context -> {
context.setCookieProcessor(new LegacyCookieProcessor());
});
}
}

View File

@@ -0,0 +1,23 @@
package com.ruoyi.system.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Minio 配置信息
*
* @author ruoyi
*/
@Configuration
@ConfigurationProperties(prefix = "system")
@Data
public class SystemConfig
{
/**
* 加密密钥
*/
private String AESkey;
}

View File

@@ -0,0 +1,109 @@
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.common.core.domain.http.Channel;
import com.ruoyi.system.service.IChannelService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* 渠道配置Controller
*
* @author ruoyi
* @date 2024-09-15
*/
@RestController
@RequestMapping("/channel")
public class ChannelController extends BaseController
{
@Autowired
private IChannelService channelService;
/**
* 查询渠道配置列表
*/
@RequiresPermissions("system:channel:list")
@GetMapping("/list")
public TableDataInfo list(Channel channel)
{
startPage();
List<Channel> list = channelService.selectChannelList(channel);
return getDataTable(list);
}
/**
* 导出渠道配置列表
*/
@RequiresPermissions("system:channel:export")
@Log(title = "渠道配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Channel channel)
{
List<Channel> list = channelService.selectChannelList(channel);
ExcelUtil<Channel> util = new ExcelUtil<Channel>(Channel.class);
util.exportExcel(response, list, "渠道配置数据");
}
/**
* 获取渠道配置详细信息
*/
@RequiresPermissions("system:channel:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(channelService.selectChannelById(id));
}
/**
* 新增渠道配置
*/
@RequiresPermissions("system:channel:add")
@Log(title = "渠道配置", businessType = BusinessType.INSERT)
@RequestMapping(value = "/add", method = RequestMethod.POST)
public AjaxResult add(@RequestBody Channel channel)
{
return toAjax(channelService.insertChannel(channel));
}
/**
* 修改渠道配置
*/
@RequiresPermissions("system:channel:edit")
@Log(title = "渠道配置", businessType = BusinessType.UPDATE)
@RequestMapping(value = "/edit", method = RequestMethod.POST)
public AjaxResult edit(@RequestBody Channel channel)
{
return toAjax(channelService.updateChannel(channel));
}
/**
* 删除渠道配置
*/
@RequiresPermissions("system:channel:remove")
@Log(title = "渠道配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(channelService.deleteChannelByIds(ids));
}
/**
* 根据渠道标识获取渠道类型
* @param sign
* @return
*/
@GetMapping("/getChannelBySign")
public AjaxResult getChannelBySign(@RequestParam("sign")String sign){
return channelService.getChannelBySign(sign);
}
}

View File

@@ -0,0 +1,46 @@
package com.ruoyi.system.controller;
import com.ruoyi.common.core.domain.http.Channel;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.service.IChannelService;
import com.ruoyi.system.service.ICommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 渠道配置Controller
*
* @author ruoyi
* @date 2024-09-15
*/
@RestController
@RequestMapping("/common")
public class CommonController extends BaseController
{
@Autowired
private ICommonService commonService;
/**
* H5发送验证码
* @param phone 手机号码
* @return AjaxResult
*/
@GetMapping("/sendSms")
public AjaxResult sendSms(@RequestParam("phone")String phone, HttpServletRequest request){
String header = request.getHeader("x-sms-source");
return commonService.sendSms(phone,header);
}
}

View File

@@ -0,0 +1,135 @@
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.GetSumDto;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.domain.dto.ApplyCallback;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
import com.ruoyi.system.service.ICustomerApplyLogService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* 客户申请记录Controller
*
* @author ruoyi
* @date 2024-09-15
*/
@RestController
@RequestMapping("/log")
public class CustomerApplyLogController extends BaseController
{
@Autowired
private ICustomerApplyLogService customerApplyLogService;
/**
* 查询客户申请记录列表
*/
@RequiresPermissions("system:log:list")
@GetMapping("/list")
public TableDataInfo list(CustomerApplyLog customerApplyLog)
{
startPage();
List<CustomerApplyLog> list = customerApplyLogService.selectCustomerApplyLogList(customerApplyLog);
return getDataTable(list);
}
/**
* 获取商户今日已申请数
*
*
* @param getSumDto
* @param source 请求来源
* @return 结果
*/
@PostMapping("/sum")
public R<Integer> sum(@RequestBody GetSumDto getSumDto, @RequestHeader(SecurityConstants.FROM_SOURCE) String source){
return R.ok(customerApplyLogService.getApplySum(getSumDto.getMerchantId()));
}
/**
* 获取用户今日是否是否已申请
*
*
* @param customerID
* @param source 请求来源
* @return 结果
*/
@GetMapping("/customerApply")
public R<Boolean> customerApply(@RequestParam("customerID") Long customerID,@RequestHeader(SecurityConstants.FROM_SOURCE) String source){
return customerApplyLogService.getCustomerApply(customerID);
}
/**
* 导出客户申请记录列表
*/
@RequiresPermissions("system:log:export")
@Log(title = "客户申请记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CustomerApplyLog customerApplyLog)
{
List<CustomerApplyLog> list = customerApplyLogService.selectCustomerApplyLogList(customerApplyLog);
ExcelUtil<CustomerApplyLog> util = new ExcelUtil<CustomerApplyLog>(CustomerApplyLog.class);
util.exportExcel(response, list, "客户申请记录数据");
}
/**
* 获取客户申请记录详细信息
*/
@RequiresPermissions("system:log:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(customerApplyLogService.selectCustomerApplyLogById(id));
}
/**
* 新增客户申请记录
*/
@RequiresPermissions("system:log:add")
@Log(title = "客户申请记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CustomerApplyLog customerApplyLog)
{
return toAjax(customerApplyLogService.insertCustomerApplyLog(customerApplyLog));
}
/**
* 修改客户申请记录
*/
@RequiresPermissions("system:log:edit")
@Log(title = "客户申请记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CustomerApplyLog customerApplyLog)
{
return toAjax(customerApplyLogService.updateCustomerApplyLog(customerApplyLog));
}
/**
* 删除客户申请记录
*/
@RequiresPermissions("system:log:remove")
@Log(title = "客户申请记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(customerApplyLogService.deleteCustomerApplyLogByIds(ids));
}
/**
* 下游数据回调
*/
@PostMapping("/applyCallback")
public AjaxResult applyCallback(@RequestBody ApplyCallback applyCallback){
return customerApplyLogService.applyCallBack(applyCallback);
}
}

View File

@@ -0,0 +1,184 @@
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.service.IMerchantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.common.core.domain.http.Customer;
import com.ruoyi.system.service.ICustomerService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* 客户信息Controller
*
* @author ruoyi
* @date 2024-09-15
*/
@RestController
@RequestMapping("/customer")
public class CustomerController extends BaseController
{
@Autowired
private ICustomerService customerService;
@Autowired
private IMerchantService merchantService;
/**
* 查询客户信息列表
*/
@RequiresPermissions("system:customer:list")
@GetMapping("/list")
public TableDataInfo list(Customer customer)
{
startPage();
List<Customer> list = customerService.selectCustomerList(customer);
return getDataTable(list);
}
/**
* 导出客户信息列表
*/
@RequiresPermissions("system:customer:export")
@Log(title = "客户信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Customer customer)
{
List<Customer> list = customerService.selectCustomerList(customer);
ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
util.exportExcel(response, list, "客户信息数据");
}
/**
* 获取客户信息详细信息
*/
@RequiresPermissions("system:customer:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(customerService.selectCustomerById(id));
}
/**
* 通过手机号MD5查询用户信息
*
* @param phoneMD5 用户名
* @return 结果
*/
@GetMapping("/getByMd5")
public R<Customer> getCustomerInfoByPhoneMd5(@RequestParam("phoneMD5")String phoneMD5){
return customerService.selectByPhoneMd5(phoneMD5);
}
/**
* 通过手机号MD5更新用户信息
*
* @param customer 用户
* @return 结果
*/
@PostMapping("/updateByPhoneMd5")
public R updateByPhoneMd5(@RequestBody Customer customer ,@RequestHeader(SecurityConstants.FROM_SOURCE) String source){
return customerService.updateByPhoneMd5(customer);
}
/**
* 新增客户信息
* @return
*/
@PostMapping("/addNewCustomer")
public R add(@RequestBody Customer customer,@RequestHeader(SecurityConstants.FROM_SOURCE) String source){
boolean save = customerService.save(customer);
if (save){
return R.ok();
}
return R.fail();
}
/**
* 新增客户信息
*/
@RequiresPermissions("system:customer:add")
@Log(title = "客户信息", businessType = BusinessType.INSERT)
@RequestMapping(value = "/add", method = RequestMethod.POST)
public AjaxResult add(@RequestBody Customer customer)
{
return toAjax(customerService.insertCustomer(customer));
}
/**
* 修改客户信息
*/
@RequiresPermissions("system:customer:edit")
@Log(title = "客户信息", businessType = BusinessType.UPDATE)
@RequestMapping(value = "/edit", method = RequestMethod.POST)
public AjaxResult edit(@RequestBody Customer customer)
{
return toAjax(customerService.updateCustomer(customer));
}
/**
* 删除客户信息
*/
@RequiresPermissions("system:customer:remove")
@Log(title = "客户信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(customerService.deleteCustomerByIds(ids));
}
/**
* 获取用户token
* @param phone
* @return
*/
@GetMapping("/getCustomerToken")
public String getCustomerToken(@RequestParam("phone") String phone,@RequestParam("channelId")Long channelId) {
return customerService.getCustomerToken(phone);
}
/**
* H5用户登录
*/
@GetMapping("/customerLogin")
public AjaxResult customerLogin(@RequestParam("phone")String phone,@RequestParam("code")Integer code,HttpServletRequest request){
return customerService.customerLogin(phone,code,request);
}
/**
* H5保存用户留资信息
*/
@PostMapping("/saveCustomerInfo")
public AjaxResult saveCustomerInfo(@RequestBody Customer customer, HttpServletRequest request){
return customerService.saveCustomerInfo(customer,request);
}
/**
* 获取商户下渠道列表
* @return
*/
@RequestMapping(value = "/getAllMerchantList", method = RequestMethod.GET)
public AjaxResult getAllMerchantList()
{
return success(merchantService.findAllMerchantList());
}
@PostMapping("/v1/saveCustomerInfo")
public AjaxResult v1SaveCustomerInfo(@RequestBody Customer customer, HttpServletRequest request){
return customerService.v1SaveCustomerInfo(customer,request);
}
}

View File

@@ -0,0 +1,157 @@
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.domain.dto.ApplyCallback;
import com.ruoyi.system.service.IChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.common.core.domain.http.Merchant;
import com.ruoyi.system.service.IMerchantService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* 商户Controller
*
* @author ruoyi
* @date 2024-09-15
*/
@RestController
@RequestMapping("/merchant")
public class MerchantController extends BaseController
{
@Autowired
private IMerchantService merchantService;
@Autowired
private IChannelService channelService;
/**
* 查询商户列表
*/
@RequiresPermissions("system:merchant:list")
@GetMapping("/list")
public TableDataInfo list(Merchant merchant)
{
startPage();
List<Merchant> list = merchantService.selectMerchantList(merchant);
return getDataTable(list);
}
/**
* 获取合适的产品
*
* @return 结果
*/
@GetMapping("/merchantList")
public R<List<Merchant>> merchantList(){
return merchantService.getMerchantList();
}
/**
* 导出商户列表
*/
@RequiresPermissions("system:merchant:export")
@Log(title = "商户", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Merchant merchant)
{
List<Merchant> list = merchantService.selectMerchantList(merchant);
ExcelUtil<Merchant> util = new ExcelUtil<Merchant>(Merchant.class);
util.exportExcel(response, list, "商户数据");
}
/**
* 获取商户详细信息
*/
@RequiresPermissions("system:merchant:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(merchantService.selectMerchantById(id));
}
/**
* 获取商户下渠道列表
* @return
*/
@GetMapping("/getMerchantChannelList")
public AjaxResult getMerchantChannelList()
{
return success(channelService.findAllChannelList());
}
/**
* 新增商户
*/
@RequiresPermissions("system:merchant:add")
@Log(title = "商户", businessType = BusinessType.INSERT)
@RequestMapping(value = "/add", method = RequestMethod.POST)
public AjaxResult add(@RequestBody Merchant merchant)
{
return toAjax(merchantService.insertMerchant(merchant));
}
/**
* 修改商户
*/
@RequiresPermissions("system:merchant:edit")
@Log(title = "商户", businessType = BusinessType.UPDATE)
@RequestMapping(value = "/edit", method = RequestMethod.POST)
public AjaxResult edit(@RequestBody Merchant merchant)
{
return toAjax(merchantService.updateMerchant(merchant));
}
/**
* 删除商户
*/
@RequiresPermissions("system:merchant:remove")
@Log(title = "商户", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(merchantService.deleteMerchantByIds(ids));
}
/**
* 获取合适的产品
*/
@GetMapping("/getMatchMerchant")
public AjaxResult getMatchMerchantList(HttpServletRequest request){
return merchantService.getMatchMerchantList(request);
}
/**
* H5申请商户
*/
@GetMapping("/h5applyMerchant")
public AjaxResult H5applyMerchant(@RequestParam("merchantId") String merchantId,HttpServletRequest request){
return merchantService.H5applyMerchant(Long.valueOf(merchantId),request);
}
@GetMapping("/getMatchMerchantNew")
public AjaxResult getMatchMerchantNew(){
return merchantService.getMatchMerchantNew();
}
@GetMapping("/v1/getMatchMerchant")
public AjaxResult V1GetMatchMerchant(HttpServletRequest request){
return merchantService.V1GetMatchMerchant(request);
}
}

View File

@@ -0,0 +1,11 @@
package com.ruoyi.system.domain.dto;
import lombok.Data;
@Data
public class ApplyCallback {
private String sign;
private String Data;
}

View File

@@ -0,0 +1,23 @@
package com.ruoyi.system.domain.dto;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class ApplyCallbackDto {
//订单号
private String orderNo;
//md5
private String md5;
//订单价格
private BigDecimal price;
//订单状态
private Integer orderStatus;
}

View File

@@ -0,0 +1,19 @@
package com.ruoyi.system.domain.dto;
import lombok.Data;
@Data
public class MerchantListDto {
//商户名
private String merchantName;
//商户跳转地址
private String merchantUrl;
//商户描述
private String merchantDescribe;
//商户ID
private Long merchantId;
}

View File

@@ -0,0 +1,69 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.domain.http.Channel;
/**
* 渠道配置Mapper接口
*
* @author ruoyi
* @date 2024-09-15
*/
public interface ChannelMapper extends BaseMapper<Channel>
{
/**
* 查询渠道配置
*
* @param id 渠道配置主键
* @return 渠道配置
*/
public Channel selectChannelById(Long id);
/**
* 查询渠道配置列表
*
* @param channel 渠道配置
* @return 渠道配置集合
*/
public List<Channel> selectChannelList(Channel channel);
/**
* 新增渠道配置
*
* @param channel 渠道配置
* @return 结果
*/
public int insertChannel(Channel channel);
/**
* 修改渠道配置
*
* @param channel 渠道配置
* @return 结果
*/
public int updateChannel(Channel channel);
/**
* 删除渠道配置
*
* @param id 渠道配置主键
* @return 结果
*/
public int deleteChannelById(Long id);
/**
* 批量删除渠道配置
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteChannelByIds(Long[] ids);
/**
* 查询渠道配置列表
* @return 渠道配置集合
*/
public List<Channel> findAllChannelList();
}

View File

@@ -0,0 +1,63 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
/**
* 客户申请记录Mapper接口
*
* @author ruoyi
* @date 2024-09-15
*/
public interface CustomerApplyLogMapper extends BaseMapper<CustomerApplyLog>
{
/**
* 查询客户申请记录
*
* @param id 客户申请记录主键
* @return 客户申请记录
*/
public CustomerApplyLog selectCustomerApplyLogById(Long id);
/**
* 查询客户申请记录列表
*
* @param customerApplyLog 客户申请记录
* @return 客户申请记录集合
*/
public List<CustomerApplyLog> selectCustomerApplyLogList(CustomerApplyLog customerApplyLog);
/**
* 新增客户申请记录
*
* @param customerApplyLog 客户申请记录
* @return 结果
*/
public int insertCustomerApplyLog(CustomerApplyLog customerApplyLog);
/**
* 修改客户申请记录
*
* @param customerApplyLog 客户申请记录
* @return 结果
*/
public int updateCustomerApplyLog(CustomerApplyLog customerApplyLog);
/**
* 删除客户申请记录
*
* @param id 客户申请记录主键
* @return 结果
*/
public int deleteCustomerApplyLogById(Long id);
/**
* 批量删除客户申请记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteCustomerApplyLogByIds(Long[] ids);
}

View File

@@ -0,0 +1,63 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.domain.http.Customer;
/**
* 客户信息Mapper接口
*
* @author ruoyi
* @date 2024-09-15
*/
public interface CustomerMapper extends BaseMapper<Customer>
{
/**
* 查询客户信息
*
* @param id 客户信息主键
* @return 客户信息
*/
public Customer selectCustomerById(Long id);
/**
* 查询客户信息列表
*
* @param customer 客户信息
* @return 客户信息集合
*/
public List<Customer> selectCustomerList(Customer customer);
/**
* 新增客户信息
*
* @param customer 客户信息
* @return 结果
*/
public int insertCustomer(Customer customer);
/**
* 修改客户信息
*
* @param customer 客户信息
* @return 结果
*/
public int updateCustomer(Customer customer);
/**
* 删除客户信息
*
* @param id 客户信息主键
* @return 结果
*/
public int deleteCustomerById(Long id);
/**
* 批量删除客户信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteCustomerByIds(Long[] ids);
}

View File

@@ -0,0 +1,71 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.domain.http.Customer;
import com.ruoyi.common.core.domain.http.Merchant;
/**
* 商户Mapper接口
*
* @author ruoyi
* @date 2024-09-15
*/
public interface MerchantMapper extends BaseMapper<Merchant>
{
/**
* 查询商户
*
* @param id 商户主键
* @return 商户
*/
public Merchant selectMerchantById(Long id);
/**
* 查询商户列表
*
* @param merchant 商户
* @return 商户集合
*/
public List<Merchant> selectMerchantList(Merchant merchant);
/**
* 新增商户
*
* @param merchant 商户
* @return 结果
*/
public int insertMerchant(Merchant merchant);
/**
* 修改商户
*
* @param merchant 商户
* @return 结果
*/
public int updateMerchant(Merchant merchant);
/**
* 删除商户
*
* @param id 商户主键
* @return 结果
*/
public int deleteMerchantById(Long id);
/**
* 批量删除商户
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMerchantByIds(Long[] ids);
/**
* 获取商户列表
* @return
*/
public List<Merchant> findAllMerchantList();
}

View File

@@ -0,0 +1,12 @@
package com.ruoyi.system.process;
import com.ruoyi.common.core.web.domain.AjaxResult;
/**
*根据流程类型 执行不同的处理器
*/
public interface ProcessHandler {
AjaxResult invoke();
}

View File

@@ -0,0 +1,36 @@
package com.ruoyi.system.process.enums;
import com.ruoyi.common.core.exception.ServiceException;
public enum ProcessHandlerEnum {
H5_HANDLER("H5_HANDLER", "H5Handler"),
HALF_HANDLER("HALF_HANDLER", "HalfHandler");
final String code;
final String name;
public String getCode() {
return code;
}
public String getName() {
return name;
}
ProcessHandlerEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static String getNameByCode(String code) {
ProcessHandlerEnum[] processHandlerEnums = values();
for (ProcessHandlerEnum processHandlerEnum : processHandlerEnums) {
if (processHandlerEnum.getCode().equals(code)) {
return processHandlerEnum.getName();
}
}
String msg = String.format("请检查对应的流程处理器是否实现,编码为:%s", code);
throw new ServiceException(msg, 500);
}
}

View File

@@ -0,0 +1,14 @@
package com.ruoyi.system.process.handler;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.process.ProcessHandler;
import org.springframework.stereotype.Component;
@Component(value = "H5Handler")
public class H5Handler implements ProcessHandler {
@Override
public AjaxResult invoke() {
return null;
}
}

View File

@@ -0,0 +1,13 @@
package com.ruoyi.system.process.handler;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.process.ProcessHandler;
import org.springframework.stereotype.Component;
@Component(value = "HalfHandler")
public class HalfHandler implements ProcessHandler {
@Override
public AjaxResult invoke() {
return null;
}
}

View File

@@ -0,0 +1 @@
package com.ruoyi.system.process;

View File

@@ -0,0 +1,75 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.domain.http.Channel;
import com.ruoyi.common.core.web.domain.AjaxResult;
/**
* 渠道配置Service接口
*
* @author ruoyi
* @date 2024-09-15
*/
public interface IChannelService
{
/**
* 查询渠道配置
*
* @param id 渠道配置主键
* @return 渠道配置
*/
public Channel selectChannelById(Long id);
/**
* 查询渠道配置列表
*
* @param channel 渠道配置
* @return 渠道配置集合
*/
public List<Channel> selectChannelList(Channel channel);
/**
* 新增渠道配置
*
* @param channel 渠道配置
* @return 结果
*/
public long insertChannel(Channel channel);
/**
* 修改渠道配置
*
* @param channel 渠道配置
* @return 结果
*/
public int updateChannel(Channel channel);
/**
* 批量删除渠道配置
*
* @param ids 需要删除的渠道配置主键集合
* @return 结果
*/
public int deleteChannelByIds(Long[] ids);
/**
* 删除渠道配置信息
*
* @param id 渠道配置主键
* @return 结果
*/
public int deleteChannelById(Long id);
/**
* 获取所有的渠道列表
* @return
*/
public List<Channel> findAllChannelList();
/**
* 根据渠道标识获取渠道
* @param sign
* @return
*/
AjaxResult getChannelBySign(String sign);
}

View File

@@ -0,0 +1,24 @@
package com.ruoyi.system.service;
import com.ruoyi.common.core.domain.http.Channel;
import com.ruoyi.common.core.web.domain.AjaxResult;
import java.util.List;
/**
* 渠道配置Service接口
*
* @author ruoyi
* @date 2024-09-15
*/
public interface ICommonService
{
/**
* H5发送验证码
* @param phone
* @return
*/
AjaxResult sendSms(String phone,String smsSource);
}

View File

@@ -0,0 +1,87 @@
package com.ruoyi.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.domain.dto.ApplyCallback;
/**
* 客户申请记录Service接口
*
* @author ruoyi
* @date 2024-09-15
*/
public interface ICustomerApplyLogService extends IService<CustomerApplyLog>
{
/**
* 查询客户申请记录
*
* @param id 客户申请记录主键
* @return 客户申请记录
*/
public CustomerApplyLog selectCustomerApplyLogById(Long id);
/**
* 查询客户申请记录列表
*
* @param customerApplyLog 客户申请记录
* @return 客户申请记录集合
*/
public List<CustomerApplyLog> selectCustomerApplyLogList(CustomerApplyLog customerApplyLog);
/**
* 新增客户申请记录
*
* @param customerApplyLog 客户申请记录
* @return 结果
*/
public int insertCustomerApplyLog(CustomerApplyLog customerApplyLog);
/**
* 修改客户申请记录
*
* @param customerApplyLog 客户申请记录
* @return 结果
*/
public int updateCustomerApplyLog(CustomerApplyLog customerApplyLog);
/**
* 批量删除客户申请记录
*
* @param ids 需要删除的客户申请记录主键集合
* @return 结果
*/
public int deleteCustomerApplyLogByIds(Long[] ids);
/**
* 删除客户申请记录信息
*
* @param id 客户申请记录主键
* @return 结果
*/
public int deleteCustomerApplyLogById(Long id);
/**
* 获取当日商户已申请数
* @param merchantId
* @return
*/
Integer getApplySum(Long merchantId);
/**
* 获取用户今日是否是否已申请
* @param customerID
* @return
*/
R<Boolean> getCustomerApply(Long customerID);
/**
* 申请回调
* @param applyCallback
* @return
*/
AjaxResult applyCallBack(ApplyCallback applyCallback);
}

View File

@@ -0,0 +1,114 @@
package com.ruoyi.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.http.Customer;
import com.ruoyi.common.core.web.domain.AjaxResult;
import javax.servlet.http.HttpServletRequest;
/**
* 客户信息Service接口
*
* @author ruoyi
* @date 2024-09-15
*/
public interface ICustomerService extends IService<Customer>
{
/**
* 查询客户信息
*
* @param id 客户信息主键
* @return 客户信息
*/
public Customer selectCustomerById(Long id);
/**
* 查询客户信息列表
*
* @param customer 客户信息
* @return 客户信息集合
*/
public List<Customer> selectCustomerList(Customer customer);
/**
* 新增客户信息
*
* @param customer 客户信息
* @return 结果
*/
public int insertCustomer(Customer customer);
/**
* 修改客户信息
*
* @param customer 客户信息
* @return 结果
*/
public int updateCustomer(Customer customer);
/**
* 批量删除客户信息
*
* @param ids 需要删除的客户信息主键集合
* @return 结果
*/
public int deleteCustomerByIds(Long[] ids);
/**
* 删除客户信息信息
*
* @param id 客户信息主键
* @return 结果
*/
public int deleteCustomerById(Long id);
/**
* 根据手机好MD5查询用户
* @param phoneMD5
* @return
*/
R<Customer> selectByPhoneMd5(String phoneMD5);
/**
* 通过手机号更新用户信息
* @param customer
* @return
*/
R updateByPhoneMd5(Customer customer);
/**
* 获取用户tooken
* @param phone
* @return
*/
String getCustomerToken(String phone);
/**
* 注册并返回token
* @param phone
* @return
*/
public String registAndretrunToken(String phone,Long channelId);
/**
* h5用户登录
* @param phone
* @param code
* @param request
* @return
*/
AjaxResult customerLogin(String phone, Integer code,HttpServletRequest request);
/**
* 保存用户留资信息
* @param customer
* @param request
* @return
*/
AjaxResult saveCustomerInfo(Customer customer, HttpServletRequest request);
AjaxResult v1SaveCustomerInfo(Customer customer, HttpServletRequest request);
}

View File

@@ -0,0 +1,98 @@
package com.ruoyi.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.http.Customer;
import com.ruoyi.common.core.domain.http.Merchant;
import com.ruoyi.common.core.web.domain.AjaxResult;
import javax.servlet.http.HttpServletRequest;
/**
* 商户Service接口
*
* @author ruoyi
* @date 2024-09-15
*/
public interface IMerchantService extends IService<Merchant>
{
/**
* 查询商户
*
* @param id 商户主键
* @return 商户
*/
public Merchant selectMerchantById(Long id);
/**
* 查询商户列表
*
* @param merchant 商户
* @return 商户集合
*/
public List<Merchant> selectMerchantList(Merchant merchant);
/**
* 新增商户
*
* @param merchant 商户
* @return 结果
*/
public int insertMerchant(Merchant merchant);
/**
* 修改商户
*
* @param merchant 商户
* @return 结果
*/
public int updateMerchant(Merchant merchant);
/**
* 批量删除商户
*
* @param ids 需要删除的商户主键集合
* @return 结果
*/
public int deleteMerchantByIds(Long[] ids);
/**
* 删除商户信息
*
* @param id 商户主键
* @return 结果
*/
public int deleteMerchantById(Long id);
/**
* 获取基本合适的商户
* @return
*/
R<List<Merchant>> getMerchantList();
/**
* H5获取合适产品
* @param request
* @return
*/
AjaxResult getMatchMerchantList(HttpServletRequest request);
/**
* 获取所有的商户列表
* @return
*/
public List<Merchant> findAllMerchantList();
/**
* H5申请订单
* @param merchantId
* @param request
* @return
*/
AjaxResult H5applyMerchant(Long merchantId, HttpServletRequest request);
AjaxResult getMatchMerchantNew();
AjaxResult V1GetMatchMerchant(HttpServletRequest request);
}

View File

@@ -0,0 +1,164 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.system.mapper.ChannelMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.domain.http.Channel;
import com.ruoyi.system.service.IChannelService;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
/**
* 渠道配置Service业务层处理
*
* @author ruoyi
* @date 2024-09-15
*/
@Service
@Slf4j
public class ChannelServiceImpl implements IChannelService
{
@Autowired
private ChannelMapper channelMapper;
@Autowired
private RedisService redisService;
@PostConstruct
public void init(){
log.info("初始化渠道数据开始");
List<Channel> channels = channelMapper.selectList(new LambdaQueryWrapper<Channel>());
for (Channel channel:channels) {
redisService.deleteObject(CacheConstants.CHANNEL_ID+channel.getId());
redisService.setCacheObject(CacheConstants.CHANNEL_ID+channel.getId(),channel);
redisService.deleteObject(CacheConstants.CHANNEL_SIGN+channel.getChannelSign());
redisService.setCacheObject(CacheConstants.CHANNEL_SIGN+channel.getChannelSign(),channel);
}
}
/**
* 查询渠道配置
*
* @param id 渠道配置主键
* @return 渠道配置
*/
@Override
public Channel selectChannelById(Long id)
{
return channelMapper.selectChannelById(id);
}
/**
* 查询渠道配置列表
*
* @param channel 渠道配置
* @return 渠道配置
*/
@Override
public List<Channel> selectChannelList(Channel channel)
{
return channelMapper.selectChannelList(channel);
}
/**
* 新增渠道配置
*
* @param channel 渠道配置
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public long insertChannel(Channel channel)
{
if (StringUtils.isEmpty(channel.getChannelSign())) {
channel.setChannelSign(RandomStringUtils.random(16, true, false));
}
channel.setCreateTime(DateUtils.getNowDate());
channel.setUpdateTime(DateUtils.getNowDate());
long i = channelMapper.insertChannel(channel);
//新增插入缓存
Channel channelById = channelMapper.selectChannelById(i);
redisService.setCacheObject(CacheConstants.CHANNEL_ID+i,channelById);
redisService.setCacheObject(CacheConstants.CHANNEL_SIGN+channel.getChannelSign(),channelById);
return i;
}
/**
* 修改渠道配置
*
* @param channel 渠道配置
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int updateChannel(Channel channel)
{
channel.setUpdateTime(DateUtils.getNowDate());
int i = channelMapper.updateChannel(channel);
Channel channelById = channelMapper.selectChannelById(channel.getId());
redisService.deleteObject(CacheConstants.CHANNEL_ID+channel.getId());
redisService.deleteObject(CacheConstants.CHANNEL_SIGN+channel.getChannelSign());
redisService.setCacheObject(CacheConstants.CHANNEL_ID+channel.getId(),channelById);
redisService.setCacheObject(CacheConstants.CHANNEL_SIGN+channel.getChannelSign(),channelById);
return i;
}
/**
* 批量删除渠道配置
*
* @param ids 需要删除的渠道配置主键
* @return 结果
*/
@Override
public int deleteChannelByIds(Long[] ids)
{
return channelMapper.deleteChannelByIds(ids);
}
/**
* 删除渠道配置信息
*
* @param id 渠道配置主键
* @return 结果
*/
@Override
public int deleteChannelById(Long id)
{
return channelMapper.deleteChannelById(id);
}
/**
* 获取所有的渠道列表
* @return
*/
//@Cacheable(value = "channel",key = "'channel:all'")
public List<Channel> findAllChannelList(){
return channelMapper.findAllChannelList();
}
/**
* 根据渠道标识获取渠道
* @param sign
* @return
*/
@Override
public AjaxResult getChannelBySign(String sign) {
Channel channel = channelMapper.selectOne(new LambdaQueryWrapper<Channel>().eq(Channel::getChannelSign, sign));
if (channel==null||channel.getChannelSign()==null){
return AjaxResult.error("渠道异常");
}
return AjaxResult.success("获取成功",channel.getChannelType());
}
}

View File

@@ -0,0 +1,102 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.common.core.constant.RedisConstant;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.common.sms.component.SmsComponent;
import com.ruoyi.system.service.ICommonService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import java.security.SecureRandom;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* 渠道配置Service业务层处理
*
* @author ruoyi
* @date 2024-09-15
*/
@Service
public class CommonServiceImpl implements ICommonService {
@Autowired
private RedisService redisService;
@Autowired
private SmsComponent smsComponent;
@Autowired
private Environment environment;
@Override
public AjaxResult sendSms(String phone, String smsSource) {
if (StringUtils.isEmpty(phone)) {
return AjaxResult.error("手机号未空");
}
if (phone.length() != 11) {
return AjaxResult.error("手机号长度异常");
}
//正式环境发送验证码 pc4位 h5注册页6位
String code;
// 判断是否为正式环境
if (isProductionProfileActive()) {
//正式环境操作
code = smsSource.equalsIgnoreCase("h5") ? generateCode(6) : generateCode(4);
// 发送短信
Map<String, String> params = new HashMap<>();
params.put(phone, code);
smsComponent.sendP2PMsg(params);
} else {
// 非正式环境直接设置固定验证码
code = smsSource.equalsIgnoreCase("h5") ? "123456" : "1234";
}
//放入缓存 3分钟
redisService.setCacheObject(RedisConstant.H5_LOGIN_CACHE + phone, code, 3 * 60L, TimeUnit.SECONDS);
return AjaxResult.success("发送成功");
}
/**
* 判断当前活跃环境是否是 正式环境
* if (isProductionProfileActive()) {
* // 进行与生产环境相关的逻辑处理
* } else {
* // 进行非生产环境的处理
* }
*
* @return
*/
public boolean isProductionProfileActive() {
// 获取当前应用的活跃环境
String[] activeProfiles = environment.getActiveProfiles();
// 定义线上环境列表
List<String> proList = new ArrayList<>(Arrays.asList("prod", "pro"));
// 检查活跃环境是否包含在 proList 中
for (String profile : activeProfiles) {
if (proList.contains(profile)) {
return true; // 如果有活跃环境在 proList 中,返回 true
}
}
return false; // 如果没有匹配的环境,返回 false
}
/**
* 定义生成验证码的方法
*
* @param length 验证码长度
* @return
*/
private String generateCode(int length) {
SecureRandom secureRandom = new SecureRandom();
int bound = (int) Math.pow(10, length);
int min = bound / 10;
return String.valueOf(secureRandom.nextInt(bound - min) + min);
}
}

View File

@@ -0,0 +1,179 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.LocalDateTimeUtils;
import com.ruoyi.common.core.utils.SecureUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.domain.dto.ApplyCallback;
import com.ruoyi.system.domain.dto.ApplyCallbackDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.CustomerApplyLogMapper;
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
import com.ruoyi.system.service.ICustomerApplyLogService;
import org.springframework.util.StringUtils;
/**
* 客户申请记录Service业务层处理
*
* @author ruoyi
* @date 2024-09-15
*/
@Service
@Slf4j
public class CustomerApplyLogServiceImpl extends ServiceImpl<CustomerApplyLogMapper, CustomerApplyLog> implements IService<CustomerApplyLog>,ICustomerApplyLogService
{
@Autowired
private CustomerApplyLogMapper customerApplyLogMapper;
/**
* 查询客户申请记录
*
* @param id 客户申请记录主键
* @return 客户申请记录
*/
@Override
public CustomerApplyLog selectCustomerApplyLogById(Long id)
{
return customerApplyLogMapper.selectCustomerApplyLogById(id);
}
/**
* 查询客户申请记录列表
*
* @param customerApplyLog 客户申请记录
* @return 客户申请记录
*/
@Override
public List<CustomerApplyLog> selectCustomerApplyLogList(CustomerApplyLog customerApplyLog)
{
return customerApplyLogMapper.selectCustomerApplyLogList(customerApplyLog);
}
/**
* 新增客户申请记录
*
* @param customerApplyLog 客户申请记录
* @return 结果
*/
@Override
public int insertCustomerApplyLog(CustomerApplyLog customerApplyLog)
{
customerApplyLog.setCreateTime(DateUtils.getNowDate());
return customerApplyLogMapper.insertCustomerApplyLog(customerApplyLog);
}
/**
* 修改客户申请记录
*
* @param customerApplyLog 客户申请记录
* @return 结果
*/
@Override
public int updateCustomerApplyLog(CustomerApplyLog customerApplyLog)
{
customerApplyLog.setUpdateTime(DateUtils.getNowDate());
return customerApplyLogMapper.updateCustomerApplyLog(customerApplyLog);
}
/**
* 批量删除客户申请记录
*
* @param ids 需要删除的客户申请记录主键
* @return 结果
*/
@Override
public int deleteCustomerApplyLogByIds(Long[] ids)
{
return customerApplyLogMapper.deleteCustomerApplyLogByIds(ids);
}
/**
* 删除客户申请记录信息
*
* @param id 客户申请记录主键
* @return 结果
*/
@Override
public int deleteCustomerApplyLogById(Long id)
{
return customerApplyLogMapper.deleteCustomerApplyLogById(id);
}
/**
* 获取当日商户已申请数
* @param merchantId
* @return
*/
@Override
public Integer getApplySum(Long merchantId) {
Long aLong = customerApplyLogMapper.selectCount(
new LambdaQueryWrapper<CustomerApplyLog>()
.eq(CustomerApplyLog::getMerchantId, merchantId)
.eq(CustomerApplyLog::getOrderStatus, 0)
.ge(CustomerApplyLog::getCreateTime, LocalDateTimeUtils.getDateFromLocalDateTime(LocalDateTimeUtils.getTodayStartTime()))
.le(CustomerApplyLog::getCreateTime, LocalDateTimeUtils.getDateFromLocalDateTime(LocalDateTimeUtils.getTodayEndTime())));
return aLong.intValue();
}
/**
* 获取用户今日是否已申请
* @param customerID
* @return
*/
@Override
public R<Boolean> getCustomerApply(Long customerID) {
Long aLong = customerApplyLogMapper.selectCount(
new LambdaQueryWrapper<CustomerApplyLog>()
.isNotNull(CustomerApplyLog::getMerchantId)
.eq(CustomerApplyLog::getOrderStatus, 20)
.ge(CustomerApplyLog::getCreateTime, LocalDateTimeUtils.getDateFromLocalDateTime(LocalDateTimeUtils.getTodayStartTime()))
.le(CustomerApplyLog::getCreateTime, LocalDateTimeUtils.getDateFromLocalDateTime(LocalDateTimeUtils.getTodayEndTime())));
return R.ok(aLong>0);
}
/**
* 申请回调
*/
@Override
public AjaxResult applyCallBack(ApplyCallback applyCallback) {
String s = SecureUtils.AesUtil.AesDecode(applyCallback.getData(), applyCallback.getSign());
if (StringUtils.isEmpty(s)){
return AjaxResult.error("解密异常");
}
ApplyCallbackDto applyCallbackDto;
try {
applyCallbackDto = JSONObject.parseObject(s, ApplyCallbackDto.class);
log.info("渠道:{},回调数据:{}",applyCallback.getSign(),applyCallbackDto);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("数据转换异常");
}
try {
CustomerApplyLog customerApplyLog = customerApplyLogMapper.selectOne(new LambdaQueryWrapper<CustomerApplyLog>().eq(CustomerApplyLog::getOrderNo, applyCallbackDto.getOrderNo()));
if (applyCallbackDto.getOrderStatus()!=null) {
customerApplyLog.setOrderStatus(applyCallbackDto.getOrderStatus().longValue());
}
if (applyCallbackDto.getPrice()!=null){
if (customerApplyLog.getPrice()==null){
customerApplyLog.setPrice(applyCallbackDto.getPrice());
}else {
customerApplyLog.setPrice(customerApplyLog.getPrice().add(applyCallbackDto.getPrice()));
}
}
customerApplyLogMapper.updateById(customerApplyLog);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("数据异常");
}
return AjaxResult.success("回调成功");
}
}

View File

@@ -0,0 +1,282 @@
package com.ruoyi.system.service.impl;
import java.util.*;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.crypto.digest.MD5;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.core.constant.RedisConstant;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.http.Channel;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.EncryptUtil;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.redis.service.CustomerTokenService;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.system.config.SystemConfig;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.CustomerMapper;
import com.ruoyi.common.core.domain.http.Customer;
import com.ruoyi.system.service.ICustomerService;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
/**
* 客户信息Service业务层处理
*
* @author ruoyi
* @date 2024-09-15
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements IService<Customer>,ICustomerService {
private final CustomerMapper customerMapper;
private final SystemConfig systemConfig;
private final CustomerTokenService customerTokenService;
private final RedisService redisService;
private final TokenService tokenService;
/**
* 查询客户信息
*
* @param id 客户信息主键
* @return 客户信息
*/
@Override
public Customer selectCustomerById(Long id)
{
return customerMapper.selectCustomerById(id);
}
/**
* 查询客户信息列表
*
* @param customer 客户信息
* @return 客户信息
*/
@Override
public List<Customer> selectCustomerList(Customer customer)
{
return customerMapper.selectCustomerList(customer);
}
/**
* 新增客户信息
*
* @param customer 客户信息
* @return 结果
*/
@Override
public int insertCustomer(Customer customer)
{
customer.setCreateTime(DateUtils.getNowDate());
return customerMapper.insertCustomer(customer);
}
/**
* 修改客户信息
*
* @param customer 客户信息
* @return 结果
*/
@Override
public int updateCustomer(Customer customer)
{
customer.setUpdateTime(DateUtils.getNowDate());
return customerMapper.updateCustomer(customer);
}
/**
* 批量删除客户信息
*
* @param ids 需要删除的客户信息主键
* @return 结果
*/
@Override
public int deleteCustomerByIds(Long[] ids)
{
return customerMapper.deleteCustomerByIds(ids);
}
/**
* 删除客户信息信息
*
* @param id 客户信息主键
* @return 结果
*/
@Override
public int deleteCustomerById(Long id)
{
return customerMapper.deleteCustomerById(id);
}
/**
* 通过手机号MD5查询
* @param phoneMD5
* @return
*/
@Override
public R<Customer> selectByPhoneMd5(String phoneMD5) {
Customer one = getOne(new LambdaQueryWrapper<Customer>().eq(Customer::getPhoneMd5, phoneMD5));
if (one==null||one.getId()==null){
return R.fail();
}
return R.ok(one);
}
/**
* 通过手机号更新用户信息
* @param customer
* @return
*/
@Override
public R updateByPhoneMd5(Customer customer) {
int update = customerMapper.update(customer, new UpdateWrapper<Customer>().lambda().eq(Customer::getPhoneMd5, customer.getPhoneMd5()));
if (update>0){
return R.ok();
}
return R.fail();
}
@Override
public String getCustomerToken(String phone) {
log.info("获取用户token,手机号:{}", phone);
Customer customer = this.getOne(new LambdaQueryWrapper<Customer>().eq(Customer::getPhone, phone));
log.info("获取用户token,用户信息:{}", customer);
//获取到用户登陆的token
String token = customerTokenService.getToken(customer.getId());
if (StringUtils.isEmpty(token)) {
//生成一个长60的token
//token = customerTokenService.generateToken(customer.getId(), customer.getPhone(), "ANDROID", customer.getChannelId());
token = tokenService.createTokenApp(customer.getId(),customer.getChannelId());
}
return token;
}
/**
* 注册并返回token
* @param phone
* @return
*/
public String registAndretrunToken(String phone,Long channelId){
Customer customer = new Customer();
customer.setChannelId(channelId);
customer.setPhone(EncryptUtil.AESencode(phone, systemConfig.getAESkey()));
customer.setPhoneMd5(MD5.create().digestHex(phone).toLowerCase(Locale.ROOT));
customer.setIsAuth(false);
customer.setFirstLoginTime(new Date());
customer.setLastLoginTime(new Date());
customer.setStatus(1);
customer.setCreateTime(new Date());
customerMapper.insert(customer);
String token = customerTokenService.getToken(customer.getId());
if (StringUtils.isEmpty(token)) {
//生成一个长60的token
//token = customerTokenService.generateToken(customer.getId(), customer.getPhone(), "ANDROID", customer.getChannelId());
token = tokenService.createTokenApp(customer.getId(),channelId);
}
return token;
}
/**
* H5用户登陆
* @param phone
* @param code
* @param request
* @return
*/
@Override
public AjaxResult customerLogin(String phone, Integer code, HttpServletRequest request) {
String sign = request.getHeader("sign");
if (StringUtils.isEmpty(sign)){
return AjaxResult.error("渠道标识不存在");
}
Channel channel = redisService.getCacheObject(CacheConstants.CHANNEL_SIGN+sign);
Boolean aBoolean = redisService.hasKey(RedisConstant.H5_LOGIN_CACHE + phone);
if (!aBoolean){
return AjaxResult.error("验证码不存在");
}
int cacheCode = redisService.getCacheObject(RedisConstant.H5_LOGIN_CACHE + phone);
if (cacheCode!=code){
return AjaxResult.success("验证码错误");
}
String customerToken = registAndretrunToken(phone,channel.getId());
return AjaxResult.success("登录成功",customerToken);
}
/**
* 保存用户留资信息
* @param customer
* @param request
* @return
*/
@Override
public AjaxResult saveCustomerInfo(Customer customer, HttpServletRequest request) {
String authorization = request.getHeader("Authorization");
Long customerId = customerTokenService.getCustomerId(authorization, false);
String sign = request.getHeader("sign");
if (StringUtils.isEmpty(sign)){
return AjaxResult.error("渠道标识不存在");
}
Channel channel = redisService.getCacheObject(CacheConstants.CHANNEL_SIGN+sign);
if (customerId==null){
return AjaxResult.error("用户不存在或未登录");
}
if (StringUtils.isEmpty(customer.getIdCard())){
return AjaxResult.error("身份证好不能为空");
}
boolean validCard = IdcardUtil.isValidCard(customer.getIdCard());
if (validCard){
return AjaxResult.error("身份证号码异常");
}
if (StringUtils.isEmpty(customer.getActurlName())){
return AjaxResult.error("姓名不能为空");
}
int ageByIdCard = IdcardUtil.getAgeByIdCard(customer.getIdCard());
customer.setAge(ageByIdCard);
int genderByIdCard = IdcardUtil.getGenderByIdCard(customer.getIdCard());
customer.setSex(genderByIdCard==0?1:0);
customer.setId(customerId);
customer.setChannelId(channel.getId());
customer.setIsAuth(true);
customer.setStatus(1);
updateById(customer);
return AjaxResult.success("保存成功");
}
@Override
public AjaxResult v1SaveCustomerInfo(Customer customer, HttpServletRequest request) {
String authorization = request.getHeader("Authorization");
Long customerId = customerTokenService.getCustomerId(authorization, false);
String sign = request.getHeader("sign");
if (StringUtils.isEmpty(sign)) {
return AjaxResult.error("渠道标识不存在");
}
Channel channel = redisService.getCacheObject(CacheConstants.CHANNEL_SIGN + sign);
if (customerId == null) {
return AjaxResult.error("用户不存在或未登录");
}
if (StringUtils.isEmpty(customer.getActurlName())) {
return AjaxResult.error("姓名不能为空");
}
customer.setId(customerId);
customer.setChannelId(channel.getId());
customer.setIsAuth(true);
customer.setStatus(1);
updateById(customer);
return AjaxResult.success("保存成功");
}
}

View File

@@ -0,0 +1,288 @@
package com.ruoyi.system.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.constant.RedisConstant;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.http.Customer;
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
import com.ruoyi.common.core.domain.http.Merchant;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.redis.service.CustomerTokenService;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.system.domain.dto.MerchantListDto;
import com.ruoyi.system.mapper.CustomerMapper;
import com.ruoyi.system.mapper.MerchantMapper;
import com.ruoyi.system.service.ICustomerApplyLogService;
import com.ruoyi.system.service.IMerchantService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* 商户Service业务层处理
*
* @author ruoyi
* @date 2024-09-15
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements IService<Merchant>,IMerchantService
{
private final MerchantMapper merchantMapper;
private final CustomerTokenService customerTokenService;
private final ICustomerApplyLogService customerApplyLogService;
private final CustomerMapper customerMapper;
private final RedisService redisService;
/**
* 查询商户
*
* @param id 商户主键
* @return 商户
*/
@Override
public Merchant selectMerchantById(Long id)
{
return merchantMapper.selectMerchantById(id);
}
/**
* 查询商户列表
*
* @param merchant 商户
* @return 商户
*/
@Override
public List<Merchant> selectMerchantList(Merchant merchant)
{
return merchantMapper.selectMerchantList(merchant);
}
/**
* 新增商户
*
* @param merchant 商户
* @return 结果
*/
@Override
public int insertMerchant(Merchant merchant)
{
merchant.setCreateTime(DateUtils.getNowDate());
return merchantMapper.insertMerchant(merchant);
}
/**
* 修改商户
*
* @param merchant 商户
* @return 结果
*/
@Override
public int updateMerchant(Merchant merchant)
{
merchant.setUpdateTime(DateUtils.getNowDate());
return merchantMapper.updateMerchant(merchant);
}
/**
* 批量删除商户
*
* @param ids 需要删除的商户主键
* @return 结果
*/
@Override
public int deleteMerchantByIds(Long[] ids)
{
return merchantMapper.deleteMerchantByIds(ids);
}
/**
* 删除商户信息
*
* @param id 商户主键
* @return 结果
*/
@Override
public int deleteMerchantById(Long id)
{
return merchantMapper.deleteMerchantById(id);
}
/**
* 获取基本合适的商户
* @return
*/
@Override
public R<List<Merchant>> getMerchantList() {
List<Merchant> merchants = merchantMapper.selectList(new LambdaQueryWrapper<Merchant>().eq(Merchant::getStatus, true));
if (CollectionUtil.isEmpty(merchants)){
return R.fail();
}
return R.ok(merchants);
}
public List<Merchant> findAllMerchantList(){
return merchantMapper.findAllMerchantList();
}
@Override
public AjaxResult getMatchMerchantList(HttpServletRequest request) {
String authorization = request.getHeader("Authorization");
Long customerId = customerTokenService.getCustomerId(authorization, false);
if (customerId==null){
return AjaxResult.error("用户不存在或未登录");
}
log.info("H5打开页面{}",customerId);
Customer customer = customerMapper.selectById(customerId);
List<Merchant> merchants = matchMerchant(customer);
List<MerchantListDto> merchantListDtos = new ArrayList<>();
for (Merchant merchant:merchants) {
MerchantListDto merchantListDto = new MerchantListDto();
merchantListDto.setMerchantName(merchant.getMerchantName());
merchantListDto.setMerchantDescribe(merchant.getMerchantDescribe());
merchantListDto.setMerchantUrl(merchant.getHitUrl());
merchantListDto.setMerchantId(merchant.getId());
merchantListDtos.add(merchantListDto);
}
return AjaxResult.success(merchantListDtos);
}
@Override
public AjaxResult H5applyMerchant(Long merchantId, HttpServletRequest request) {
//获取用户
String authorization = request.getHeader("Authorization");
Long customerId = customerTokenService.getCustomerId(authorization, false);
Boolean aBoolean = redisService.hasKey(RedisConstant.H5_APPLY_CHECK + customerId);
if (aBoolean){
return AjaxResult.error("请勿重复点击");
}
log.info("H5申请用户{}",customerId);
Customer customer = customerMapper.selectById(customerId);
Merchant merchant = merchantMapper.selectById(merchantId);
redisService.setCacheObject(RedisConstant.H5_APPLY_CHECK+customerId,1,10l, TimeUnit.SECONDS);
//生成订单号
String orderNo = System.currentTimeMillis()+""+merchantId+""+customerId;
//记录申请订单
CustomerApplyLog customerApplyLog = new CustomerApplyLog();
customerApplyLog.setCustomerId(customerId);
customerApplyLog.setMerchantId(merchantId);
customerApplyLog.setChannelId(customer.getChannelId());
customerApplyLog.setOrderStatus(0l);
customerApplyLog.setOrderNo(orderNo);
customerApplyLog.setCreateTime(new Date());
customerApplyLogService.save(customerApplyLog);
return AjaxResult.success("点击成功","orderNo="+orderNo+"&sign="+merchant.getChannelSign());
}
/**
* 获取前筛符合的商户
* @param customer
*/
private List<Merchant> matchMerchant(Customer customer) {
R<List<Merchant>> listR = getMerchantList();
if (listR.getCode()!=200){
return new ArrayList<>();
}
List<Merchant> merchants = new ArrayList<>();
for (Merchant merchant:listR.getData()) {
//限量判定
Integer sum = customerApplyLogService.getApplySum(merchant.getId());
if (merchant.getLimitType()!=null&&merchant.getLimitType()==1&&merchant.getLimitNum()<=sum){
continue;
}
if (merchant.getAgeLimitStart()!=null&&merchant.getAgeLimitEnd()!=null&&(customer.getAge()<merchant.getAgeLimitStart()||customer.getAge()>merchant.getAgeLimitEnd())){
continue;
}
if (merchant.getChannelLimitType()!=null&&(merchant.getChannelLimitType()==1||merchant.getChannelLimitType()==2)){
List<Long> list = Arrays.asList(merchant.getChannelLimit().split(",")).stream().map(val->Long.parseLong(val)).collect(Collectors.toList());
if (merchant.getChannelLimitType()==1&& !list.contains(customer.getChannelId())){
continue;
}
if (merchant.getChannelLimitType()==2&& list.contains(customer.getChannelId())){
continue;
}
}
merchants.add(merchant);
}
return merchants;
}
@Override
public AjaxResult getMatchMerchantNew() {
List<Merchant> merchantLists = matchMerchantNew();
List<MerchantListDto> results = new ArrayList<>();
for (Merchant merchant : merchantLists) {
MerchantListDto merchantListDto = new MerchantListDto();
merchantListDto.setMerchantName(merchant.getMerchantName());
merchantListDto.setMerchantDescribe(merchant.getMerchantDescribe());
merchantListDto.setMerchantUrl(merchant.getHitUrl());
merchantListDto.setMerchantId(merchant.getId());
results.add(merchantListDto);
}
return AjaxResult.success(results);
}
@Override
public AjaxResult V1GetMatchMerchant(HttpServletRequest request) {
String authorization = request.getHeader("Authorization");
Long customerId = customerTokenService.getCustomerId(authorization, false);
if (customerId==null){
return AjaxResult.error("用户不存在或未登录");
}
Customer customer = customerMapper.selectById(customerId);
List<Merchant> merchants = matchMerchant(customer);
List<MerchantListDto> merchantListDtos = new ArrayList<>();
for (Merchant merchant:merchants) {
MerchantListDto merchantListDto = new MerchantListDto();
merchantListDto.setMerchantName(merchant.getMerchantName());
merchantListDto.setMerchantDescribe(merchant.getMerchantDescribe());
merchantListDto.setMerchantUrl(merchant.getHitUrl());
merchantListDto.setMerchantId(merchant.getId());
merchantListDtos.add(merchantListDto);
}
return AjaxResult.success(merchantListDtos);
}
private List<Merchant> getMerchantLists() {
LambdaQueryWrapper<Merchant> queryWrapper = new LambdaQueryWrapper<Merchant>().eq(Merchant::getStatus, true);
List<Merchant> merchants = merchantMapper.selectList(queryWrapper);
return CollectionUtils.isEmpty(merchants) ? new ArrayList<>() : merchants;
}
private List<Merchant> matchMerchantNew() {
List<Merchant> merchantLists = getMerchantLists();
if (CollectionUtils.isEmpty(merchantLists)) {
return merchantLists;
}
List<Merchant> merchants = new ArrayList<>();
for (Merchant merchant : merchantLists) {
//限量判定
Integer sum = customerApplyLogService.getApplySum(merchant.getId());
if (merchant.getLimitType() != null && merchant.getLimitType() == 1 && merchant.getLimitNum() <= sum) {
continue;
}
merchants.add(merchant);
}
return merchants;
}
}

View File

@@ -14,10 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
# 配置文件格式
file-extension: yml
# 共享配置

View File

@@ -0,0 +1,114 @@
<?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.ruoyi.system.mapper.ChannelMapper">
<resultMap type="com.ruoyi.common.core.domain.http.Channel" id="ChannelResult">
<result property="id" column="id" />
<result property="channelName" column="channel_name" />
<result property="channelSign" column="channel_sign" />
<result property="channelType" column="channel_type" />
<result property="score" column="score" />
<result property="htmlName" column="html_name" />
<result property="htmlLocation" column="html_location" />
<result property="ips" column="ips" />
<result property="period" column="period" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<resultMap type="com.ruoyi.common.core.domain.http.Channel" id="ChannelResultList">
<result property="id" column="id" />
<result property="channelName" column="channel_name" />
<result property="channelSign" column="channel_sign" />
</resultMap>
<sql id="selectChannelVo">
select id, channel_name, channel_sign,channel_type, score, html_name, html_location, ips, period, create_time, update_time, remark from channel
</sql>
<sql id="selectChannelIdName">
select id, channel_name, channel_sign from channel
</sql>
<select id="selectChannelList" parameterType="com.ruoyi.common.core.domain.http.Channel" resultMap="ChannelResult">
<include refid="selectChannelVo"/>
<where>
<if test="channelName != null and channelName != ''"> and channel_name like concat('%', #{channelName}, '%')</if>
<if test="channelSign != null and channelSign != ''"> and channel_sign = #{channelSign}</if>
<if test="channelType != null and channelType != ''"> and channel_type = #{channelType}</if>
<if test="score != null "> and score = #{score}</if>
<if test="htmlName != null and htmlName != ''"> and html_name like concat('%', #{htmlName}, '%')</if>
<if test="htmlLocation != null and htmlLocation != ''"> and html_location = #{htmlLocation}</if>
<if test="ips != null and ips != ''"> and ips = #{ips}</if>
<if test="period != null and period != ''"> and period = #{period}</if>
</where>
</select>
<select id="selectChannelById" parameterType="java.lang.Long" resultMap="ChannelResult">
<include refid="selectChannelVo"/>
where id = #{id}
</select>
<insert id="insertChannel" parameterType="com.ruoyi.common.core.domain.http.Channel" useGeneratedKeys="true" keyProperty="id">
insert into channel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="channelName != null">channel_name,</if>
<if test="channelSign != null">channel_sign,</if>
<if test="channelType != null">channel_type,</if>
<if test="score != null">score,</if>
<if test="htmlName != null">html_name,</if>
<if test="htmlLocation != null">html_location,</if>
<if test="ips != null">ips,</if>
<if test="period != null">period,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="channelName != null">#{channelName},</if>
<if test="channelSign != null">#{channelSign},</if>
<if test="channelType != null">#{channelType},</if>
<if test="score != null">#{score},</if>
<if test="htmlName != null">#{htmlName},</if>
<if test="htmlLocation != null">#{htmlLocation},</if>
<if test="ips != null">#{ips},</if>
<if test="period != null">#{period},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateChannel" parameterType="com.ruoyi.common.core.domain.http.Channel">
update channel
<trim prefix="SET" suffixOverrides=",">
<if test="channelName != null">channel_name = #{channelName},</if>
<if test="channelSign != null">channel_sign = #{channelSign},</if>
<if test="channelType != null">channel_type = #{channelType},</if>
<if test="score != null">score = #{score},</if>
<if test="htmlName != null">html_name = #{htmlName},</if>
<if test="htmlLocation != null">html_location = #{htmlLocation},</if>
<if test="ips != null">ips = #{ips},</if>
<if test="period != null">period = #{period},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteChannelById" parameterType="java.lang.Long">
delete from channel where id = #{id}
</delete>
<delete id="deleteChannelByIds" parameterType="java.lang.String">
delete from channel where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="findAllChannelList" resultMap="ChannelResultList">
<include refid="selectChannelIdName"/>
</select>
</mapper>

View File

@@ -0,0 +1,88 @@
<?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.ruoyi.system.mapper.CustomerApplyLogMapper">
<resultMap type="com.ruoyi.common.core.domain.http.CustomerApplyLog" id="CustomerApplyLogResult">
<result property="id" column="id" />
<result property="customerId" column="customer_id" />
<result property="merchantId" column="merchant_id" />
<result property="channelId" column="channel_id" />
<result property="orderStatus" column="order_status" />
<result property="price" column="price" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectCustomerApplyLogVo">
select id, customer_id, merchant_id, channel_id, order_status, price, create_time, update_time, remark from customer_apply_log
</sql>
<select id="selectCustomerApplyLogList" parameterType="com.ruoyi.common.core.domain.http.CustomerApplyLog" resultMap="CustomerApplyLogResult">
<include refid="selectCustomerApplyLogVo"/>
<where>
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="merchantId != null "> and merchant_id = #{merchantId}</if>
<if test="channelId != null "> and channel_id = #{channelId}</if>
<if test="orderStatus != null "> and order_status = #{orderStatus}</if>
<if test="price != null "> and price = #{price}</if>
</where>
</select>
<select id="selectCustomerApplyLogById" parameterType="java.lang.Long" resultMap="CustomerApplyLogResult">
<include refid="selectCustomerApplyLogVo"/>
where id = #{id}
</select>
<insert id="insertCustomerApplyLog" parameterType="com.ruoyi.common.core.domain.http.CustomerApplyLog" useGeneratedKeys="true" keyProperty="id">
insert into customer_apply_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">customer_id,</if>
<if test="merchantId != null">merchant_id,</if>
<if test="channelId != null">channel_id,</if>
<if test="orderStatus != null">order_status,</if>
<if test="price != null">price,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">#{customerId},</if>
<if test="merchantId != null">#{merchantId},</if>
<if test="channelId != null">#{channelId},</if>
<if test="orderStatus != null">#{orderStatus},</if>
<if test="price != null">#{price},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateCustomerApplyLog" parameterType="com.ruoyi.common.core.domain.http.CustomerApplyLog">
update customer_apply_log
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="merchantId != null">merchant_id = #{merchantId},</if>
<if test="channelId != null">channel_id = #{channelId},</if>
<if test="orderStatus != null">order_status = #{orderStatus},</if>
<if test="price != null">price = #{price},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustomerApplyLogById" parameterType="java.lang.Long">
delete from customer_apply_log where id = #{id}
</delete>
<delete id="deleteCustomerApplyLogByIds" parameterType="java.lang.String">
delete from customer_apply_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,184 @@
<?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.ruoyi.system.mapper.CustomerMapper">
<resultMap type="com.ruoyi.common.core.domain.http.Customer" id="CustomerResult">
<result property="id" column="id" />
<result property="channelId" column="channel_id" />
<result property="age" column="age" />
<result property="sex" column="sex" />
<result property="name" column="name" />
<result property="acturlName" column="acturl_name" />
<result property="phone" column="phone" />
<result property="phoneMd5" column="phone_md5" />
<result property="isAuth" column="is_auth" />
<result property="city" column="city" />
<result property="cityCode" column="city_code" />
<result property="firstLoginTime" column="first_login_time" />
<result property="lastLoginTime" column="last_login_time" />
<result property="lastLoginIp" column="last_login_ip" />
<result property="status" column="status" />
<result property="socialSecurity" column="social_security" />
<result property="car" column="car" />
<result property="guaranteeSlip" column="guarantee_slip" />
<result property="education" column="education" />
<result property="accumulationFund" column="accumulation_fund" />
<result property="hourse" column="hourse" />
<result property="career" column="career" />
<result property="huaBei" column="hua_bei" />
<result property="baiTiao" column="bai_tiao" />
<result property="zhiMa" column="zhi_ma" />
<result property="income" column="income" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectCustomerVo">
select id, channel_id, age, sex, name, acturl_name, phone, phone_md5, is_auth, city, city_code, first_login_time, last_login_time, last_login_ip, status, social_security, car, guarantee_slip, education, accumulation_fund, hourse, career, hua_bei, bai_tiao, zhi_ma, income, create_time, update_time from customer
</sql>
<select id="selectCustomerList" parameterType="com.ruoyi.common.core.domain.http.Customer" resultMap="CustomerResult">
<include refid="selectCustomerVo"/>
<where>
<if test="channelId != null "> and channel_id = #{channelId}</if>
<if test="age != null "> and age = #{age}</if>
<if test="sex != null "> and sex = #{sex}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="acturlName != null and acturlName != ''"> and acturl_name like concat('%', #{acturlName}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="phoneMd5 != null and phoneMd5 != ''"> and phone_md5 = #{phoneMd5}</if>
<if test="isAuth != null "> and is_auth = #{isAuth}</if>
<if test="city != null and city != ''"> and city = #{city}</if>
<if test="cityCode != null "> and city_code = #{cityCode}</if>
<if test="firstLoginTime != null "> and first_login_time = #{firstLoginTime}</if>
<if test="lastLoginTime != null "> and last_login_time = #{lastLoginTime}</if>
<if test="lastLoginIp != null "> and last_login_ip = #{lastLoginIp}</if>
<if test="status != null "> and status = #{status}</if>
<if test="socialSecurity != null "> and social_security = #{socialSecurity}</if>
<if test="car != null "> and car = #{car}</if>
<if test="guaranteeSlip != null "> and guarantee_slip = #{guaranteeSlip}</if>
<if test="education != null "> and education = #{education}</if>
<if test="accumulationFund != null "> and accumulation_fund = #{accumulationFund}</if>
<if test="hourse != null "> and hourse = #{hourse}</if>
<if test="career != null "> and career = #{career}</if>
<if test="huaBei != null "> and hua_bei = #{huaBei}</if>
<if test="baiTiao != null "> and bai_tiao = #{baiTiao}</if>
<if test="zhiMa != null "> and zhi_ma = #{zhiMa}</if>
<if test="income != null "> and income = #{income}</if>
</where>
</select>
<select id="selectCustomerById" parameterType="java.lang.Long" resultMap="CustomerResult">
<include refid="selectCustomerVo"/>
where id = #{id}
</select>
<insert id="insertCustomer" parameterType="com.ruoyi.common.core.domain.http.Customer" useGeneratedKeys="true" keyProperty="id">
insert into customer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="channelId != null">channel_id,</if>
<if test="age != null">age,</if>
<if test="sex != null">sex,</if>
<if test="name != null">name,</if>
<if test="acturlName != null">acturl_name,</if>
<if test="phone != null">phone,</if>
<if test="phoneMd5 != null">phone_md5,</if>
<if test="isAuth != null">is_auth,</if>
<if test="city != null">city,</if>
<if test="cityCode != null">city_code,</if>
<if test="firstLoginTime != null">first_login_time,</if>
<if test="lastLoginTime != null">last_login_time,</if>
<if test="lastLoginIp != null">last_login_ip,</if>
<if test="status != null">status,</if>
<if test="socialSecurity != null">social_security,</if>
<if test="car != null">car,</if>
<if test="guaranteeSlip != null">guarantee_slip,</if>
<if test="education != null">education,</if>
<if test="accumulationFund != null">accumulation_fund,</if>
<if test="hourse != null">hourse,</if>
<if test="career != null">career,</if>
<if test="huaBei != null">hua_bei,</if>
<if test="baiTiao != null">bai_tiao,</if>
<if test="zhiMa != null">zhi_ma,</if>
<if test="income != null">income,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="channelId != null">#{channelId},</if>
<if test="age != null">#{age},</if>
<if test="sex != null">#{sex},</if>
<if test="name != null">#{name},</if>
<if test="acturlName != null">#{acturlName},</if>
<if test="phone != null">#{phone},</if>
<if test="phoneMd5 != null">#{phoneMd5},</if>
<if test="isAuth != null">#{isAuth},</if>
<if test="city != null">#{city},</if>
<if test="cityCode != null">#{cityCode},</if>
<if test="firstLoginTime != null">#{firstLoginTime},</if>
<if test="lastLoginTime != null">#{lastLoginTime},</if>
<if test="lastLoginIp != null">#{lastLoginIp},</if>
<if test="status != null">#{status},</if>
<if test="socialSecurity != null">#{socialSecurity},</if>
<if test="car != null">#{car},</if>
<if test="guaranteeSlip != null">#{guaranteeSlip},</if>
<if test="education != null">#{education},</if>
<if test="accumulationFund != null">#{accumulationFund},</if>
<if test="hourse != null">#{hourse},</if>
<if test="career != null">#{career},</if>
<if test="huaBei != null">#{huaBei},</if>
<if test="baiTiao != null">#{baiTiao},</if>
<if test="zhiMa != null">#{zhiMa},</if>
<if test="income != null">#{income},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateCustomer" parameterType="com.ruoyi.common.core.domain.http.Customer">
update customer
<trim prefix="SET" suffixOverrides=",">
<if test="channelId != null">channel_id = #{channelId},</if>
<if test="age != null">age = #{age},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="name != null">name = #{name},</if>
<if test="acturlName != null">acturl_name = #{acturlName},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="phoneMd5 != null">phone_md5 = #{phoneMd5},</if>
<if test="isAuth != null">is_auth = #{isAuth},</if>
<if test="city != null">city = #{city},</if>
<if test="cityCode != null">city_code = #{cityCode},</if>
<if test="firstLoginTime != null">first_login_time = #{firstLoginTime},</if>
<if test="lastLoginTime != null">last_login_time = #{lastLoginTime},</if>
<if test="lastLoginIp != null">last_login_ip = #{lastLoginIp},</if>
<if test="status != null">status = #{status},</if>
<if test="socialSecurity != null">social_security = #{socialSecurity},</if>
<if test="car != null">car = #{car},</if>
<if test="guaranteeSlip != null">guarantee_slip = #{guaranteeSlip},</if>
<if test="education != null">education = #{education},</if>
<if test="accumulationFund != null">accumulation_fund = #{accumulationFund},</if>
<if test="hourse != null">hourse = #{hourse},</if>
<if test="career != null">career = #{career},</if>
<if test="huaBei != null">hua_bei = #{huaBei},</if>
<if test="baiTiao != null">bai_tiao = #{baiTiao},</if>
<if test="zhiMa != null">zhi_ma = #{zhiMa},</if>
<if test="income != null">income = #{income},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustomerById" parameterType="java.lang.Long">
delete from customer where id = #{id}
</delete>
<delete id="deleteCustomerByIds" parameterType="java.lang.String">
delete from customer where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,340 @@
<?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.ruoyi.system.mapper.MerchantMapper">
<resultMap type="com.ruoyi.common.core.domain.http.Merchant" id="MerchantResult">
<result property="id" column="id" />
<result property="merchantType" column="merchant_type" />
<result property="merchantName" column="merchant_name" />
<result property="merchantDescribe" column="merchant_describe" />
<result property="merchantCompany" column="merchant_company" />
<result property="logo" column="logo" />
<result property="status" column="status" />
<result property="limitNum" column="limit_num" />
<result property="limitType" column="limit_type" />
<result property="isBalanceMonitoring" column="is_balance_monitoring" />
<result property="balanceMonitoring" column="balance_monitoring" />
<result property="ispass" column="ispass" />
<result property="customerInfoFilterType" column="customer_info_filter_type" />
<result property="channelLimitType" column="channel_limit_type" />
<result property="channelLimit" column="channel_limit" />
<result property="period" column="period" />
<result property="hitUrl" column="hit_url" />
<result property="registUrl" column="regist_url" />
<result property="ageLimitStart" column="age_limit_start" />
<result property="ageLimitEnd" column="age_limit_end" />
<result property="phoneLimit" column="phone_limit" />
<result property="label" column="label" />
<result property="merchantAuth" column="merchant_auth" />
<result property="socialSecurityNo" column="social_security_no" />
<result property="socialSecurityLow" column="social_security_low" />
<result property="socialSecurityHigh" column="social_security_high" />
<result property="carNo" column="car_no" />
<result property="carHave" column="car_have" />
<result property="guaranteeSlipLow" column="guarantee_slip_low" />
<result property="guaranteeSlipCentre" column="guarantee_slip_centre" />
<result property="guaranteeSlipHigh" column="guarantee_slip_high" />
<result property="educationMiddle" column="education_middle" />
<result property="educationHighSchool" column="education_high_school" />
<result property="educationPolytechnic" column="education_polytechnic" />
<result property="educationJuniorCollege" column="education_junior_college" />
<result property="educationUndergraduateCourse" column="education_undergraduate_course" />
<result property="educationPostgraduate" column="education_postgraduate" />
<result property="accumulationFundLow" column="accumulation_fund_low" />
<result property="accumulationFundHigh" column="accumulation_fund_high" />
<result property="hourseNo" column="hourse_no" />
<result property="hourseFullPayment" column="hourse_full_payment" />
<result property="hourseMortgaging" column="hourse_mortgaging" />
<result property="officeWorker" column="office_worker" />
<result property="civilServant" column="civil_servant" />
<result property="privatePropertyOwners" column="private_property_owners" />
<result property="selfEmployedPerson" column="self_employed_person" />
<result property="otherOccupations" column="other_occupations" />
<result property="huaBeiLow" column="hua_bei_low" />
<result property="huaBeiMiddle" column="hua_bei_middle" />
<result property="huaBeiHigh" column="hua_bei_high" />
<result property="baiTiaoLow" column="bai_tiao_low" />
<result property="baiTiaoMiddle" column="bai_tiao_middle" />
<result property="baiTiaoHigh" column="bai_tiao_high" />
<result property="zhiMa" column="zhi_ma" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<resultMap type="com.ruoyi.common.core.domain.http.Merchant" id="MerchantIdNameResult">
<result property="id" column="id" />
<result property="merchantName" column="merchant_name" />
</resultMap>
<sql id="selectMerchantVo">
select id, merchant_type, merchant_name, merchant_describe, merchant_company, logo, status, limit_num, limit_type,is_balance_monitoring,balance_monitoring,ispass, customer_info_filter_type,channel_limit_type,channel_limit,period,hit_url,regist_url,age_limit_start, age_limit_end, phone_limit,label,merchant_auth, social_security_no, social_security_low, social_security_high, car_no, car_have, guarantee_slip_low, guarantee_slip_centre, guarantee_slip_high, education_middle, education_high_school, education_polytechnic, education_junior_college, education_undergraduate_course, education_postgraduate, accumulation_fund_low, accumulation_fund_high, hourse_no, hourse_full_payment, hourse_mortgaging, office_worker, civil_servant, private_property_owners, self_employed_person, other_occupations, hua_bei_low, hua_bei_middle, hua_bei_high, bai_tiao_low, bai_tiao_middle, bai_tiao_high, zhi_ma, create_time, update_time, remark from merchant
</sql>
<sql id="findAllMerchant">
select id, merchant_name from merchant
</sql>
<select id="selectMerchantList" parameterType="com.ruoyi.common.core.domain.http.Merchant" resultMap="MerchantResult">
<include refid="selectMerchantVo"/>
<where>
<if test="merchantType != null "> and merchant_type = #{merchantType}</if>
<if test="merchantName != null and merchantName != ''"> and merchant_name like concat('%', #{merchantName}, '%')</if>
<if test="merchantDescribe != null and merchantDescribe != ''"> and merchant_describe = #{merchantDescribe}</if>
<if test="merchantCompany != null and merchantCompany != ''"> and merchant_company = #{merchantCompany}</if>
<if test="logo != null "> and logo = #{logo}</if>
<if test="status != null "> and status = #{status}</if>
<if test="limitNum != null and limitNum != ''"> and limit_num = #{limitNum}</if>
<if test="limitType != null "> and limit_type = #{limitType}</if>
<if test="isBalanceMonitoring != null "> and is_balance_monitoring = #{isBalanceMonitoring}</if>
<if test="balanceMonitoring != null "> and balance_monitoring = #{balanceMonitoring}</if>
<if test="ispass != null "> and ispass = #{ispass}</if>
<if test="customerInfoFilterType != null "> and customer_info_filter_type = #{customerInfoFilterType}</if>
<if test="channelLimitType != null "> and channel_limit_type = #{channelLimitType}</if>
<if test="channelLimit != null "> and channel_limit = #{channelLimit}</if>
<if test="period != null "> and period = #{period}</if>
<if test="hitUrl != null "> and hit_url = #{hitUrl}</if>
<if test="registUrl != null "> and regist_url = #{registUrl}</if>
<if test="ageLimitStart != null "> and age_limit_start = #{ageLimitStart}</if>
<if test="ageLimitEnd != null "> and age_limit_end = #{ageLimitEnd}</if>
<if test="phoneLimit != null and phoneLimit != ''"> and phone_limit = #{phoneLimit}</if>
<if test="label != null and label != ''"> and label = #{label}</if>
<if test="merchantAuth != null "> and merchant_auth = #{merchantAuth}</if>
<if test="socialSecurityNo != null "> and social_security_no = #{socialSecurityNo}</if>
<if test="socialSecurityLow != null "> and social_security_low = #{socialSecurityLow}</if>
<if test="socialSecurityHigh != null "> and social_security_high = #{socialSecurityHigh}</if>
<if test="carNo != null "> and car_no = #{carNo}</if>
<if test="carHave != null "> and car_have = #{carHave}</if>
<if test="guaranteeSlipLow != null "> and guarantee_slip_low = #{guaranteeSlipLow}</if>
<if test="guaranteeSlipCentre != null "> and guarantee_slip_centre = #{guaranteeSlipCentre}</if>
<if test="guaranteeSlipHigh != null "> and guarantee_slip_high = #{guaranteeSlipHigh}</if>
<if test="educationMiddle != null "> and education_middle = #{educationMiddle}</if>
<if test="educationHighSchool != null "> and education_high_school = #{educationHighSchool}</if>
<if test="educationPolytechnic != null "> and education_polytechnic = #{educationPolytechnic}</if>
<if test="educationJuniorCollege != null "> and education_junior_college = #{educationJuniorCollege}</if>
<if test="educationUndergraduateCourse != null "> and education_undergraduate_course = #{educationUndergraduateCourse}</if>
<if test="educationPostgraduate != null "> and education_postgraduate = #{educationPostgraduate}</if>
<if test="accumulationFundLow != null "> and accumulation_fund_low = #{accumulationFundLow}</if>
<if test="accumulationFundHigh != null "> and accumulation_fund_high = #{accumulationFundHigh}</if>
<if test="hourseNo != null "> and hourse_no = #{hourseNo}</if>
<if test="hourseFullPayment != null "> and hourse_full_payment = #{hourseFullPayment}</if>
<if test="hourseMortgaging != null "> and hourse_mortgaging = #{hourseMortgaging}</if>
<if test="officeWorker != null "> and office_worker = #{officeWorker}</if>
<if test="civilServant != null "> and civil_servant = #{civilServant}</if>
<if test="privatePropertyOwners != null "> and private_property_owners = #{privatePropertyOwners}</if>
<if test="selfEmployedPerson != null "> and self_employed_person = #{selfEmployedPerson}</if>
<if test="otherOccupations != null "> and other_occupations = #{otherOccupations}</if>
<if test="huaBeiLow != null "> and hua_bei_low = #{huaBeiLow}</if>
<if test="huaBeiMiddle != null "> and hua_bei_middle = #{huaBeiMiddle}</if>
<if test="huaBeiHigh != null "> and hua_bei_high = #{huaBeiHigh}</if>
<if test="baiTiaoLow != null "> and bai_tiao_low = #{baiTiaoLow}</if>
<if test="baiTiaoMiddle != null "> and bai_tiao_middle = #{baiTiaoMiddle}</if>
<if test="baiTiaoHigh != null "> and bai_tiao_high = #{baiTiaoHigh}</if>
<if test="zhiMa != null "> and zhi_ma = #{zhiMa}</if>
</where>
</select>
<select id="selectMerchantById" parameterType="java.lang.Long" resultMap="MerchantResult">
<include refid="selectMerchantVo"/>
where id = #{id}
</select>
<insert id="insertMerchant" parameterType="com.ruoyi.common.core.domain.http.Merchant" useGeneratedKeys="true" keyProperty="id">
insert into merchant
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="merchantType != null">merchant_type,</if>
<if test="merchantName != null">merchant_name,</if>
<if test="merchantDescribe != null">merchant_describe,</if>
<if test="merchantCompany != null">merchant_company,</if>
<if test="logo != null">logo,</if>
<if test="status != null">status,</if>
<if test="limitNum != null">limit_num,</if>
<if test="limitType != null">limit_type,</if>
<if test="isBalanceMonitoring != null">is_balance_monitoring,</if>
<if test="balanceMonitoring != null">balance_monitoring,</if>
<if test="ispass != null">ispass,</if>
<if test="customerInfoFilterType != null">customer_info_filter_type,</if>
<if test="channelLimitType != null">channel_limit_type,</if>
<if test="channelLimit != null">channel_limit,</if>
<if test="period != null">period,</if>
<if test="hitUrl != null">hit_url,</if>
<if test="registUrl != null">regist_url,</if>
<if test="ageLimitStart != null">age_limit_start,</if>
<if test="ageLimitEnd != null">age_limit_end,</if>
<if test="phoneLimit != null">phone_limit,</if>
<if test="label != null">label,</if>
<if test="merchantAuth != null">merchant_auth,</if>
<if test="socialSecurityNo != null">social_security_no,</if>
<if test="socialSecurityLow != null">social_security_low,</if>
<if test="socialSecurityHigh != null">social_security_high,</if>
<if test="carNo != null">car_no,</if>
<if test="carHave != null">car_have,</if>
<if test="guaranteeSlipLow != null">guarantee_slip_low,</if>
<if test="guaranteeSlipCentre != null">guarantee_slip_centre,</if>
<if test="guaranteeSlipHigh != null">guarantee_slip_high,</if>
<if test="educationMiddle != null">education_middle,</if>
<if test="educationHighSchool != null">education_high_school,</if>
<if test="educationPolytechnic != null">education_polytechnic,</if>
<if test="educationJuniorCollege != null">education_junior_college,</if>
<if test="educationUndergraduateCourse != null">education_undergraduate_course,</if>
<if test="educationPostgraduate != null">education_postgraduate,</if>
<if test="accumulationFundLow != null">accumulation_fund_low,</if>
<if test="accumulationFundHigh != null">accumulation_fund_high,</if>
<if test="hourseNo != null">hourse_no,</if>
<if test="hourseFullPayment != null">hourse_full_payment,</if>
<if test="hourseMortgaging != null">hourse_mortgaging,</if>
<if test="officeWorker != null">office_worker,</if>
<if test="civilServant != null">civil_servant,</if>
<if test="privatePropertyOwners != null">private_property_owners,</if>
<if test="selfEmployedPerson != null">self_employed_person,</if>
<if test="otherOccupations != null">other_occupations,</if>
<if test="huaBeiLow != null">hua_bei_low,</if>
<if test="huaBeiMiddle != null">hua_bei_middle,</if>
<if test="huaBeiHigh != null">hua_bei_high,</if>
<if test="baiTiaoLow != null">bai_tiao_low,</if>
<if test="baiTiaoMiddle != null">bai_tiao_middle,</if>
<if test="baiTiaoHigh != null">bai_tiao_high,</if>
<if test="zhiMa != null">zhi_ma,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="merchantType != null">#{merchantType},</if>
<if test="merchantName != null">#{merchantName},</if>
<if test="merchantDescribe != null">#{merchantDescribe},</if>
<if test="merchantCompany != null">#{merchantCompany},</if>
<if test="logo != null">#{logo},</if>
<if test="status != null">#{status},</if>
<if test="limitNum != null">#{limitNum},</if>
<if test="limitType != null">#{limitType},</if>
<if test="isBalanceMonitoring != null">#{isBalanceMonitoring},</if>
<if test="balanceMonitoring != null">#{balanceMonitoring},</if>
<if test="ispass != null">#{ispass},</if>
<if test="customerInfoFilterType != null">#{customerInfoFilterType},</if>
<if test="channelLimitType != null">#{channelLimitType},</if>
<if test="channelLimit != null">#{channelLimit},</if>
<if test="period != null">#{period},</if>
<if test="hitUrl != null">#{hitUrl},</if>
<if test="registUrl != null">#{registUrl},</if>
<if test="ageLimitStart != null">#{ageLimitStart},</if>
<if test="ageLimitEnd != null">#{ageLimitEnd},</if>
<if test="phoneLimit != null">#{phoneLimit},</if>
<if test="label != null">#{label},</if>
<if test="merchantAuth != null">#{merchantAuth},</if>
<if test="socialSecurityNo != null">#{socialSecurityNo},</if>
<if test="socialSecurityLow != null">#{socialSecurityLow},</if>
<if test="socialSecurityHigh != null">#{socialSecurityHigh},</if>
<if test="carNo != null">#{carNo},</if>
<if test="carHave != null">#{carHave},</if>
<if test="guaranteeSlipLow != null">#{guaranteeSlipLow},</if>
<if test="guaranteeSlipCentre != null">#{guaranteeSlipCentre},</if>
<if test="guaranteeSlipHigh != null">#{guaranteeSlipHigh},</if>
<if test="educationMiddle != null">#{educationMiddle},</if>
<if test="educationHighSchool != null">#{educationHighSchool},</if>
<if test="educationPolytechnic != null">#{educationPolytechnic},</if>
<if test="educationJuniorCollege != null">#{educationJuniorCollege},</if>
<if test="educationUndergraduateCourse != null">#{educationUndergraduateCourse},</if>
<if test="educationPostgraduate != null">#{educationPostgraduate},</if>
<if test="accumulationFundLow != null">#{accumulationFundLow},</if>
<if test="accumulationFundHigh != null">#{accumulationFundHigh},</if>
<if test="hourseNo != null">#{hourseNo},</if>
<if test="hourseFullPayment != null">#{hourseFullPayment},</if>
<if test="hourseMortgaging != null">#{hourseMortgaging},</if>
<if test="officeWorker != null">#{officeWorker},</if>
<if test="civilServant != null">#{civilServant},</if>
<if test="privatePropertyOwners != null">#{privatePropertyOwners},</if>
<if test="selfEmployedPerson != null">#{selfEmployedPerson},</if>
<if test="otherOccupations != null">#{otherOccupations},</if>
<if test="huaBeiLow != null">#{huaBeiLow},</if>
<if test="huaBeiMiddle != null">#{huaBeiMiddle},</if>
<if test="huaBeiHigh != null">#{huaBeiHigh},</if>
<if test="baiTiaoLow != null">#{baiTiaoLow},</if>
<if test="baiTiaoMiddle != null">#{baiTiaoMiddle},</if>
<if test="baiTiaoHigh != null">#{baiTiaoHigh},</if>
<if test="zhiMa != null">#{zhiMa},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateMerchant" parameterType="com.ruoyi.common.core.domain.http.Merchant">
update merchant
<trim prefix="SET" suffixOverrides=",">
<if test="merchantType != null">merchant_type = #{merchantType},</if>
<if test="merchantName != null">merchant_name = #{merchantName},</if>
<if test="merchantDescribe != null">merchant_describe = #{merchantDescribe},</if>
<if test="merchantCompany != null">merchant_company = #{merchantCompany},</if>
<if test="logo != null">logo = #{logo},</if>
<if test="status != null">status = #{status},</if>
<if test="limitNum != null">limit_num = #{limitNum},</if>
<if test="limitType != null">limit_type = #{limitType},</if>
<if test="isBalanceMonitoring != null">is_balance_monitoring = #{isBalanceMonitoring},</if>
<if test="balanceMonitoring != null">balance_monitoring = #{balanceMonitoring},</if>
<if test="ispass != null">ispass = #{ispass},</if>
<if test="customerInfoFilterType != null">customer_info_filter_type = #{customerInfoFilterType},</if>
<if test="channelLimitType != null">channel_limit_type = #{channelLimitType},</if>
<if test="channelLimit != null">channel_limit = #{channelLimit},</if>
<if test="period != null">period = #{period},</if>
<if test="hitUrl != null">hit_url = #{hitUrl},</if>
<if test="registUrl != null">regist_url = #{registUrl},</if>
<if test="ageLimitStart != null">age_limit_start = #{ageLimitStart},</if>
<if test="ageLimitEnd != null">age_limit_end = #{ageLimitEnd},</if>
<if test="phoneLimit != null">phone_limit = #{phoneLimit},</if>
<if test="label != null">label = #{label},</if>
<if test="merchantAuth != null">merchant_auth = #{merchantAuth},</if>
<if test="socialSecurityNo != null">social_security_no = #{socialSecurityNo},</if>
<if test="socialSecurityLow != null">social_security_low = #{socialSecurityLow},</if>
<if test="socialSecurityHigh != null">social_security_high = #{socialSecurityHigh},</if>
<if test="carNo != null">car_no = #{carNo},</if>
<if test="carHave != null">car_have = #{carHave},</if>
<if test="guaranteeSlipLow != null">guarantee_slip_low = #{guaranteeSlipLow},</if>
<if test="guaranteeSlipCentre != null">guarantee_slip_centre = #{guaranteeSlipCentre},</if>
<if test="guaranteeSlipHigh != null">guarantee_slip_high = #{guaranteeSlipHigh},</if>
<if test="educationMiddle != null">education_middle = #{educationMiddle},</if>
<if test="educationHighSchool != null">education_high_school = #{educationHighSchool},</if>
<if test="educationPolytechnic != null">education_polytechnic = #{educationPolytechnic},</if>
<if test="educationJuniorCollege != null">education_junior_college = #{educationJuniorCollege},</if>
<if test="educationUndergraduateCourse != null">education_undergraduate_course = #{educationUndergraduateCourse},</if>
<if test="educationPostgraduate != null">education_postgraduate = #{educationPostgraduate},</if>
<if test="accumulationFundLow != null">accumulation_fund_low = #{accumulationFundLow},</if>
<if test="accumulationFundHigh != null">accumulation_fund_high = #{accumulationFundHigh},</if>
<if test="hourseNo != null">hourse_no = #{hourseNo},</if>
<if test="hourseFullPayment != null">hourse_full_payment = #{hourseFullPayment},</if>
<if test="hourseMortgaging != null">hourse_mortgaging = #{hourseMortgaging},</if>
<if test="officeWorker != null">office_worker = #{officeWorker},</if>
<if test="civilServant != null">civil_servant = #{civilServant},</if>
<if test="privatePropertyOwners != null">private_property_owners = #{privatePropertyOwners},</if>
<if test="selfEmployedPerson != null">self_employed_person = #{selfEmployedPerson},</if>
<if test="otherOccupations != null">other_occupations = #{otherOccupations},</if>
<if test="huaBeiLow != null">hua_bei_low = #{huaBeiLow},</if>
<if test="huaBeiMiddle != null">hua_bei_middle = #{huaBeiMiddle},</if>
<if test="huaBeiHigh != null">hua_bei_high = #{huaBeiHigh},</if>
<if test="baiTiaoLow != null">bai_tiao_low = #{baiTiaoLow},</if>
<if test="baiTiaoMiddle != null">bai_tiao_middle = #{baiTiaoMiddle},</if>
<if test="baiTiaoHigh != null">bai_tiao_high = #{baiTiaoHigh},</if>
<if test="zhiMa != null">zhi_ma = #{zhiMa},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMerchantById" parameterType="java.lang.Long">
delete from merchant where id = #{id}
</delete>
<delete id="deleteMerchantByIds" parameterType="java.lang.String">
delete from merchant where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="findAllMerchantList" resultMap="MerchantIdNameResult">
<include refid="findAllMerchant"/>
</select>
</mapper>

View File

@@ -0,0 +1,48 @@
package com.ruoyi.system;
import cn.hutool.json.JSONUtil;
import com.ruoyi.common.sms.component.SmsComponent;
import com.ruoyi.common.sms.entity.response.SmsResponse;
import org.assertj.core.util.Maps;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.HashMap;
import java.util.Map;
import static cn.hutool.extra.spring.SpringUtil.getActiveProfile;
@SpringBootTest
public class RuoYiSystemApplicationTest {
@Autowired
SmsComponent smsComponent;
@Test
public void testGroupMsg(){
String mobile = "15826189779,15826189779,17382317154";
String content = "123456";
SmsResponse groupMsg = smsComponent.sendGroupMsg(mobile, content);
System.out.println(JSONUtil.toJsonStr(groupMsg));
}
@Test
public void testP2pMsg(){
String content = "123456";
Map<String, String> params = new HashMap<>();
params.put("15826189779", content);
SmsResponse sendP2PMsg = smsComponent.sendP2PMsg(params);
System.out.println(JSONUtil.toJsonStr(sendP2PMsg));
}
@Test
public void getActivePro(){
String activeProfile = getActiveProfile();
System.out.println(activeProfile);
}
}