收银点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;
@@ -123,16 +124,25 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
private SxfMerAuditHandler handler; private SxfMerAuditHandler handler;
@Resource @Resource
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 {
self.step1(userId,channel); self.step1(userId, channel);
executorService.execute(() -> { executorService.execute(() -> {
try { try {
self.step2(userId,channel); self.step2(userId, channel);
Thread.sleep(10000); Thread.sleep(10000);
self.step3(userId, channel); self.step3(userId, channel);
} catch (Exception e) { } catch (Exception e) {
@@ -204,7 +214,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
JSONObject extra = mcs.getExtra(); JSONObject extra = mcs.getExtra();
String custId = extra.getString("custId"); String custId = extra.getString("custId");
RespEntity respEntity; RespEntity respEntity;
if(channel == 4) { if (channel == 4) {
RateInfo rateInfo = new RateInfo(); RateInfo rateInfo = new RateInfo();
rateInfo.setCustId(custId); rateInfo.setCustId(custId);
rateInfo.setBusOpenType("00|01"); 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()); throw new MsgException("银盛云商服3.0商户签约申请请求失败, {}", respEntity.getSubMsg());
} }
//保存费率 //保存费率
channelFee(0.48d,0.48d, channel, mcs.getMerchantCode()); channelFee(0.48d, 0.48d, channel, mcs.getMerchantCode());
}else { } else {
RateInfoD1 rateInfoD1 = new RateInfoD1(); RateInfoD1 rateInfoD1 = new RateInfoD1();
rateInfoD1.setCustId(custId); rateInfoD1.setCustId(custId);
rateInfoD1.setBusOpenType("00"); rateInfoD1.setBusOpenType("00");
@@ -251,7 +261,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
throw new MsgException("银盛云商服3.0商户签约申请请求失败, {}", respEntity.getSubMsg()); 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()); 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(); Notify.Cust cust = notifyData.getCust();
cust.setStatus(notifyData.getStatus()); cust.setStatus(notifyData.getStatus());
auditResultHandle(cust,channel); auditResultHandle(cust, channel);
break; break;
case Notify.TYPE_MERC_SIGN: case Notify.TYPE_MERC_SIGN:
// 签约变更通知 // 签约变更通知
Notify.Auth auth = notifyData.getAuth(); Notify.Auth auth = notifyData.getAuth();
auth.setStatus(notifyData.getStatus()); auth.setStatus(notifyData.getStatus());
signResultHandle(auth,channel); signResultHandle(auth, channel);
break; break;
case Notify.TYPE_MERC_CHANGE: case Notify.TYPE_MERC_CHANGE:
// 商户资料变更通知 // 商户资料变更通知
@@ -320,11 +330,76 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
// 报备通知 // 报备通知
Notify.Report report = notifyData.getReport(); Notify.Report report = notifyData.getReport();
report.setStatus(notifyData.getStatus()); report.setStatus(notifyData.getStatus());
collectSubMerId(report,channel); collectSubMerId(report, channel);
break; break;
} }
} }
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) {
@@ -415,9 +490,9 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
private MercInfo combineBaseInfo(String userId, Integer channel) { private MercInfo combineBaseInfo(String userId, Integer channel) {
CombineMercInfo combineMercInfo; CombineMercInfo combineMercInfo;
if (channel.equals(4)){ if (channel.equals(4)) {
combineMercInfo = mercAuditListener.getMercInfo(userId, Account.CHANNEL_TYPE_D0); combineMercInfo = mercAuditListener.getMercInfo(userId, Account.CHANNEL_TYPE_D0);
}else { } else {
combineMercInfo = mercAuditListener.getMercInfo(userId, Account.CHANNEL_TYPE_D1); 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())) { if ("1".equals(mbi.getMerchantType())) {
custInfo.setMercName(mbi.getAlias()); custInfo.setMercName(mbi.getAlias());
}else { } else {
custInfo.setMercName(mbi.getMerchantName()); custInfo.setMercName(mbi.getMerchantName());
} }
custInfo.setMercShortName(mbi.getAlias()); custInfo.setMercShortName(mbi.getAlias());
@@ -458,7 +533,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
if (channel.equals(4)) { if (channel.equals(4)) {
custInfo.setNotifyUrl(YsConfigV3.AUDIT_NOTIFY_URL); custInfo.setNotifyUrl(YsConfigV3.AUDIT_NOTIFY_URL);
custInfo.setAgtMercId(ysConfigV3.getAgentNo()); custInfo.setAgtMercId(ysConfigV3.getAgentNo());
}else { } else {
custInfo.setNotifyUrl(YsConfigV3.AUDIT_NOTIFY_URL_D1); custInfo.setNotifyUrl(YsConfigV3.AUDIT_NOTIFY_URL_D1);
custInfo.setAgtMercId(ysConfigV3.getAgentNoD1()); 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)) { if (!mbi.getMerchantType().equals(MerchantBaseInfo.MERCH_TYPE_MICRO)) {
busInfo.setBusNm(mbi.getBussAuthName()); busInfo.setBusNm(mbi.getBussAuthName());
busInfo.setBusNo(mbi.getBussAuthNum()); busInfo.setBusNo(mbi.getBussAuthNum());
if (mbi.getBussAuthStartTime() == null || mbi.getBussAuthEndTime() == null){ if (mbi.getBussAuthStartTime() == null || mbi.getBussAuthEndTime() == null) {
throw new MsgException("营业执照日期有误"); throw new MsgException("营业执照日期有误");
} }
busInfo.setBusCertBgn(mbi.getBussAuthStartTime().replace("","") busInfo.setBusCertBgn(mbi.getBussAuthStartTime().replace("", "")
.replace("", "").replace("", "")); .replace("", "").replace("", ""));
busInfo.setBusCertExpire(mbi.getBussAuthEndTime().replace("","") busInfo.setBusCertExpire(mbi.getBussAuthEndTime().replace("", "")
.replace("", "").replace("", "")); .replace("", "").replace("", ""));
busInfo.setBusAddr(mbi.getBussAuthAddress()); busInfo.setBusAddr(mbi.getBussAuthAddress());
busInfo.setBusCertType("19"); busInfo.setBusCertType("19");
} else { } else {
@@ -568,7 +643,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
case YsConfigV3.STATUS_SUCCESS: case YsConfigV3.STATUS_SUCCESS:
mcs.setAuditSuccessTime(new Date()); mcs.setAuditSuccessTime(new Date());
mcsService.updateById(mcs); mcsService.updateById(mcs);
sign(mcs,channel); sign(mcs, channel);
break; break;
case YsConfigV3.STATUS_REFUSE: case YsConfigV3.STATUS_REFUSE:
List<String> excludeStatus = Arrays.asList(MerchantChannelStatus.AUDIT_STATUS_REJECT, MerchantChannelStatus.AUDIT_STATUS_SUCCESS); List<String> 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; 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,7 +873,8 @@ 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();
// //
// MercChangeRecord entity = mcrService.get(changeResult.getChangeSysFlowId(), 4); // MercChangeRecord entity = mcrService.get(changeResult.getChangeSysFlowId(), 4);
@@ -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,8 +1109,9 @@ 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) {
return; return;
} }
@@ -1177,11 +1266,12 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
param.put(YsConstant.MERC_ID, merchantId); param.put(YsConstant.MERC_ID, merchantId);
param.put("reportChannel", "CUPS_ALIPAY"); 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)) { if (!Objects.equals(req.getSubCode(), YsConfigV3.BIZ_SUCCESS)) {
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)) {
@@ -1190,7 +1280,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
String signId = mcs.getExtra().getString("signId"); String signId = mcs.getExtra().getString("signId");
if (StringUtils.isEmpty(signId)) { if (StringUtils.isEmpty(signId)) {
sign(mcs,mcs.getChannel()); sign(mcs, mcs.getChannel());
return; return;
} }
@@ -1198,7 +1288,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
reqParam.put("signId", signId); reqParam.put("signId", signId);
reqParam.put("isSendConMsg", "1"); 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)) { if (!Objects.equals(respEntity.getSubCode(), YsConfigV3.BIZ_SUCCESS)) {
throw new MsgException("银盛云商服3.0商户签约短信请求失败, " + respEntity.getSubMsg()); 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"); 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)); account = accountService.getOne(new QueryWrapper<>(account));
accountIdCard = idCardService.getAccountIdCard(bankCardDTO.getUserId(), Account.CHANNEL_TYPE_D0); accountIdCard = idCardService.getAccountIdCard(bankCardDTO.getUserId(), Account.CHANNEL_TYPE_D0);
JSONObject bak = account.getBak(); JSONObject bak = account.getBak();
}else { } else {
account.setUserId(bankCardDTO.getUserId()).setChannelType(Account.CHANNEL_TYPE_D1); account.setUserId(bankCardDTO.getUserId()).setChannelType(Account.CHANNEL_TYPE_D1);
account = accountService.getOne(new QueryWrapper<>(account)); account = accountService.getOne(new QueryWrapper<>(account));
accountIdCard = idCardService.getAccountIdCard(bankCardDTO.getUserId(), Account.CHANNEL_TYPE_D1); 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); // noticeService.saveSysNotice(userId, title, remark);
// generalPushUtil.sendAllPlatByAlias(Collections.singletonList(userId), title, remark, "1"); // 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); // 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) {
if (mcs == null) { if (mcs == null) {
return; return;
} }
@@ -1731,13 +1825,13 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
return; 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)) { if (!Objects.equals(respEntity.getSubCode(), YsConfigV3.BIZ_SUCCESS)) {
throw new MsgException("银盛云商服3.0商户信息状态确认失败: {}", respEntity.getSubMsg()); throw new MsgException("银盛云商服3.0商户信息状态确认失败: {}", respEntity.getSubMsg());
} }
Notify.Cust cust = JSON.parseObject(respEntity.getBusinessData(), Notify.Cust.class); Notify.Cust cust = JSON.parseObject(respEntity.getBusinessData(), Notify.Cust.class);
auditResultHandle(cust,channel); auditResultHandle(cust, channel);
} }
// public void result(String sysFlowId){ // 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) { public void signResult(String userId, Integer channel) {
MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByUserId(userId); MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByUserId(userId);
@@ -1770,15 +1865,17 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
JSONObject reqParam = new JSONObject(); JSONObject reqParam = new JSONObject();
reqParam.put("authId", authId); 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)) { if (!Objects.equals(respEntity.getSubCode(), YsConfigV3.BIZ_SUCCESS)) {
throw new MsgException("银盛云商服3.0商户签约状态请求失败, {}", respEntity.getSubMsg()); 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 * @param userId 用户id
*/ */
// public void editResult(String userId) { // 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(); JSONArray array = new JSONArray();
Set<FeesSetVo> feesSet = new HashSet<>(); Set<FeesSetVo> feesSet = new HashSet<>();
FeesSetVo w = new FeesSetVo(); FeesSetVo w = new FeesSetVo();

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,8 +164,9 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
/** /**
* 判断userId的多商户列表中是否包含selectUserId * 判断userId的多商户列表中是否包含selectUserId
* @param userId 用户id *
* @param selectUserId 多商户列表校验用户id * @param userId 用户id
* @param selectUserId 多商户列表校验用户id
*/ */
private void checkAvailable(String userId, String selectUserId) { private void checkAvailable(String userId, String selectUserId) {
if (userId.equals(selectUserId)) { if (userId.equals(selectUserId)) {
@@ -211,20 +210,43 @@ 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<>();
for (MerchantChannel data : merchantChannels) { queryWrapper.eq("merchantCode",merchantCode);
for (Integer i :channelByMerchantCode) { List<MerchantBaseInfo> list = merchantBaseInfoMapper.selectList(queryWrapper);
if (data.getId().equals(i)){ if (list.size() > 0){
data.setStatus("1"); 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) {
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<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
@@ -270,7 +293,7 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
public Boolean addCashPlace(MerchantBaseInfo merchantBaseInfo) { public Boolean addCashPlace(MerchantBaseInfo merchantBaseInfo) {
//判断能不能新加收银点 //判断能不能新加收银点
MerchantChannelStatus byMerchantCode = channelStatusMapper.getByMerchantCode(merchantBaseInfo.getMerchantCode(), merchantBaseInfo.getChannel()); MerchantChannelStatus byMerchantCode = channelStatusMapper.getByMerchantCode(merchantBaseInfo.getMerchantCode(), merchantBaseInfo.getChannel());
if (byMerchantCode != null){ if (byMerchantCode != null) {
throw new MsgException("不能添加收银点"); throw new MsgException("不能添加收银点");
} }
//增加商户通道 //增加商户通道
@@ -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;
} }
@@ -372,12 +395,12 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
} }
@Override @Override
public List<MerchantCashPlaceVO> getListForBase(Integer current, Integer size,String merchantCodes,String name) { public List<MerchantCashPlaceVO> getListForBase(Integer current, Integer size, String merchantCodes, String name) {
//分页 //分页
current=(current-1)*size; current = (current - 1) * size;
//查询 //查询
List<MerchantCashPlaceVO> merchantCashPlaceVOS = channelStatusMapper.selectMerchantCode(merchantCodes, name,current,size); List<MerchantCashPlaceVO> merchantCashPlaceVOS = channelStatusMapper.selectMerchantCode(merchantCodes, name, current, size);
//如果全为0,默认是用户号 //如果全为0,默认是用户号
boolean allZero = true; boolean allZero = true;
@@ -415,7 +438,7 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
MerchantCashPlace merchantCashPlace = new MerchantCashPlace().setId(cashPlaceId); MerchantCashPlace merchantCashPlace = new MerchantCashPlace().setId(cashPlaceId);
merchantCashPlace = getOne(new QueryWrapper<>(merchantCashPlace)); merchantCashPlace = getOne(new QueryWrapper<>(merchantCashPlace));
if (merchantCashPlace == null) { if (merchantCashPlace == null) {
throw new MsgException("收银点不存在"); throw new MsgException("收银点不存在");
} }
@@ -588,27 +611,28 @@ 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) {
if(StringUtil.isNotEmpty(snNo)){ if (StringUtil.isNotEmpty(snNo)) {
order.setSnNo(snNo); order.setSnNo(snNo);
QueryWrapper<MerchantCashPayCode> cashCodeQueryWrapper = new QueryWrapper<MerchantCashPayCode>().eq("payCode",snNo); QueryWrapper<MerchantCashPayCode> cashCodeQueryWrapper = new QueryWrapper<MerchantCashPayCode>().eq("payCode", snNo);
List<MerchantCashPayCode> merchantCashPayCodes = merchantCashPayCodeMapper.selectList(cashCodeQueryWrapper); List<MerchantCashPayCode> merchantCashPayCodes = merchantCashPayCodeMapper.selectList(cashCodeQueryWrapper);
if(!merchantCashPayCodes.isEmpty()){ if (!merchantCashPayCodes.isEmpty()) {
MerchantCashPayCode cashPayCode = merchantCashPayCodes.get(0); MerchantCashPayCode cashPayCode = merchantCashPayCodes.get(0);
order.setCashPlaceId(String.valueOf(cashPayCode.getCashPlaceId())); order.setCashPlaceId(String.valueOf(cashPayCode.getCashPlaceId()));
QueryWrapper<MerchantCashPlaceStaff> queryWrapper = new QueryWrapper<MerchantCashPlaceStaff>().eq("cashPlaceId",cashPayCode.getCashPlaceId()) QueryWrapper<MerchantCashPlaceStaff> queryWrapper = new QueryWrapper<MerchantCashPlaceStaff>().eq("cashPlaceId", cashPayCode.getCashPlaceId())
.eq("status",MerchantCashPlaceStaff.STATUS_ONLINE); .eq("status", MerchantCashPlaceStaff.STATUS_ONLINE);
List<MerchantCashPlaceStaff> placeStaffList = merchantCashPlaceStaffMapper.selectList(queryWrapper); List<MerchantCashPlaceStaff> placeStaffList = merchantCashPlaceStaffMapper.selectList(queryWrapper);
if(!placeStaffList.isEmpty()){ if (!placeStaffList.isEmpty()) {
MerchantCashPlaceStaff placeStaff = placeStaffList.get(0); MerchantCashPlaceStaff placeStaff = placeStaffList.get(0);
order.setStaffCode(String.valueOf(placeStaff.getUserId())); order.setStaffCode(String.valueOf(placeStaff.getUserId()));
UserApp app = userAppMapper.selectByUserId(placeStaff.getUserId()); UserApp app = userAppMapper.selectByUserId(placeStaff.getUserId());
if(app != null){ if (app != null) {
order.setStaffName(app.getUserName()); order.setStaffName(app.getUserName());
} }
} }

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;
@@ -105,7 +91,7 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public long addCashierCounte(MerchantCashPlace merchantCashPlace,UserApp userApp1) { public long addCashierCounte(MerchantCashPlace merchantCashPlace, UserApp userApp1) {
if (StringUtils.isEmpty(merchantCashPlace.getName())) { if (StringUtils.isEmpty(merchantCashPlace.getName())) {
throw new MsgException("缺少收银台名称"); throw new MsgException("缺少收银台名称");
@@ -117,7 +103,7 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
throw new MsgException("该收银点名称已存在"); throw new MsgException("该收银点名称已存在");
} }
UserInfo userInfo1 = userInfoMapper.selectById(userApp1.getUserId()); UserInfo userInfo1 = userInfoMapper.selectById(userApp1.getUserId());
if (userInfo1.getLoginName().contains("-")){ if (userInfo1.getLoginName().contains("-")) {
throw new MsgException("请使用登录账号创建收银点"); throw new MsgException("请使用登录账号创建收银点");
} }
QueryWrapper<UserCashPlace> wrapper = new QueryWrapper<>(); QueryWrapper<UserCashPlace> wrapper = new QueryWrapper<>();
@@ -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);
@@ -141,10 +134,10 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
if (sydNum > 0) { if (sydNum > 0) {
UserInfo userInfo = userInfoMapper.selectById(merchantCashPlace.getUserId()); UserInfo userInfo = userInfoMapper.selectById(merchantCashPlace.getUserId());
QueryWrapper<UserCashPlace> userCashPlaceQueryWrapper = new QueryWrapper<>(); QueryWrapper<UserCashPlace> userCashPlaceQueryWrapper = new QueryWrapper<>();
userCashPlaceQueryWrapper.eq("root_account_id",merchantCashPlace.getUserId()); userCashPlaceQueryWrapper.eq("root_account_id", merchantCashPlace.getUserId());
long sumNum = userCashPlaceMapper.selectCount(userCashPlaceQueryWrapper); long sumNum = userCashPlaceMapper.selectCount(userCashPlaceQueryWrapper);
userInfo.setId(null); 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.setCreateTime(new Date());
userInfo.setPassword(MD5Util.MD5Encode("czg12345678", "utf-8")); userInfo.setPassword(MD5Util.MD5Encode("czg12345678", "utf-8"));
Long roleId = null; Long roleId = null;
@@ -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());
@@ -212,21 +208,21 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
infoId = userInfo.getId(); infoId = userInfo.getId();
isRoot = "false"; isRoot = "false";
QueryWrapper<IdCard> cardQueryWrapper = new QueryWrapper<>(); QueryWrapper<IdCard> cardQueryWrapper = new QueryWrapper<>();
cardQueryWrapper.eq("userId",userApp1.getUserId()); cardQueryWrapper.eq("userId", userApp1.getUserId());
List<IdCard> idCardList = idCardMapper.selectList(cardQueryWrapper); List<IdCard> idCardList = idCardMapper.selectList(cardQueryWrapper);
for (IdCard idCard:idCardList){ for (IdCard idCard : idCardList) {
idCard.setId(null); idCard.setId(null);
idCard.setUserId(infoId+""); idCard.setUserId(infoId + "");
idCard.setCreateTime(new Date()); idCard.setCreateTime(new Date());
idCard.setUpdateTime(new Date()); idCard.setUpdateTime(new Date());
idCardMapper.insert(idCard); idCardMapper.insert(idCard);
} }
QueryWrapper<BankCard> bankCardQueryWrapper = new QueryWrapper<>(); QueryWrapper<BankCard> bankCardQueryWrapper = new QueryWrapper<>();
bankCardQueryWrapper.eq("userId",userApp1.getUserId()); bankCardQueryWrapper.eq("userId", userApp1.getUserId());
List<BankCard> cardList = bankCardMapper.selectList(bankCardQueryWrapper); List<BankCard> cardList = bankCardMapper.selectList(bankCardQueryWrapper);
for (BankCard idCard:cardList){ for (BankCard idCard : cardList) {
idCard.setId(null); idCard.setId(null);
idCard.setUserId(infoId+""); idCard.setUserId(infoId + "");
idCard.setCreateTime(new Date()); idCard.setCreateTime(new Date());
idCard.setUpdateTime(new Date()); idCard.setUpdateTime(new Date());
bankCardMapper.insert(idCard); bankCardMapper.insert(idCard);
@@ -239,12 +235,12 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
merchantCashPlace.setCreateTime(new Date()); merchantCashPlace.setCreateTime(new Date());
merchantCashPlace.setCode(getCode()); merchantCashPlace.setCode(getCode());
merchantCashPlaceMapper.insert(merchantCashPlace); merchantCashPlaceMapper.insert(merchantCashPlace);
if ("true".equals(isRoot)){ if ("true".equals(isRoot)) {
QueryWrapper<UserCashPlace> placeQueryWrapper = new QueryWrapper<>(); QueryWrapper<UserCashPlace> placeQueryWrapper = new QueryWrapper<>();
placeQueryWrapper.eq("is_root_account","true"); placeQueryWrapper.eq("is_root_account", "true");
placeQueryWrapper.eq("user_id",userApp1.getUserId()); placeQueryWrapper.eq("user_id", userApp1.getUserId());
UserCashPlace childUserCashPlace = userCashPlaceMapper.selectOne(placeQueryWrapper); UserCashPlace childUserCashPlace = userCashPlaceMapper.selectOne(placeQueryWrapper);
if (Objects.isNull(childUserCashPlace)){ if (Objects.isNull(childUserCashPlace)) {
childUserCashPlace = new UserCashPlace(); childUserCashPlace = new UserCashPlace();
childUserCashPlace.setChasplaceId(merchantCashPlace.getId()); childUserCashPlace.setChasplaceId(merchantCashPlace.getId());
childUserCashPlace.setCreateTime(new Date()); childUserCashPlace.setCreateTime(new Date());
@@ -253,12 +249,12 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
childUserCashPlace.setRootAccountId(rootAccountId); childUserCashPlace.setRootAccountId(rootAccountId);
childUserCashPlace.setUserId(infoId); childUserCashPlace.setUserId(infoId);
userCashPlaceMapper.insert(childUserCashPlace); userCashPlaceMapper.insert(childUserCashPlace);
}else { } else {
childUserCashPlace.setChasplaceId(merchantCashPlace.getId()); childUserCashPlace.setChasplaceId(merchantCashPlace.getId());
childUserCashPlace.setUpdateTime(new Date()); childUserCashPlace.setUpdateTime(new Date());
userCashPlaceMapper.updateById(childUserCashPlace); userCashPlaceMapper.updateById(childUserCashPlace);
} }
}else { } else {
UserCashPlace childUserCashPlace = new UserCashPlace(); UserCashPlace childUserCashPlace = new UserCashPlace();
childUserCashPlace.setChasplaceId(merchantCashPlace.getId()); childUserCashPlace.setChasplaceId(merchantCashPlace.getId());
childUserCashPlace.setCreateTime(new Date()); childUserCashPlace.setCreateTime(new Date());
@@ -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);
@@ -295,16 +295,16 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
// return new PageInfo<MerchantCashPlace>(current, 0,0, // return new PageInfo<MerchantCashPlace>(current, 0,0,
// size, iPage.getRecords());; // size, iPage.getRecords());;
// } else { // } else {
for (MerchantCashPlace merchantCashPlace:iPage.getRecords()){ for (MerchantCashPlace merchantCashPlace : iPage.getRecords()) {
if (userId.intValue() == merchantCashPlace.getUserId().intValue()){ if (userId.intValue() == merchantCashPlace.getUserId().intValue()) {
merchantCashPlace.setTab(1); merchantCashPlace.setTab(1);
}else { } else {
merchantCashPlace.setTab(0); merchantCashPlace.setTab(0);
} }
} }
PageInfo<MerchantCashPlace> pager = new PageInfo<MerchantCashPlace>(iPage.getCurrent(), iPage.getTotal(), iPage.getPages(), PageInfo<MerchantCashPlace> pager = new PageInfo<MerchantCashPlace>(iPage.getCurrent(), iPage.getTotal(), iPage.getPages(),
iPage.getSize(), iPage.getRecords()); iPage.getSize(), iPage.getRecords());
return pager; return pager;
// } // }
} }
return new PageInfo<MerchantCashPlace>(current.longValue(), 0L, 0L, return new PageInfo<MerchantCashPlace>(current.longValue(), 0L, 0L,
@@ -415,12 +415,13 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
} }
public String getCode(){ public String getCode() {
String randomDigits = generateRandomDigits(2); String randomDigits = generateRandomDigits(2);
String randomLetters = generateRandomLetters(6); String randomLetters = generateRandomLetters(6);
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;
} }