收银点bug修复

This commit is contained in:
19991905653
2024-02-27 17:39:20 +08:00
parent aa75932add
commit c925311eb6
18 changed files with 458 additions and 156 deletions

View File

@@ -11,7 +11,8 @@ import cn.pluss.platform.merchant.AccountService;
import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService; import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@@ -39,11 +40,7 @@ public class ZfbAttestationController {
@PostMapping @PostMapping
public Result<Object> Attestation(@RequestBody Map<String, String> params) { public Result<Object> Attestation(@RequestBody Map<String, String> params) {
QueryWrapper<MerchantChannelStatus> QueryWrapper = new QueryWrapper<MerchantChannelStatus>() MerchantChannelStatus merchantCode = checkChannel(params.get("merchantCode"));
.eq("merchantCode", params.get("merchantCode"))
.eq("status", 3)
.ne("merchantId","");
MerchantChannelStatus merchantCode = merchantChannelStatusService.getOne(QueryWrapper);
if (merchantCode == null){ if (merchantCode == null){
throw new MsgException("账号异常"); throw new MsgException("账号异常");
} }
@@ -80,4 +77,26 @@ public class ZfbAttestationController {
} }
return ResultGenerator.genSuccessResult(merchantCodeMap); return ResultGenerator.genSuccessResult(merchantCodeMap);
} }
private MerchantChannelStatus checkChannel(String merchantCode){
LambdaQueryWrapper<MerchantChannelStatus> qWrapper2 = Wrappers.lambdaQuery();
qWrapper2.eq(MerchantChannelStatus::getMerchantCode, merchantCode)
.in(MerchantChannelStatus::getStatus,
MerchantChannelStatus.AUDIT_STATUS_SUCCESS,
MerchantChannelStatus.AUDIT_STATUS_DATA_EDIT)
.orderByDesc(MerchantChannelStatus::getValid)
.orderByAsc(MerchantChannelStatus::getId)
.last("limit 1");
MerchantChannelStatus mcs = merchantChannelStatusService.getOne(qWrapper2);
if (mcs != null) {
return mcs;
}
LambdaQueryWrapper<MerchantChannelStatus> qWrapper = new LambdaQueryWrapper<MerchantChannelStatus>()
.eq(MerchantChannelStatus::getMerchantCode, merchantCode)
.orderByDesc(MerchantChannelStatus::getValid)
.orderByAsc(MerchantChannelStatus::getId)
.last("limit 1");
return merchantChannelStatusService.getOne(qWrapper);
}
} }

View File

@@ -36,6 +36,7 @@ public class MerchantCashPlaceController {
@Resource @Resource
private MerchantChannelMapper merchantChannelMapper; private MerchantChannelMapper merchantChannelMapper;
@PostMapping @PostMapping
public Result<Object> add(@RequestBody MerchantCashPlace merchantCashPlace) { public Result<Object> add(@RequestBody MerchantCashPlace merchantCashPlace) {
//判定字符位数 //判定字符位数

View File

@@ -66,9 +66,9 @@ public class MerchantCashierCounteController {
* @return * @return
*/ */
@GetMapping("/list") @GetMapping("/list")
public Result<Object> list(@RequestParam Integer current, @RequestParam Integer size) { public Result<Object> list(@RequestParam Integer current, @RequestParam Integer size, @RequestParam String name) {
UserApp userApp = userAppService.queryUserAppByToken(); UserApp userApp = userAppService.queryUserAppByToken();
PageInfo result = merchantCashierCounteService.selectList(current,size,userApp.getUserId()); PageInfo result = merchantCashierCounteService.selectList(current,size,userApp.getUserId(),name);
return ResultGenerator.genSuccessResult(result); return ResultGenerator.genSuccessResult(result);
} }

View File

@@ -1,6 +1,7 @@
package cn.pluss.platform.mapper; package cn.pluss.platform.mapper;
import cn.pluss.platform.entity.MerchantCashPlace; import cn.pluss.platform.entity.MerchantCashPlace;
import cn.pluss.platform.entity.UserCashPlace;
import cn.pluss.platform.vo.MerchantCashPlaceVO; import cn.pluss.platform.vo.MerchantCashPlaceVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;

View File

@@ -56,4 +56,6 @@ public interface MerchantChannelStatusMapper extends BaseMapper<MerchantChannelS
List<Integer> getChannelByMerchantCode(@Param("merchantCode") String merchantCode); List<Integer> getChannelByMerchantCode(@Param("merchantCode") String merchantCode);
Integer saveChannel(MerchantChannelStatus merchantChannelStatus); Integer saveChannel(MerchantChannelStatus merchantChannelStatus);
List<Integer> getChannelByRootId(@Param("rootAccountId") long rootAccountId);
} }

View File

@@ -90,7 +90,12 @@
order by mcs.id desc limit #{pageSize} offset #{offset}; order by mcs.id desc limit #{pageSize} offset #{offset};
</select> </select>
<select id="getChannelByMerchantCode" resultType="java.lang.Integer"> <select id="getChannelByMerchantCode" resultType="java.lang.Integer">
SELECT channel FROM tb_pluss_merchant_channel_status WHERE merchantCode=#{merchantCode} -- SELECT channel FROM tb_pluss_merchant_channel_status tp inner join tb_pluss_merchant_cash_place tpm
-- on tp.channel = tpm.pay_passage_id and tp.userId = tpm.userId WHERE merchantCode=#{merchantCode}
SELECT tp.channel FROM tb_pluss_merchant_channel_status tp
inner join tb_pluss_merchant_base_info tmb on tp.merchantCode = tmb.merchantCode
inner join tb_pluss_merchant_cash_place tpm WHERE merchantCode=#{merchantCode}
on tmb.userId = tpm.userId
</select> </select>
<select id="selectMerchantCode" resultType="cn.pluss.platform.vo.MerchantCashPlaceVO"> <select id="selectMerchantCode" resultType="cn.pluss.platform.vo.MerchantCashPlaceVO">
SELECT SELECT
@@ -114,6 +119,9 @@
LIMIT LIMIT
#{pageNum}, #{pageSize} #{pageNum}, #{pageSize}
</select> </select>
<select id="getChannelByRootId" resultType="java.lang.Integer">
SELECT DISTINCT tpm.pay_passage_id from tb_pluss_merchant_cash_place tpm where tpm.root_account_id = #{rootAccountId}
</select>
<insert id="saveChannel" useGeneratedKeys="true" keyProperty="id" keyColumn="id" <insert id="saveChannel" useGeneratedKeys="true" keyProperty="id" keyColumn="id"
parameterType="cn.pluss.platform.entity.MerchantChannelStatus"> parameterType="cn.pluss.platform.entity.MerchantChannelStatus">

View File

@@ -9,7 +9,7 @@ import lombok.Getter;
public enum ZfbChannel { public enum ZfbChannel {
SXF_CHANNEL("随行付","https://czg-oss.oss-cn-hangzhou.aliyuncs.com/app/statics/%E9%9A%8F%E8%A1%8C%E4%BB%98.png"), SXF_CHANNEL("随行付","https://czg-oss.oss-cn-hangzhou.aliyuncs.com/app/statics/%E9%9A%8F%E8%A1%8C%E4%BB%98.png"),
YS_CHANNEL("银盛","https://czg-oss.oss-cn-hangzhou.aliyuncs.com/app/statics/%E9%93%B6%E7%9B%9B.png"), YS_CHANNEL("银盛","https://czg-oss.oss-cn-hangzhou.aliyuncs.com/app/statics/%E9%93%B6%E7%9B%9B.png"),
LKL_CHANNEL("拉卡拉","https://czg-oss.oss-cn-hangzhou.aliyuncs.com/app/statics/%E6%8B%89%E5%8D%A1%E6%8B%89.jpg"), LKL_CHANNEL("拉卡拉","https://czg-oss.oss-cn-hangzhou.aliyuncs.com/app/statics/%E6%8B%89%E5%8D%A1%E6%8B%89%28%E6%94%AF%E4%BB%98%E5%AE%9D%29.jpg"),
HF_CHANNEL("汇付", "https://czg-oss.oss-cn-hangzhou.aliyuncs.com/app/statics/%E6%B1%87%E4%BB%98.png"); HF_CHANNEL("汇付", "https://czg-oss.oss-cn-hangzhou.aliyuncs.com/app/statics/%E6%B1%87%E4%BB%98.png");

View File

@@ -195,6 +195,8 @@ public class MercAuditListenerImpl implements MercAuditListener {
sb.append("&mobile=").append(userInfo.getLoginName()); sb.append("&mobile=").append(userInfo.getLoginName());
sb.append("&syb_m_id=").append(merchantStore.getId()); sb.append("&syb_m_id=").append(merchantStore.getId());
sb.append("&addressNo=").append(merchantBaseInfo.getAddressNo()); sb.append("&addressNo=").append(merchantBaseInfo.getAddressNo());
sb.append("&merchantCode=").append(merchantBaseInfo.getMerchantCode());
sb.append("&type=").append(1);
String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress(); String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress();
String area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict(); String area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict();
try { try {

View File

@@ -13,13 +13,12 @@ import cn.pluss.platform.entity.*;
import cn.pluss.platform.exception.MsgException; import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.klk.vo.CallBackVo; import cn.pluss.platform.klk.vo.CallBackVo;
import cn.pluss.platform.klk.vo.FeesSetVo; import cn.pluss.platform.klk.vo.FeesSetVo;
import cn.pluss.platform.mapper.AccountMapper; import cn.pluss.platform.mapper.*;
import cn.pluss.platform.mapper.MerchantChannelFeeMapper;
import cn.pluss.platform.mapper.UserAppMapper;
import cn.pluss.platform.mcc.MccReflectService; import cn.pluss.platform.mcc.MccReflectService;
import cn.pluss.platform.merchant.AccountService; import cn.pluss.platform.merchant.AccountService;
import cn.pluss.platform.merchant.JftMercPaymentChannelService; import cn.pluss.platform.merchant.JftMercPaymentChannelService;
import cn.pluss.platform.merchant.MerchantBaseInfoService; import cn.pluss.platform.merchant.MerchantBaseInfoService;
import cn.pluss.platform.merchant.MerchantCashPlaceService;
import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService; import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService;
import cn.pluss.platform.merchantImage.MerchantImageService; import cn.pluss.platform.merchantImage.MerchantImageService;
import cn.pluss.platform.notice.NoticeService; import cn.pluss.platform.notice.NoticeService;
@@ -47,10 +46,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
//import cn.pluss.platform.merchant.edit.MercChangeRecordService; //import cn.pluss.platform.merchant.edit.MercChangeRecordService;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.TransactionStatus;
@@ -125,7 +126,16 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
private MerchantChannelFeeMapper merchantChannelFeeMapper; private MerchantChannelFeeMapper merchantChannelFeeMapper;
// @Autowired // @Autowired
// private MercChangeRecordService mcrService; // private MercChangeRecordService mcrService;
@Setter(onMethod_ = {@Autowired})
private MerchantBaseInfoMapper merchantBaseInfoMapper;
@Setter(onMethod_ = {@Autowired})
private MerchantCashPlaceMapper merchantCashPlaceMapper;
@Setter(onMethod_ = {@Autowired})
private UserCashPlaceMapper userCashPlaceMapper;
@Setter(onMethod_ = {@Autowired})
private MerchantChannelStatusMapper merchantChannelStatusMapper;
@Setter(onMethod_ = {@Autowired})
private UserInfoMapper userInfoMapper;
@Override @Override
public void merchantAuditV3(String userId, boolean isFailCheck, Integer channel) { public void merchantAuditV3(String userId, boolean isFailCheck, Integer channel) {
try { try {
@@ -325,6 +335,71 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
} }
} }
private void addCash(MerchantChannelStatus mcs) {
QueryWrapper<MerchantChannelStatus> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status", "3");
queryWrapper.eq("merchantCode", mcs.getMerchantCode());
// queryWrapper.eq("channel")
long num = merchantChannelStatusMapper.selectCount(queryWrapper);
if (num < 2) {
QueryWrapper<MerchantBaseInfo> baseInfoQueryWrapper = new QueryWrapper<>();
baseInfoQueryWrapper.eq("merchantCode", mcs.getMerchantCode());
List<MerchantBaseInfo> list = merchantBaseInfoMapper.selectList(baseInfoQueryWrapper);
if (list.size() > 0) {
MerchantBaseInfo merchantBaseInfo = list.iterator().next();
MerchantCashPlace merchantCashPlace = new MerchantCashPlace();
merchantCashPlace.setAddress(merchantBaseInfo.getAddress());
merchantCashPlace.setUserId(Long.valueOf(merchantBaseInfo.getUserId()));
merchantCashPlace.setName("收银点一");
merchantCashPlace.setPayPassageId(mcs.getChannel());
merchantCashPlace.setPayPassageName(mcs.getChannelName());
merchantCashPlace.setCreateTime(new Date());
merchantCashPlace.setName(merchantBaseInfo.getAlias());
merchantCashPlace.setRootAccountId(Long.valueOf(merchantBaseInfo.getUserId()));
merchantCashPlace.setCode(getCode());
merchantCashPlaceMapper.insert(merchantCashPlace);
UserInfo userInfo = userInfoMapper.selectById(merchantBaseInfo.getUserId());
UserCashPlace childUserCashPlace = new UserCashPlace();
childUserCashPlace.setChasplaceId(merchantCashPlace.getId());
childUserCashPlace.setCreateTime(new Date());
childUserCashPlace.setIsRootAccount("true");
childUserCashPlace.setOrgCode(userInfo.getLoginName());
childUserCashPlace.setRootAccountId(userInfo.getId().intValue());
childUserCashPlace.setUserId(userInfo.getId());
userCashPlaceMapper.insert(childUserCashPlace);
}
}
}
public String getCode(){
String randomDigits = generateRandomDigits(2);
String randomLetters = generateRandomLetters(6);
String randomString = randomDigits + randomLetters;
return randomString;
}
// 生成n位随机数字
private static String generateRandomDigits(int n) {
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
int digit = random.nextInt(10);
sb.append(digit);
}
return sb.toString();
}
private static String generateRandomLetters(int n) {
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
char letter = (char) (random.nextInt(26) + 'A');
sb.append(letter);
}
return sb.toString();
}
@Override @Override
public void auditResult(String userId) { public void auditResult(String userId) {
@@ -596,6 +671,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
break; break;
} }
} }
public void step2(String userId, Integer channel) { public void step2(String userId, Integer channel) {
MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByUserId(userId); MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByUserId(userId);
List<MerchantImage> miList = miService.getListOfMerch(userId, Account.CHANNEL_TYPE_D0); List<MerchantImage> miList = miService.getListOfMerch(userId, Account.CHANNEL_TYPE_D0);
@@ -612,6 +688,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
imageUpload(mi.getPhotoType(), mi.getPicUrl(), mcs.getApplicationId()); imageUpload(mi.getPhotoType(), mi.getPicUrl(), mcs.getApplicationId());
} }
} }
public void step3(String userId, Integer channel) { public void step3(String userId, Integer channel) {
MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByUserId(userId); MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByUserId(userId);
MerchantChannelStatus mcs = mcsService.getByMerchantCode(mbi.getMerchantCode(), channel); MerchantChannelStatus mcs = mcsService.getByMerchantCode(mbi.getMerchantCode(), channel);
@@ -654,6 +731,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
} }
mcsService.updateById(mcs); mcsService.updateById(mcs);
} }
private void imageUpload(String photoType, String imgUrl, String flowId) { private void imageUpload(String photoType, String imgUrl, String flowId) {
int count = 0; int count = 0;
while (count < 3) { while (count < 3) {
@@ -678,6 +756,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
throw new MsgException("图片多次上传失败"); throw new MsgException("图片多次上传失败");
} }
public String imgTypeTransform(String imageType) { public String imgTypeTransform(String imageType) {
if (imageType == null) { if (imageType == null) {
throw new MsgException("图片类型不能为空"); throw new MsgException("图片类型不能为空");
@@ -716,6 +795,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
return null; return null;
} }
public void signResultHandle(Notify.Auth authData, Integer channel) { public void signResultHandle(Notify.Auth authData, Integer channel) {
QueryWrapper<MerchantChannelStatus> qWrapper = Wrappers.query(); QueryWrapper<MerchantChannelStatus> qWrapper = Wrappers.query();
qWrapper.eq("extra ->> '$.authId'", authData.getAuthId()); qWrapper.eq("extra ->> '$.authId'", authData.getAuthId());
@@ -753,11 +833,16 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
//向小程序里加入商家 //向小程序里加入商家
handler.createStore(mcs); handler.createStore(mcs);
// //银盛再次报备 // //银盛再次报备
// JSONObject bizContentMap = new JSONObject(); JSONObject bizContentMap = new JSONObject();
// bizContentMap.put("channelId", "CUPS_WECHAT"); bizContentMap.put("channelId", "CUPS_WECHAT");
// bizContentMap.put("mercId", mercId); bizContentMap.put("mercId", mercId);
// bizContentMap.put("appletId", "wxc2bb94c0ddda1032"); bizContentMap.put("appletId", "wxfc7bd92a462eb191");
// ysServiceV3.req(ReqMethod.appIdAddOrUpdate, bizContentMap); ysServiceV3.req(ReqMethod.appIdAddOrUpdate, bizContentMap,channel);
try {
addCash(mcs);
}catch (Exception e){
log.info("创建店铺信息异常,异常信息:{}", e.getMessage());
}
break; break;
case YsConfigV3.STATUS_REFUSE: case YsConfigV3.STATUS_REFUSE:
String note1 = authData.getNote(); String note1 = authData.getNote();
@@ -788,6 +873,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
break; break;
} }
} }
// public void editResultHandle(Notify.Change changeResult) { // public void editResultHandle(Notify.Change changeResult) {
// String status = changeResult.getStatus(); // String status = changeResult.getStatus();
// //
@@ -922,6 +1008,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
} }
} }
} }
@Override @Override
public void report(MerchantChannelStatus mcs, Integer channel) { public void report(MerchantChannelStatus mcs, Integer channel) {
if (mcs == null) { if (mcs == null) {
@@ -962,6 +1049,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
throw new MsgException(result); throw new MsgException(result);
} }
} }
/** /**
* 微信网联报备 * 微信网联报备
*/ */
@@ -1021,6 +1109,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
throw new MsgException("支付宝银联报备异常," + req.getSubMsg()); throw new MsgException("支付宝银联报备异常," + req.getSubMsg());
} }
} }
@Override @Override
public void reportAgain(MerchantChannelStatus mcs, Integer channel) { public void reportAgain(MerchantChannelStatus mcs, Integer channel) {
if (mcs == null) { if (mcs == null) {
@@ -1182,6 +1271,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
throw new MsgException("支付宝银联报备异常," + req.getSubMsg()); throw new MsgException("支付宝银联报备异常," + req.getSubMsg());
} }
} }
public void sendProtocolMsg(MerchantChannelStatus mcs) { public void sendProtocolMsg(MerchantChannelStatus mcs) {
MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByMerchantCode(mcs.getMerchantCode()); MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByMerchantCode(mcs.getMerchantCode());
if (!mcs.getStatus().equals(MerchantChannelStatus.AUDIT_STATUS_WAITING_SIGN)) { if (!mcs.getStatus().equals(MerchantChannelStatus.AUDIT_STATUS_WAITING_SIGN)) {
@@ -1221,6 +1311,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
generalPushUtil.sendAllPlatByAlias(Collections.singletonList(mbi.getUserId()), title, content, "1"); generalPushUtil.sendAllPlatByAlias(Collections.singletonList(mbi.getUserId()), title, content, "1");
} }
/** /**
* 变更结算卡 * 变更结算卡
* 一般不支持非法人结算卡变更 * 一般不支持非法人结算卡变更
@@ -1323,6 +1414,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
// noticeService.saveSysNotice(userId, title, remark); // noticeService.saveSysNotice(userId, title, remark);
// generalPushUtil.sendAllPlatByAlias(Collections.singletonList(userId), title, remark, "1"); // generalPushUtil.sendAllPlatByAlias(Collections.singletonList(userId), title, remark, "1");
} }
/** /**
* 变更基本信息 * 变更基本信息
*/ */
@@ -1712,8 +1804,10 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
// RespEntity req = ysServiceV3.req(ReqMethod.changeMercBaseInfo, param); // RespEntity req = ysServiceV3.req(ReqMethod.changeMercBaseInfo, param);
// //
// } // }
/** /**
* 查询进件结果 * 查询进件结果
*
* @param mcs * @param mcs
*/ */
public void auditResult(MerchantChannelStatus mcs, Integer channel) { public void auditResult(MerchantChannelStatus mcs, Integer channel) {
@@ -1749,6 +1843,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
/** /**
* 查询签约结果,该操作作为商户最终状态的判断 * 查询签约结果,该操作作为商户最终状态的判断
*
* @param userId 用户id * @param userId 用户id
*/ */
public void signResult(String userId, Integer channel) { public void signResult(String userId, Integer channel) {
@@ -1777,8 +1872,10 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
signResultHandle(JSON.parseObject(respEntity.getBusinessData(), Notify.Auth.class), channel); signResultHandle(JSON.parseObject(respEntity.getBusinessData(), Notify.Auth.class), channel);
} }
/** /**
* 查询商户变更结果 * 查询商户变更结果
*
* @param userId 用户id * @param userId 用户id
*/ */
// public void editResult(String userId) { // public void editResult(String userId) {

View File

@@ -2,12 +2,7 @@ package cn.pluss.platform.merchant;
import cn.pluss.platform.api.PageInfo; import cn.pluss.platform.api.PageInfo;
import cn.pluss.platform.entity.*; import cn.pluss.platform.entity.*;
import cn.pluss.platform.vo.MerchantCashPlaceStaffVO;
import cn.pluss.platform.vo.MerchantCashPlaceVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@@ -23,7 +18,7 @@ public interface MerchantCashierCounteService {
long addCashierCounte(MerchantCashPlace merchantCashPlace,UserApp userApp); long addCashierCounte(MerchantCashPlace merchantCashPlace,UserApp userApp);
PageInfo selectList(Integer current, Integer size, Long userId); PageInfo selectList(Integer current, Integer size, Long userId, String name);
Map<String, Object> cutCashier(long fromChannel, long toChannel); Map<String, Object> cutCashier(long fromChannel, long toChannel);
} }

View File

@@ -20,8 +20,6 @@ import cn.pluss.platform.vo.MerchantCashPlaceVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.Setter; import lombok.Setter;
import lombok.val; import lombok.val;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -75,11 +73,11 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
private MerchantBaseInfoMapper merchantBaseInfoMapper; private MerchantBaseInfoMapper merchantBaseInfoMapper;
@Resource @Resource
private MerchantChannelStatusService merchantChannelStatusService; private MerchantCashPlaceMapper merchantCashPlaceMapper;
@Resource @Resource
private MerchantChannelStatusMapper channelStatusMapper; private MerchantChannelStatusMapper channelStatusMapper;
@Resource // @Resource
private MerchantChannelStatusExpMapper expMapper; // private MerchantChannelStatusExpMapper expMapper;
@Override @Override
@@ -166,6 +164,7 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
/** /**
* 判断userId的多商户列表中是否包含selectUserId * 判断userId的多商户列表中是否包含selectUserId
*
* @param userId 用户id * @param userId 用户id
* @param selectUserId 多商户列表校验用户id * @param selectUserId 多商户列表校验用户id
*/ */
@@ -212,19 +211,42 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
@Override @Override
public List<MerchantChannel> merchantChannel(String merchantCode, List<MerchantChannel> merchantChannels) { public List<MerchantChannel> merchantChannel(String merchantCode, List<MerchantChannel> merchantChannels) {
if (merchantCode != null){ // if (merchantCode != null){
QueryWrapper<MerchantChannelStatus> qW = new QueryWrapper<>(); // QueryWrapper<MerchantChannelStatus> qW = new QueryWrapper<>();
qW.eq("merchantCode",merchantCode); // qW.eq("merchantCode",merchantCode);
List<MerchantChannelStatus> list = merchantChannelStatusService.list(qW); // List<MerchantChannelStatus> list = merchantChannelStatusService.list(qW);
} // }
List<Integer> channelByMerchantCode = channelStatusMapper.getChannelByMerchantCode(merchantCode); QueryWrapper<MerchantBaseInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("merchantCode",merchantCode);
List<MerchantBaseInfo> list = merchantBaseInfoMapper.selectList(queryWrapper);
if (list.size() > 0){
QueryWrapper<MerchantCashPlace> wrapper = new QueryWrapper<>();
wrapper.eq("userId",list.iterator().next().getUserId());
List<MerchantCashPlace> chashList = merchantCashPlaceMapper.selectList(wrapper);
if (chashList.size() > 0){
List<Integer> channelByMerchantCode = channelStatusMapper.getChannelByRootId(chashList.iterator().next().getRootAccountId());
// List<Integer> channelByMerchantCode = channelStatusMapper.getChannelByMerchantCode(merchantCode);
for (MerchantChannel data : merchantChannels) { for (MerchantChannel data : merchantChannels) {
data.setStatus("0");
for (Integer i : channelByMerchantCode) { for (Integer i : channelByMerchantCode) {
if (data.getId().equals(i)) { if (data.getId().equals(i)) {
data.setStatus("1"); data.setStatus("1");
} }
} }
} }
}else {
for (MerchantChannel data : merchantChannels) {
data.setStatus("0");
}
}
}else {
// List<Integer> channelByMerchantCode = channelStatusMapper.getChannelByMerchantCode(merchantCode);
for (MerchantChannel data : merchantChannels) {
data.setStatus("0");
}
}
return merchantChannels; return merchantChannels;
} }
@@ -263,6 +285,7 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
/** /**
* (新)增加新的收银点 * (新)增加新的收银点
*
* @param merchantBaseInfo * @param merchantBaseInfo
*/ */
@Override @Override
@@ -284,11 +307,11 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
Integer id = channelStatusMapper.saveChannel(merchantChannelStatus); Integer id = channelStatusMapper.saveChannel(merchantChannelStatus);
//添加收银点 //添加收银点
String merchantCode = "M800" + DateUtil.format(new Date(), "yyyyMMdd") + StringUtil.random6V2(); String merchantCode = "M800" + DateUtil.format(new Date(), "yyyyMMdd") + StringUtil.random6V2();
Integer integer = expMapper.saveExp(merchantChannelStatus.getId(), merchantBaseInfo.getAlias(), merchantBaseInfo.getAddress(), new Date(),merchantCode); // Integer integer = expMapper.saveExp(merchantChannelStatus.getId(), merchantBaseInfo.getAlias(), merchantBaseInfo.getAddress(), new Date(),merchantCode);
Boolean flag = false; Boolean flag = false;
if (integer>0){ // if (integer>0){
flag = true; // flag = true;
} // }
return flag; return flag;
} }
@@ -588,9 +611,10 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
/** /**
* 设置收银点信息 * 设置收银点信息
* @date: 2021/11/29 10:57 *
* @param order: 订单信息 * @param order: 订单信息
* @param snNo: 设别号 * @param snNo: 设别号
* @date: 2021/11/29 10:57
*/ */
@Override @Override
public void setOrderPlaceInfo(MerchantOrder order, String snNo) { public void setOrderPlaceInfo(MerchantOrder order, String snNo) {

View File

@@ -4,7 +4,6 @@ import cn.pluss.platform.entity.*;
import cn.pluss.platform.exception.MsgException; import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.mapper.MerchantBaseInfoMapper; import cn.pluss.platform.mapper.MerchantBaseInfoMapper;
import cn.pluss.platform.mapper.MerchantCashPlaceStaffMapper; import cn.pluss.platform.mapper.MerchantCashPlaceStaffMapper;
import cn.pluss.platform.mapper.MerchantChannelStatusExpMapper;
import cn.pluss.platform.merchant.MerchantBaseInfoService; import cn.pluss.platform.merchant.MerchantBaseInfoService;
import cn.pluss.platform.merchant.MerchantCashPlaceService; import cn.pluss.platform.merchant.MerchantCashPlaceService;
import cn.pluss.platform.merchant.MerchantCashPlaceStaffService; import cn.pluss.platform.merchant.MerchantCashPlaceStaffService;
@@ -53,8 +52,8 @@ public class MerchantCashPlaceStaffServiceImpl extends ServiceImpl<MerchantCashP
@Resource @Resource
private MerchantChannelStatusService merchantChannelStatusService; private MerchantChannelStatusService merchantChannelStatusService;
@Resource // @Resource
private MerchantChannelStatusExpMapper expMapper; // private MerchantChannelStatusExpMapper expMapper;
@Override @Override
public void bindCashPlace(Long userId, MerchantCashPlace cashPlace) { public void bindCashPlace(Long userId, MerchantCashPlace cashPlace) {

View File

@@ -1,11 +1,8 @@
package cn.pluss.platform.merchant.impl; package cn.pluss.platform.merchant.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.jiguang.common.utils.StringUtils; import cn.jiguang.common.utils.StringUtils;
import cn.pluss.platform.api.PageInfo; import cn.pluss.platform.api.PageInfo;
import cn.pluss.platform.converter.Converter;
import cn.pluss.platform.converter.MerchantCashPlaceConverter;
import cn.pluss.platform.deviceStock.DeviceStockService; import cn.pluss.platform.deviceStock.DeviceStockService;
import cn.pluss.platform.entity.*; import cn.pluss.platform.entity.*;
import cn.pluss.platform.exception.MsgException; import cn.pluss.platform.exception.MsgException;
@@ -13,30 +10,19 @@ import cn.pluss.platform.jfShop.JfShopHandler;
import cn.pluss.platform.mapper.*; import cn.pluss.platform.mapper.*;
import cn.pluss.platform.merchant.*; import cn.pluss.platform.merchant.*;
import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService; import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService;
import cn.pluss.platform.other.JfShopParam;
import cn.pluss.platform.other.JfShopSyncUser;
import cn.pluss.platform.roleUserInfo.RoleUserInfoService; import cn.pluss.platform.roleUserInfo.RoleUserInfoService;
import cn.pluss.platform.systemConfig.SystemConfigService; import cn.pluss.platform.systemConfig.SystemConfigService;
import cn.pluss.platform.userApp.UserAppService; import cn.pluss.platform.userApp.UserAppService;
import cn.pluss.platform.userInfo.UserInfoService; import cn.pluss.platform.userInfo.UserInfoService;
import cn.pluss.platform.util.Base64Util;
import cn.pluss.platform.util.MD5Util; import cn.pluss.platform.util.MD5Util;
import cn.pluss.platform.util.StringUtil; import cn.pluss.platform.util.StringUtil;
import cn.pluss.platform.vo.MerchantCashPlaceStaffVO;
import cn.pluss.platform.vo.MerchantCashPlaceVO;
import cn.pluss.platform.vo.MerchantStaffConnVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.Setter; import lombok.Setter;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
@@ -131,6 +117,13 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
rootAccountId = userCashPlace.getRootAccountId(); rootAccountId = userCashPlace.getRootAccountId();
UserInfo userInfo = userInfoMapper.selectById(userCashPlace.getRootAccountId()); UserInfo userInfo = userInfoMapper.selectById(userCashPlace.getRootAccountId());
orgCode = userInfo.getLoginName(); orgCode = userInfo.getLoginName();
QueryWrapper<MerchantCashPlace> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("root_account_id", rootAccountId);
queryWrapper.eq("pay_passage_id", merchantCashPlace.getPayPassageId());
long num = merchantCashPlaceMapper.selectCount(queryWrapper);
if (num > 0) {
throw new MsgException("该进件通道已存在");
}
} }
QueryWrapper<MerchantCashPlace> queryWrapper = new QueryWrapper<>(); QueryWrapper<MerchantCashPlace> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("root_account_id", rootAccountId); queryWrapper.eq("root_account_id", rootAccountId);
@@ -169,6 +162,9 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
UserApp userApp = getSaveUserAppInfo(userInfo, merchantCashPlace.getUserId()); UserApp userApp = getSaveUserAppInfo(userInfo, merchantCashPlace.getUserId());
userApp.setInviteNum(getRandomNum()); userApp.setInviteNum(getRandomNum());
userApp.setId(null); userApp.setId(null);
userApp.setLogo(userApp1.getLogo());
userApp.setLoginName(userApp1.getLoginName());
userApp.setUserName(userApp1.getUserName());
userApp.setBankStatus(userApp1.getBankStatus()); userApp.setBankStatus(userApp1.getBankStatus());
userApp.setStatus(userApp1.getStatus()); userApp.setStatus(userApp1.getStatus());
userApp.setToken(userInfo.getLoginName()); userApp.setToken(userInfo.getLoginName());
@@ -275,8 +271,9 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(MD5Util.MD5Encode("1234qwer", "utf-8")); System.out.println(MD5Util.MD5Encode("1234qwer", "utf-8"));
} }
@Override @Override
public PageInfo selectList(Integer current, Integer size, Long userId) { public PageInfo selectList(Integer current, Integer size, Long userId, String name) {
QueryWrapper<UserCashPlace> queryWrapper = new QueryWrapper<>(); QueryWrapper<UserCashPlace> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", userId); queryWrapper.eq("user_id", userId);
UserCashPlace userCashPlace = userCashPlaceMapper.selectOne(queryWrapper); UserCashPlace userCashPlace = userCashPlaceMapper.selectOne(queryWrapper);
@@ -287,6 +284,9 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
List<Object> list = userCashPlaceMapper.selectObjs(wrapper); List<Object> list = userCashPlaceMapper.selectObjs(wrapper);
QueryWrapper<MerchantCashPlace> placeQueryWrapper = new QueryWrapper<>(); QueryWrapper<MerchantCashPlace> placeQueryWrapper = new QueryWrapper<>();
placeQueryWrapper.in("userId", list); placeQueryWrapper.in("userId", list);
if (StringUtils.isNotEmpty(name)){
placeQueryWrapper.like("name",name);
}
placeQueryWrapper.orderByAsc("id"); placeQueryWrapper.orderByAsc("id");
// List<MerchantCashPlace> placeList = merchantCashPlaceMapper.selectList(placeQueryWrapper); // List<MerchantCashPlace> placeList = merchantCashPlaceMapper.selectList(placeQueryWrapper);
IPage<MerchantCashPlace> iPage = merchantCashPlaceMapper.selectPage(new Page<>(current, size), placeQueryWrapper); IPage<MerchantCashPlace> iPage = merchantCashPlaceMapper.selectPage(new Page<>(current, size), placeQueryWrapper);
@@ -421,6 +421,7 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
String randomString = randomDigits + randomLetters; String randomString = randomDigits + randomLetters;
return randomString; return randomString;
} }
// 生成n位随机数字 // 生成n位随机数字
private static String generateRandomDigits(int n) { private static String generateRandomDigits(int n) {
Random random = new Random(); Random random = new Random();

View File

@@ -128,6 +128,8 @@ public abstract class BaseMerAuditHandler<T extends IMerAuditHandler> implements
sb.append("&mobile=").append(userInfo.getLoginName()); sb.append("&mobile=").append(userInfo.getLoginName());
sb.append("&syb_m_id=").append(merchantStore.getId()); sb.append("&syb_m_id=").append(merchantStore.getId());
sb.append("&addressNo=").append(merchantBaseInfo.getAddressNo()); sb.append("&addressNo=").append(merchantBaseInfo.getAddressNo());
sb.append("&merchantCode=").append(merchantBaseInfo.getMerchantCode());
sb.append("&type=").append(1);
String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress(); String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress();
String area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict(); String area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict();
try { try {

View File

@@ -102,10 +102,14 @@ public class LklMerAuditHandler {
@Setter(onMethod_ = {@Autowired}) @Setter(onMethod_ = {@Autowired})
private BankCardService bankCardService; private BankCardService bankCardService;
@Setter(onMethod_ = {@Autowired})
@Autowired private MerchantBaseInfoMapper merchantBaseInfoMapper;
private MerchantChannelFeeMapper merchantChannelFeeMapper; @Setter(onMethod_ = {@Autowired})
private MerchantCashPlaceMapper merchantCashPlaceMapper;
@Setter(onMethod_ = {@Autowired})
private UserCashPlaceMapper userCashPlaceMapper;
@Setter(onMethod_ = {@Autowired})
private MerchantChannelStatusMapper merchantChannelStatusMapper;
public void auditHandler(Map<String, Object> map) { public void auditHandler(Map<String, Object> map) {
execute(map); execute(map);
@@ -130,26 +134,94 @@ public class LklMerAuditHandler {
log.info("===================>进件回调,创建店铺开始,商户编号mno为:{}<=====================", map.get("customerNo").toString()); log.info("===================>进件回调,创建店铺开始,商户编号mno为:{}<=====================", map.get("customerNo").toString());
self.createStore(mcs); self.createStore(mcs);
try {
addCash(mcs);
}catch (Exception e){
log.info("创建店铺信息异常,异常信息:{}", e.getMessage());
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.info("创建店铺信息异常,异常信息:{}", e.getMessage()); log.info("创建店铺信息异常,异常信息:{}", e.getMessage());
} }
try { // try {
MerchantBaseInfo merchantBaseInfo = merchantBaseInfoService.getMerchantBaseInfoByMerchantCode(mcs.getMerchantCode()); // MerchantBaseInfo merchantBaseInfo = merchantBaseInfoService.getMerchantBaseInfoByMerchantCode(mcs.getMerchantCode());
if (StringUtils.isNotBlank(merchantBaseInfo.getUserId())) { // if (StringUtils.isNotBlank(merchantBaseInfo.getUserId())) {
cashPlaceService.createDefaultCashPlace(Long.parseLong(merchantBaseInfo.getUserId())); // cashPlaceService.createDefaultCashPlace(Long.parseLong(merchantBaseInfo.getUserId()));
} // }
} catch (Exception e) { // } catch (Exception e) {
LogExceptionUtils.printStack(log, e, "创建默认收银点失败,异常信息:{}"); // LogExceptionUtils.printStack(log, e, "创建默认收银点失败,异常信息:{}");
} // }
} }
} }
private void addCash(MerchantChannelStatus mcs) {
QueryWrapper<MerchantChannelStatus> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status", "3");
queryWrapper.eq("merchantCode", mcs.getMerchantCode());
// queryWrapper.eq("channel")
long num = merchantChannelStatusMapper.selectCount(queryWrapper);
if (num < 2) {
QueryWrapper<MerchantBaseInfo> baseInfoQueryWrapper = new QueryWrapper<>();
baseInfoQueryWrapper.eq("merchantCode", mcs.getMerchantCode());
List<MerchantBaseInfo> list = merchantBaseInfoMapper.selectList(baseInfoQueryWrapper);
if (list.size() > 0) {
MerchantBaseInfo merchantBaseInfo = list.iterator().next();
MerchantCashPlace merchantCashPlace = new MerchantCashPlace();
merchantCashPlace.setAddress(merchantBaseInfo.getAddress());
merchantCashPlace.setUserId(Long.valueOf(merchantBaseInfo.getUserId()));
merchantCashPlace.setName("收银点一");
merchantCashPlace.setPayPassageId(mcs.getChannel());
merchantCashPlace.setPayPassageName(mcs.getChannelName());
merchantCashPlace.setCreateTime(new Date());
merchantCashPlace.setName(merchantBaseInfo.getAlias());
merchantCashPlace.setRootAccountId(Long.valueOf(merchantBaseInfo.getUserId()));
merchantCashPlace.setCode(getCode());
merchantCashPlaceMapper.insert(merchantCashPlace);
UserInfo userInfo = userInfoMapper.selectById(merchantBaseInfo.getUserId());
UserCashPlace childUserCashPlace = new UserCashPlace();
childUserCashPlace.setChasplaceId(merchantCashPlace.getId());
childUserCashPlace.setCreateTime(new Date());
childUserCashPlace.setIsRootAccount("true");
childUserCashPlace.setOrgCode(userInfo.getLoginName());
childUserCashPlace.setRootAccountId(userInfo.getId().intValue());
childUserCashPlace.setUserId(userInfo.getId());
userCashPlaceMapper.insert(childUserCashPlace);
}
}
}
public String getCode(){
String randomDigits = generateRandomDigits(2);
String randomLetters = generateRandomLetters(6);
String randomString = randomDigits + randomLetters;
return randomString;
}
// 生成n位随机数字
private static String generateRandomDigits(int n) {
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
int digit = random.nextInt(10);
sb.append(digit);
}
return sb.toString();
}
private static String generateRandomLetters(int n) {
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
char letter = (char) (random.nextInt(26) + 'A');
sb.append(letter);
}
return sb.toString();
}
public void auditEditHandler(Map<String,Object> map){ public void auditEditHandler(Map<String,Object> map){
log.info("拉卡拉修改通知接口返回解密数据:{}", JSONUtil.toJsonStr(map)); log.info("拉卡拉修改通知接口返回解密数据:{}", JSONUtil.toJsonStr(map));
@@ -386,6 +458,7 @@ public class LklMerAuditHandler {
sb.append("&syb_m_id=").append(merchantStore.getId()); sb.append("&syb_m_id=").append(merchantStore.getId());
sb.append("&addressNo=").append(merchantBaseInfo.getAddressNo()); sb.append("&addressNo=").append(merchantBaseInfo.getAddressNo());
sb.append("&merchantCode=").append(merchantBaseInfo.getMerchantCode()); sb.append("&merchantCode=").append(merchantBaseInfo.getMerchantCode());
sb.append("&type=").append(1);
String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress(); String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress();
String area = merchantBaseInfo.getProvince() + "-" + merchantBaseInfo.getCity() + "-" + merchantBaseInfo.getDistrict(); String area = merchantBaseInfo.getProvince() + "-" + merchantBaseInfo.getCity() + "-" + merchantBaseInfo.getDistrict();
try { try {

View File

@@ -287,6 +287,8 @@ public class RyxMerAuditHandler {
String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress(); String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress();
String addressNo = merchantBaseInfo.getAddressNo(); String addressNo = merchantBaseInfo.getAddressNo();
sb.append("&addressNo=").append(addressNo); sb.append("&addressNo=").append(addressNo);
sb.append("&merchantCode=").append(merchantBaseInfo.getMerchantCode());
sb.append("&type=").append(1);
String area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict(); String area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict();
try { try {
String decodeAddress = URLEncoder.encode(address, "UTF-8"); String decodeAddress = URLEncoder.encode(address, "UTF-8");

View File

@@ -34,10 +34,7 @@ import org.springframework.web.client.RestTemplate;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Collections; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* @author djh * @author djh
@@ -66,7 +63,14 @@ public class SxfMerAuditHandler {
@Setter(onMethod_ = {@Autowired}) @Setter(onMethod_ = {@Autowired})
private NoticeService noticeService; private NoticeService noticeService;
@Setter(onMethod_ = {@Autowired})
private MerchantBaseInfoMapper merchantBaseInfoMapper;
@Setter(onMethod_ = {@Autowired})
private MerchantCashPlaceMapper merchantCashPlaceMapper;
@Setter(onMethod_ = {@Autowired})
private UserCashPlaceMapper userCashPlaceMapper;
@Setter(onMethod_ = {@Autowired})
private MerchantChannelStatusMapper merchantChannelStatusMapper;
@Setter(onMethod_ = {@Autowired, @Lazy}) @Setter(onMethod_ = {@Autowired, @Lazy})
private MerchantCashPlaceService cashPlaceService; private MerchantCashPlaceService cashPlaceService;
@@ -104,6 +108,11 @@ public class SxfMerAuditHandler {
try { try {
log.info("===================>(餐饮商超)进件回调,创建店铺开始,商户编号mno为:{}<=====================", auditResult.getString("mno")); log.info("===================>(餐饮商超)进件回调,创建店铺开始,商户编号mno为:{}<=====================", auditResult.getString("mno"));
self.createStore(mcs); self.createStore(mcs);
try {
addCash(mcs);
}catch (Exception e){
log.info("创建店铺信息异常,异常信息:{}", e.getMessage());
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.info("创建店铺信息异常,异常信息:{}", e.getMessage()); log.info("创建店铺信息异常,异常信息:{}", e.getMessage());
@@ -119,6 +128,71 @@ public class SxfMerAuditHandler {
} }
} }
private void addCash(MerchantChannelStatus mcs){
QueryWrapper<MerchantChannelStatus> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status","3");
queryWrapper.eq("merchantCode",mcs.getMerchantCode());
// queryWrapper.eq("channel")
long num = merchantChannelStatusMapper.selectCount(queryWrapper);
if (num < 1){
QueryWrapper<MerchantBaseInfo> baseInfoQueryWrapper = new QueryWrapper<>();
baseInfoQueryWrapper.eq("merchantCode",mcs.getMerchantCode());
List<MerchantBaseInfo> list = merchantBaseInfoMapper.selectList(baseInfoQueryWrapper);
if (list.size() > 0){
MerchantBaseInfo merchantBaseInfo = list.iterator().next();
MerchantCashPlace merchantCashPlace = new MerchantCashPlace();
merchantCashPlace.setAddress(merchantBaseInfo.getAddress());
merchantCashPlace.setUserId(Long.valueOf(merchantBaseInfo.getUserId()));
merchantCashPlace.setName("收银点一");
merchantCashPlace.setPayPassageId(mcs.getChannel());
merchantCashPlace.setPayPassageName(mcs.getChannelName());
merchantCashPlace.setCreateTime(new Date());
merchantCashPlace.setName(merchantBaseInfo.getAlias());
merchantCashPlace.setRootAccountId(Long.valueOf(merchantBaseInfo.getUserId()));
merchantCashPlace.setCode(getCode());
merchantCashPlaceMapper.insert(merchantCashPlace);
UserInfo userInfo = userInfoMapper.selectById(merchantBaseInfo.getUserId());
UserCashPlace childUserCashPlace = new UserCashPlace();
childUserCashPlace.setChasplaceId(merchantCashPlace.getId());
childUserCashPlace.setCreateTime(new Date());
childUserCashPlace.setIsRootAccount("true");
childUserCashPlace.setOrgCode(userInfo.getLoginName());
childUserCashPlace.setRootAccountId(userInfo.getId().intValue());
childUserCashPlace.setUserId(userInfo.getId());
userCashPlaceMapper.insert(childUserCashPlace);
}
}
}
public String getCode(){
String randomDigits = generateRandomDigits(2);
String randomLetters = generateRandomLetters(6);
String randomString = randomDigits + randomLetters;
return randomString;
}
// 生成n位随机数字
private static String generateRandomDigits(int n) {
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
int digit = random.nextInt(10);
sb.append(digit);
}
return sb.toString();
}
private static String generateRandomLetters(int n) {
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
char letter = (char) (random.nextInt(26) + 'A');
sb.append(letter);
}
return sb.toString();
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public MerchantChannelStatus auditCallback(JSONObject auditResult) { public MerchantChannelStatus auditCallback(JSONObject auditResult) {
MerchantChannelStatus merchantChannelStatus = new MerchantChannelStatus() MerchantChannelStatus merchantChannelStatus = new MerchantChannelStatus()
@@ -376,6 +450,8 @@ public class SxfMerAuditHandler {
sb.append("&mobile=").append(userInfo.getLoginName()); sb.append("&mobile=").append(userInfo.getLoginName());
sb.append("&syb_m_id=").append(merchantStore.getId()); sb.append("&syb_m_id=").append(merchantStore.getId());
sb.append("&addressNo=").append(merchantBaseInfo.getAddressNo()); sb.append("&addressNo=").append(merchantBaseInfo.getAddressNo());
sb.append("&merchantCode=").append(merchantBaseInfo.getMerchantCode());
sb.append("&type=").append(1);
String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress(); String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress();
String area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict(); String area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict();
try { try {

View File

@@ -38,7 +38,7 @@ public class ReqEntity {
ReqEntity entity = new ReqEntity(); ReqEntity entity = new ReqEntity();
entity.timeStamp = DateUtil.format(date, "yyyy-MM-dd HH:mm:ss"); entity.timeStamp = DateUtil.format(date, "yyyy-MM-dd HH:mm:ss");
entity.method = reqMethod.getMethod(); entity.method = reqMethod.getMethod();
entity.reqId = "SYB_" + RandomUtil.randomString(4) + DateUtil.format(date, "yyMMddHHmmss"); entity.reqId = "YSK_" + RandomUtil.randomString(4) + DateUtil.format(date, "yyMMddHHmmss");
return entity; return entity;
} }
@@ -48,7 +48,7 @@ public class ReqEntity {
ReqEntity entity = new ReqEntity(); ReqEntity entity = new ReqEntity();
entity.timeStamp = DateUtil.format(date, "yyyy-MM-dd HH:mm:ss"); entity.timeStamp = DateUtil.format(date, "yyyy-MM-dd HH:mm:ss");
entity.method = reqMethod.getMethod(); entity.method = reqMethod.getMethod();
entity.reqId = "SYB_" + RandomUtil.randomString(4) + DateUtil.format(date, "yyMMddHHmmss"); entity.reqId = "YSK_" + RandomUtil.randomString(4) + DateUtil.format(date, "yyMMddHHmmss");
return entity; return entity;
} }