|
@@ -1,9 +1,10 @@
|
|
|
package com.kxs.product.biz.service.impl;
|
|
package com.kxs.product.biz.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import cn.hutool.core.date.DatePattern;
|
|
|
|
|
+import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
import cn.hutool.core.text.CharSequenceUtil;
|
|
import cn.hutool.core.text.CharSequenceUtil;
|
|
|
import cn.hutool.core.util.IdcardUtil;
|
|
import cn.hutool.core.util.IdcardUtil;
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -18,31 +19,29 @@ import com.kxs.common.security.util.SecurityUtils;
|
|
|
import com.kxs.product.api.dto.kxsapp.merchant.MachineRatioDTO;
|
|
import com.kxs.product.api.dto.kxsapp.merchant.MachineRatioDTO;
|
|
|
import com.kxs.product.api.dto.kxsapp.merchant.MerchantListDTO;
|
|
import com.kxs.product.api.dto.kxsapp.merchant.MerchantListDTO;
|
|
|
import com.kxs.product.api.dto.kxsapp.merchant.ToMerchantMakerDTO;
|
|
import com.kxs.product.api.dto.kxsapp.merchant.ToMerchantMakerDTO;
|
|
|
|
|
+import com.kxs.product.api.model.KxsBrand;
|
|
|
import com.kxs.product.api.model.KxsMachine;
|
|
import com.kxs.product.api.model.KxsMachine;
|
|
|
import com.kxs.product.api.model.KxsMachineRatio;
|
|
import com.kxs.product.api.model.KxsMachineRatio;
|
|
|
-import com.kxs.product.api.model.KxsMachineTrack;
|
|
|
|
|
|
|
+import com.kxs.product.api.model.KxsMerchant;
|
|
|
import com.kxs.product.api.req.kxs.FeeSetReq;
|
|
import com.kxs.product.api.req.kxs.FeeSetReq;
|
|
|
import com.kxs.product.api.vo.kxsapp.merchant.MerchantDetailVO;
|
|
import com.kxs.product.api.vo.kxsapp.merchant.MerchantDetailVO;
|
|
|
-import com.kxs.product.api.vo.kxsapp.merchant.MerchantListVO;
|
|
|
|
|
-import com.kxs.product.api.vo.kxsapp.merchant.MerchantTotalVO;
|
|
|
|
|
|
|
+import com.kxs.product.biz.mapper.KxsBrandMapper;
|
|
|
import com.kxs.product.biz.mapper.KxsMachineMapper;
|
|
import com.kxs.product.biz.mapper.KxsMachineMapper;
|
|
|
import com.kxs.product.biz.mapper.KxsMachineRatioMapper;
|
|
import com.kxs.product.biz.mapper.KxsMachineRatioMapper;
|
|
|
import com.kxs.product.biz.mapper.KxsMerchantMapper;
|
|
import com.kxs.product.biz.mapper.KxsMerchantMapper;
|
|
|
-import com.kxs.product.api.model.KxsMerchant;
|
|
|
|
|
import com.kxs.product.biz.service.KxsMerchantService;
|
|
import com.kxs.product.biz.service.KxsMerchantService;
|
|
|
import com.kxs.system.api.feign.RemoteOldService;
|
|
import com.kxs.system.api.feign.RemoteOldService;
|
|
|
import com.kxs.user.api.feign.RemoteKxsUserService;
|
|
import com.kxs.user.api.feign.RemoteKxsUserService;
|
|
|
import com.kxs.user.api.model.KxsUser;
|
|
import com.kxs.user.api.model.KxsUser;
|
|
|
import com.kxs.user.api.model.KxsUserReal;
|
|
import com.kxs.user.api.model.KxsUserReal;
|
|
|
-import com.kxs.user.api.vo.kxsapp.user.RealUserInfoVO;
|
|
|
|
|
import io.seata.spring.annotation.GlobalTransactional;
|
|
import io.seata.spring.annotation.GlobalTransactional;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
-import net.bytebuddy.implementation.bytecode.Throw;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.HashMap;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 客小爽商户表(KxsMerchant)表服务实现类
|
|
* 客小爽商户表(KxsMerchant)表服务实现类
|
|
@@ -54,6 +53,7 @@ import java.util.HashMap;
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
|
public class KxsMerchantServiceImpl extends ServiceImpl<KxsMerchantMapper, KxsMerchant> implements KxsMerchantService {
|
|
public class KxsMerchantServiceImpl extends ServiceImpl<KxsMerchantMapper, KxsMerchant> implements KxsMerchantService {
|
|
|
private final KxsMachineMapper kxsMachineMapper;
|
|
private final KxsMachineMapper kxsMachineMapper;
|
|
|
|
|
+ private final KxsBrandMapper kxsBrandMapper;
|
|
|
private final RemoteKxsUserService remoteKxsUserService;
|
|
private final RemoteKxsUserService remoteKxsUserService;
|
|
|
private final KxsMerchantMapper kxsMerchantMapper;
|
|
private final KxsMerchantMapper kxsMerchantMapper;
|
|
|
private final KxsMachineRatioMapper kxsMachineRatioMapper;
|
|
private final KxsMachineRatioMapper kxsMachineRatioMapper;
|
|
@@ -62,17 +62,14 @@ public class KxsMerchantServiceImpl extends ServiceImpl<KxsMerchantMapper, KxsMe
|
|
|
public Object merchantList(Page<KxsMerchant> page, MerchantListDTO param) {
|
|
public Object merchantList(Page<KxsMerchant> page, MerchantListDTO param) {
|
|
|
Long userId = SecurityUtils.getUser().getId();
|
|
Long userId = SecurityUtils.getUser().getId();
|
|
|
param.setUserId(userId);
|
|
param.setUserId(userId);
|
|
|
- if (param.getSort() != null && param.getSort().equals("amount")){
|
|
|
|
|
- param.setSort("thisMonthTrade");
|
|
|
|
|
- }else if (param.getSort() != null && param.getSort().equals("time")){
|
|
|
|
|
- param.setSort("create_time");
|
|
|
|
|
- }else {
|
|
|
|
|
- param.setSort(null);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
if (param.getAmountSection() != null){
|
|
if (param.getAmountSection() != null){
|
|
|
- AssertUtil.IsIntervalVariableAmount(param.getAmountSection());
|
|
|
|
|
|
|
+ AssertUtil.isIntervalVariableAmount(param.getAmountSection());
|
|
|
}
|
|
}
|
|
|
- return kxsMerchantMapper.merchantList(page,param);
|
|
|
|
|
|
|
+ //查询本月交易额
|
|
|
|
|
+ String month = LocalDateTimeUtil.format(LocalDate.now(), DatePattern.SIMPLE_MONTH_PATTERN);
|
|
|
|
|
+ param.setTradeMonth(month);
|
|
|
|
|
+ return kxsMerchantMapper.merchantList(page, param, CommonConstants.MCH_TABLE_PREFIX + month);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -86,7 +83,71 @@ public class KxsMerchantServiceImpl extends ServiceImpl<KxsMerchantMapper, KxsMe
|
|
|
merchantDetailVO.setPosSn(kxsMachine.getPosSn());
|
|
merchantDetailVO.setPosSn(kxsMachine.getPosSn());
|
|
|
merchantDetailVO.setBrand(kxsMachine.getBrandId().toString());
|
|
merchantDetailVO.setBrand(kxsMachine.getBrandId().toString());
|
|
|
merchantDetailVO.setActTime(kxsMachine.getActTime().toString());
|
|
merchantDetailVO.setActTime(kxsMachine.getActTime().toString());
|
|
|
|
|
+ KxsBrand brand = kxsBrandMapper.selectById(kxsMachine.getBrandId());
|
|
|
|
|
+ merchantDetailVO.setBrandName(brand.getName());
|
|
|
|
|
+
|
|
|
|
|
+ if (kxsMachine.getBrandId() == 12 || kxsMachine.getBrandId() == 13 || kxsMachine.getBrandId() == 15)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (kxsMachine.getUpFeeFlag() == 1 && kxsMachine.getDownFeeFlag() == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ merchantDetailVO.setMchStatus("稳定期A");
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (kxsMachine.getDownFeeFlag() == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ if(kxsMachine.getMachineRatio().compareTo(new BigDecimal("0.6")) == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ merchantDetailVO.setMchStatus("稳定期B");
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ merchantDetailVO.setMchStatus( "稳定期A");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ merchantDetailVO.setMchStatus("扶持期");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (kxsMachine.getBrandId() == 14) //广电卡
|
|
|
|
|
+ {
|
|
|
|
|
+ if (kxsMachine.getBindTime().plusDays(CommonConstants.BIND_DAY_NUM).isAfter(LocalDateTime.now()))
|
|
|
|
|
+ {
|
|
|
|
|
+ merchantDetailVO.setMchStatus("扶持期");
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ merchantDetailVO.setMchStatus("稳定期");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ if (kxsMachine.getBindTime().plusDays(CommonConstants.BIND_DAY_NUM).isAfter(LocalDateTime.now()) && kxsMachine.getIsFirst() == 1 && kxsMachine.getCashPledge().compareTo(BigDecimal.ZERO) > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ merchantDetailVO.setMchStatus("扶持期");
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (kxsMachine.getDownFeeFlag() == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (kxsMachine.getMachineRatio().compareTo(new BigDecimal("0.6")) == 0 )
|
|
|
|
|
+ {
|
|
|
|
|
+ merchantDetailVO.setMchStatus("稳定期B");
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (kxsMachine.getMachineRatio().compareTo(new BigDecimal("0.63")) == 0 )
|
|
|
|
|
+ {
|
|
|
|
|
+ merchantDetailVO.setMchStatus("稳定期A");
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ merchantDetailVO.setMchStatus("稳定期");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ merchantDetailVO.setMchStatus("稳定期");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return merchantDetailVO;
|
|
return merchantDetailVO;
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|