更新新逻辑

This commit is contained in:
liuyingfang
2023-11-16 14:15:46 +08:00
parent bb05947394
commit 8b555d4682
17 changed files with 205 additions and 47 deletions

View File

@@ -56,10 +56,11 @@ public class IntroduceController {
if ("AG".equals(typeCode) || "FB".equals(typeCode) || "SB".equals(typeCode)){
return image.PROMOTION_IMAGE.getImageUrl();
}
if ("1".equals(merchantType)){
//TODO 现在的逻辑是所有的都可以是创客
// if ("1".equals(merchantType)){
return image.SMALL_IMAGE.getImageUrl();
}
return image.OTHER_IMAGE.getImageUrl();
// }
// return image.OTHER_IMAGE.getImageUrl();
}
@PostMapping ("/common")
@@ -97,13 +98,13 @@ public class IntroduceController {
//安卓
if ("1".equals(type)){
if ("1".equals(entity.getAndroid())) {
return ResultGenerator.genSuccessResult(entity.getContent());
return ResultGenerator.genSuccessResult(image(params.get("typeCode"), params.get("merchantType")));
}
return ResultGenerator.genSuccessResult("");
//IOS
}else if ("2".equals(type)){
if ("1".equals(entity.getIos())) {
return ResultGenerator.genSuccessResult(entity.getContent());
return ResultGenerator.genSuccessResult(image(params.get("typeCode"), params.get("merchantType")));
}
return ResultGenerator.genSuccessResult("");
}

View File

@@ -39,14 +39,15 @@ public class ZfbAttestationController {
@PostMapping
public Result<Object> Attestation(@RequestBody Map<String, String> params) {
QueryWrapper<Account> QueryWrapper = new QueryWrapper<Account>()
.eq("userId", Integer.valueOf(params.get("userId")))
.eq("valid", 1);
Account one = accountService.getOne(QueryWrapper);
if (one == null){
QueryWrapper<MerchantChannelStatus> QueryWrapper = new QueryWrapper<MerchantChannelStatus>()
.eq("merchantCode", params.get("merchantCode"))
.eq("status", 3)
.ne("merchantId","");
MerchantChannelStatus merchantCode = merchantChannelStatusService.getOne(QueryWrapper);
if (merchantCode == null){
throw new MsgException("账号异常");
}
MerchantChannelStatus merchantCode = merchantChannelStatusService.getMerchantCodeByInfo(params.get("merchantCode"), one.getChannelType());
HashMap<Object, Object> merchantCodeMap = new HashMap<>();
switch (merchantCode.getChannel()){
case 1:

View File

@@ -66,6 +66,14 @@ public class AuditCallbackController {
return sxfMerchantAuditService.merchantAuditCallback(result);
}
@PostMapping("updateSxf")
// TODO 后续需要接sxf的回调
public Map<String, Object> updateSxfCallback(@RequestBody JSONObject result) throws Exception {
System.out.println("回调成功+++++++++\n");
System.out.println(result);
return result;
}
@PostMapping("ys")
public String ysAuditCallback(@RequestParam Map<String, Object> result) throws Exception {
result = (JSONObject) JSON.toJSON(result);

View File

@@ -7,7 +7,7 @@
</select>
<select id="getByMerchantCode" resultType="cn.pluss.platform.entity.MerchantChannelStatus">
SELECT t1.* FROM tb_pluss_merchant_channel_status t1
SELECT t1.*,t2.channelName FROM tb_pluss_merchant_channel_status t1
LEFT JOIN tb_pluss_merchant_channel t2 ON t1.channel = t2.id
WHERE t2.`status` = '1' AND t1.merchantCode = #{merchantCode} AND t1.channel = #{channel}
</select>

View File

@@ -0,0 +1,34 @@
package cn.pluss.platform.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum MccAndStore {
SUPERMARKET(1,"5411"),
BARBER(2,"7230"),
COSMETOLOGY(3,"7298"),
GYM(4,"7997"),
FOOT(5,"7297"),
FAVITY(6,"8021");
private final Integer value;
private final String desc;
public static String findValueByStoreId(Integer storeId) {
for (MccAndStore store : MccAndStore.values()) {
if (store.getValue().equals(storeId)) {
return store.getDesc();
}
}
return null;
}
}

View File

@@ -15,7 +15,7 @@ import lombok.EqualsAndHashCode;
" LEFT JOIN tb_pluss_user_app ua ON ua.userId = opr.userId WHERE ua.userType != 'staff' GROUP BY extension ->> '$.ip'" +
") t ON t.ip = opr.extension ->> '$.ip' WHERE ua.userType != 'staff') t1")
@EqualsAndHashCode(callSuper = true)
public class OperationRecordVO extends OperationRecord {
public class OperationRecordVO extends OperationRecord {
/**
* 实名姓名

View File

@@ -38,6 +38,7 @@
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
@@ -49,6 +50,10 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>

View File

@@ -2,18 +2,31 @@ package cn.pluss.platform.AppletStoreUser.impl;
import cn.pluss.platform.AppletStoreUser.AppletStoreUserService;
import cn.pluss.platform.appletInfo.AppletInfoService;
import cn.pluss.platform.entity.AppletInfo;
import cn.pluss.platform.entity.AppletStore;
import cn.pluss.platform.entity.AppletStoreUser;
import cn.pluss.platform.entity.*;
import cn.pluss.platform.enums.MccAndStore;
import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.mapper.AppletInfoMapper;
import cn.pluss.platform.mapper.AppletStoreMapper;
import cn.pluss.platform.mapper.AppletStoreUserMapper;
import cn.pluss.platform.mapper.MerchantStoreMapper;
import cn.pluss.platform.merchant.MerchantBaseInfoService;
import cn.pluss.platform.userInfo.UserInfoService;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.BodyInserters;
import cn.pluss.platform.enums.MccAndStore;
import reactor.core.publisher.Mono;
import javax.annotation.Resource;
import java.util.Date;
@@ -27,6 +40,12 @@ public class AppletStoreUserServiceImpl extends ServiceImpl<AppletStoreUserMappe
private AppletStoreUserMapper appletStoreUserMapper;
@Resource
private AppletStoreMapper appletStoreMapper;
@Resource
private MerchantBaseInfoService merchantBaseInfoService;
@Resource
private UserInfoService userInfoService;
@Resource
private MerchantStoreMapper merchantStoreMapper;
@Override
@Transactional(rollbackFor=Exception.class)
public Integer addAppletStoreUser(AppletStoreUser appletStoreUser) {
@@ -41,6 +60,89 @@ public class AppletStoreUserServiceImpl extends ServiceImpl<AppletStoreUserMappe
throw new MsgException("未找到店铺号");
}
appletStoreUser.setCreateTime(new Date());
return baseMapper.insert(appletStoreUser);
int insert = baseMapper.insert(appletStoreUser);
if (insert>0){
MerchantBaseInfo merchantBaseInfo = merchantBaseInfoService.getMerchantBaseInfoByUserId(String.valueOf(appletStoreUser.getUserId()));
if (merchantBaseInfo == null){
throw new MsgException("未找到商户");
}
// 设置请求地址
String url = "https://door.sxczgkj.cn/api/javaapp/apple/registeredstore";
// 创建WebClient对象
WebClient webClient = WebClient.builder().build();
// 构造请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
// 构造请求参数
StringBuilder params = new StringBuilder();
params.append("title=").append(merchantBaseInfo.getAlias());
//判断mcc码
params.append("&mcc=").append(MccAndStore.findValueByStoreId(appletStoreUser.getAppleStoreId()));
UserInfo userInfo = userInfoService.getMainUserInfo(Long.valueOf(merchantBaseInfo.getUserId()));
params.append("&mobile=").append(userInfo.getPhone());
QueryWrapper storQueryWrapper= new QueryWrapper<>();
storQueryWrapper.eq("merchantCode",merchantBaseInfo.getMerchantCode());
MerchantStore merchantStore = merchantStoreMapper.selectOne(storQueryWrapper);
params.append("&syb_m_id=").append(merchantStore.getId());
params.append("&type=1");
// 发送POST请求并获取响应
Mono<String> response = webClient.post()
.uri(url)
.headers(httpHeaders -> httpHeaders.addAll(headers))
.body(BodyInserters.fromObject(params.toString()))
.retrieve()
.bodyToMono(String.class);
// 响应结果判断
String responseMsg = response.block();
if (responseMsg.contains("\"code\":1")) {
// 返回1
return 1;
}else {
throw new MsgException("添加失败");
}
}
throw new MsgException("店铺开通有误");
}
public static void main(String[] args) {
// 设置请求地址
String url = "https://door.sxczgkj.cn/api/javaapp/apple/registeredstore";
// 创建WebClient对象
WebClient webClient = WebClient.builder().build();
// 构造请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
// 构造请求参数
StringBuilder params = new StringBuilder();
params.append("mobile=11111111111");
params.append("&mcc=7997");
params.append("&type=1");
params.append("&title=测试测试");
// 发送POST请求并获取响应
Mono<String> response = webClient.post()
.uri(url)
.body(BodyInserters.fromObject(params.toString()))
.headers(httpHeaders -> httpHeaders.addAll(headers))
.retrieve()
.bodyToMono(String.class);
// 打印响应结果
System.out.println(response.block());
}
}

View File

@@ -95,11 +95,6 @@ public class UserMakerQuotaServiceImpl extends ServiceImpl<UserMakerQuotaMapper,
return;
}
if(!"1".equals(merchantBaseInfoByMerchantCode.getMerchantType())){
log.error("商户并非小微商户:{},{}",merchantBaseInfoByMerchantCode.getMerchantCode(),merchantBaseInfoByMerchantCode.getMerchantType());
return;
}
UserPromotion userInfo = userPromotionMapper.selectByPrimaryKey(Long.valueOf(merchantBaseInfoByMerchantCode.getUserId()));
if(ObjectUtil.isEmpty(userInfo)){
log.error("用户所属关系不存在");

View File

@@ -46,9 +46,9 @@ public class AppletStoreServiceImpl extends ServiceImpl<AppletStoreMapper, Apple
userApp.getMerchantCode();
MerchantStore storeByMerchantCode = merchantStoreService.getStoreByMerchantCode(userApp.getMerchantCode());
//组装数据
return menuList(appletStores,userId, storeByMerchantCode.getId());
return menuList(appletStores,userId, storeByMerchantCode.getId(),userApp.getPhone());
}
private List<AppletStoreVO> menuList(List<AppletStore> appletStores, Integer userId, Integer storeId){
private List<AppletStoreVO> menuList(List<AppletStore> appletStores, Integer userId, Integer storeId,String phone){
List<AppletStoreUser> appletStoreByUser = appletStoreUserMapper.getAppletStoreByUser(userId);
ArrayList<AppletStoreVO> appletStoreVOList = new ArrayList<>();
for (AppletStore appletStore : appletStores) {
@@ -66,7 +66,7 @@ public class AppletStoreServiceImpl extends ServiceImpl<AppletStoreMapper, Apple
appletStoreVO.setId(appletStore.getId());
appletStoreVO.setStoreName(appletStore.getStoreName());
appletStoreVO.setIcon(appletStore.getIcon());
appletStoreVO.setPath(appletStore.getUrl());
appletStoreVO.setPath(appletStore.getUrl()+"&syb_m_id="+storeId+"&mobile="+phone);
appletStoreVO.setGhappId(appletStore.getAppId());
appletStoreVO.setWxType(appletStore.getWxType() == null?0:appletStore.getWxType());
appletStoreVOList.add(appletStoreVO);

View File

@@ -410,7 +410,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
AccountDTO accountDTO = accountService.getRealAccount(userId, Account.CHANNEL_TYPE_D1);
IdCard legalIdCard = idCardService.getLegalIdCard(userId);
//upstreamInfoService.save(mbi, legalIdCard, accountDTO.getIdcard(), accountDTO.getBankCard(), 4);
}
private MercInfo combineBaseInfo(String userId, Integer channel) {

View File

@@ -333,6 +333,10 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
}
}
}
//最后查询旧的信息
Account accountOld = new Account();
accountOld.setChannelType(accountDTO.getChannelType()).setUserId(accountDTO.getUserId());
accountOld = getOne(new QueryWrapper<>(accountOld));
accountDTO.paramCheck();
@@ -344,14 +348,14 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
});
// 原则上这里不需要再做空判断
if (accIdCard != null) {
RiskBlacklist riskBlacklist = new RiskBlacklist();
riskBlacklist.setIdcardNo(accIdCard.getCertNo());
Integer count = riskBlacklistMapper.selectCount(Wrappers.query(riskBlacklist));
if (count > 0) {
throw new MsgException("当前结算人已在风控黑名单中,请更换结算信息");
}
}
// if (accIdCard != null) {
// RiskBlacklist riskBlacklist = new RiskBlacklist();
// riskBlacklist.setIdcardNo(accIdCard.getCertNo());
// Integer count = riskBlacklistMapper.selectCount(Wrappers.query(riskBlacklist));
// if (count > 0) {
// throw new MsgException("当前结算人已在风控黑名单中,请更换结算信息");
// }
// }
delAccount(accountDTO.getUserId(), accountDTO.getChannelType());
@@ -408,6 +412,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
bankCardService.save(accountDTO.getBankCard());
account.setBankCardId(accountDTO.getBankCard().getId() + "");
//看一下之前默认
if (accountOld.getValid() == 1) {
account.setValid(1);
} else {
account.setValid(0);
}
this.baseMapper.insert(account);
//如果注册了一个通道给他默认
LambdaQueryWrapper<Account> qWrapperAccountD1 = Wrappers.lambdaQuery();
@@ -1066,7 +1077,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
});
MerchantChannelStatus mcs = mcsService.getByMerchantCodeAndChannelType(mbi.getMerchantCode(), account.getChannelType());
MerchantChannelStatus mcs = mcsService.getByMerchantCodeAndChannelTypeV1(mbi.getMerchantCode(), account.getChannelType());
if (mcs == null || !MerchantChannelStatus.AUDIT_STATUS_DATA_EDIT.equals(mcs.getStatus())) {
account.setBak(null);
}

View File

@@ -37,6 +37,12 @@ public interface MerchantChannelStatusService extends IService<MerchantChannelSt
qWrapper.eq(MerchantChannelStatus::getAuthorizationStatus,1);
return getOne(qWrapper);
}
default MerchantChannelStatus getByMerchantCodeAndChannelTypeV1(String merchantCode, String channelType) {
LambdaQueryWrapper<MerchantChannelStatus> qWrapper = Wrappers.lambdaQuery();
qWrapper.eq(MerchantChannelStatus::getVirChannelFlag, channelType);
qWrapper.eq(MerchantChannelStatus::getMerchantCode, merchantCode);
return getOne(qWrapper);
}
default MerchantChannelStatus getByMerchantCodeAndChannelTypeNew(String merchantCode, String channelType) {
LambdaQueryWrapper<MerchantChannelStatus> qWrapper = Wrappers.lambdaQuery();
qWrapper.eq(MerchantChannelStatus::getVirChannelFlag, channelType);

View File

@@ -380,8 +380,8 @@ public class LklMerAuditHandler {
StringBuilder sb = new StringBuilder(baseUrl);
sb.append("?title=").append(merchantBaseInfo.getAlias());
sb.append("&password=").append(userInfo.getPassword().toLowerCase());
sb.append("?mcc=").append(merchantBaseInfo.getMcc());
sb.append("?mccName=").append(merchantBaseInfo.getMccName());
sb.append("&mcc=").append(merchantBaseInfo.getMcc());
sb.append("&mccName=").append(merchantBaseInfo.getMccName());
sb.append("&mobile=").append(userInfo.getLoginName());
sb.append("&syb_m_id=").append(merchantStore.getId());
sb.append("&addressNo=").append(merchantBaseInfo.getAddressNo());

View File

@@ -370,8 +370,8 @@ public class SxfMerAuditHandler {
String baseUrl = it.toString();
StringBuilder sb = new StringBuilder(baseUrl);
sb.append("?title=").append(merchantBaseInfo.getAlias());
sb.append("?mcc=").append(merchantBaseInfo.getMcc());
sb.append("?mccName=").append(merchantBaseInfo.getMccName());
sb.append("&mcc=").append(merchantBaseInfo.getMcc());
sb.append("&mccName=").append(merchantBaseInfo.getMccName());
sb.append("&password=").append(userInfo.getPassword().toLowerCase());
sb.append("&mobile=").append(userInfo.getLoginName());
sb.append("&syb_m_id=").append(merchantStore.getId());

View File

@@ -1934,7 +1934,7 @@ public class UserAppServiceImpl extends ServiceImpl<UserAppMapper, UserApp> impl
userInfo.setId(userApp.getUserId());
UserInfo userInfos = userInfoService.queryUserInfo(userInfo);
if(ObjectUtil.isEmpty(userInfos)){
MsgException.checkNull(null,"户信息不存在");
MsgException.checkNull(null,"户信息不存在");
}
PhoneValidateCode phoneValidateCode = new PhoneValidateCode();
@@ -1956,14 +1956,9 @@ public class UserAppServiceImpl extends ServiceImpl<UserAppMapper, UserApp> impl
MerchantBaseInfo baseInfo= merchantBaseInfoService.getMerchantBaseInfoByUserId(userInfos.getId().toString());
if(ObjectUtil.isEmpty(baseInfo)){
MsgException.checkNull(null,"商户信息不存在");
MsgException.checkNull(null,"请先进行商户认证");
}
if(!"1".equals(baseInfo.getMerchantType())){
MsgException.checkNull(null,"非小微不允许升级创客");
}
UserMarker marker= userMarkerMapper.selectById(userApp.getUserId());
if(ObjectUtil.isNotEmpty(marker)){

View File

@@ -113,7 +113,7 @@ import java.util.regex.Pattern;
/**
* @author yuchen
* @Description (会员扫商户二维码 走正常的扣款流程 微信扫的话调微信支付接口 支付宝扫调支付宝支付接口)
* @Description (会员扫商户二维码 走正常的扣款流程 微信扫的话调微信支付接口 银收客扫调支付宝支付接口)
*/
@Controller
@Slf4j