随行付进件

This commit is contained in:
liuyingfang 2023-09-14 09:37:34 +08:00
parent 95952a234a
commit 9787272d82
34 changed files with 2151 additions and 108 deletions

View File

@ -0,0 +1,22 @@
package com.chaozhanggui.admin.system.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chaozhanggui.common.system.config.RespBody;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author lyf
*/
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/DeviceStock")
@Slf4j
public class DeviceStockController {
// @RequestMapping("pageData")
// public RespBody pageData(){
//
// }
}

View File

@ -0,0 +1,37 @@
package com.chaozhanggui.admin.system.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chaozhanggui.admin.system.service.MerOrderDetailService;
import com.chaozhanggui.common.system.config.RespBody;
import com.chaozhanggui.dao.system.entity.TbPlussMercOrderDetail;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author lyf
*/
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/mercOrderDetail")
@Slf4j
public class MerOrderDetailController {
@Resource
private MerOrderDetailService merOrderDetailService;
/**
* 设备列表
* @param merOrderDetail
* @param current
* @param size
* @return
*/
@GetMapping("/pageInfo")
public RespBody pageInfo(TbPlussMercOrderDetail merOrderDetail, @RequestParam("current") Integer current,
@RequestParam("size") Integer size) {
return merOrderDetailService.merOrderDetail(current, size, merOrderDetail);
}
}

View File

@ -1,14 +1,11 @@
package com.chaozhanggui.admin.system.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chaozhanggui.dao.system.entity.TbPlussMerchantChannelStatus;
import com.chaozhanggui.dao.system.entity.VO.UserInfoVO;
import com.chaozhanggui.admin.system.service.MerchantChannelStatusService;
import com.chaozhanggui.common.system.config.RespBody;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
/**
* 商户通道相关信息
@ -18,8 +15,9 @@ import java.util.Map;
@RestController
@RequestMapping("/merchantChannel")
@Slf4j
public class MerchantChannelController {
public class MerchantChannelStatusController {
@Resource
private MerchantChannelStatusService merchantChannelStatusService;
// @GetMapping(value = "/queryUserAppByPage")
// public Map<String, Object> queryUserAppByPage(@RequestParam(defaultValue = "1") Integer currPage, Integer size,
@ -125,4 +123,17 @@ public class MerchantChannelController {
// result.put("currPage", currPage);
// return result;
// }
/**
* 后台进件
* @param userId
* @param channelId
* @param merchantCode
* @return
*/
@GetMapping(value = "/manualMerchantIncom/{userId}/{channelId}/{merchantCode}")
public RespBody manualMerchantIncome(@PathVariable("userId") Integer userId, @PathVariable("channelId") String channelId, @PathVariable("merchantCode") String merchantCode){
return new RespBody (merchantChannelStatusService.manualMerchantIncome(userId,channelId,merchantCode));
}
}

View File

@ -24,6 +24,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
@ -90,7 +91,7 @@ public class OpLogAspect {
sb.append("请求参数:");
if(ObjectUtil.isNotEmpty(args)||args.length>0){
Arrays.stream(args).forEach(it->{
if(it instanceof String||it instanceof Integer||it instanceof Long){
if(it instanceof String||it instanceof Integer||it instanceof Long|| it instanceof BigDecimal ){
sb.append(it);
sb.append("&");
}else if(it instanceof Object){

View File

@ -46,11 +46,22 @@ public class AccountService {
private TbPlussBankCodeSxfMapper bankCodeSxfMapper;
@Resource
private TbPlussRiskBlacklistMapper riskBlacklistMapper;
@Resource
private MerchantChannelStatusService merchantChannelStatusService;
private static final int MAX_MIRCO_MERCHANT_NUM = 3;
public AccountDTO getRealAccount(String userId) {
return getRealAccount(userId, TbPlussAccount.CHANNEL_TYPE_D1);
}
/**
* 获取用户指定结算通道类型下的结算信息
*
* @param userId 用户id
* @param channelType 通道类型D1D0
* @return
*/
public AccountDTO getRealAccount(String userId, String channelType) {
if (!TbPlussAccount.CHANNEL_TYPE_D1.equals(channelType) && !TbPlussAccount.CHANNEL_TYPE_D0.equals(channelType)) {
throw new MsgException("未知的通道类型");
@ -222,4 +233,50 @@ public class AccountService {
}
}
public void checkCert(String certNo, String checkMsg) {
Integer num = 0;
try {
num = accountMapper.selectMicroMbiAccountNum(certNo);
} catch (Exception e) {
log.error(e.toString());
}
if (num >= MAX_MIRCO_MERCHANT_NUM) {
throw new MsgException(checkMsg);
}
}
// public AccountDTO getAccount(String userId) {
// TbPlussMerchantBaseInfo mbi = merchantBaseInfoMapper.selectByUserId(userId);
// if (mbi == null) {
// return getRealAccount(userId, TbPlussAccount.CHANNEL_TYPE_D1);
// }
//
// TbPlussMerchantChannelStatus mcs = merchantChannelStatusService.getValidData(mbi.getMerchantCode());
// if (mcs == null || !Objects.equals(mcs.getChannel(), 4)) {
// return getRealAccount(userId, Account.CHANNEL_TYPE_D1);
// } else {
// return getRealAccount(userId, Account.CHANNEL_TYPE_D0);
// }
// }
/**
* 获取结算信息(app回显时候使用账户信息与法人信息可能并未对应)
*
* @param userId
* @return
*/
public AccountDTO getAccount(String userId) {
TbPlussMerchantBaseInfo mbi = merchantBaseInfoMapper.selectByUserId(userId);
if (mbi == null) {
return getRealAccount(userId, TbPlussAccount.CHANNEL_TYPE_D1);
}
TbPlussMerchantChannelStatus mcs = merchantChannelStatusService.getValidData(mbi.getMerchantcode());
if (mcs == null || !Objects.equals(mcs.getChannel(), 4)) {
return getRealAccount(userId, TbPlussAccount.CHANNEL_TYPE_D1);
} else {
return getRealAccount(userId, TbPlussAccount.CHANNEL_TYPE_D0);
}
}
}

View File

@ -0,0 +1,47 @@
package com.chaozhanggui.admin.system.service;
import com.chaozhanggui.common.system.config.MsgException;
import com.chaozhanggui.dao.system.dao.TbPlussIdCardMapper;
import com.chaozhanggui.dao.system.dao.TbPlussMerchantBaseInfoMapper;
import com.chaozhanggui.dao.system.dao.TbPlussMerchantChannelStatusMapper;
import com.chaozhanggui.dao.system.entity.TbPlussIdCard;
import com.chaozhanggui.dao.system.entity.TbPlussMerchantBaseInfo;
import javax.annotation.Resource;
/**
* 进件通用方法放到这里
* @author lyf
*/
public abstract class BaseMerchantAuditService {
@Resource
protected TbPlussMerchantChannelStatusMapper merchantChannelStatusMapper;
@Resource
protected TbPlussMerchantBaseInfoMapper merchantBaseInfoMapper;
@Resource
protected TbPlussIdCardMapper idCardMapper;
@Resource
protected AccountService accountService;
/**
* 进件检测
* @param userId
* @param isFailCheck
*/
public void merchantAuditCheck(String userId, boolean isFailCheck) {
TbPlussMerchantBaseInfo merchantBaseInfo = merchantBaseInfoMapper.selectByUserId(userId);
MsgException.checkNull(merchantBaseInfo, "请完善经营信息");
String merchantType = merchantBaseInfo.getMerchanttype();
String principalPerson = merchantBaseInfo.getPrincipalperson();
TbPlussIdCard legalIdCard = idCardMapper.getLegalIdCard(userId);
MsgException.checkNull(legalIdCard, "请完善法人信息");
if (!"1".equals(merchantType)) {
MsgException.checkBlank(principalPerson, "请完善营业执照信息");
}
accountService.checkCert(legalIdCard.getCertno(), "同一证件只能注册三个小微商户, 如有增加需求请联系客服");
}
}

View File

@ -0,0 +1,27 @@
package com.chaozhanggui.admin.system.service;
import com.chaozhanggui.common.system.config.Pager;
import com.chaozhanggui.common.system.config.RespBody;
import com.chaozhanggui.dao.system.dao.TbPlussMercOrderDetailMapper;
import com.chaozhanggui.dao.system.entity.TbPlussMercOrderDetail;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author lyf
*/
@Service
public class MerOrderDetailService {
@Resource
private TbPlussMercOrderDetailMapper merOrderDetailMapper;
public RespBody merOrderDetail(Integer current, Integer size, TbPlussMercOrderDetail condition){
PageHelper.startPage(current, size);
List<TbPlussMercOrderDetail> mercOrderDetailsList = merOrderDetailMapper.selectByOrderDetailList(condition);
PageInfo<TbPlussMercOrderDetail> mercOrderDetailPageInfo = new PageInfo<>(mercOrderDetailsList);
return new RespBody("000000",mercOrderDetailPageInfo);
}
}

View File

@ -1,90 +0,0 @@
package com.chaozhanggui.admin.system.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chaozhanggui.dao.system.entity.TbPlussMerchantChannelStatus;
import com.chaozhanggui.dao.system.entity.VO.UserInfoVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @author lyf
*/
@Service
@Slf4j
public class MerchantChannelService {
// public Page<UserInfoVO> queryUserInfoVOPage(Map<String, Object> map) {
// List<UserInfoVO> result = baseMapper.queryUserInfoVOPage(map);
//
// long page = ((Integer) map.get("offset")).longValue() + 1L;
// long pageSize = ((Integer) map.get("pageSize")).longValue();
// Page<UserInfoVO> pageResult = new Page<>(page, pageSize);
// pageResult.setRecords(result);
// Long count = baseMapper.queryUserPageCount(map).longValue();
// pageResult.setTotal(count);
//
// if (result.isEmpty()) {
// return pageResult;
// }
// List<String> merchantCodeList = new ArrayList<>();
// List<Integer> userIdList = new ArrayList<>();
// for (UserInfoVO userInfoVO : result) {
// merchantCodeList.add(userInfoVO.getMerchantCode() + "");
// userIdList.add(Integer.valueOf(userInfoVO.getUserId() + ""));
// }
//
// List<MerchantChannelStatusVO> channelStatusList = mcsService.listByMerchantCodeList(merchantCodeList);
// Map<String, Integer> mapMerchantId = new HashMap<>();
// for (UserInfoVO userInfoVO : result) {
// List<MerchantChannelStatus> statusList = userInfoVO.getChannelStatusList();
// if (statusList == null) {
// statusList = new ArrayList<>();
// userInfoVO.setChannelStatusList(statusList);
// }
//
// Iterator<MerchantChannelStatusVO> iterator = channelStatusList.iterator();
// while (iterator.hasNext()) {
// MerchantChannelStatusVO item = iterator.next();
// if (item.getMerchantCode().equals(userInfoVO.getMerchantCode())) {
// if (!mapMerchantId.containsKey(item.getChannel() + item.getMerchantId() + item.getMerchantCode())) {
// statusList.add(item);
// mapMerchantId.put(item.getChannel() + item.getMerchantId() + item.getMerchantCode(), 1);
// }
// if (Objects.equals(4, item.getChannel())) {
// if (userInfoVO.getWxMercNoD0() == null) {
// userInfoVO.setWxMercNoD0(item.getWxMercNo());
// } else {
// userInfoVO.setWxMercNoD0(userInfoVO.getWxMercNoD0() + " / " + item.getWxMercNo());
// }
//
// if (userInfoVO.getZfbMercNoD0() == null) {
// userInfoVO.setZfbMercNoD0(item.getZfbMercNo());
// } else {
// userInfoVO.setZfbMercNoD0(userInfoVO.getZfbMercNoD0() + " / " + item.getWxMercNo());
// }
// } else {
// userInfoVO.setWxMercNoD1(item.getWxMercNo());
// userInfoVO.setZfbMercNoD1(item.getZfbMercNo());
// }
//
// iterator.remove();
// }
// }
// }
//
// return pageResult;
// }
// public TbPlussMerchantChannelStatus getByMerchantCodeAndChannelType(String merchantCode, String channelType) {
// LambdaQueryWrapper<TbPlussMerchantChannelStatus> qWrapper = Wrappers.lambdaQuery();
// qWrapper.eq(TbPlussMerchantChannelStatus::getVirchannelflag, channelType);
// qWrapper.eq(TbPlussMerchantChannelStatus::getMerchantcode, merchantCode);
// qWrapper.eq(TbPlussMerchantChannelStatus::getAuthorizationstatus,1);
//
// return getOne(qWrapper);
// }
}

View File

@ -0,0 +1,179 @@
package com.chaozhanggui.admin.system.service;
import cn.hutool.core.util.ObjectUtil;
import com.chaozhanggui.common.system.config.MsgException;
import com.chaozhanggui.common.system.config.RespBody;
import com.chaozhanggui.dao.system.dao.TbPlussMerchantChannelStatusMapper;
import com.chaozhanggui.dao.system.entity.TbPlussMerchantChannelStatus;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Objects;
/**
* @author lyf
*/
@Service
@Slf4j
public class MerchantChannelStatusService {
// public Page<UserInfoVO> queryUserInfoVOPage(Map<String, Object> map) {
// List<UserInfoVO> result = baseMapper.queryUserInfoVOPage(map);
//
// long page = ((Integer) map.get("offset")).longValue() + 1L;
// long pageSize = ((Integer) map.get("pageSize")).longValue();
// Page<UserInfoVO> pageResult = new Page<>(page, pageSize);
// pageResult.setRecords(result);
// Long count = baseMapper.queryUserPageCount(map).longValue();
// pageResult.setTotal(count);
//
// if (result.isEmpty()) {
// return pageResult;
// }
// List<String> merchantCodeList = new ArrayList<>();
// List<Integer> userIdList = new ArrayList<>();
// for (UserInfoVO userInfoVO : result) {
// merchantCodeList.add(userInfoVO.getMerchantCode() + "");
// userIdList.add(Integer.valueOf(userInfoVO.getUserId() + ""));
// }
//
// List<MerchantChannelStatusVO> channelStatusList = mcsService.listByMerchantCodeList(merchantCodeList);
// Map<String, Integer> mapMerchantId = new HashMap<>();
// for (UserInfoVO userInfoVO : result) {
// List<MerchantChannelStatus> statusList = userInfoVO.getChannelStatusList();
// if (statusList == null) {
// statusList = new ArrayList<>();
// userInfoVO.setChannelStatusList(statusList);
// }
//
// Iterator<MerchantChannelStatusVO> iterator = channelStatusList.iterator();
// while (iterator.hasNext()) {
// MerchantChannelStatusVO item = iterator.next();
// if (item.getMerchantCode().equals(userInfoVO.getMerchantCode())) {
// if (!mapMerchantId.containsKey(item.getChannel() + item.getMerchantId() + item.getMerchantCode())) {
// statusList.add(item);
// mapMerchantId.put(item.getChannel() + item.getMerchantId() + item.getMerchantCode(), 1);
// }
// if (Objects.equals(4, item.getChannel())) {
// if (userInfoVO.getWxMercNoD0() == null) {
// userInfoVO.setWxMercNoD0(item.getWxMercNo());
// } else {
// userInfoVO.setWxMercNoD0(userInfoVO.getWxMercNoD0() + " / " + item.getWxMercNo());
// }
//
// if (userInfoVO.getZfbMercNoD0() == null) {
// userInfoVO.setZfbMercNoD0(item.getZfbMercNo());
// } else {
// userInfoVO.setZfbMercNoD0(userInfoVO.getZfbMercNoD0() + " / " + item.getWxMercNo());
// }
// } else {
// userInfoVO.setWxMercNoD1(item.getWxMercNo());
// userInfoVO.setZfbMercNoD1(item.getZfbMercNo());
// }
//
// iterator.remove();
// }
// }
// }
//
// return pageResult;
// }
// public TbPlussMerchantChannelStatus getByMerchantCodeAndChannelType(String merchantCode, String channelType) {
// LambdaQueryWrapper<TbPlussMerchantChannelStatus> qWrapper = Wrappers.lambdaQuery();
// qWrapper.eq(TbPlussMerchantChannelStatus::getVirchannelflag, channelType);
// qWrapper.eq(TbPlussMerchantChannelStatus::getMerchantcode, merchantCode);
// qWrapper.eq(TbPlussMerchantChannelStatus::getAuthorizationstatus,1);
//
// return getOne(qWrapper);
// }
@Resource
private TbPlussMerchantChannelStatusMapper merchantChannelStatusMapper;
@Resource
private SxfMerchantAuditService sxfMerchantAuditService;
/**
* 后台进件
* @param userId
* @param channelId
* @param merchantCode
* @return
*/
public RespBody manualMerchantIncome(Integer userId, String channelId, String merchantCode){
//检查进件通道
if (ObjectUtil.isEmpty(channelId)){
return new RespBody("000080");
}
TbPlussMerchantChannelStatus merchantChannelStatus = merchantChannelStatusMapper.selectByPrimaryKey(Integer.valueOf(channelId));
if (ObjectUtil.isEmpty(merchantChannelStatus)){
return new RespBody("000081");
}
//通道互不干扰
if ("1".equals(channelId)) {
TbPlussMerchantChannelStatus sxfChannel = merchantChannelStatusMapper.selectByMerchantCode(merchantCode, 3);
if (sxfChannel != null || Objects.equals(sxfChannel.getChannel(),3)){
return new RespBody("000082");
}
}
if ("3".equals(channelId)) {
TbPlussMerchantChannelStatus ryxChannel = merchantChannelStatusMapper.selectByMerchantCode(merchantCode, 1);
if (ryxChannel != null && Objects.equals(ryxChannel.getChannel(), 1)) {
return new RespBody("000083");
}
}
//先查询该通道下是否有记录
TbPlussMerchantChannelStatus mcs = merchantChannelStatusMapper.selectByMerchantCode(merchantCode, Integer.valueOf(channelId));
if (mcs == null) {
return new RespBody("000084");
} else {
if (mcs.getChannel() != null) {
if (Integer.parseInt(channelId) == mcs.getChannel()
&& TbPlussMerchantChannelStatus.isAudited(mcs)) {
return new RespBody("000085");
}
}
}
TbPlussMerchantChannelStatus.checkCanAudit(mcs);
//选择通道
switch (channelId) {
case "1":
// 随行付
sxfMerchantAuditService.merchantAudit(String.valueOf(userId), false);
break;
// case "2":
// // 乐刷暂不支持
// leshuaMerchantAuditService.merchantAudit(userId, false);
// break;
// case "3":
// // 瑞银信
// ryxMerchantAuditService.merchantAudit(userId, false);
// break;
// case "4":
// // 银盛
// ysAuditServiceV3.merchantAuditV3(userId, false, 4);
// break;
// case "5":
// laKalaInterface.createTuoKeInfo(userId);
// break;
// case "6":
// ysAuditServiceV3.merchantAuditV3(userId, false, 6);
// break;
// default:
// MsgException.throwException("未知的进件通道");
}
return new RespBody("000000");
}
public TbPlussMerchantChannelStatus getValidData(String merchantCode){
if (StringUtils.isEmpty(merchantCode)) {
return null;
}
TbPlussMerchantChannelStatus mcs = merchantChannelStatusMapper.getIncomingInfo(TbPlussMerchantChannelStatus.AUDIT_STATUS_SUCCESS,
TbPlussMerchantChannelStatus.AUDIT_STATUS_DATA_EDIT, merchantCode);
if (mcs != null) {
return mcs;
}
return merchantChannelStatusMapper.getIncomingInfoAnother(merchantCode);
}
}

View File

@ -0,0 +1,108 @@
package com.chaozhanggui.admin.system.service;
import com.chaozhanggui.admin.system.model.CommonError;
import com.chaozhanggui.common.system.config.MsgException;
import com.chaozhanggui.dao.system.dao.TbPlussIdCardMapper;
import com.chaozhanggui.dao.system.dao.TbPlussMerchantBaseInfoMapper;
import com.chaozhanggui.dao.system.dao.TbPlussMerchantChannelStatusMapper;
import com.chaozhanggui.dao.system.dao.TbPlussMerchantImageMapper;
import com.chaozhanggui.dao.system.entity.*;
import com.chaozhanggui.dao.system.entity.DTO.AccountDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author lyf
*/
@Service
@Slf4j
public class MerchantImageService {
@Resource
private TbPlussMerchantBaseInfoMapper merchantBaseInfoMapper;
@Resource
private TbPlussMerchantImageMapper merchantImageMapper;
@Resource
private AccountService accountService;
@Resource
private TbPlussIdCardMapper idCardMapper;
/**
* 根据用户id获取进件图片信息, 包含结算信息等.
* 鉴于某些原因结算信息相关的图片不再实时保存到当前表中.
* 此方法就是用于获取进件需要的所有图片信息
*
* @param userId 用户id
* @param channelType 通道类型
* @return 进件图片资料
*/
List<TbPlussMerchantImage> getListOfMerch(String userId, String channelType){
TbPlussMerchantBaseInfo merchantBaseInfo = merchantBaseInfoMapper.selectByUserId(userId);
//查询图片
List<TbPlussMerchantImage> miList = merchantImageMapper.getListOfMerch(merchantBaseInfo.getMerchantcode());
AccountDTO accountDTO = accountService.getRealAccount(userId, channelType);
MsgException.checkNull(accountDTO.getIdcard(), CommonError.NO_ACCOUNT_ID_CARD);
MsgException.checkBlank(accountDTO.getIdcard().getImgpositive(), CommonError.NO_PART_ACCOUNT_ID_CARD_HEAD);
MsgException.checkBlank(accountDTO.getIdcard().getImgnegative(), CommonError.NO_PART_ACCOUNT_ID_CARD_EMBLEM);
MsgException.checkNull(accountDTO.getBankCard(), CommonError.NO_ACCOUNT_BANK_CARD);
if (accountDTO.getBankCard().getAccounttype().equals(TbPlussBankCard.ACCOUNT_TYPE_CORPORATE)) {
// 对公
MsgException.checkBlank(accountDTO.getBankCard().getLicenseurl(), CommonError.NO_ACCOUNT_BANK_CARD_LICENSE);
} else {
// 对私
MsgException.checkBlank(accountDTO.getBankCard().getImgurl(), CommonError.NO_ACCOUNT_BANK_CARD_IMG);
}
if (accountDTO.getSettletype().startsWith(TbPlussAccount.SETTLE_TYPE_PRIVATE_ILLEGAL)) {
// 非法人结算需要非法人授权函
MsgException.checkBlank(accountDTO.getCertificateurl(), CommonError.NO_ILLEGAL_ACCOUNT_CERTIFICATE_URL);
TbPlussMerchantImage mi = new TbPlussMerchantImage();
mi.setPicurl(accountDTO.getCertificateurl());
mi.setPhotoType(TbPlussMerchantImage.NON_LEG_SETTLE_AUTH);
miList.add(mi);
}
TbPlussMerchantImage mi = new TbPlussMerchantImage();
mi.setPicurl(accountDTO.getIdcard().getImgpositive());
mi.setPhotoType(TbPlussMerchantImage.SETTLE_IDCARD_FRONT);
miList.add(mi);
mi = new TbPlussMerchantImage();
mi.setPicurl(accountDTO.getIdcard().getImgnegative());
mi.setPhotoType(TbPlussMerchantImage.SETTLE_IDCARD_BACK);
miList.add(mi);
mi = new TbPlussMerchantImage();
if (accountDTO.getBankCard().getAccounttype().equals(TbPlussBankCard.ACCOUNT_TYPE_CORPORATE)) {
mi.setPicurl(accountDTO.getBankCard().getLicenseurl());
mi.setPhotoType(TbPlussMerchantImage.ACCOUNT_PERMITS);
} else {
mi.setPicurl(accountDTO.getBankCard().getImgurl());
mi.setPhotoType(TbPlussMerchantImage.BANK_CARD_FRONT);
}
miList.add(mi);
TbPlussIdCard legalIdCard = idCardMapper.getLegalIdCard(userId);
if (legalIdCard == null) {
legalIdCard = accountDTO.getIdcard();
}
mi = new TbPlussMerchantImage();
mi.setPicurl(legalIdCard.getImgpositive());
mi.setPhotoType(TbPlussMerchantImage.IDCARD_FRONT);
miList.add(mi);
mi = new TbPlussMerchantImage();
mi.setPicurl(legalIdCard.getImgnegative());
mi.setPhotoType(TbPlussMerchantImage.IDCARD_BACK);
miList.add(mi);
return miList;
}
}

View File

@ -0,0 +1,42 @@
package com.chaozhanggui.admin.system.service;
import com.chaozhanggui.common.system.config.MsgException;
import com.chaozhanggui.dao.system.dao.TbPlussRegionCodeSxfMapper;
import com.chaozhanggui.dao.system.entity.TbPlussRegionCodeSxf;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 不同通道的地区表映射表 服务类
* @author lyf
*/
@Service
@Slf4j
public class RegionReflectService {
@Resource
private TbPlussRegionCodeSxfMapper regionCodeSxfMapper;
/**
* 获取随行付地区code信息
*
* @param province
* @param city
* @param area /
* @return 地区信息
*/
public TbPlussRegionCodeSxf getSxfRegionCode(String province, String city, String area){
try {
TbPlussRegionCodeSxf regionCodeYs = regionCodeSxfMapper.selectRegionCode(province, city, area);
if (regionCodeYs == null) {
throw new MsgException("随行付获取地区信息异常");
}
return regionCodeYs;
} catch (Exception e) {
e.printStackTrace();
log.error("===随行付获取地区信息异常===");
throw new MsgException("随行付获取地区信息异常");
}
}
}

View File

@ -23,6 +23,8 @@ import java.util.List;
public class SxfMccInfoService{
@Resource
private TbPlussBankCodeSxfMapper bankCodeSxfMapper;
@Resource
private TbPlussSxfMccInfoMapper sxfMccInfoMapper;
public RespBody pageData(Integer current, Integer size,String keyWord){
PageHelper.startPage(current,size);
@ -30,5 +32,13 @@ public class SxfMccInfoService{
PageInfo pageInfo = new PageInfo(list);
return new RespBody("000000",pageInfo);
}
public TbPlussSxfMccInfo getByMccCode(String mccCode) {
List<TbPlussSxfMccInfo> sxfMccInfos = sxfMccInfoMapper.selectList(mccCode);
if (sxfMccInfos == null || sxfMccInfos.size() == 0) {
return null;
}
return sxfMccInfos.get(0);
}
}

View File

@ -0,0 +1,575 @@
package com.chaozhanggui.admin.system.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.chaozhanggui.admin.system.util.RSAUtils;
import com.chaozhanggui.admin.system.util.SignUtils;
import com.chaozhanggui.admin.system.util.StringUtil;
import com.chaozhanggui.common.system.config.MsgException;
import com.chaozhanggui.common.system.config.channel.SxfConfig;
import com.chaozhanggui.common.system.util.FileUtil;
import com.chaozhanggui.common.system.util.ParametersUtil;
import com.chaozhanggui.dao.system.dao.*;
import com.chaozhanggui.dao.system.entity.*;
import com.chaozhanggui.dao.system.entity.DTO.AccountDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.*;
/**
* @author lyf
*/
@Service
@Slf4j
public class SxfMerchantAuditService extends BaseMerchantAuditService{
@Resource
private TbPlussMerchantBaseInfoMapper merchantBaseInfoMapper;
@Resource
private TbPlussMerchantChannelStatusMapper merchantChannelStatusMapper;
@Resource
private TbPlussMerchantAuditRecordMapper merchantAuditRecordMapper;
@Resource
private MerchantImageService merchantImageService;
@Resource
private SxfMccInfoService sxfMccInfoService;
@Resource
private RegionReflectService regionReflectService;
@Resource
private TbPlussIdCardMapper idCardMapper;
@Resource
private TbPlussBankCodeSxfMapper bankCodeSxfMapper;
@Transactional(rollbackFor = Exception.class)
public void merchantAudit(String userId, boolean isFailCheck) {
//进件检测
merchantAuditCheck(userId,isFailCheck);
TbPlussMerchantBaseInfo merchantBaseInfo = merchantBaseInfoMapper.selectByUserId(userId);
TbPlussMerchantChannelStatus mcs = merchantChannelStatusMapper.getByMerchantCode(merchantBaseInfo.getMerchantcode(),"1");
JSONObject reqData = new JSONObject();
// 判断是第一次进件是入驻修改还是第一次进件
String targetUrl;
MsgException.checkNull(mcs, "商户未提交审核");
String status = mcs.getStatus();
String thirdStatus = mcs.getThirdstatus();
String merchantId = mcs.getMerchantid();
if (status.equals(TbPlussMerchantChannelStatus.AUDIT_STATUS_EXAMINING) && !thirdStatus.equals(TbPlussMerchantChannelStatus.AUDIT_THIRD_STATUS_WAITING)) {
MsgException.throwException("进件审核中,请等待审核结果");
}
if (TbPlussMerchantChannelStatus.isAudited(mcs)) {
MsgException.throwException("商户已进件成功,请勿重复进件");
}
if (StringUtils.isEmpty(merchantId)) {
// 初次进件
targetUrl = SxfConfig.SXF_MERCHANT_INCOME;
} else {
// 进件失败数据修改
targetUrl = SxfConfig.SXF_UPADTE_MERCHANT_RZ;
reqData.put("mno", merchantId);
}
// step 1组合请求数据
reqData.putAll(getMerchantAuditInfo(userId, merchantBaseInfo, mcs));
reqData.put("callbackUrl", ParametersUtil.domain + "/api/auditCallback/sxf");
//支付宝通道ID
reqData.put("specifyALiPayChannel", ParametersUtil.alipayChannel);
log.info("{}随行付进件参数{}", userId, JSON.toJSONString(reqData));
// step 2调取通用请求
JSONObject resultMap = requestApi(targetUrl, reqData);
// 请求成功, 验证签名
try {
checkSign(resultMap);
} catch (Exception e) {
MsgException.throwException(e.getMessage());
}
MsgException.checkUnequals(SxfConfig.SXF_SUCCESS_CODE, resultMap.get("code"), "进件失败," + resultMap.get("msg"));
// 业务成功
JSONObject respData = resultMap.getJSONObject("respData");
MsgException.checkUnequals(SxfConfig.SXF_SUCCESS_CODE, respData.get("bizCode"), "进件失败," + respData.get("bizMsg"));
Date date = new Date();
String applicationId = respData.getString("applicationId");
String mno = respData.getString("mno");
mcs.setChannel(1);
mcs.setUpdatetime(date);
mcs.setMerchantcode(merchantBaseInfo.getMerchantcode());
mcs.setStatus("1");
mcs.setThirdstatus("");
mcs.setCallbackstatus("0");
mcs.setRemark("随行付审核中");
mcs.setApplicationid(applicationId);
mcs.setMerchantid(mno);
TbPlussMerchantAuditRecord merchantAuditRecord = new TbPlussMerchantAuditRecord();
merchantAuditRecord.setStatus("1");
merchantAuditRecord.setMerchantcode(merchantBaseInfo.getMerchantcode());
merchantAuditRecord.setChannel(1);
merchantAuditRecord.setThirdstatus("");
merchantAuditRecord.setMerchantid(mno);
merchantAuditRecordMapper.insert(merchantAuditRecord);
if (StringUtil.isNotEmpty(mcs.getId())) {
merchantChannelStatusMapper.updateByPrimaryKeySelective(mcs);
} else {
// 保存进件信息
merchantChannelStatusMapper.insertSelective(mcs);
}
}
private JSONObject getMerchantAuditInfo(String userId, TbPlussMerchantBaseInfo merchantBaseInfo, TbPlussMerchantChannelStatus merchantChannelStatus) {
// step 1组合请求数据
JSONObject reqData = new JSONObject();
MsgException.checkBlank(merchantBaseInfo.getMerchanttype(), "请先填写商户资料");
AccountDTO accountDTO = accountService.getAccount(userId);
List<TbPlussMerchantImage> merchantChannelImgList = merchantImageService.getListOfMerch(userId, TbPlussAccount.CHANNEL_TYPE_D1);
for (TbPlussMerchantImage merchantImage : merchantChannelImgList) {
// 兼容老通道用户切换通道后没有相关的图片链接
if (StringUtils.isEmpty(merchantImage.getPhotourl())) {
imageUpload(merchantImage);
}
}
combineMerchantBaseInfo(reqData, merchantBaseInfo);
combineCommon(reqData);
combineBankInfo(reqData, userId);
// 添加添加账户类型判断此处可能是图片驳回故需要自己添加账号类型判断
String actTyp = TbPlussBankCard.ACCOUNT_TYPE_CORPORATE.equals(accountDTO.getBankCard().getAccounttype()) ? "00" : "01";
combineImage(reqData, merchantChannelImgList, actTyp, merchantBaseInfo.getMerchanttype());
// 入驻图片修改去掉不能传的参数
if (merchantChannelStatus != null && TbPlussMerchantChannelStatus.AUDIT_STATUS_REVIEW_REJECT.equals(merchantChannelStatus.getStatus())) {
reqData.remove("operationalType");
reqData.remove("haveLicenseNo");
reqData.remove("mecTypeFlag");
reqData.remove("parentMno");
reqData.remove("independentModel");
reqData.remove("qrcodeList");
reqData.remove("bankCardRates");
reqData.remove("settleType");
reqData.remove("clearTimeSts");
reqData.remove("clearTime");
reqData.remove("supportPayChannels");
reqData.remove("supportTradeTypes");
reqData.remove("activityType");
reqData.remove("specifyWechatChannel");
reqData.remove("specifyALiPayChannel");
reqData.remove("onlineType");
reqData.remove("onlineName");
reqData.remove("onlineTypeInfo");
reqData.remove("cprRegNmCn");
reqData.remove("registCode");
reqData.remove("licenseMatch");
reqData.remove("orgCode");
reqData.remove("taxRegNo");
reqData.remove("businessLicStt");
reqData.remove("businessLicEnt");
reqData.remove("identityName");
reqData.remove("identityTyp");
reqData.remove("identityNo");
reqData.remove("legalPersonLicStt");
reqData.remove("legalPersonLicEnt");
reqData.remove("actNm");
reqData.remove("actTyp");
reqData.remove("stmManIdNo");
reqData.remove("accountLicStt");
reqData.remove("accountLicEnt");
}
return reqData;
}
/**
* 向随行付发送请求
* @param url
* @param reqData
* @return
*/
public JSONObject requestApi(String url, JSONObject reqData) {
RestTemplate restTemplate = new RestTemplate();
try {
JSONObject paramMap = new JSONObject();
paramMap.put("orgId", SxfConfig.ORG_ID);
paramMap.put("reqId", UUID.randomUUID().toString().replaceAll("-", ""));
paramMap.put("version", "1.0");
paramMap.put("timestamp", DateFormatUtils.format(new Date(), "yyyyMMddHHmmss"));
paramMap.put("reqData", reqData);
paramMap.put("signType", "RSA");
String signContent = SignUtils.getSignContent(paramMap);
paramMap.put("sign", RSAUtils.sign(SxfConfig.PRIVATE_KEY, signContent));
log.info("===================>【随行付】请求参数:{}<================",paramMap);
ResponseEntity<JSONObject> responseEntity = restTemplate.postForEntity(url, paramMap, JSONObject.class);
// 检查网络请求状态
if (!HttpStatus.OK.equals(responseEntity.getStatusCode())) {
throw new MsgException("请求失败,请求状态异常");
}
log.info("=============return_info============");
if (responseEntity.getBody() != null) {
log.info(responseEntity.getBody().toJSONString());
}
return responseEntity.getBody();
} catch (Exception e) {
e.printStackTrace();
throw new MsgException("随行付接口异常");
}
}
/**
* 随行付验签
* @param receiveData
* @throws Exception
*/
public void checkSign(JSONObject receiveData) throws Exception {
if (receiveData == null || receiveData.getString("sign") == null) {
throw new MsgException("未知数据");
}
String srcData = SignUtils.getSignContent(receiveData);
boolean sign = RSAUtils.checkSign(SxfConfig.PUBLIC_KEY, srcData, receiveData.getString("sign"));
if (!sign) {
throw new IllegalArgumentException("商户入驻回调接口验签不通过");
}
}
/**
* @param merchantImage 上传图片信息
* orgId - 机构编号;
* reqId - 请求id, uuid;
* pictureType - 照片类型; 具体类型参照随行付文档;
* file - 图片文件, 文件格式为mutilpartfile, 文件名为file
*/
public void imageUpload(TbPlussMerchantImage merchantImage) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
byte[] bytes;
try {
bytes = FileUtil.url2Bytes(merchantImage.getPicurl());
} catch (Exception e) {
e.printStackTrace();
throw new MsgException("图片读取失败");
}
ByteArrayResource contentsAsResource = new ByteArrayResource(bytes) {
@Override
public String getFilename() {
return UUID.randomUUID().toString().replace("-", "") + ".jpg";
}
};
paramMap.add("file", contentsAsResource);
paramMap.add("orgId", SxfConfig.ORG_ID);
paramMap.add("pictureType", imgTypeTransform(merchantImage.getPhotoType()));
HttpEntity<MultiValueMap<String, Object>> request = new HttpEntity<>(paramMap, headers);
RestTemplate restTemplate = new RestTemplate();
JSONObject responseJson = restTemplate.postForObject(SxfConfig.SXF_MERCHANT_INCOME_PHOTO_UPLOAD, request, JSONObject.class);
MsgException.checkNull(responseJson, "请求失败");
log.info("upload response : {}", responseJson.toJSONString());
MsgException.checkUnequals(SxfConfig.SXF_SUCCESS_CODE, responseJson.get("code"), "请求失败");
JSONObject respData = responseJson.getJSONObject("respData");
MsgException.checkNull(respData, "上传图片失败");
MsgException.checkUnequals(SxfConfig.SXF_SUCCESS_CODE, respData.get("bizCode"), respData.getString("bizMsg"));
Date date = new Date();
merchantImage.setPhotourl(respData.getString("PhotoUrl"));
}
/**
* 图片类型转换源照片类型主要为乐刷定义的图片类型参考MerchantImage
*
* @param imageType 图片类型
* @return 对应通道的图片定义类型
*/
public String imgTypeTransform(String imageType) {
switch (imageType) {
case TbPlussMerchantImage.IDCARD_FRONT:
return TbPlussMerchantImage.IDCARD_FRONT;
case TbPlussMerchantImage.IDCARD_BACK:
return TbPlussMerchantImage.IDCARD_BACK;
case TbPlussMerchantImage.SETTLE_IDCARD_FRONT:
return TbPlussMerchantImage.SETTLE_IDCARD_FRONT;
case TbPlussMerchantImage.SETTLE_IDCARD_BACK:
return TbPlussMerchantImage.SETTLE_IDCARD_BACK;
case TbPlussMerchantImage.BANK_CARD_BACK:
return TbPlussMerchantImage.BANK_CARD_BACK;
case TbPlussMerchantImage.BANK_CARD_FRONT:
return TbPlussMerchantImage.BANK_CARD_FRONT;
case TbPlussMerchantImage.BUSINESS_LICENSE:
return TbPlussMerchantImage.BUSINESS_LICENSE;
case TbPlussMerchantImage.ACCOUNT_PERMITS:
return TbPlussMerchantImage.ACCOUNT_PERMITS;
case TbPlussMerchantImage.NON_LEG_SETTLE_AUTH:
return TbPlussMerchantImage.NON_LEG_SETTLE_AUTH;
case TbPlussMerchantImage.SHOP_FRONT_DOOR:
return TbPlussMerchantImage.SHOP_FRONT_DOOR;
case TbPlussMerchantImage.CASH_DESK_PHOTO:
return TbPlussMerchantImage.CASH_DESK_PHOTO;
case TbPlussMerchantImage.STORE_INTERIOR_PHOTO:
return TbPlussMerchantImage.STORE_INTERIOR_PHOTO;
default:
return TbPlussMerchantImage.OTHER;
}
}
private void combineMerchantBaseInfo(Map<String, Object> map, TbPlussMerchantBaseInfo merchantBaseInfo) {
String mcc = merchantBaseInfo.getMcc();
TbPlussSxfMccInfo sxfMccInfo = sxfMccInfoService.getByMccCode(mcc);
map.put("mecDisNm", merchantBaseInfo.getAlias());
map.put("mblNo", merchantBaseInfo.getContactmobile());
if (sxfMccInfo == null) {
map.put("operationalType", "01");
} else {
// 判断经营类型
switch (sxfMccInfo.getfMccType()) {
case "线上":
//TODO 如果渠道判定魏线上则 onlineType onlineName为必填
map.put("operationalType", "02");
break;
case "非盈利":
map.put("operationalType", "03");
break;
case "缴费类":
map.put("operationalType", "04");
break;
case "保险":
map.put("operationalType", "05");
break;
case "私立院校":
map.put("operationalType", "06");
break;
default:
map.put("operationalType", "01");
break;
}
}
// 商户类型
switch (merchantBaseInfo.getMerchanttype()) {
case "1":
map.put("haveLicenseNo", "01");
map.put("actTyp", "01");
break;
case "2":
map.put("haveLicenseNo", "02");
map.put("registCode", merchantBaseInfo.getBussauthnum());
map.put("cprRegNmCn", merchantBaseInfo.getBussauthname());
break;
case "3":
map.put("haveLicenseNo", "03");
map.put("registCode", merchantBaseInfo.getBussauthnum());
map.put("cprRegNmCn", merchantBaseInfo.getBussauthname());
map.put("licenseMatch", "00");
break;
default:
throw new MsgException("未知商户类型");
}
map.put("mecTypeFlag", "00");
map.put("cprRegAddr", merchantBaseInfo.getAddress());
String province = merchantBaseInfo.getProvince();
String city = merchantBaseInfo.getCity();
String area = merchantBaseInfo.getDistrict();
TbPlussRegionCodeSxf regionCodeSxf = regionReflectService.getSxfRegionCode(province, city, area);
map.put("regProvCd", regionCodeSxf.getProvincecode());
map.put("regCityCd", regionCodeSxf.getCitycode());
map.put("regDistCd", regionCodeSxf.getAreacode());
map.put("mccCd", mcc);
map.put("csTelNo", merchantBaseInfo.getContactmobile());
}
private void combineCommon(Map<String, Object> map) {
Map<String, Object> rateMap = new HashMap<>();
List<Map<String, Object>> qrCodeList = new LinkedList<>();
// 微信
rateMap.put("rate", "0.38");
rateMap.put("rateType", "01");
qrCodeList.add(rateMap);
// 支付宝
rateMap = new HashMap<>();
rateMap.put("rate", "0.38");
rateMap.put("rateType", "02");
qrCodeList.add(rateMap);
// 银联小于1000
rateMap = new HashMap<>();
rateMap.put("rate", "0.40");
rateMap.put("rateType", "06");
qrCodeList.add(rateMap);
// 银联大于1000
rateMap = new HashMap<>();
rateMap.put("rate", "0.6");
rateMap.put("rateType", "07");
qrCodeList.add(rateMap);
map.put("qrcodeList", qrCodeList);
// 03 T1 04 D1
map.put("settleType", "04");
}
/**
* 组合银行卡信息 必须的在combineMerchantBaseInfo之后调用
*
* @param paramMap 组合的数据
* @param userId 用户id
*/
private void combineBankInfo(Map<String, Object> paramMap, String userId) {
// 结算信息
AccountDTO accountDTO = accountService.getRealAccount(userId);
MsgException.checkNull(accountDTO, "请完善结算信息");
// 实名信息
TbPlussIdCard certIdCard = idCardMapper.selectCertByUserId(Integer.valueOf(userId),TbPlussIdCard.TYPE_CERT);
TbPlussIdCard inChargeIdCard;
if (TbPlussAccount.SETTLE_TYPE_MICRO_STORE.equals(accountDTO.getSettletype())) {
// 小微商户 - 结算信息中的身份信息即商户负责人信息
inChargeIdCard = accountDTO.getIdcard();
} else {
// 其他的负责人信息是法人信息
inChargeIdCard = idCardMapper.getLegalIdCard(userId);
}
TbPlussBankCard bankCard = accountDTO.getBankCard();
paramMap.put("identityName", inChargeIdCard.getCertname());
paramMap.put("identityTyp", inChargeIdCard.getCerttype());
paramMap.put("identityNo", inChargeIdCard.getCertno());
if ("01".equals(paramMap.get("haveLicenseNo"))) {
// 小微商户
paramMap.put("stmManIdNo", certIdCard.getCertno());
paramMap.put("actTyp", "01");
} else {
// 非小微商户可以
paramMap.put("actTyp", TbPlussBankCard.ACCOUNT_TYPE_CORPORATE.equals(bankCard.getAccounttype()) ? "00" : "01");
if (accountDTO.getSettletype() == null) {
throw new MsgException("缺少结算信息(若无填写结算信息界面请更新app)");
}
TbPlussIdCard idCard = accountDTO.getIdcard();
if (idCard == null) {
idCard = certIdCard;
}
// 对私需要传递
if ("01".equals(paramMap.get("actTyp"))) {
paramMap.put("stmManIdNo", idCard.getCertno());
}
}
paramMap.put("actNm", bankCard.getBankholder());
paramMap.put("actNo", bankCard.getBankcardno());
paramMap.put("accountLicStt", inChargeIdCard.getCertstarttime());
paramMap.put("accountLicEnt", inChargeIdCard.getCertendtime());
QueryWrapper<TbPlussBankCodeSxf> queryWrapper = new QueryWrapper<TbPlussBankCodeSxf>()
.eq("cnaps_code", bankCard.getContactline());
TbPlussBankCodeSxf bankCodeSxf = bankCodeSxfMapper.selectOne(queryWrapper);
// 银行code
paramMap.put("depoBank", bankCodeSxf.getBankCode());
// 省份code
paramMap.put("depoProvCd", bankCodeSxf.getProvinceCode());
// 城市code
paramMap.put("depoCityCd", bankCodeSxf.getCityCode());
// 联行号
paramMap.put("lbnkNo", bankCodeSxf.getCnapsCode());
}
private void combineImage(Map<String, Object> paramMap, List<TbPlussMerchantImage> merchantImageList, String actTyp, String merchantType) {
for (TbPlussMerchantImage merchantImage : merchantImageList) {
combineImage(paramMap, merchantImage, actTyp, merchantType);
}
}
private void combineImage(Map<String, Object> paramMap, TbPlussMerchantImage merchantImage, String actTyp, String merchantType) {
// 非小微商户必须传营业执照
switch (merchantImage.getPhotoType()) {
case TbPlussMerchantImage.IDCARD_FRONT:
// 法人身份证正面
paramMap.put("legalPersonidPositivePic", merchantImage.getPhotourl());
break;
case TbPlussMerchantImage.IDCARD_BACK:
paramMap.put("legalPersonidOppositePic", merchantImage.getPhotourl());
break;
case TbPlussMerchantImage.SETTLE_IDCARD_FRONT:
if (TbPlussBankCard.ACCOUNT_TYPE_PRIVATE.equals(paramMap.get("actTyp"))) {
// 对私需要传结算人身份证
paramMap.put("settlePersonIdcardPositive", merchantImage.getPhotourl());
}
break;
case TbPlussMerchantImage.SETTLE_IDCARD_BACK:
if (TbPlussBankCard.ACCOUNT_TYPE_PRIVATE.equals(paramMap.get("actTyp"))) {
// 对私需要传结算人身份证
paramMap.put("settlePersonIdcardOpposite", merchantImage.getPhotourl());
}
break;
case TbPlussMerchantImage.SHOP_FRONT_DOOR:
paramMap.put("storePic", merchantImage.getPhotourl());
break;
case TbPlussMerchantImage.STORE_INTERIOR_PHOTO:
paramMap.put("insideScenePic", merchantImage.getPhotourl());
break;
case TbPlussMerchantImage.ACCOUNT_PERMITS:
if (!"01".equals(actTyp)) {
// 对公结算需传开户许可证
paramMap.put("openingAccountLicensePic", merchantImage.getPhotourl());
}
break;
case TbPlussMerchantImage.BANK_CARD_FRONT:
if ("01".equals(actTyp)) {
// 对私需要传银行卡
paramMap.put("bankCardPositivePic", merchantImage.getPhotourl());
}
break;
case TbPlussMerchantImage.BUSINESS_LICENSE:
if (!"1".equals(merchantType)) {
paramMap.put("licensePic", merchantImage.getPhotourl());
}
break;
case TbPlussMerchantImage.NON_LEG_SETTLE_AUTH:
// 对私 结算人与法人的身份证证件不一致时需要提交
if (TbPlussBankCard.ACCOUNT_TYPE_PRIVATE.equals(paramMap.get("actTyp")) && !paramMap.get("identityNo").equals(paramMap.get("stmManIdNo"))) {
paramMap.put("letterOfAuthPic", merchantImage.getPhotourl());
}
break;
default:
break;
}
}
}

View File

@ -585,7 +585,7 @@ public class Userservice {
TbPlussUserAccount userAccount= tbPlussUserAccountMapper.selectByPrimaryKey(Integer.valueOf(userId));
if(ObjectUtil.isEmpty(userAccount)|| N.gt(amount,userAccount.getBalance().subtract(userAccount.getFreezeBalance()))){
log.error("可提余额不足:{},{},{}",userId,amount,userAccount.getBalance().subtract(userAccount.getFreezeBalance()));
log.error("可提余额不足:{},{}",userId,amount);
return new RespBody("000029");
}

View File

@ -0,0 +1,214 @@
package com.chaozhanggui.admin.system.util;
import com.aliyun.oss.ServiceException;
import com.chaozhanggui.common.system.config.MsgException;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
/**
* @author rsa加密解密签名验签工具类
*/
public class RSAUtils {
private RSAUtils() {}
public static final String RSA = "RSA";
public static final String CIPHERALGORITHM = "RSA/ECB/PKCS1Padding";
public static String sign(String privateKey, String src) throws Exception {
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) getPrivateKey(privateKey);
return sign(rsaPrivateKey, src);
}
public static boolean checkSign(String publicKey, String src, String sign) throws Exception {
RSAPublicKey rsaPublicKey = (RSAPublicKey) getPublicKey(publicKey);
return checkSign(rsaPublicKey, src, sign);
}
public static String signSHA256(String privateKey, String src) throws Exception {
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) getPrivateKey(privateKey);
return signSHA256WithRSA(rsaPrivateKey, src);
}
public static boolean checkSignSHA256(String publicKey, String src, String sign) throws Exception {
RSAPublicKey rsaPublicKey = (RSAPublicKey) getPublicKey(publicKey);
return checkSignSHA256WithRSA(rsaPublicKey, src, sign);
}
/**
* 私钥签名过程
*
* @param rsaPrivateKey 私钥
* @param plainTextData 明文数据
* @return
* @throws Exception 加密过程中的异常信息
*/
public static String sign(RSAPrivateKey rsaPrivateKey, String plainTextData) throws Exception {
if (rsaPrivateKey == null) {
throw new MsgException("签名私钥为空, 请设置");
}
Signature signature = Signature.getInstance("SHA1withRSA");
signature.initSign(rsaPrivateKey);
signature.update(plainTextData.getBytes());
byte[] result = signature.sign();
return Base64.getEncoder().encodeToString(result);
}
/**
* 私钥签名过程
*
* @param rsaPrivateKey 私钥
* @param plainTextData 明文数据
* @return
* @throws Exception 加密过程中的异常信息
*/
public static String signSHA256WithRSA(RSAPrivateKey rsaPrivateKey, String plainTextData) throws Exception {
if (rsaPrivateKey == null) {
throw new MsgException("签名私钥为空, 请设置");
}
Signature signature = Signature.getInstance("SHA256withRSA");
signature.initSign(rsaPrivateKey);
signature.update(plainTextData.getBytes());
byte[] result = signature.sign();
return Base64.getEncoder().encodeToString(result);
}
public static boolean checkSign(RSAPublicKey rsaPublicKey, String src, String sign) throws Exception {
Signature signature = Signature.getInstance("SHA1withRSA");
signature.initVerify(rsaPublicKey);
signature.update(src.getBytes(StandardCharsets.UTF_8));
return signature.verify(Base64.getDecoder().decode(sign));
}
public static boolean checkSignSHA256WithRSA(RSAPublicKey rsaPublicKey, String src, String sign) throws Exception {
Signature signature = Signature.getInstance("SHA256withRSA");
signature.initVerify(rsaPublicKey);
signature.update(src.getBytes(StandardCharsets.UTF_8));
return signature.verify(Base64.getDecoder().decode(sign));
}
public static PublicKey getPublicKey(String key) throws Exception {
byte[] keyBytes;
keyBytes = Base64.getDecoder().decode(key);
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(RSA);
return keyFactory.generatePublic(keySpec);
}
public static PrivateKey getPrivateKey(String key) throws Exception {
byte[] keyBytes;
keyBytes = Base64.getMimeDecoder().decode(key);
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(RSA);
return keyFactory.generatePrivate(keySpec);
}
/**
* 公钥加密过程
*
* @param rsaPublicKey 公钥
* @param plainTextData 明文数据
* @return
* @throws Exception 加密过程中的异常信息
*/
public static String encrypt(RSAPublicKey rsaPublicKey, String plainTextData) throws Exception {
if (rsaPublicKey == null) {
throw new MsgException("加密公钥为空, 请设置");
}
Base64.Encoder encoder = Base64.getEncoder();
Cipher cipher = Cipher.getInstance(RSA);
cipher.init(Cipher.ENCRYPT_MODE, rsaPublicKey);
byte[] output = cipher.doFinal(plainTextData.getBytes(StandardCharsets.UTF_8));
return encoder.encodeToString(output);
}
/**
* 使用私钥解密
* @param rsaPrivateKey 私钥
* @param encryptParam 公钥加密的字符串
* @return 解密后的字符串
* */
public static String decrypt(RSAPrivateKey rsaPrivateKey,String encryptParam) throws Exception {
Base64.Decoder decoder = Base64.getDecoder();
Base64.Encoder encoder = Base64.getEncoder();
Cipher cipher;
try {
cipher = Cipher.getInstance(RSA);
cipher.init(Cipher.DECRYPT_MODE, rsaPrivateKey);
byte[] output = cipher.doFinal(decoder.decode(encryptParam));
return new String(output, StandardCharsets.UTF_8);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* Ecb解密
* @param encryptedBytes
* @param privateKey
* @param keyLength
* @param reserveSize
* @return
*/
public static byte[] decryptEcb(byte[] encryptedBytes, PrivateKey privateKey, int keyLength, int reserveSize) throws ServiceException {
int keyByteSize = keyLength / 8; // 密钥字节数
int decryptBlockSize = keyByteSize - reserveSize; // 解密块大小=密钥字节数-padding填充字节数
int nBlock = encryptedBytes.length / keyByteSize;// 计算分段解密的block数理论上能整除
try {
Cipher cipher = Cipher.getInstance(CIPHERALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, privateKey);
// 输出buffer大小为nBlock个decryptBlockSize
ByteArrayOutputStream outbuf = new ByteArrayOutputStream(nBlock * decryptBlockSize);
// 分段解密
for (int offset = 0; offset < encryptedBytes.length; offset += keyByteSize) {
// block大小: decryptBlock 剩余字节数
int inputLen = encryptedBytes.length - offset;
if (inputLen > keyByteSize) {
inputLen = keyByteSize;
}
// 得到分段解密结果
byte[] decryptedBlock = cipher.doFinal(encryptedBytes, offset, inputLen);
// 追加结果到输出buffer中
outbuf.write(decryptedBlock);
}
outbuf.flush();
outbuf.close();
return outbuf.toByteArray();
} catch (NoSuchAlgorithmException e) {
throw new ServiceException(String.format("没有[%s]此类解密算法", CIPHERALGORITHM));
} catch (NoSuchPaddingException e) {
throw new ServiceException(String.format("没有[%s]此类填充模式", CIPHERALGORITHM));
} catch (InvalidKeyException e) {
throw new ServiceException("无效密钥");
} catch (IllegalBlockSizeException e) {
throw new ServiceException("解密块大小不合法");
} catch (BadPaddingException e) {
throw new ServiceException("错误填充模式");
} catch (IOException e) {
throw new ServiceException("字节输出流异常");
}
}
}

View File

@ -1,21 +1,42 @@
package com.chaozhanggui.common.system.config;
import com.chaozhanggui.common.system.util.ParametersUtil;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
/**
* 配置参数接收实体类
* @author lyf
*/
@Data
@Configuration
@PropertySource("classpath:application-common.yml")
@Component
public class ParameterConfig {
/**
* 阿里自用型应用appid
*/
@Value("${parameter.ZY_ALI_APP_ID}")
public String ZY_ALI_APP_ID;
/**
* 正式服务器域名
*/
@Value("${parameter.domain}")
public String domain;
/**
* 支付宝通道ID
*/
@Value("${parameter.alipayChannel}")
public String alipayChannel;
@PostConstruct
public void init() {
ParametersUtil.domain = domain;
ParametersUtil.alipayChannel = alipayChannel;
}
}

View File

@ -0,0 +1,219 @@
package com.chaozhanggui.common.system.config.channel;
import com.alibaba.fastjson.JSONObject;
/**
* @author lyf
*/
public class SxfConfig {
/**
* 微信实名认证接口前缀
*/
private static final String SXF_CERT_DOMAIN = "https://openapi.suixingpay.com";
/**
* 微信实名认证接口
*/
public static final String SXF_WX_CERT = SXF_CERT_DOMAIN + "/merchant/realName/commitApply";
/**
* 查询微信认证授权状态
*/
public static final String SXF_WX_CERT_STATUS = SXF_CERT_DOMAIN + "/merchant/realName/queryGrantStatus";
/**
* 微信实名认证申请结果查询接口
*/
public static final String SXF_WX_CERT_RESULT = SXF_CERT_DOMAIN + "/merchant/realName/queryApplyInfo";
/**
* 微信实名认证申请撤销接口
*/
public static final String SXF_WX_CERT_CANCEL = SXF_CERT_DOMAIN + "/merchant/realName/backApplyBill";
public static String PRIVATE_KEY =
"MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAMRFhTpr+JWtfhHZ80UJcnDCMeydtcF38S5s+WdifTYNMequFN6uRYoSFJqzQrR0ls7/ZAjUFP/dZL0QJAsWlnRLLSvPsgUU/DzAF7myl6/swuK4eo9frwAYP4ItQcP+DsHBUFnqUbWUON8C3M5ggY92qKfKV1k59tVnFVjoPhbbAgMBAAECgYAzL/5jEi2uu6SZe0Iayy/xgHQMxcTVRDa+aOVStTj6k85k6im/OawhKj39aqsG7TE3oxuvwcAISvEu7bq4uZdbICPdeKLcfNpK4pIfVfokPROjlKSyDgm37gqM7F+T0ZoARVqcd7Mgj09UKKpq7Pi0a/FusEa5CdG2LrUTjZuHIQJBAOFzolrGsPsWaVMpoYGeRY2UrT0PjfXJ1E7nkHqLXCCgfrur374YEEWeLtjHCI6zaXgv/3Coj3USAhKMw4lDAYcCQQDe3bL3szwkGdUmZk61ebY7HanilKnIYNuhC9ALUEElDp2eA1ld5cQvRb4BAeNsvabptt2lRPcscFu9zvH0DaUNAkEAww8HAz8xVKyZSAiW4cyMJOjj0hapHmUXOYWELWJxvRDfVYRpOtEbEwC/S3M45i44LHJqsZBFPmbsQBxl+VZt9QJBAL2tD+EywU+0UK2SyxA2mzqq32iAwBNTI/lnlVPbpOYGD21pSkjZAWR+RdyTn9xveLxWr0M2c+t1YQ8lLtVYO40CQQC2pVlYu5BIvXClLj6pHxwrK9G3JgwaanbEPFX0PjIJmU94QSLUd4OtDhvbXq43E5dlyvz5ybYvd8pygmjV9oM5";
//"MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAMRFhTpr+JWtfhHZ80UJcnDCMeydtcF38S5s+WdifTYNMequFN6uRYoSFJqzQrR0ls7/ZAjUFP/dZL0QJAsWlnRLLSvPsgUU/DzAF7myl6/swuK4eo9frwAYP4ItQcP+DsHBUFnqUbWUON8C3M5ggY92qKfKV1k59tVnFVjoPhbbAgMBAAECgYAzL/5jEi2uu6SZe0Iayy/xgHQMxcTVRDa+aOVStTj6k85k6im/OawhKj39aqsG7TE3oxuvwcAISvEu7bq4uZdbICPdeKLcfNpK4pIfVfokPROjlKSyDgm37gqM7F+T0ZoARVqcd7Mgj09UKKpq7Pi0a/FusEa5CdG2LrUTjZuHIQJBAOFzolrGsPsWaVMpoYGeRY2UrT0PjfXJ1E7nkHqLXCCgfrur374YEEWeLtjHCI6zaXgv/3Coj3USAhKMw4lDAYcCQQDe3bL3szwkGdUmZk61ebY7HanilKnIYNuhC9ALUEElDp2eA1ld5cQvRb4BAeNsvabptt2lRPcscFu9zvH0DaUNAkEAww8HAz8xVKyZSAiW4cyMJOjj0hapHmUXOYWELWJxvRDfVYRpOtEbEwC/S3M45i44LHJqsZBFPmbsQBxl+VZt9QJBAL2tD+EywU+0UK2SyxA2mzqq32iAwBNTI/lnlVPbpOYGD21pSkjZAWR+RdyTn9xveLxWr0M2c+t1YQ8lLtVYO40CQQC2pVlYu5BIvXClLj6pHxwrK9G3JgwaanbEPFX0PjIJmU94QSLUd4OtDhvbXq43E5dlyvz5ybYvd8pygmjV9oM5";
public static String PUBLIC_KEY;
/**
* sxf渠道号
*/
public static String SXF_SUB_CHANNEL_NO = "398434152";
/**
* sxf环境机构号
*/
public static String ORG_ID;
/**
* 商户号
*/
public static String MERCHANT_NO = "399200821899489";
/**
* 成功响应码
*/
public static final String SXF_SUCCESS_CODE = "0000";
/** 功能未开通 */
public static final String SXF_NO_PERMIT = "0006";
public static final String SXF_REFUND_SUCCESS_CODE = "2002";
/**
* 退款成功状态
*/
public static final String SXF_REFUND_SUCCESS_STATUS_CODE = "REFUNDSUC";
/********************************************进件相关***************************************************/
/**
* 退款成功失败状态
*/
public static final String SXF_REFUND_FAIL_STATUS_CODE = "REFUNDFAIL";
/**
* 退款成功中状态
*/
public static final String SXF_REFUND_ING_STATUS_CODE = "REFUNDING";
/**
* 失败响应码
*/
public static final String SXF_FAIL_CODE = "0001";
/**
* sxf正式domain
*/
private static String sxfDomain;
/**
* 进件相关
* 正式环境图片上传
*/
public static String SXF_MERCHANT_INCOME_PHOTO_UPLOAD = sxfDomain + "/merchant/uploadPicture";
/**
* 进件相关
* 正式环境商户入驻
*/
public static String SXF_MERCHANT_INCOME = sxfDomain + "/merchant/income";
/**
* 进件信息
* 正式环境商户入驻信息修改
* 备注商户进件失败的信息修改
*/
public static String SXF_UPADTE_MERCHANT_RZ = sxfDomain + "/merchant/updateMerchantInfo";
/**
* 该接口通过申请单号查询
* 进件信息
* 正式环境商户入驻接口查询
*/
public static String SXF_QUERY_MERCHANT_INFO = sxfDomain + "/merchant/queryMerchantInfo";
/**
* 该接口通过商编查询商户信息
*/
public static String SXF_MERCHANT_INFO_QUERY = sxfDomain + "/merchant/merchantInfoQuery";
/********************************************支付相关***************************************************/
/**
* 进件信息
* 正式环境商户进件信息修改
* 备注商户进件成功的信息修改
*/
public static String SXF_UPDATE_MERCHANT_INFO = sxfDomain + "/merchant/editMerchantInfo";
/**
* 进件信息
* 正式环境商户信息修改审核结果查询
*/
public static String SXF_UPDATE_MERCHANT_INFO_RESULT = sxfDomain + "/merchant/queryModifyResult";
/**
* 商户设置
* 正式环境修改商户费率信息 次日0时 生效
*/
public static String SXF_UPDATE_MERCHANT_RATE = sxfDomain + "/merchant/merchantSetup";
/**
* 商户查询
* 正式环境商户详情查询
*/
public static String SXF_QUERY_MERCHANT_DETAIL = sxfDomain + "/merchant/merchantInfoQuery";
/**
* 主扫付款
* 正式环境商户主扫接口
*/
public static String SXF_REVERSE_SCAN_PAY = sxfDomain + "/order/reverseScan";
/**
* 商户被扫付款
* 正式环境商户被扫接口
*/
public static String SXF_JSAPI_SCAN_PAY = sxfDomain + "/order/jsapiScan";
/**
* 退款
* 正式环境退款接口地址
*/
public static String SXF_REFUND_PAY = sxfDomain + "/order/refund";
/**
* 交易查询
* 正式环境交易查询
*/
public static String SXF_TRADE_QUERY_PAY = sxfDomain + "/query/tradeQuery";
/**
* 订单关闭
* 订单关闭接口
*/
public static String SXF_CLOSE_ORDER = sxfDomain + "/query/close";
/**
* 订单撤销
* 订单撤销接口
*/
public static String SXF_CANCEL_ORDER = sxfDomain + "/query/cancel";
/**
* sxf 辅助接口 获取wxopenId
*/
public static String SXF_GET_WX_OPENID = sxfDomain + "/query/getSubOPenid";
/**
* sxf 辅助接口 获取银联用户标识
*/
public static String SXF_GET_UNION_USERID = sxfDomain + "/query/getUnionInfo";
/**
* 转账接口地址
*/
public static String SXF_ORG_TRANS_FER = sxfDomain + "/capital/fundManage/orgTransfer";
/**
* 商户生成带金额的付款码用户扫码付款
* 正式环境商户被扫接口
*/
public static String SXF_ACTIVE_SCAN_PAY = sxfDomain + "/order/activeScan";
public static JSONObject ok() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("code", "success");
jsonObject.put("msg", "成功");
return jsonObject;
}
/**
* 参数初始化
* @param domain sxf链接前缀
* @param publicKey 公钥
* @param orgId 机构id
*/
public static void init(String domain, String publicKey, String orgId) {
sxfDomain = domain;
PUBLIC_KEY = publicKey;
ORG_ID = orgId;
SXF_MERCHANT_INCOME_PHOTO_UPLOAD = sxfDomain + "/merchant/uploadPicture";
SXF_MERCHANT_INCOME = sxfDomain + "/merchant/income";
SXF_UPADTE_MERCHANT_RZ = sxfDomain + "/merchant/updateMerchantInfo";
SXF_QUERY_MERCHANT_INFO = sxfDomain + "/merchant/queryMerchantInfo";
SXF_UPDATE_MERCHANT_INFO = sxfDomain + "/merchant/editMerchantInfo";
SXF_UPDATE_MERCHANT_INFO_RESULT = sxfDomain + "/merchant/queryModifyResult";
SXF_UPDATE_MERCHANT_RATE = sxfDomain + "/merchant/merchantSetup";
SXF_QUERY_MERCHANT_DETAIL = sxfDomain + "/merchant/merchantInfoQuery";
SXF_REVERSE_SCAN_PAY = sxfDomain + "/order/reverseScan";
SXF_JSAPI_SCAN_PAY = sxfDomain + "/order/jsapiScan";
SXF_REFUND_PAY = sxfDomain + "/order/refund";
SXF_TRADE_QUERY_PAY = sxfDomain + "/query/tradeQuery";
SXF_CLOSE_ORDER = sxfDomain + "/query/close";
SXF_CANCEL_ORDER = sxfDomain + "/query/cancel";
SXF_GET_WX_OPENID = sxfDomain + "/query/getSubOPenid";
SXF_GET_UNION_USERID = sxfDomain + "/query/getUnionInfo";
SXF_ORG_TRANS_FER = sxfDomain + "/capital/fundManage/orgTransfer";
SXF_MERCHANT_INFO_QUERY = sxfDomain + "/merchant/merchantInfoQuery";
SXF_ACTIVE_SCAN_PAY = sxfDomain + "/order/activeScan";
}
}

View File

@ -78,6 +78,13 @@ public class ExceptionUtil {
map.put("000071","支付宝资金不足");
map.put("000072","未找到支行信息");
map.put("000080","请选择进件通道");
map.put("000081","不存在的进件通道");
map.put("000082","已在【瑞银信】进件的商户禁止在【随行付】通道进件");
map.put("000083","已在【随行付】进件的商户禁止在【瑞银信】通道进件");
map.put("000084","商户未提交进件请求");
map.put("000085","当前通道下已进件,请选择别的进件通道");

View File

@ -0,0 +1,29 @@
package com.chaozhanggui.common.system.util;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* @author lyf
*/
public class FileUtil {
public static byte[] url2Bytes(String url) throws IOException {
URL urlConet = new URL(url);
HttpURLConnection con = (HttpURLConnection) urlConet.openConnection();
con.setRequestMethod("GET");
con.setConnectTimeout(4 * 1000);
InputStream inStream = con.getInputStream(); //通过输入流获取图片数据
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
byte[] buffer = new byte[2048];
int len = 0;
while ((len = inStream.read(buffer)) != -1) {
outStream.write(buffer, 0, len);
}
inStream.close();
byte[] data = outStream.toByteArray();
return data;
}
}

View File

@ -0,0 +1,213 @@
package com.chaozhanggui.common.system.util;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @author lyf
*/
public class ParametersUtil {
public static String getRequestPrefix(HttpServletRequest request) {
return "https://" + request.getServerName() + request.getContextPath();
}
public static String getSelfRedirectUrl(HttpServletRequest request, String requestPath) {
return getRequestPrefix(request) + requestPath;
}
/**
* 上传图片保存路径
*/
public static String upload_save_path;
/**
* 上传图片访问路径
*/
public static String upload_visit_path;
/**
* 获取支付宝授权token
*/
public static String ALI_APP_AUTH_TOKEN;
/**
* 支付宝费率
*/
public static Double ALI_RATE;
/**
* 微信费率
*/
public static Double WECHAT_RATE;
/**
* 微信支付appid
*/
public static String APPID;
/**
* 小程序付款的appid
*/
public static String APPLETS_APPID;
/**
* 小程序密钥
*/
public static String APPLETS_SECRET;
/**
* AppSecret
*/
public static String APPSECRET;
/**
* IOS公众号ID
*/
public static String APPID_IOS;
/**
* IOS公众号密钥
*/
public static String APP_SECRET_IOS;
/**
*商户号
*/
public static String PID;
/**
* 秘钥
*/
public static String KEY;
/**
* 微信支付回调地址
*/
public static String wechatCallback;
/**
* 支付宝Appid
*/
public static String ALI_APP_ID;
/**
* 支付宝私钥
*/
public static String PRI;
/**
* 支付宝公钥
*/
public static String PUB;
/**
* 支付宝授权回调地址
*/
public static String ALI_RETURN_URL;
/**
* 服务器域名
*/
public static String domain;
/**
* 乐刷代理商编号
*/
public static String agentId;
/**
* 乐刷进件和交易请求密钥key
*/
public static String leshuapaykey;
/**
* 交易异步通知回调密钥
*/
public static String leshuaCallBackKey;
/**
* 粉丝分润比例
*/
public static Double fans_profit;
/**
*乐刷费率
*/
public static Double leshuarate;
/**
* 下载apk地址
*/
public static String apk_dowload_url;
/**
*apk版本号
*/
public static String versions;
/**
* 官网获取的 API Key OCR
*/
public static String baiduAK;
/**
* 官网获取的 Secret Key OCR
*/
public static String baiduSK;
/**
* 官网获取的 API Key 人脸识别
*/
public static String baiduAK2;
/**
* 官网获取的 Secret Key 人脸识别
*/
public static String baiduSK2;
/**
* 身份证OCR接口地址
*/
public static String idCardOCRUrl;
/**
* 银行卡OCR接口地址
*/
public static String bankCardOCRUrl;
/**
* 营业执照OCR接口地址
*/
public static String blCardOCRUrl;
/**
* 阿里自用型应用appid
*/
public static String ZY_ALI_APP_ID;
/**
* 阿里自用型应用私钥
*/
public static String ZY_PRI;
/**
* 阿里自用型应用公钥
*/
public static String ZY_PUB;
/**
* 刘思义本人的乐刷的商户编号 用来收推广人升级的钱
*/
public static String LESHUALIU;
/**
* 收银呗微信普通商户APPID
*/
public static String MERCHANT_APPID;
/**
* 收银呗微信普通商户Appsecret
*/
public static String MERCHANT_APPSECRET;
/**
* 收银呗微信普通商户号
*/
public static String MERCHANT_PID;
/**
* 收银呗微信普通商户key
*/
public static String MERCHANT_KEY;
public static String LESHUA_API;
/**
* @description:收银呗商家公众号APPID
* @date: 2021/9/23 10:27
*/
public static String SJ_APPID;
/**
* @description:收银呗商家公众号APPSECRET
* @date: 2021/9/23 10:27
*/
public static String SJ_APPSECRET;
/**
* 快递相关快递鸟
*/
public static String USERID;
public static String APIKEY;
public static List<String> url;
/**
* 支付宝通道ID
*/
public static String alipayChannel;
}

View File

@ -28,4 +28,6 @@ public interface TbPlussAccountMapper {
Integer selectCountIdCardId(@Param("idCardId")String idCardId, @Param("userId")String userId);
Integer selectCountBankCard(@Param("bankCardId")String bankCardId, @Param("userId")String userId);
Integer selectMicroMbiAccountNum(@Param("certNo") String certNo);
}

View File

@ -5,6 +5,8 @@ import com.chaozhanggui.dao.system.entity.TbPlussMercOrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Mapper
public interface TbPlussMercOrderDetailMapper {
@ -15,6 +17,7 @@ public interface TbPlussMercOrderDetailMapper {
int insertSelective(TbPlussMercOrderDetail record);
TbPlussMercOrderDetail selectByPrimaryKey(Integer id);
List<TbPlussMercOrderDetail> selectByOrderDetailList(TbPlussMercOrderDetail condition);
int updateByPrimaryKeySelective(TbPlussMercOrderDetail record);

View File

@ -20,6 +20,8 @@ public interface TbPlussMerchantChannelStatusMapper {
TbPlussMerchantChannelStatus selectByPrimaryKey(Integer id);
TbPlussMerchantChannelStatus selectByMerchantCode(@Param("merchantCode") String merchantCode, @Param("channelId") Integer channelId);
int updateByPrimaryKeySelective(TbPlussMerchantChannelStatus record);
int updateByPrimaryKeyWithBLOBs(TbPlussMerchantChannelStatus record);
@ -38,6 +40,7 @@ public interface TbPlussMerchantChannelStatusMapper {
Integer selectCount(TbPlussMerchantChannelStatus record);
TbPlussMerchantChannelStatus getIncomingInfo(@Param("status1")String status1, @Param("status2")String status2,
@Param("merchantCode")String merchantCode);
TbPlussMerchantChannelStatus getIncomingInfoAnother(@Param("merchantCode")String merchantCode);
}

View File

@ -19,6 +19,7 @@ public interface TbPlussMerchantImageMapper {
TbPlussMerchantImage selectByPrimaryKey(Integer id);
List<TbPlussMerchantImage> selectByMerchantCode(String merchantCode);
List<TbPlussMerchantImage> getListOfMerch(String merchantCode);
TbPlussMerchantImage selectByMerchantCodeType(@Param("merchantCode") String merchantCode,@Param("photoType") String photoType);
int updateByPrimaryKeySelective(TbPlussMerchantImage record);
@ -26,4 +27,5 @@ public interface TbPlussMerchantImageMapper {
int updateByCodeAndType(TbPlussMerchantImage record);
int updateByPrimaryKey(TbPlussMerchantImage record);
}

View File

@ -3,6 +3,7 @@ package com.chaozhanggui.dao.system.dao;
import com.chaozhanggui.dao.system.entity.TbPlussRegionCodeSxf;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
@Component
@ -16,6 +17,15 @@ public interface TbPlussRegionCodeSxfMapper {
TbPlussRegionCodeSxf selectByPrimaryKey(Integer id);
/**
* 获取银盛对应的地区信息
* @param province
* @param city
* @param area 县区
* @return 地区信息
*/
TbPlussRegionCodeSxf selectRegionCode(@Param("province") String province, @Param("city") String city, @Param("area") String area);
int updateByPrimaryKeySelective(TbPlussRegionCodeSxf record);
int updateByPrimaryKey(TbPlussRegionCodeSxf record);

View File

@ -3,8 +3,11 @@ package com.chaozhanggui.dao.system.dao;
import com.chaozhanggui.dao.system.entity.TbPlussSxfMccInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Mapper
public interface TbPlussSxfMccInfoMapper {
@ -15,6 +18,7 @@ public interface TbPlussSxfMccInfoMapper {
int insertSelective(TbPlussSxfMccInfo record);
TbPlussSxfMccInfo selectByPrimaryKey(Integer fId);
List<TbPlussSxfMccInfo> selectList(@Param("mccCode") String mccCode);
int updateByPrimaryKeySelective(TbPlussSxfMccInfo record);

View File

@ -1,10 +1,41 @@
package com.chaozhanggui.dao.system.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
public class TbPlussMercOrderDetail implements Serializable {
/** 待付款 */
public static final String STATUS_NO_PAY = "00";
/** 已付款 */
public static final String STATUS_PAYED = "01";
/** 退款中 */
public static final String STATUS_REFUND_REQ = "02";
/** 同意退款,需填写退货订单号 */
public static final String STATUS_REFUNDING = "12";
/** 退款申请中,已填写快递单号 */
public static final String STATUS_REFUND_AGREE = "13";
/** 已退款 */
public static final String STATUS_REFUND_SUCCESS = "03";
/** 退款失败 */
public static final String STATUS_REFUND_FAIL = "04";
/** 待收货 */
public static final String STATUS_UN_RECEIVED = "05";
/** 已完成 */
public static final String STATUS_COMPLETE = "06";
private static final long serialVersionUID = 1L;
private Integer id;
private Integer shoptrolleyid;
@ -53,7 +84,123 @@ public class TbPlussMercOrderDetail implements Serializable {
private Date createtime;
private static final long serialVersionUID = 1L;
@TableField(exist = false)
private String statusDesc;
@TableField(exist = false)
private String phone;
@TableField(exist = false)
private String verifyCode;
@TableField(exist = false)
private List<String> picList;
/**
* 物流状态
*/
@TableField(exist = false)
private String expressStatus;
@TableField(exist = false)
private String expressStatusDesc;
@TableField(exist = false)
private TbPlussMercOrderNew order;
@TableField(exist = false)
private TbPlussMerchantBaseInfo merchant;
@TableField(exist = false)
private String roleCode;
/**
* 规格名称
*/
@TableField(exist = false)
private String specName;
// private static final long serialVersionUID = 1L;
public String getStatusDesc() {
return statusDesc;
}
public void setStatusDesc(String statusDesc) {
this.statusDesc = statusDesc;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getVerifyCode() {
return verifyCode;
}
public void setVerifyCode(String verifyCode) {
this.verifyCode = verifyCode;
}
public List<String> getPicList() {
return picList;
}
public void setPicList(List<String> picList) {
this.picList = picList;
}
public String getExpressStatus() {
return expressStatus;
}
public void setExpressStatus(String expressStatus) {
this.expressStatus = expressStatus;
}
public String getExpressStatusDesc() {
return expressStatusDesc;
}
public void setExpressStatusDesc(String expressStatusDesc) {
this.expressStatusDesc = expressStatusDesc;
}
public TbPlussMercOrderNew getOrder() {
return order;
}
public void setOrder(TbPlussMercOrderNew order) {
this.order = order;
}
public TbPlussMerchantBaseInfo getMerchant() {
return merchant;
}
public void setMerchant(TbPlussMerchantBaseInfo merchant) {
this.merchant = merchant;
}
public String getRoleCode() {
return roleCode;
}
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
public String getSpecName() {
return specName;
}
public void setSpecName(String specName) {
this.specName = specName;
}
public Integer getId() {
return id;

View File

@ -1,6 +1,7 @@
package com.chaozhanggui.dao.system.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.chaozhanggui.common.system.config.MsgException;
import java.io.Serializable;
import java.util.Date;
@ -359,4 +360,39 @@ public class TbPlussMerchantChannelStatus implements Serializable {
}
return flag;
}
/**
* 是否已进件
* @param mcs
* @return
*/
public static boolean isAudited(TbPlussMerchantChannelStatus mcs) {
if (mcs == null) {
return false;
}
return TbPlussMerchantChannelStatus.AUDIT_STATUS_SUCCESS.equals(mcs.getStatus()) ||
TbPlussMerchantChannelStatus.AUDIT_STATUS_DATA_EDIT.equals(mcs.getStatus()) ||
TbPlussMerchantChannelStatus.AUDIT_STATUS_FIRST_TRIAL_SUCCESS.equals(mcs.getStatus());
}
/**
* 商户申请进件后客服进行初次进件校验后
* 判断商户是否可以进行过审进件
*
* @param merchantChannelStatus 进件状态信息
* @return ignored
*/
public static void checkCanAudit(TbPlussMerchantChannelStatus merchantChannelStatus) {
if (merchantChannelStatus == null) {
MsgException.throwException("商户未提交审核");
return;
}
String status = merchantChannelStatus.getStatus();
String thirdStatus = merchantChannelStatus.getThirdstatus();
if (TbPlussMerchantChannelStatus.AUDIT_STATUS_REJECT.equals(status)||!TbPlussMerchantChannelStatus.AUDIT_STATUS_EXAMINING.equals(status) || !AUDIT_THIRD_STATUS_WAITING.equals(thirdStatus)) {
MsgException.throwException("不符合商户审核条件");
}
}
}

View File

@ -110,6 +110,15 @@
</where>
limit 1
</select>
<select id="selectMicroMbiAccountNum" resultType="java.lang.Integer">
SELECT count(DISTINCT mbi.userId) count FROM tb_pluss_merchant_base_info mbi
LEFT JOIN tb_pluss_account account ON account.userId = mbi.userId
LEFT JOIN tb_pluss_id_card ic ON account.userId = ic.userId AND account.idCardId = ic.id
LEFT JOIN tb_pluss_merchant_channel_status mcs ON mcs.merchantCode = mbi.merchantCode
WHERE merchantType = 1
AND mcs.`status` IN (3)
AND ic.certNo = #{certNo}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_pluss_account
where id = #{id,jdbcType=INTEGER}

View File

@ -37,6 +37,59 @@
<include refid="Base_Column_List" />
from tb_pluss_merc_order_detail
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByOrderDetailList" resultType="com.chaozhanggui.dao.system.entity.TbPlussMercOrderDetail">
SELECT mo.*,
ua.roleCode,
ds.specName as specName,
moe.status as expressStatus,
mon.receiver as 'order.receiver',
mon.phone as 'order.phone',
mon.address as 'order.address',
mon.payType as 'order.payType',
mon.orderAmt as 'order.orderAmt',
mon.areaName as 'order.areaName',
mbi.alias as 'merchant.alias'
FROM
tb_pluss_merc_order_detail mo
left join tb_pluss_device_spec ds on mo.code = ds.code and mo.type = ds.spec
left join tb_pluss_merc_order_express moe on mo.expressNo = moe.expressNo
left join tb_pluss_merc_order_new mon on mo.orderNo = mon.orderNo
left join tb_pluss_user_app ua on mo.userId = ua.userId
left join tb_pluss_merchant_base_info mbi on mo.userId = mbi.userId
<where>
<if test="orderno != null and orderno != ''">
and mo.orderNo = #{orderno}
</if>
<if test="name != null and name != ''">
and mo.name = #{name}
</if>
<if test="merchant != null and merchant.alias != null and merchant.alias != ''">
and mbi.alias = #{merchant.alias}
</if>
<if test="userid != null">
and mo.userId = #{userid}
</if>
<if test="roleCode != null and roleCode != ''">
and ua.roleCode = #{roleCode}
</if>
<if test="logistno != null and logistno != ''">
and mo.logistNo = #{logistno}
</if>
<if test="expressno != null and expressno != ''">
and mo.expressNo = #{expressno}
</if>
<if test="status != null and status != ''">
and mo.status = #{status}
</if>
<if test="merchant != null and order.payType != null and order.payType != null">
and mon.payType = #{order.paytype}
</if>
<if test="merchant != null and order.phone != null and order.phone != ''">
and mon.phone = #{order.phone}
</if>
</where>
order by mo.createTime desc
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_pluss_merc_order_detail

View File

@ -416,4 +416,26 @@
order by valid desc
limit 1
</select>
<select id="selectByMerchantCode"
resultType="com.chaozhanggui.dao.system.entity.TbPlussMerchantChannelStatus">
SELECT * FROM tb_pluss_merchant_channel_status
WHERE merchantCode=#{merchantCode}
AND channelId=#{channelId}
</select>
<select id="getIncomingInfo" resultType="com.chaozhanggui.dao.system.entity.TbPlussMerchantChannelStatus">
SELECT *
FROM tb_pluss_merchant_channel_status
WHERE merchantCode = #{merchantCode}
AND status IN ('AUDIT_STATUS_SUCCESS', 'AUDIT_STATUS_DATA_EDIT')
ORDER BY valid DESC, id ASC
LIMIT 1;
</select>
<select id="getIncomingInfoAnother"
resultType="com.chaozhanggui.dao.system.entity.TbPlussMerchantChannelStatus">
SELECT *
FROM merchant_channel_status
WHERE merchant_code = #{merchantCode}
ORDER BY valid DESC, id ASC
LIMIT 1;
</select>
</mapper>

View File

@ -34,6 +34,13 @@
where merchantCode = #{merchantCode}
AND photoType = #{photoType}
</select>
<select id="getListOfMerch" resultType="com.chaozhanggui.dao.system.entity.TbPlussMerchantImage">
SELECT *
FROM tb_pluss_merchant_image
WHERE merchant_code = #{merchantCode}
AND photo_type NOT IN
('96', '97', '05','07', '98', '01','02');
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_pluss_merchant_image
where id = #{id,jdbcType=INTEGER}

View File

@ -18,6 +18,16 @@
<include refid="Base_Column_List" />
from tb_pluss_region_code_sxf
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectRegionCode" resultType="com.chaozhanggui.dao.system.entity.TbPlussRegionCodeSxf">
SELECT sxf.id, sxf.province, sxf.provinceCode, sxf.city, sxf.cityCode, sxf.area, sxf.areaCode
FROM tb_pluss_region_code_sxf sxf
LEFT JOIN tb_pluss_region_reflect rr ON sxf.id = rr.regionDes
LEFT JOIN tb_pluss_region_code_ls ls ON ls.id = rr.regionSrc
WHERE rr.channel = 1
AND ls.province LIKE CONCAT(#{province}, "%")
AND ls.city = #{city}
AND ls.area = #{area}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_pluss_region_code_sxf

View File

@ -17,6 +17,12 @@
<include refid="Base_Column_List" />
from tb_pluss_sxf_mcc_info
where F_ID = #{fId,jdbcType=INTEGER}
</select>
<select id="selectList" resultType="com.chaozhanggui.dao.system.entity.TbPlussSxfMccInfo">
select
<include refid="Base_Column_List" />
from tb_pluss_sxf_mcc_info
WHERE F_mcc_code = #{mccCode}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_pluss_sxf_mcc_info