收银点bug修复
This commit is contained in:
@@ -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<Object> Attestation(@RequestBody Map<String, String> params) {
|
||||
|
||||
QueryWrapper<MerchantChannelStatus> QueryWrapper = new QueryWrapper<MerchantChannelStatus>()
|
||||
.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<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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public class MerchantCashPlaceController {
|
||||
@Resource
|
||||
private MerchantChannelMapper merchantChannelMapper;
|
||||
|
||||
|
||||
@PostMapping
|
||||
public Result<Object> add(@RequestBody MerchantCashPlace merchantCashPlace) {
|
||||
//判定字符位数
|
||||
|
||||
@@ -66,9 +66,9 @@ public class MerchantCashierCounteController {
|
||||
* @return
|
||||
*/
|
||||
@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();
|
||||
PageInfo result = merchantCashierCounteService.selectList(current,size,userApp.getUserId());
|
||||
PageInfo result = merchantCashierCounteService.selectList(current,size,userApp.getUserId(),name);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -56,4 +56,6 @@ public interface MerchantChannelStatusMapper extends BaseMapper<MerchantChannelS
|
||||
|
||||
List<Integer> getChannelByMerchantCode(@Param("merchantCode") String merchantCode);
|
||||
Integer saveChannel(MerchantChannelStatus merchantChannelStatus);
|
||||
|
||||
List<Integer> getChannelByRootId(@Param("rootAccountId") long rootAccountId);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,12 @@
|
||||
order by mcs.id desc limit #{pageSize} offset #{offset};
|
||||
</select>
|
||||
<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 id="selectMerchantCode" resultType="cn.pluss.platform.vo.MerchantCashPlaceVO">
|
||||
SELECT
|
||||
@@ -114,6 +119,9 @@
|
||||
LIMIT
|
||||
#{pageNum}, #{pageSize}
|
||||
</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"
|
||||
parameterType="cn.pluss.platform.entity.MerchantChannelStatus">
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<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
|
||||
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<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;
|
||||
}
|
||||
}
|
||||
|
||||
public void step2(String userId, Integer channel) {
|
||||
MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByUserId(userId);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
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<MerchantChannelStatus> 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<FeesSetVo> feesSet = new HashSet<>();
|
||||
FeesSetVo w = new FeesSetVo();
|
||||
|
||||
@@ -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<String, Object> cutCashier(long fromChannel, long toChannel);
|
||||
}
|
||||
|
||||
@@ -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<MerchantCashPlaceM
|
||||
private MerchantBaseInfoMapper merchantBaseInfoMapper;
|
||||
|
||||
@Resource
|
||||
private MerchantChannelStatusService merchantChannelStatusService;
|
||||
private MerchantCashPlaceMapper merchantCashPlaceMapper;
|
||||
@Resource
|
||||
private MerchantChannelStatusMapper channelStatusMapper;
|
||||
@Resource
|
||||
private MerchantChannelStatusExpMapper expMapper;
|
||||
// @Resource
|
||||
// private MerchantChannelStatusExpMapper expMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -166,8 +164,9 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
|
||||
|
||||
/**
|
||||
* 判断userId的多商户列表中是否包含selectUserId
|
||||
* @param userId 用户id
|
||||
* @param selectUserId 多商户列表校验用户id
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param selectUserId 多商户列表校验用户id
|
||||
*/
|
||||
private void checkAvailable(String userId, String selectUserId) {
|
||||
if (userId.equals(selectUserId)) {
|
||||
@@ -211,20 +210,43 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MerchantChannel> merchantChannel(String merchantCode,List<MerchantChannel> merchantChannels) {
|
||||
if (merchantCode != null){
|
||||
QueryWrapper<MerchantChannelStatus> qW = new QueryWrapper<>();
|
||||
qW.eq("merchantCode",merchantCode);
|
||||
List<MerchantChannelStatus> list = merchantChannelStatusService.list(qW);
|
||||
}
|
||||
List<Integer> channelByMerchantCode = channelStatusMapper.getChannelByMerchantCode(merchantCode);
|
||||
for (MerchantChannel data : merchantChannels) {
|
||||
for (Integer i :channelByMerchantCode) {
|
||||
if (data.getId().equals(i)){
|
||||
data.setStatus("1");
|
||||
public List<MerchantChannel> merchantChannel(String merchantCode, List<MerchantChannel> merchantChannels) {
|
||||
// if (merchantCode != null){
|
||||
// QueryWrapper<MerchantChannelStatus> qW = new QueryWrapper<>();
|
||||
// qW.eq("merchantCode",merchantCode);
|
||||
// List<MerchantChannelStatus> list = merchantChannelStatusService.list(qW);
|
||||
// }
|
||||
QueryWrapper<MerchantBaseInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("merchantCode",merchantCode);
|
||||
List<MerchantBaseInfo> list = merchantBaseInfoMapper.selectList(queryWrapper);
|
||||
if (list.size() > 0){
|
||||
QueryWrapper<MerchantCashPlace> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("userId",list.iterator().next().getUserId());
|
||||
List<MerchantCashPlace> chashList = merchantCashPlaceMapper.selectList(wrapper);
|
||||
if (chashList.size() > 0){
|
||||
List<Integer> channelByMerchantCode = channelStatusMapper.getChannelByRootId(chashList.iterator().next().getRootAccountId());
|
||||
// List<Integer> channelByMerchantCode = channelStatusMapper.getChannelByMerchantCode(merchantCode);
|
||||
for (MerchantChannel data : merchantChannels) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -263,6 +285,7 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
|
||||
|
||||
/**
|
||||
* (新)增加新的收银点
|
||||
*
|
||||
* @param merchantBaseInfo
|
||||
*/
|
||||
@Override
|
||||
@@ -270,7 +293,7 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
|
||||
public Boolean addCashPlace(MerchantBaseInfo merchantBaseInfo) {
|
||||
//判断能不能新加收银点
|
||||
MerchantChannelStatus byMerchantCode = channelStatusMapper.getByMerchantCode(merchantBaseInfo.getMerchantCode(), merchantBaseInfo.getChannel());
|
||||
if (byMerchantCode != null){
|
||||
if (byMerchantCode != null) {
|
||||
throw new MsgException("不能添加收银点");
|
||||
}
|
||||
//增加商户通道
|
||||
@@ -284,11 +307,11 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
|
||||
Integer id = channelStatusMapper.saveChannel(merchantChannelStatus);
|
||||
//添加收银点
|
||||
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;
|
||||
if (integer>0){
|
||||
flag = true;
|
||||
}
|
||||
// if (integer>0){
|
||||
// flag = true;
|
||||
// }
|
||||
|
||||
return flag;
|
||||
}
|
||||
@@ -372,12 +395,12 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
|
||||
}
|
||||
|
||||
@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,默认是用户号
|
||||
boolean allZero = true;
|
||||
@@ -415,7 +438,7 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
|
||||
MerchantCashPlace merchantCashPlace = new MerchantCashPlace().setId(cashPlaceId);
|
||||
merchantCashPlace = getOne(new QueryWrapper<>(merchantCashPlace));
|
||||
|
||||
if (merchantCashPlace == null) {
|
||||
if (merchantCashPlace == null) {
|
||||
throw new MsgException("收银点不存在");
|
||||
}
|
||||
|
||||
@@ -588,27 +611,28 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
|
||||
|
||||
/**
|
||||
* 设置收银点信息
|
||||
* @date: 2021/11/29 10:57
|
||||
*
|
||||
* @param order: 订单信息
|
||||
* @param snNo: 设别号
|
||||
* @date: 2021/11/29 10:57
|
||||
*/
|
||||
@Override
|
||||
public void setOrderPlaceInfo(MerchantOrder order,String snNo) {
|
||||
if(StringUtil.isNotEmpty(snNo)){
|
||||
public void setOrderPlaceInfo(MerchantOrder order, String snNo) {
|
||||
if (StringUtil.isNotEmpty(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);
|
||||
if(!merchantCashPayCodes.isEmpty()){
|
||||
if (!merchantCashPayCodes.isEmpty()) {
|
||||
MerchantCashPayCode cashPayCode = merchantCashPayCodes.get(0);
|
||||
order.setCashPlaceId(String.valueOf(cashPayCode.getCashPlaceId()));
|
||||
QueryWrapper<MerchantCashPlaceStaff> queryWrapper = new QueryWrapper<MerchantCashPlaceStaff>().eq("cashPlaceId",cashPayCode.getCashPlaceId())
|
||||
.eq("status",MerchantCashPlaceStaff.STATUS_ONLINE);
|
||||
QueryWrapper<MerchantCashPlaceStaff> queryWrapper = new QueryWrapper<MerchantCashPlaceStaff>().eq("cashPlaceId", cashPayCode.getCashPlaceId())
|
||||
.eq("status", MerchantCashPlaceStaff.STATUS_ONLINE);
|
||||
List<MerchantCashPlaceStaff> 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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<MerchantCashP
|
||||
@Resource
|
||||
private MerchantChannelStatusService merchantChannelStatusService;
|
||||
|
||||
@Resource
|
||||
private MerchantChannelStatusExpMapper expMapper;
|
||||
// @Resource
|
||||
// private MerchantChannelStatusExpMapper expMapper;
|
||||
|
||||
@Override
|
||||
public void bindCashPlace(Long userId, MerchantCashPlace cashPlace) {
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package cn.pluss.platform.merchant.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.jiguang.common.utils.StringUtils;
|
||||
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.entity.*;
|
||||
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.merchant.*;
|
||||
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.systemConfig.SystemConfigService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.userInfo.UserInfoService;
|
||||
import cn.pluss.platform.util.Base64Util;
|
||||
import cn.pluss.platform.util.MD5Util;
|
||||
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.update.LambdaUpdateWrapper;
|
||||
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.service.impl.ServiceImpl;
|
||||
import lombok.Setter;
|
||||
import lombok.val;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -105,7 +91,7 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public long addCashierCounte(MerchantCashPlace merchantCashPlace,UserApp userApp1) {
|
||||
public long addCashierCounte(MerchantCashPlace merchantCashPlace, UserApp userApp1) {
|
||||
|
||||
if (StringUtils.isEmpty(merchantCashPlace.getName())) {
|
||||
throw new MsgException("缺少收银台名称");
|
||||
@@ -117,7 +103,7 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
|
||||
throw new MsgException("该收银点名称已存在");
|
||||
}
|
||||
UserInfo userInfo1 = userInfoMapper.selectById(userApp1.getUserId());
|
||||
if (userInfo1.getLoginName().contains("-")){
|
||||
if (userInfo1.getLoginName().contains("-")) {
|
||||
throw new MsgException("请使用登录账号创建收银点");
|
||||
}
|
||||
QueryWrapper<UserCashPlace> 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<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.eq("root_account_id", rootAccountId);
|
||||
@@ -141,10 +134,10 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
|
||||
if (sydNum > 0) {
|
||||
UserInfo userInfo = userInfoMapper.selectById(merchantCashPlace.getUserId());
|
||||
QueryWrapper<UserCashPlace> 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<IdCard> cardQueryWrapper = new QueryWrapper<>();
|
||||
cardQueryWrapper.eq("userId",userApp1.getUserId());
|
||||
cardQueryWrapper.eq("userId", userApp1.getUserId());
|
||||
List<IdCard> 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<BankCard> bankCardQueryWrapper = new QueryWrapper<>();
|
||||
bankCardQueryWrapper.eq("userId",userApp1.getUserId());
|
||||
bankCardQueryWrapper.eq("userId", userApp1.getUserId());
|
||||
List<BankCard> 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<UserCashPlace> 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<UserCashPlace> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id", userId);
|
||||
UserCashPlace userCashPlace = userCashPlaceMapper.selectOne(queryWrapper);
|
||||
@@ -287,6 +284,9 @@ public class MerchantCashierCounteServiceImpl implements MerchantCashierCounteSe
|
||||
List<Object> list = userCashPlaceMapper.selectObjs(wrapper);
|
||||
QueryWrapper<MerchantCashPlace> placeQueryWrapper = new QueryWrapper<>();
|
||||
placeQueryWrapper.in("userId", list);
|
||||
if (StringUtils.isNotEmpty(name)){
|
||||
placeQueryWrapper.like("name",name);
|
||||
}
|
||||
placeQueryWrapper.orderByAsc("id");
|
||||
// List<MerchantCashPlace> placeList = merchantCashPlaceMapper.selectList(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,
|
||||
// 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<MerchantCashPlace> pager = new PageInfo<MerchantCashPlace>(iPage.getCurrent(), iPage.getTotal(), iPage.getPages(),
|
||||
iPage.getSize(), iPage.getRecords());
|
||||
return pager;
|
||||
PageInfo<MerchantCashPlace> pager = new PageInfo<MerchantCashPlace>(iPage.getCurrent(), iPage.getTotal(), iPage.getPages(),
|
||||
iPage.getSize(), iPage.getRecords());
|
||||
return pager;
|
||||
// }
|
||||
}
|
||||
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 randomLetters = generateRandomLetters(6);
|
||||
String randomString = randomDigits + randomLetters;
|
||||
return randomString;
|
||||
}
|
||||
|
||||
// 生成n位随机数字
|
||||
private static String generateRandomDigits(int n) {
|
||||
Random random = new Random();
|
||||
|
||||
@@ -128,6 +128,8 @@ public abstract class BaseMerAuditHandler<T extends IMerAuditHandler> 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 {
|
||||
|
||||
@@ -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<String, Object> 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<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){
|
||||
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 {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<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)
|
||||
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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user