From c925311eb6dfadc99e7bff09500ef2b22fcc610e Mon Sep 17 00:00:00 2001 From: 19991905653 Date: Tue, 27 Feb 2024 17:39:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E9=93=B6=E7=82=B9bug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ZfbAttestationController.java | 31 ++- .../merchant/MerchantCashPlaceController.java | 1 + .../MerchantCashierCounteController.java | 4 +- .../mapper/MerchantCashPlaceMapper.java | 1 + .../mapper/MerchantChannelStatusMapper.java | 2 + .../mapper/MerchantChannelStatusMapper.xml | 10 +- .../cn/pluss/platform/enums/ZfbChannel.java | 2 +- .../channel/MercAuditListenerImpl.java | 2 + .../channel/ys/impl/YSAuditServiceV3.java | 183 ++++++++++++++---- .../MerchantCashierCounteService.java | 7 +- .../impl/MerchantCashPlaceServiceImpl.java | 96 +++++---- .../MerchantCashPlaceStaffServiceImpl.java | 5 +- .../MerchantCashierCounteServiceImpl.java | 77 ++++---- .../platform/task/BaseMerAuditHandler.java | 2 + .../platform/task/LklMerAuditHandler.java | 99 ++++++++-- .../platform/task/RyxMerAuditHandler.java | 2 + .../platform/task/SxfMerAuditHandler.java | 86 +++++++- .../platform/ys/impl/v20220527/ReqEntity.java | 4 +- 18 files changed, 458 insertions(+), 156 deletions(-) diff --git a/pluss-api-page/src/main/java/cn/pluss/platform/controller/ZfbAttestationController.java b/pluss-api-page/src/main/java/cn/pluss/platform/controller/ZfbAttestationController.java index 14d94ea..e05fab1 100644 --- a/pluss-api-page/src/main/java/cn/pluss/platform/controller/ZfbAttestationController.java +++ b/pluss-api-page/src/main/java/cn/pluss/platform/controller/ZfbAttestationController.java @@ -11,7 +11,8 @@ import cn.pluss.platform.merchant.AccountService; import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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 java.util.ArrayList; import java.util.HashMap; @@ -39,11 +40,7 @@ public class ZfbAttestationController { @PostMapping public Result Attestation(@RequestBody Map params) { - QueryWrapper QueryWrapper = new QueryWrapper() - .eq("merchantCode", params.get("merchantCode")) - .eq("status", 3) - .ne("merchantId",""); - MerchantChannelStatus merchantCode = merchantChannelStatusService.getOne(QueryWrapper); + MerchantChannelStatus merchantCode = checkChannel(params.get("merchantCode")); if (merchantCode == null){ throw new MsgException("账号异常"); } @@ -80,4 +77,26 @@ public class ZfbAttestationController { } return ResultGenerator.genSuccessResult(merchantCodeMap); } + private MerchantChannelStatus checkChannel(String merchantCode){ + LambdaQueryWrapper 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 qWrapper = new LambdaQueryWrapper() + .eq(MerchantChannelStatus::getMerchantCode, merchantCode) + .orderByDesc(MerchantChannelStatus::getValid) + .orderByAsc(MerchantChannelStatus::getId) + .last("limit 1"); + + return merchantChannelStatusService.getOne(qWrapper); + } } diff --git a/pluss-api-page/src/main/java/cn/pluss/platform/controller/merchant/MerchantCashPlaceController.java b/pluss-api-page/src/main/java/cn/pluss/platform/controller/merchant/MerchantCashPlaceController.java index 9eb3398..401742f 100644 --- a/pluss-api-page/src/main/java/cn/pluss/platform/controller/merchant/MerchantCashPlaceController.java +++ b/pluss-api-page/src/main/java/cn/pluss/platform/controller/merchant/MerchantCashPlaceController.java @@ -36,6 +36,7 @@ public class MerchantCashPlaceController { @Resource private MerchantChannelMapper merchantChannelMapper; + @PostMapping public Result add(@RequestBody MerchantCashPlace merchantCashPlace) { //判定字符位数 diff --git a/pluss-api-page/src/main/java/cn/pluss/platform/controller/merchant/MerchantCashierCounteController.java b/pluss-api-page/src/main/java/cn/pluss/platform/controller/merchant/MerchantCashierCounteController.java index 6741526..3c5fbcf 100644 --- a/pluss-api-page/src/main/java/cn/pluss/platform/controller/merchant/MerchantCashierCounteController.java +++ b/pluss-api-page/src/main/java/cn/pluss/platform/controller/merchant/MerchantCashierCounteController.java @@ -66,9 +66,9 @@ public class MerchantCashierCounteController { * @return */ @GetMapping("/list") - public Result list(@RequestParam Integer current, @RequestParam Integer size) { + public Result list(@RequestParam Integer current, @RequestParam Integer size, @RequestParam String name) { 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); } diff --git a/pluss-dao-bundle/src/main/java/cn/pluss/platform/mapper/MerchantCashPlaceMapper.java b/pluss-dao-bundle/src/main/java/cn/pluss/platform/mapper/MerchantCashPlaceMapper.java index ff67627..20cb9cd 100644 --- a/pluss-dao-bundle/src/main/java/cn/pluss/platform/mapper/MerchantCashPlaceMapper.java +++ b/pluss-dao-bundle/src/main/java/cn/pluss/platform/mapper/MerchantCashPlaceMapper.java @@ -1,6 +1,7 @@ package cn.pluss.platform.mapper; import cn.pluss.platform.entity.MerchantCashPlace; +import cn.pluss.platform.entity.UserCashPlace; import cn.pluss.platform.vo.MerchantCashPlaceVO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; diff --git a/pluss-dao-bundle/src/main/java/cn/pluss/platform/mapper/MerchantChannelStatusMapper.java b/pluss-dao-bundle/src/main/java/cn/pluss/platform/mapper/MerchantChannelStatusMapper.java index 02fe357..96350aa 100644 --- a/pluss-dao-bundle/src/main/java/cn/pluss/platform/mapper/MerchantChannelStatusMapper.java +++ b/pluss-dao-bundle/src/main/java/cn/pluss/platform/mapper/MerchantChannelStatusMapper.java @@ -56,4 +56,6 @@ public interface MerchantChannelStatusMapper extends BaseMapper getChannelByMerchantCode(@Param("merchantCode") String merchantCode); Integer saveChannel(MerchantChannelStatus merchantChannelStatus); + + List getChannelByRootId(@Param("rootAccountId") long rootAccountId); } diff --git a/pluss-dao-bundle/src/main/resources/mapper/MerchantChannelStatusMapper.xml b/pluss-dao-bundle/src/main/resources/mapper/MerchantChannelStatusMapper.xml index fbdf6c7..75bb3af 100644 --- a/pluss-dao-bundle/src/main/resources/mapper/MerchantChannelStatusMapper.xml +++ b/pluss-dao-bundle/src/main/resources/mapper/MerchantChannelStatusMapper.xml @@ -90,7 +90,12 @@ order by mcs.id desc limit #{pageSize} offset #{offset}; + diff --git a/pluss-model-bundle/src/main/java/cn/pluss/platform/enums/ZfbChannel.java b/pluss-model-bundle/src/main/java/cn/pluss/platform/enums/ZfbChannel.java index 4feb824..f2ff9c8 100644 --- a/pluss-model-bundle/src/main/java/cn/pluss/platform/enums/ZfbChannel.java +++ b/pluss-model-bundle/src/main/java/cn/pluss/platform/enums/ZfbChannel.java @@ -9,7 +9,7 @@ import lombok.Getter; 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"), 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"); diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/channel/MercAuditListenerImpl.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/channel/MercAuditListenerImpl.java index a86bd25..393fa1a 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/channel/MercAuditListenerImpl.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/channel/MercAuditListenerImpl.java @@ -195,6 +195,8 @@ public class MercAuditListenerImpl implements MercAuditListener { sb.append("&mobile=").append(userInfo.getLoginName()); sb.append("&syb_m_id=").append(merchantStore.getId()); 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 area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict(); try { diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/channel/ys/impl/YSAuditServiceV3.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/channel/ys/impl/YSAuditServiceV3.java index 9dee8b9..81c2b47 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/channel/ys/impl/YSAuditServiceV3.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/channel/ys/impl/YSAuditServiceV3.java @@ -13,13 +13,12 @@ import cn.pluss.platform.entity.*; import cn.pluss.platform.exception.MsgException; import cn.pluss.platform.klk.vo.CallBackVo; import cn.pluss.platform.klk.vo.FeesSetVo; -import cn.pluss.platform.mapper.AccountMapper; -import cn.pluss.platform.mapper.MerchantChannelFeeMapper; -import cn.pluss.platform.mapper.UserAppMapper; +import cn.pluss.platform.mapper.*; import cn.pluss.platform.mcc.MccReflectService; import cn.pluss.platform.merchant.AccountService; import cn.pluss.platform.merchant.JftMercPaymentChannelService; import cn.pluss.platform.merchant.MerchantBaseInfoService; +import cn.pluss.platform.merchant.MerchantCashPlaceService; import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService; import cn.pluss.platform.merchantImage.MerchantImageService; 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.toolkit.Wrappers; //import cn.pluss.platform.merchant.edit.MercChangeRecordService; +import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; import org.springframework.transaction.TransactionStatus; @@ -123,16 +124,25 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer private SxfMerAuditHandler handler; @Resource private MerchantChannelFeeMapper merchantChannelFeeMapper; -// @Autowired + // @Autowired // 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 public void merchantAuditV3(String userId, boolean isFailCheck, Integer channel) { try { - self.step1(userId,channel); + self.step1(userId, channel); executorService.execute(() -> { try { - self.step2(userId,channel); + self.step2(userId, channel); Thread.sleep(10000); self.step3(userId, channel); } catch (Exception e) { @@ -204,7 +214,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer JSONObject extra = mcs.getExtra(); String custId = extra.getString("custId"); RespEntity respEntity; - if(channel == 4) { + if (channel == 4) { RateInfo rateInfo = new RateInfo(); rateInfo.setCustId(custId); rateInfo.setBusOpenType("00|01"); @@ -228,8 +238,8 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer throw new MsgException("银盛云商服3.0商户签约申请请求失败, {}", respEntity.getSubMsg()); } //保存费率 - channelFee(0.48d,0.48d, channel, mcs.getMerchantCode()); - }else { + channelFee(0.48d, 0.48d, channel, mcs.getMerchantCode()); + } else { RateInfoD1 rateInfoD1 = new RateInfoD1(); rateInfoD1.setCustId(custId); rateInfoD1.setBusOpenType("00"); @@ -251,7 +261,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer throw new MsgException("银盛云商服3.0商户签约申请请求失败, {}", respEntity.getSubMsg()); } //保存费率 - channelFee(0.38d,0.38d, channel, mcs.getMerchantCode()); + channelFee(0.38d, 0.38d, channel, mcs.getMerchantCode()); } JSONObject businessData = JSON.parseObject(respEntity.getBusinessData()); @@ -300,13 +310,13 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer // 资料确认通知 Notify.Cust cust = notifyData.getCust(); cust.setStatus(notifyData.getStatus()); - auditResultHandle(cust,channel); + auditResultHandle(cust, channel); break; case Notify.TYPE_MERC_SIGN: // 签约变更通知 Notify.Auth auth = notifyData.getAuth(); auth.setStatus(notifyData.getStatus()); - signResultHandle(auth,channel); + signResultHandle(auth, channel); break; case Notify.TYPE_MERC_CHANGE: // 商户资料变更通知 @@ -320,11 +330,76 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer // 报备通知 Notify.Report report = notifyData.getReport(); report.setStatus(notifyData.getStatus()); - collectSubMerId(report,channel); + collectSubMerId(report, channel); break; } } + private void addCash(MerchantChannelStatus mcs) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("status", "3"); + queryWrapper.eq("merchantCode", mcs.getMerchantCode()); +// queryWrapper.eq("channel") + long num = merchantChannelStatusMapper.selectCount(queryWrapper); + if (num < 2) { + QueryWrapper baseInfoQueryWrapper = new QueryWrapper<>(); + baseInfoQueryWrapper.eq("merchantCode", mcs.getMerchantCode()); + List 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 public void auditResult(String userId) { @@ -415,9 +490,9 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer private MercInfo combineBaseInfo(String userId, Integer channel) { CombineMercInfo combineMercInfo; - if (channel.equals(4)){ + if (channel.equals(4)) { combineMercInfo = mercAuditListener.getMercInfo(userId, Account.CHANNEL_TYPE_D0); - }else { + } else { combineMercInfo = mercAuditListener.getMercInfo(userId, Account.CHANNEL_TYPE_D1); } @@ -431,7 +506,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer //商户基本信息 if ("1".equals(mbi.getMerchantType())) { custInfo.setMercName(mbi.getAlias()); - }else { + } else { custInfo.setMercName(mbi.getMerchantName()); } custInfo.setMercShortName(mbi.getAlias()); @@ -458,7 +533,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer if (channel.equals(4)) { custInfo.setNotifyUrl(YsConfigV3.AUDIT_NOTIFY_URL); custInfo.setAgtMercId(ysConfigV3.getAgentNo()); - }else { + } else { custInfo.setNotifyUrl(YsConfigV3.AUDIT_NOTIFY_URL_D1); custInfo.setAgtMercId(ysConfigV3.getAgentNoD1()); } @@ -527,13 +602,13 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer if (!mbi.getMerchantType().equals(MerchantBaseInfo.MERCH_TYPE_MICRO)) { busInfo.setBusNm(mbi.getBussAuthName()); busInfo.setBusNo(mbi.getBussAuthNum()); - if (mbi.getBussAuthStartTime() == null || mbi.getBussAuthEndTime() == null){ - throw new MsgException("营业执照日期有误"); + if (mbi.getBussAuthStartTime() == null || mbi.getBussAuthEndTime() == null) { + throw new MsgException("营业执照日期有误"); } - busInfo.setBusCertBgn(mbi.getBussAuthStartTime().replace("年","") - .replace("月", "").replace("日", "")); - busInfo.setBusCertExpire(mbi.getBussAuthEndTime().replace("年","") - .replace("月", "").replace("日", "")); + busInfo.setBusCertBgn(mbi.getBussAuthStartTime().replace("年", "") + .replace("月", "").replace("日", "")); + busInfo.setBusCertExpire(mbi.getBussAuthEndTime().replace("年", "") + .replace("月", "").replace("日", "")); busInfo.setBusAddr(mbi.getBussAuthAddress()); busInfo.setBusCertType("19"); } else { @@ -568,7 +643,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer case YsConfigV3.STATUS_SUCCESS: mcs.setAuditSuccessTime(new Date()); mcsService.updateById(mcs); - sign(mcs,channel); + sign(mcs, channel); break; case YsConfigV3.STATUS_REFUSE: List excludeStatus = Arrays.asList(MerchantChannelStatus.AUDIT_STATUS_REJECT, MerchantChannelStatus.AUDIT_STATUS_SUCCESS); @@ -596,6 +671,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer break; } } + public void step2(String userId, Integer channel) { MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByUserId(userId); List 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()); } } + public void step3(String userId, Integer channel) { MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByUserId(userId); MerchantChannelStatus mcs = mcsService.getByMerchantCode(mbi.getMerchantCode(), channel); @@ -654,6 +731,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer } mcsService.updateById(mcs); } + private void imageUpload(String photoType, String imgUrl, String flowId) { int count = 0; while (count < 3) { @@ -678,6 +756,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer throw new MsgException("图片多次上传失败"); } + public String imgTypeTransform(String imageType) { if (imageType == null) { throw new MsgException("图片类型不能为空"); @@ -716,6 +795,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer return null; } + public void signResultHandle(Notify.Auth authData, Integer channel) { QueryWrapper qWrapper = Wrappers.query(); qWrapper.eq("extra ->> '$.authId'", authData.getAuthId()); @@ -753,11 +833,16 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer //向小程序里加入商家 handler.createStore(mcs); // //银盛再次报备 -// JSONObject bizContentMap = new JSONObject(); -// bizContentMap.put("channelId", "CUPS_WECHAT"); -// bizContentMap.put("mercId", mercId); -// bizContentMap.put("appletId", "wxc2bb94c0ddda1032"); -// ysServiceV3.req(ReqMethod.appIdAddOrUpdate, bizContentMap); + JSONObject bizContentMap = new JSONObject(); + bizContentMap.put("channelId", "CUPS_WECHAT"); + bizContentMap.put("mercId", mercId); + bizContentMap.put("appletId", "wxfc7bd92a462eb191"); + ysServiceV3.req(ReqMethod.appIdAddOrUpdate, bizContentMap,channel); + try { + addCash(mcs); + }catch (Exception e){ + log.info("创建店铺信息异常,异常信息:{}", e.getMessage()); + } break; case YsConfigV3.STATUS_REFUSE: String note1 = authData.getNote(); @@ -788,7 +873,8 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer break; } } -// public void editResultHandle(Notify.Change changeResult) { + + // public void editResultHandle(Notify.Change changeResult) { // String status = changeResult.getStatus(); // // MercChangeRecord entity = mcrService.get(changeResult.getChangeSysFlowId(), 4); @@ -922,6 +1008,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer } } } + @Override public void report(MerchantChannelStatus mcs, Integer channel) { if (mcs == null) { @@ -962,6 +1049,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer throw new MsgException(result); } } + /** * 微信网联报备 */ @@ -1021,8 +1109,9 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer throw new MsgException("支付宝银联报备异常," + req.getSubMsg()); } } + @Override - public void reportAgain(MerchantChannelStatus mcs, Integer channel){ + public void reportAgain(MerchantChannelStatus mcs, Integer channel) { if (mcs == null) { return; } @@ -1177,11 +1266,12 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer param.put(YsConstant.MERC_ID, merchantId); param.put("reportChannel", "CUPS_ALIPAY"); - RespEntity req = ysServiceV3.req(ReqMethod.reportAgain, param,Integer.valueOf(merchantId)); + RespEntity req = ysServiceV3.req(ReqMethod.reportAgain, param, Integer.valueOf(merchantId)); if (!Objects.equals(req.getSubCode(), YsConfigV3.BIZ_SUCCESS)) { throw new MsgException("支付宝银联报备异常," + req.getSubMsg()); } } + public void sendProtocolMsg(MerchantChannelStatus mcs) { MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByMerchantCode(mcs.getMerchantCode()); if (!mcs.getStatus().equals(MerchantChannelStatus.AUDIT_STATUS_WAITING_SIGN)) { @@ -1190,7 +1280,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer String signId = mcs.getExtra().getString("signId"); if (StringUtils.isEmpty(signId)) { - sign(mcs,mcs.getChannel()); + sign(mcs, mcs.getChannel()); return; } @@ -1198,7 +1288,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer reqParam.put("signId", signId); reqParam.put("isSendConMsg", "1"); - RespEntity respEntity = ysServiceV3.req(ReqMethod.sendSmsOrEmailMsg, reqParam,mcs.getChannel()); + RespEntity respEntity = ysServiceV3.req(ReqMethod.sendSmsOrEmailMsg, reqParam, mcs.getChannel()); if (!Objects.equals(respEntity.getSubCode(), YsConfigV3.BIZ_SUCCESS)) { throw new MsgException("银盛云商服3.0商户签约短信请求失败, " + respEntity.getSubMsg()); } @@ -1221,6 +1311,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer generalPushUtil.sendAllPlatByAlias(Collections.singletonList(mbi.getUserId()), title, content, "1"); } + /** * 变更结算卡 * 一般不支持非法人结算卡变更 @@ -1258,7 +1349,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer account = accountService.getOne(new QueryWrapper<>(account)); accountIdCard = idCardService.getAccountIdCard(bankCardDTO.getUserId(), Account.CHANNEL_TYPE_D0); JSONObject bak = account.getBak(); - }else { + } else { account.setUserId(bankCardDTO.getUserId()).setChannelType(Account.CHANNEL_TYPE_D1); account = accountService.getOne(new QueryWrapper<>(account)); accountIdCard = idCardService.getAccountIdCard(bankCardDTO.getUserId(), Account.CHANNEL_TYPE_D1); @@ -1323,6 +1414,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer // noticeService.saveSysNotice(userId, title, remark); // generalPushUtil.sendAllPlatByAlias(Collections.singletonList(userId), title, remark, "1"); } + /** * 变更基本信息 */ @@ -1712,11 +1804,13 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer // RespEntity req = ysServiceV3.req(ReqMethod.changeMercBaseInfo, param); // // } + /** * 查询进件结果 + * * @param mcs */ - public void auditResult(MerchantChannelStatus mcs,Integer channel) { + public void auditResult(MerchantChannelStatus mcs, Integer channel) { if (mcs == null) { return; } @@ -1731,13 +1825,13 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer return; } - RespEntity respEntity = ysServiceV3.req(ReqMethod.queryCustApply, new JSONObject().fluentPut("sysFlowId", sysFlowId),channel); + RespEntity respEntity = ysServiceV3.req(ReqMethod.queryCustApply, new JSONObject().fluentPut("sysFlowId", sysFlowId), channel); if (!Objects.equals(respEntity.getSubCode(), YsConfigV3.BIZ_SUCCESS)) { throw new MsgException("银盛云商服3.0商户信息状态确认失败: {}", respEntity.getSubMsg()); } Notify.Cust cust = JSON.parseObject(respEntity.getBusinessData(), Notify.Cust.class); - auditResultHandle(cust,channel); + auditResultHandle(cust, channel); } // public void result(String sysFlowId){ @@ -1749,7 +1843,8 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer /** * 查询签约结果,该操作作为商户最终状态的判断 - * @param userId 用户id + * + * @param userId 用户id */ public void signResult(String userId, Integer channel) { MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByUserId(userId); @@ -1770,15 +1865,17 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer JSONObject reqParam = new JSONObject(); reqParam.put("authId", authId); - RespEntity respEntity = ysServiceV3.req(ReqMethod.queryAuthInfo, reqParam,channel); + RespEntity respEntity = ysServiceV3.req(ReqMethod.queryAuthInfo, reqParam, channel); if (!Objects.equals(respEntity.getSubCode(), YsConfigV3.BIZ_SUCCESS)) { throw new MsgException("银盛云商服3.0商户签约状态请求失败, {}", respEntity.getSubMsg()); } - signResultHandle(JSON.parseObject(respEntity.getBusinessData(), Notify.Auth.class),channel); + signResultHandle(JSON.parseObject(respEntity.getBusinessData(), Notify.Auth.class), channel); } + /** * 查询商户变更结果 + * * @param userId 用户id */ // public void editResult(String userId) { @@ -1851,7 +1948,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer // } // } // } - public void channelFee(Double WECHAT, Double ALIPAY, Integer channel, String merchantCode){ + public void channelFee(Double WECHAT, Double ALIPAY, Integer channel, String merchantCode) { JSONArray array = new JSONArray(); Set feesSet = new HashSet<>(); FeesSetVo w = new FeesSetVo(); diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/MerchantCashierCounteService.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/MerchantCashierCounteService.java index 8cacea9..a6ab0b7 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/MerchantCashierCounteService.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/MerchantCashierCounteService.java @@ -2,12 +2,7 @@ package cn.pluss.platform.merchant; import cn.pluss.platform.api.PageInfo; 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; /** @@ -23,7 +18,7 @@ public interface MerchantCashierCounteService { 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 cutCashier(long fromChannel, long toChannel); } diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantCashPlaceServiceImpl.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantCashPlaceServiceImpl.java index e7b9d1a..35e0402 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantCashPlaceServiceImpl.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantCashPlaceServiceImpl.java @@ -20,8 +20,6 @@ import cn.pluss.platform.vo.MerchantCashPlaceVO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; import lombok.Setter; import lombok.val; import org.springframework.beans.factory.annotation.Autowired; @@ -75,11 +73,11 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl merchantChannel(String merchantCode,List merchantChannels) { - if (merchantCode != null){ - QueryWrapper qW = new QueryWrapper<>(); - qW.eq("merchantCode",merchantCode); - List list = merchantChannelStatusService.list(qW); - } - List channelByMerchantCode = channelStatusMapper.getChannelByMerchantCode(merchantCode); - for (MerchantChannel data : merchantChannels) { - for (Integer i :channelByMerchantCode) { - if (data.getId().equals(i)){ - data.setStatus("1"); + public List merchantChannel(String merchantCode, List merchantChannels) { +// if (merchantCode != null){ +// QueryWrapper qW = new QueryWrapper<>(); +// qW.eq("merchantCode",merchantCode); +// List list = merchantChannelStatusService.list(qW); +// } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("merchantCode",merchantCode); + List list = merchantBaseInfoMapper.selectList(queryWrapper); + if (list.size() > 0){ + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("userId",list.iterator().next().getUserId()); + List chashList = merchantCashPlaceMapper.selectList(wrapper); + if (chashList.size() > 0){ + List channelByMerchantCode = channelStatusMapper.getChannelByRootId(chashList.iterator().next().getRootAccountId()); +// List channelByMerchantCode = channelStatusMapper.getChannelByMerchantCode(merchantCode); + for (MerchantChannel data : merchantChannels) { + data.setStatus("0"); + for (Integer i : channelByMerchantCode) { + if (data.getId().equals(i)) { + data.setStatus("1"); + } + } + } + }else { + for (MerchantChannel data : merchantChannels) { + data.setStatus("0"); } } + + }else { +// List channelByMerchantCode = channelStatusMapper.getChannelByMerchantCode(merchantCode); + for (MerchantChannel data : merchantChannels) { + data.setStatus("0"); + } } + return merchantChannels; } @@ -263,6 +285,7 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl0){ - flag = true; - } +// if (integer>0){ +// flag = true; +// } return flag; } @@ -372,12 +395,12 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl getListForBase(Integer current, Integer size,String merchantCodes,String name) { + public List getListForBase(Integer current, Integer size, String merchantCodes, String name) { //分页 - current=(current-1)*size; + current = (current - 1) * size; //查询 - List merchantCashPlaceVOS = channelStatusMapper.selectMerchantCode(merchantCodes, name,current,size); + List merchantCashPlaceVOS = channelStatusMapper.selectMerchantCode(merchantCodes, name, current, size); //如果全为0,默认是用户号 boolean allZero = true; @@ -415,7 +438,7 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl(merchantCashPlace)); - if (merchantCashPlace == null) { + if (merchantCashPlace == null) { throw new MsgException("收银点不存在"); } @@ -588,27 +611,28 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl cashCodeQueryWrapper = new QueryWrapper().eq("payCode",snNo); + QueryWrapper cashCodeQueryWrapper = new QueryWrapper().eq("payCode", snNo); List merchantCashPayCodes = merchantCashPayCodeMapper.selectList(cashCodeQueryWrapper); - if(!merchantCashPayCodes.isEmpty()){ + if (!merchantCashPayCodes.isEmpty()) { MerchantCashPayCode cashPayCode = merchantCashPayCodes.get(0); order.setCashPlaceId(String.valueOf(cashPayCode.getCashPlaceId())); - QueryWrapper queryWrapper = new QueryWrapper().eq("cashPlaceId",cashPayCode.getCashPlaceId()) - .eq("status",MerchantCashPlaceStaff.STATUS_ONLINE); + QueryWrapper queryWrapper = new QueryWrapper().eq("cashPlaceId", cashPayCode.getCashPlaceId()) + .eq("status", MerchantCashPlaceStaff.STATUS_ONLINE); List placeStaffList = merchantCashPlaceStaffMapper.selectList(queryWrapper); - if(!placeStaffList.isEmpty()){ + if (!placeStaffList.isEmpty()) { MerchantCashPlaceStaff placeStaff = placeStaffList.get(0); order.setStaffCode(String.valueOf(placeStaff.getUserId())); UserApp app = userAppMapper.selectByUserId(placeStaff.getUserId()); - if(app != null){ + if (app != null) { order.setStaffName(app.getUserName()); } } diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantCashPlaceStaffServiceImpl.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantCashPlaceStaffServiceImpl.java index 9a5b349..47b196f 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantCashPlaceStaffServiceImpl.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantCashPlaceStaffServiceImpl.java @@ -4,7 +4,6 @@ import cn.pluss.platform.entity.*; import cn.pluss.platform.exception.MsgException; import cn.pluss.platform.mapper.MerchantBaseInfoMapper; import cn.pluss.platform.mapper.MerchantCashPlaceStaffMapper; -import cn.pluss.platform.mapper.MerchantChannelStatusExpMapper; import cn.pluss.platform.merchant.MerchantBaseInfoService; import cn.pluss.platform.merchant.MerchantCashPlaceService; import cn.pluss.platform.merchant.MerchantCashPlaceStaffService; @@ -53,8 +52,8 @@ public class MerchantCashPlaceStaffServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); @@ -131,6 +117,13 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe rootAccountId = userCashPlace.getRootAccountId(); UserInfo userInfo = userInfoMapper.selectById(userCashPlace.getRootAccountId()); orgCode = userInfo.getLoginName(); + QueryWrapper 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 queryWrapper = new QueryWrapper<>(); queryWrapper.eq("root_account_id", rootAccountId); @@ -141,10 +134,10 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe if (sydNum > 0) { UserInfo userInfo = userInfoMapper.selectById(merchantCashPlace.getUserId()); QueryWrapper userCashPlaceQueryWrapper = new QueryWrapper<>(); - userCashPlaceQueryWrapper.eq("root_account_id",merchantCashPlace.getUserId()); + userCashPlaceQueryWrapper.eq("root_account_id", merchantCashPlace.getUserId()); long sumNum = userCashPlaceMapper.selectCount(userCashPlaceQueryWrapper); userInfo.setId(null); - userInfo.setLoginName(userInfo.getLoginName().concat("-").concat(String.format("%02d", sumNum+1))); + userInfo.setLoginName(userInfo.getLoginName().concat("-").concat(String.format("%02d", sumNum + 1))); userInfo.setCreateTime(new Date()); userInfo.setPassword(MD5Util.MD5Encode("czg12345678", "utf-8")); Long roleId = null; @@ -169,6 +162,9 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe UserApp userApp = getSaveUserAppInfo(userInfo, merchantCashPlace.getUserId()); userApp.setInviteNum(getRandomNum()); userApp.setId(null); + userApp.setLogo(userApp1.getLogo()); + userApp.setLoginName(userApp1.getLoginName()); + userApp.setUserName(userApp1.getUserName()); userApp.setBankStatus(userApp1.getBankStatus()); userApp.setStatus(userApp1.getStatus()); userApp.setToken(userInfo.getLoginName()); @@ -212,21 +208,21 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe infoId = userInfo.getId(); isRoot = "false"; QueryWrapper cardQueryWrapper = new QueryWrapper<>(); - cardQueryWrapper.eq("userId",userApp1.getUserId()); + cardQueryWrapper.eq("userId", userApp1.getUserId()); List idCardList = idCardMapper.selectList(cardQueryWrapper); - for (IdCard idCard:idCardList){ + for (IdCard idCard : idCardList) { idCard.setId(null); - idCard.setUserId(infoId+""); + idCard.setUserId(infoId + ""); idCard.setCreateTime(new Date()); idCard.setUpdateTime(new Date()); idCardMapper.insert(idCard); } QueryWrapper bankCardQueryWrapper = new QueryWrapper<>(); - bankCardQueryWrapper.eq("userId",userApp1.getUserId()); + bankCardQueryWrapper.eq("userId", userApp1.getUserId()); List cardList = bankCardMapper.selectList(bankCardQueryWrapper); - for (BankCard idCard:cardList){ + for (BankCard idCard : cardList) { idCard.setId(null); - idCard.setUserId(infoId+""); + idCard.setUserId(infoId + ""); idCard.setCreateTime(new Date()); idCard.setUpdateTime(new Date()); bankCardMapper.insert(idCard); @@ -239,12 +235,12 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe merchantCashPlace.setCreateTime(new Date()); merchantCashPlace.setCode(getCode()); merchantCashPlaceMapper.insert(merchantCashPlace); - if ("true".equals(isRoot)){ + if ("true".equals(isRoot)) { QueryWrapper placeQueryWrapper = new QueryWrapper<>(); - placeQueryWrapper.eq("is_root_account","true"); - placeQueryWrapper.eq("user_id",userApp1.getUserId()); + placeQueryWrapper.eq("is_root_account", "true"); + placeQueryWrapper.eq("user_id", userApp1.getUserId()); UserCashPlace childUserCashPlace = userCashPlaceMapper.selectOne(placeQueryWrapper); - if (Objects.isNull(childUserCashPlace)){ + if (Objects.isNull(childUserCashPlace)) { childUserCashPlace = new UserCashPlace(); childUserCashPlace.setChasplaceId(merchantCashPlace.getId()); childUserCashPlace.setCreateTime(new Date()); @@ -253,12 +249,12 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe childUserCashPlace.setRootAccountId(rootAccountId); childUserCashPlace.setUserId(infoId); userCashPlaceMapper.insert(childUserCashPlace); - }else { + } else { childUserCashPlace.setChasplaceId(merchantCashPlace.getId()); childUserCashPlace.setUpdateTime(new Date()); userCashPlaceMapper.updateById(childUserCashPlace); } - }else { + } else { UserCashPlace childUserCashPlace = new UserCashPlace(); childUserCashPlace.setChasplaceId(merchantCashPlace.getId()); childUserCashPlace.setCreateTime(new Date()); @@ -275,8 +271,9 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe public static void main(String[] args) { System.out.println(MD5Util.MD5Encode("1234qwer", "utf-8")); } + @Override - public PageInfo selectList(Integer current, Integer size, Long userId) { + public PageInfo selectList(Integer current, Integer size, Long userId, String name) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("user_id", userId); UserCashPlace userCashPlace = userCashPlaceMapper.selectOne(queryWrapper); @@ -287,6 +284,9 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe List list = userCashPlaceMapper.selectObjs(wrapper); QueryWrapper placeQueryWrapper = new QueryWrapper<>(); placeQueryWrapper.in("userId", list); + if (StringUtils.isNotEmpty(name)){ + placeQueryWrapper.like("name",name); + } placeQueryWrapper.orderByAsc("id"); // List placeList = merchantCashPlaceMapper.selectList(placeQueryWrapper); IPage iPage = merchantCashPlaceMapper.selectPage(new Page<>(current, size), placeQueryWrapper); @@ -295,16 +295,16 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe // return new PageInfo(current, 0,0, // size, iPage.getRecords());; // } else { - for (MerchantCashPlace merchantCashPlace:iPage.getRecords()){ - if (userId.intValue() == merchantCashPlace.getUserId().intValue()){ + for (MerchantCashPlace merchantCashPlace : iPage.getRecords()) { + if (userId.intValue() == merchantCashPlace.getUserId().intValue()) { merchantCashPlace.setTab(1); - }else { + } else { merchantCashPlace.setTab(0); } } - PageInfo pager = new PageInfo(iPage.getCurrent(), iPage.getTotal(), iPage.getPages(), - iPage.getSize(), iPage.getRecords()); - return pager; + PageInfo pager = new PageInfo(iPage.getCurrent(), iPage.getTotal(), iPage.getPages(), + iPage.getSize(), iPage.getRecords()); + return pager; // } } return new PageInfo(current.longValue(), 0L, 0L, @@ -415,12 +415,13 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe } - public String getCode(){ + 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(); diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/task/BaseMerAuditHandler.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/task/BaseMerAuditHandler.java index 2e1adeb..ca64e6c 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/task/BaseMerAuditHandler.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/task/BaseMerAuditHandler.java @@ -128,6 +128,8 @@ public abstract class BaseMerAuditHandler implements sb.append("&mobile=").append(userInfo.getLoginName()); sb.append("&syb_m_id=").append(merchantStore.getId()); 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 area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict(); try { diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/task/LklMerAuditHandler.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/task/LklMerAuditHandler.java index b336947..db446fe 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/task/LklMerAuditHandler.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/task/LklMerAuditHandler.java @@ -102,10 +102,14 @@ public class LklMerAuditHandler { @Setter(onMethod_ = {@Autowired}) private BankCardService bankCardService; - - @Autowired - private MerchantChannelFeeMapper merchantChannelFeeMapper; - + @Setter(onMethod_ = {@Autowired}) + private MerchantBaseInfoMapper merchantBaseInfoMapper; + @Setter(onMethod_ = {@Autowired}) + private MerchantCashPlaceMapper merchantCashPlaceMapper; + @Setter(onMethod_ = {@Autowired}) + private UserCashPlaceMapper userCashPlaceMapper; + @Setter(onMethod_ = {@Autowired}) + private MerchantChannelStatusMapper merchantChannelStatusMapper; public void auditHandler(Map map) { execute(map); @@ -130,26 +134,94 @@ public class LklMerAuditHandler { log.info("===================>进件回调,创建店铺开始,商户编号mno为:{}<=====================", map.get("customerNo").toString()); self.createStore(mcs); - + try { + addCash(mcs); + }catch (Exception e){ + log.info("创建店铺信息异常,异常信息:{}", e.getMessage()); + } } catch (Exception e) { e.printStackTrace(); log.info("创建店铺信息异常,异常信息:{}", e.getMessage()); } - try { - MerchantBaseInfo merchantBaseInfo = merchantBaseInfoService.getMerchantBaseInfoByMerchantCode(mcs.getMerchantCode()); - if (StringUtils.isNotBlank(merchantBaseInfo.getUserId())) { - cashPlaceService.createDefaultCashPlace(Long.parseLong(merchantBaseInfo.getUserId())); - } - } catch (Exception e) { - LogExceptionUtils.printStack(log, e, "创建默认收银点失败,异常信息:{}"); - } +// try { +// MerchantBaseInfo merchantBaseInfo = merchantBaseInfoService.getMerchantBaseInfoByMerchantCode(mcs.getMerchantCode()); +// if (StringUtils.isNotBlank(merchantBaseInfo.getUserId())) { +// cashPlaceService.createDefaultCashPlace(Long.parseLong(merchantBaseInfo.getUserId())); +// } +// } catch (Exception e) { +// LogExceptionUtils.printStack(log, e, "创建默认收银点失败,异常信息:{}"); +// } } } + private void addCash(MerchantChannelStatus mcs) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("status", "3"); + queryWrapper.eq("merchantCode", mcs.getMerchantCode()); +// queryWrapper.eq("channel") + long num = merchantChannelStatusMapper.selectCount(queryWrapper); + if (num < 2) { + QueryWrapper baseInfoQueryWrapper = new QueryWrapper<>(); + baseInfoQueryWrapper.eq("merchantCode", mcs.getMerchantCode()); + List 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 map){ log.info("拉卡拉修改通知接口返回解密数据:{}", JSONUtil.toJsonStr(map)); @@ -386,6 +458,7 @@ public class LklMerAuditHandler { sb.append("&syb_m_id=").append(merchantStore.getId()); 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 area = merchantBaseInfo.getProvince() + "-" + merchantBaseInfo.getCity() + "-" + merchantBaseInfo.getDistrict(); try { diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/task/RyxMerAuditHandler.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/task/RyxMerAuditHandler.java index fa95e90..dfd7eb9 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/task/RyxMerAuditHandler.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/task/RyxMerAuditHandler.java @@ -287,6 +287,8 @@ public class RyxMerAuditHandler { String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress(); String addressNo = merchantBaseInfo.getAddressNo(); sb.append("&addressNo=").append(addressNo); + sb.append("&merchantCode=").append(merchantBaseInfo.getMerchantCode()); + sb.append("&type=").append(1); String area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict(); try { String decodeAddress = URLEncoder.encode(address, "UTF-8"); diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/task/SxfMerAuditHandler.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/task/SxfMerAuditHandler.java index 31dadad..4fe6540 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/task/SxfMerAuditHandler.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/task/SxfMerAuditHandler.java @@ -34,10 +34,7 @@ import org.springframework.web.client.RestTemplate; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @author djh @@ -66,7 +63,14 @@ public class SxfMerAuditHandler { @Setter(onMethod_ = {@Autowired}) 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}) private MerchantCashPlaceService cashPlaceService; @@ -104,6 +108,11 @@ public class SxfMerAuditHandler { try { log.info("===================>(餐饮商超)进件回调,创建店铺开始,商户编号mno为:{}<=====================", auditResult.getString("mno")); self.createStore(mcs); + try { + addCash(mcs); + }catch (Exception e){ + log.info("创建店铺信息异常,异常信息:{}", e.getMessage()); + } } catch (Exception e) { e.printStackTrace(); log.info("创建店铺信息异常,异常信息:{}", e.getMessage()); @@ -119,6 +128,71 @@ public class SxfMerAuditHandler { } } + private void addCash(MerchantChannelStatus mcs){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("status","3"); + queryWrapper.eq("merchantCode",mcs.getMerchantCode()); +// queryWrapper.eq("channel") + long num = merchantChannelStatusMapper.selectCount(queryWrapper); + if (num < 1){ + QueryWrapper baseInfoQueryWrapper = new QueryWrapper<>(); + baseInfoQueryWrapper.eq("merchantCode",mcs.getMerchantCode()); + List 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) public MerchantChannelStatus auditCallback(JSONObject auditResult) { MerchantChannelStatus merchantChannelStatus = new MerchantChannelStatus() @@ -376,6 +450,8 @@ public class SxfMerAuditHandler { sb.append("&mobile=").append(userInfo.getLoginName()); sb.append("&syb_m_id=").append(merchantStore.getId()); 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 area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict(); try { diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/ys/impl/v20220527/ReqEntity.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/ys/impl/v20220527/ReqEntity.java index 418624d..65da17f 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/ys/impl/v20220527/ReqEntity.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/ys/impl/v20220527/ReqEntity.java @@ -38,7 +38,7 @@ public class ReqEntity { ReqEntity entity = new ReqEntity(); entity.timeStamp = DateUtil.format(date, "yyyy-MM-dd HH:mm:ss"); 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; } @@ -48,7 +48,7 @@ public class ReqEntity { ReqEntity entity = new ReqEntity(); entity.timeStamp = DateUtil.format(date, "yyyy-MM-dd HH:mm:ss"); 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; }