|
@@ -15,17 +15,22 @@ import com.kxs.common.core.exception.GlobalCustomerException;
|
|
|
import com.kxs.common.core.util.AssertUtil;
|
|
import com.kxs.common.core.util.AssertUtil;
|
|
|
import com.kxs.common.core.util.R;
|
|
import com.kxs.common.core.util.R;
|
|
|
import com.kxs.common.security.util.SecurityUtils;
|
|
import com.kxs.common.security.util.SecurityUtils;
|
|
|
|
|
+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.KxsMachine;
|
|
import com.kxs.product.api.model.KxsMachine;
|
|
|
|
|
+import com.kxs.product.api.model.KxsMachineRatio;
|
|
|
import com.kxs.product.api.model.KxsMachineTrack;
|
|
import com.kxs.product.api.model.KxsMachineTrack;
|
|
|
|
|
+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.MerchantListVO;
|
|
|
import com.kxs.product.api.vo.kxsapp.merchant.MerchantTotalVO;
|
|
import com.kxs.product.api.vo.kxsapp.merchant.MerchantTotalVO;
|
|
|
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.KxsMerchantMapper;
|
|
import com.kxs.product.biz.mapper.KxsMerchantMapper;
|
|
|
import com.kxs.product.api.model.KxsMerchant;
|
|
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.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;
|
|
@@ -37,6 +42,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 客小爽商户表(KxsMerchant)表服务实现类
|
|
* 客小爽商户表(KxsMerchant)表服务实现类
|
|
@@ -50,6 +56,8 @@ public class KxsMerchantServiceImpl extends ServiceImpl<KxsMerchantMapper, KxsMe
|
|
|
private final KxsMachineMapper kxsMachineMapper;
|
|
private final KxsMachineMapper kxsMachineMapper;
|
|
|
private final RemoteKxsUserService remoteKxsUserService;
|
|
private final RemoteKxsUserService remoteKxsUserService;
|
|
|
private final KxsMerchantMapper kxsMerchantMapper;
|
|
private final KxsMerchantMapper kxsMerchantMapper;
|
|
|
|
|
+ private final KxsMachineRatioMapper kxsMachineRatioMapper;
|
|
|
|
|
+ private final RemoteOldService remoteOldService;
|
|
|
@Override
|
|
@Override
|
|
|
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();
|
|
@@ -185,15 +193,49 @@ public class KxsMerchantServiceImpl extends ServiceImpl<KxsMerchantMapper, KxsMe
|
|
|
return R.ok();
|
|
return R.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public R changeMachineRatio(MachineRatioDTO param) {
|
|
|
|
|
|
|
|
|
|
+ KxsMerchant mchInfo = getById(param.getMerchantId());
|
|
|
|
|
+ if (mchInfo == null) {
|
|
|
|
|
+ throw new GlobalCustomerException("商户不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ KxsMachine kxsMachine = kxsMachineMapper.selectById(mchInfo.getMachineId());
|
|
|
|
|
+ if (kxsMachine == null) {
|
|
|
|
|
+ throw new GlobalCustomerException("商户机具不存在");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ FeeSetReq req = FeeSetReq.builder()
|
|
|
|
|
+ .posSn(kxsMachine.getPosSn())
|
|
|
|
|
+ .brandId(kxsMachine.getBrandId())
|
|
|
|
|
+ .feeRate(param.getMachineRatio())
|
|
|
|
|
+ .build();
|
|
|
|
|
+ HashMap<String, Object> reqParam = new HashMap<>();
|
|
|
|
|
+ reqParam.put("value", JSON.toJSONString(req));
|
|
|
|
|
+ R res = remoteOldService.feeSet(reqParam);
|
|
|
|
|
+
|
|
|
|
|
+ if(res.getStatus() != CommonConstants.SUCCESS){
|
|
|
|
|
+ throw new GlobalCustomerException("修改费率失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ kxsMachine.setMachineRatio(param.getMachineRatio());
|
|
|
|
|
+ kxsMachine.setDownFeeFlag(CommonConstants.SUCCESS);
|
|
|
|
|
+ //增加费率调整记录
|
|
|
|
|
+ KxsMachineRatio kxsMachineRatio = new KxsMachineRatio();
|
|
|
|
|
+ kxsMachineRatio.setMerchantId(mchInfo.getId());
|
|
|
|
|
+ kxsMachineRatio.setRatio(param.getMachineRatio());
|
|
|
|
|
+ kxsMachineRatio.setMachineId(kxsMachine.getId());
|
|
|
|
|
+ kxsMachineRatio.setStatus(CommonConstants.SUCCESS);
|
|
|
|
|
+ kxsMachineRatio.setBrandId(kxsMachine.getBrandId());
|
|
|
|
|
+ kxsMachineRatio.setPosUserId(kxsMachine.getUserId());
|
|
|
|
|
+ kxsMachineRatio.setPosSn(kxsMachine.getPosSn());
|
|
|
|
|
+ kxsMachineRatio.setUserId(SecurityUtils.getUser().getId().intValue());
|
|
|
|
|
+ kxsMachineRatio.setResult(JSON.toJSONString(res));
|
|
|
|
|
+ kxsMachineRatio.setRemark("设置成功");
|
|
|
|
|
+ kxsMachineRatioMapper.insert(kxsMachineRatio);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ return R.ok();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|