diff --git a/pluss-api-page/src/main/java/cn/pluss/platform/controller/IntroduceController.java b/pluss-api-page/src/main/java/cn/pluss/platform/controller/IntroduceController.java index 03ba39e..fa98410 100644 --- a/pluss-api-page/src/main/java/cn/pluss/platform/controller/IntroduceController.java +++ b/pluss-api-page/src/main/java/cn/pluss/platform/controller/IntroduceController.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletRequest; import java.util.Objects; /** @@ -25,7 +26,7 @@ public class IntroduceController { private AppGuideService appGuideService; @GetMapping({"/common", "/common/{code}"}) - public Result billIntro(@PathVariable(value = "code", required = false) String code) { + public Result billIntro(@PathVariable(value = "code", required = false) String code, HttpServletRequest httpServletRequest) { if (StringUtils.isEmpty(code)) { String html = "


"; return ResultGenerator.genSuccessResult(html); @@ -36,6 +37,12 @@ public class IntroduceController { return ResultGenerator.genSuccessResult(entity == null ? "" : entity.getContent()); } if (Objects.equals(entity.getType(), "1")) { + String type = httpServletRequest.getHeader("type"); + if ("1".equals(type)){ + return ResultGenerator.genSuccessResult(entity == null ? "" : entity.getContent()); + }else if ("2".equals(type)){ + return ResultGenerator.genFailResult(""); + } return ResultGenerator.genSuccessResult(entity == null ? "" : entity.getContent()); }else { return ResultGenerator.genFailResult(""); diff --git a/pluss-dao-bundle/src/main/java/cn/pluss/platform/mapper/UserPromotionMapper.java b/pluss-dao-bundle/src/main/java/cn/pluss/platform/mapper/UserPromotionMapper.java new file mode 100644 index 0000000..36a37e7 --- /dev/null +++ b/pluss-dao-bundle/src/main/java/cn/pluss/platform/mapper/UserPromotionMapper.java @@ -0,0 +1,10 @@ +package cn.pluss.platform.mapper; + +import cn.pluss.platform.entity.UserManageProfit; +import cn.pluss.platform.entity.UserPromotion; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface UserPromotionMapper extends BaseMapper { +} diff --git a/pluss-model-bundle/src/main/java/cn/pluss/platform/entity/UserInfo.java b/pluss-model-bundle/src/main/java/cn/pluss/platform/entity/UserInfo.java index c5475b1..b484724 100644 --- a/pluss-model-bundle/src/main/java/cn/pluss/platform/entity/UserInfo.java +++ b/pluss-model-bundle/src/main/java/cn/pluss/platform/entity/UserInfo.java @@ -91,6 +91,16 @@ public class UserInfo { private String oldPhone; @TableField(exist = false) private String roleIds; + /** + * 用户注册选择身份 + */ + @TableField(exist = false) + private String typeCode; + /** + * 费率 + */ + @TableField(exist = false) + private String currentFee; /** * 生成一个新的用户对象 diff --git a/pluss-model-bundle/src/main/java/cn/pluss/platform/entity/UserPromotion.java b/pluss-model-bundle/src/main/java/cn/pluss/platform/entity/UserPromotion.java new file mode 100644 index 0000000..c6d045f --- /dev/null +++ b/pluss-model-bundle/src/main/java/cn/pluss/platform/entity/UserPromotion.java @@ -0,0 +1,39 @@ +package cn.pluss.platform.entity; + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * 用户推广费率对照表 + * @author lyf + */ +@Data +@TableName("tb_pluss_user_promotion") +public class UserPromotion { + @TableField(value = "user_id") + private Long userId; + + @TableField(value = "type_code") + private String typeCode; + + @TableField(value = "current_fee") + private String currentFee; + + @TableField(value = "parent_user_id") + private String parentUserId; + + @TableField(value = "create_time") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @JSONField(format = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + @TableField(value = "update_time") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @JSONField(format = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; +} diff --git a/pluss-model-bundle/src/main/java/cn/pluss/platform/entity/UserType.java b/pluss-model-bundle/src/main/java/cn/pluss/platform/entity/UserType.java new file mode 100644 index 0000000..351d881 --- /dev/null +++ b/pluss-model-bundle/src/main/java/cn/pluss/platform/entity/UserType.java @@ -0,0 +1,50 @@ +package cn.pluss.platform.entity; + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 分佣相关 + * @author lyf + */ +@Data +@TableName("tb_pluss_user_type") +public class UserType { + /** + * 分佣类型(层级) + */ + @TableField(value = "type_code") + private String typeCode; + /** + * 类型名称 + */ + @TableField(value = "type_name") + private String typeName; + /** + * 当前层级费率 + */ + @TableField(value = "current_fee") + private BigDecimal currentFee; + /** + * 下级推广费率 + */ + @TableField(value = "low_fee") + private BigDecimal lowFee; + + @TableField(value = "create_time") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @JSONField(format = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + @TableField(value = "update_time") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @JSONField(format = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + +} diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/channel/ys/impl/YSAuditServiceV3.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/channel/ys/impl/YSAuditServiceV3.java index b3548b8..8a3de04 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/channel/ys/impl/YSAuditServiceV3.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/channel/ys/impl/YSAuditServiceV3.java @@ -12,7 +12,9 @@ import cn.pluss.platform.dto.BankCardDTO; 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.mcc.MccReflectService; import cn.pluss.platform.merchant.AccountService; @@ -39,6 +41,7 @@ import cn.pluss.platform.ys.impl.v20220527.entity.*; import cn.pluss.platform.ys.impl.v20220527.service.YsAuditServiceV3; import cn.pluss.platform.ysExtension.v20220615.YsConstantV3; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -118,6 +121,8 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer private SubMerchantService smService; @Resource private SxfMerAuditHandler handler; + @Resource + private MerchantChannelFeeMapper merchantChannelFeeMapper; // @Autowired // private MercChangeRecordService mcrService; @@ -214,7 +219,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer rateFeeInfo.setBank1creditPayFee(new RateFeeDetail("0", "0.61", "1", "999900")); rateFeeInfo.setBank2debitPayFee(new RateFeeDetail("0", "0.60", "1", "999900")); rateFeeInfo.setBank2creditPayFee(new RateFeeDetail("0", "0.60", "1")); - RateFeeDetail codeScanD0Fee = new RateFeeDetail("0", "0.48", "1"); + RateFeeDetail codeScanD0Fee = new RateFeeDetail("0", "0.10", "1"); rateInfo.setCodeScanD0Fee(codeScanD0Fee); rateInfo.setCodeScanT1Fee(rateFeeInfo); @@ -222,6 +227,8 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer if (!Objects.equals(respEntity.getSubCode(), YsConfigV3.BIZ_SUCCESS)) { throw new MsgException("银盛云商服3.0商户签约申请请求失败, {}", respEntity.getSubMsg()); } + //保存费率 + channelFee(0.48d,0.48d, channel, mcs.getMerchantCode()); }else { RateInfoD1 rateInfoD1 = new RateInfoD1(); rateInfoD1.setCustId(custId); @@ -243,6 +250,8 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer if (!Objects.equals(respEntity.getSubCode(), YsConfigV3.BIZ_SUCCESS)) { throw new MsgException("银盛云商服3.0商户签约申请请求失败, {}", respEntity.getSubMsg()); } + //保存费率 + channelFee(0.38d,0.38d, channel, mcs.getMerchantCode()); } JSONObject businessData = JSON.parseObject(respEntity.getBusinessData()); @@ -746,7 +755,6 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer // bizContentMap.put("appletId", "wxc2bb94c0ddda1032"); // ysServiceV3.req(ReqMethod.appIdAddOrUpdate, bizContentMap); break; - //TODO 失败和错误时没有处理 case YsConfigV3.STATUS_REFUSE: String note1 = authData.getNote(); mcs.setRemark(note1); @@ -823,6 +831,8 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer JSONObject param = new JSONObject(); param.put(YsConstant.MERC_ID, mcs.getMerchantId()); param.put("option", "ON"); + param.put("rateFee", "0.38"); + param.put("rateBottom", "1"); ysServiceV3.req(ReqMethod.openOnlinePay, param, mcs.getChannel()); } catch (Exception e) { log.error("云商服3.0开通线上D0接口报错: {}", e.getMessage()); @@ -1830,4 +1840,27 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer // } // } // } + public void channelFee(Double WECHAT, Double ALIPAY, Integer channel, String merchantCode){ + JSONArray array = new JSONArray(); + Set feesSet = new HashSet<>(); + FeesSetVo w = new FeesSetVo(); + w.setFeeCode("WECHAT"); + w.setFeeValue(WECHAT); + array.add(w); + + FeesSetVo a = new FeesSetVo(); + a.setFeeCode("ALIPAY"); + a.setFeeValue(ALIPAY); + array.add(a); + + feesSet.add(w); + feesSet.add(a); + MerchantChannelFee merchantChannelFee = new MerchantChannelFee(); + merchantChannelFee.setChannel(channel); + merchantChannelFee.setMerchantCode(merchantCode); + merchantChannelFee.setFeeStr(array.toJSONString()); + merchantChannelFee.setCreateTime(new Date()); + merchantChannelFeeMapper.insert(merchantChannelFee); + } } + diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantBaseInfoServiceImpl.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantBaseInfoServiceImpl.java index 86cc5c9..3357962 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantBaseInfoServiceImpl.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantBaseInfoServiceImpl.java @@ -350,38 +350,38 @@ public class MerchantBaseInfoServiceImpl extends ServiceImpl(merchantStore)); - MerchantBaseInfo merchantBaseInfo = getMerchantBaseInfoByMerchantCode(merchantChannelStatus.getMerchantCode()); - QueryWrapper queryWrapper = new QueryWrapper() - .eq("merchantCode", merchantChannelStatus.getMerchantCode()).eq("photoType", "06"); - MerchantImage merchantImage = merchantImageMapper.selectOne(queryWrapper); - //String baseUrl = "https://life.sxczgkj.cn/web/wmerchant.php?c=site&a=entry&ctrl=store&ac=oauth&op=add_merchan&do=web&m=we7_wmall&i=1"; - String baseUrl = "https://kysh.sxczgkj.cn/javaApi/java-api/add-store"; - StringBuilder sb = new StringBuilder(baseUrl); - sb.append("?title=").append(mbi.getAlias()); - sb.append("&syb_m_id=").append(merchantStore.getId()); - sb.append("&addressNo=").append(merchantBaseInfo.getAddressNo()); - String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress(); - String area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict(); - try { - String decodeAddress = URLEncoder.encode(address, "UTF-8"); - sb.append("&address=").append(decodeAddress); - String decodeArea = URLEncoder.encode(area, "UTF-8"); - sb.append("&area=").append(decodeArea); - String logo = URLEncoder.encode(merchantImage.getPicUrl(), "GBK"); - sb.append("&logo=").append(logo); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - Map lnxMap = IpUtils.getLocationByAddress(address); - if (lnxMap != null) { - sb.append("&location_x=").append(lnxMap.get("x")); - sb.append("&location_y=").append(lnxMap.get("y")); - } - // 请求生成店铺j - RestTemplate restTemplate = new RestTemplate(); - String result = restTemplate.getForObject(sb.toString(), String.class); +// MerchantChannelStatus merchantChannelStatus = new MerchantChannelStatus(); +// merchantStore = merchantStoreMapper.selectOne(new QueryWrapper<>(merchantStore)); +// MerchantBaseInfo merchantBaseInfo = getMerchantBaseInfoByMerchantCode(merchantChannelStatus.getMerchantCode()); +// QueryWrapper queryWrapper = new QueryWrapper() +// .eq("merchantCode", merchantChannelStatus.getMerchantCode()).eq("photoType", "06"); +// MerchantImage merchantImage = merchantImageMapper.selectOne(queryWrapper); +// //String baseUrl = "https://life.sxczgkj.cn/web/wmerchant.php?c=site&a=entry&ctrl=store&ac=oauth&op=add_merchan&do=web&m=we7_wmall&i=1"; +// String baseUrl = "https://kysh.sxczgkj.cn/javaApi/java-api/add-store"; +// StringBuilder sb = new StringBuilder(baseUrl); +// sb.append("?title=").append(mbi.getAlias()); +// sb.append("&syb_m_id=").append(merchantStore.getId()); +// sb.append("&addressNo=").append(merchantBaseInfo.getAddressNo()); +// String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress(); +// String area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict(); +// try { +// String decodeAddress = URLEncoder.encode(address, "UTF-8"); +// sb.append("&address=").append(decodeAddress); +// String decodeArea = URLEncoder.encode(area, "UTF-8"); +// sb.append("&area=").append(decodeArea); +// String logo = URLEncoder.encode(merchantImage.getPicUrl(), "GBK"); +// sb.append("&logo=").append(logo); +// } catch (UnsupportedEncodingException e) { +// e.printStackTrace(); +// } +// Map lnxMap = IpUtils.getLocationByAddress(address); +// if (lnxMap != null) { +// sb.append("&location_x=").append(lnxMap.get("x")); +// sb.append("&location_y=").append(lnxMap.get("y")); +// } +// // 请求生成店铺j +// RestTemplate restTemplate = new RestTemplate(); +// String result = restTemplate.getForObject(sb.toString(), String.class); } } diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantServiceImpl.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantServiceImpl.java index dabe05b..12100be 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantServiceImpl.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/MerchantServiceImpl.java @@ -429,8 +429,9 @@ public class MerchantServiceImpl implements MerchantService { }else if(channel.getChannel()==5){ //拉卡拉的主扫接口 result=lkLPayServiceImpl.tradePay(order,channel,merchant); - } - else { + } else if (channel.getChannel() == 6) { + + }else { MsgException.throwException("未知通道"); } if (ResultCode.SUCCESS.code() != result.getInteger("code")) { diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/account/AccountServiceImpl.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/account/AccountServiceImpl.java index cef6c15..506b633 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/account/AccountServiceImpl.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchant/impl/account/AccountServiceImpl.java @@ -400,32 +400,32 @@ public class AccountServiceImpl extends ServiceImpl impl // } // 如果不存在D0的结算信息,则直接将D1的结算信息带过来 - LambdaQueryWrapper qWrapperAccountD1 = Wrappers.lambdaQuery(); - qWrapperAccountD1.eq(Account::getUserId, accountDTO.getUserId()).eq(Account::getChannelType, Account.CHANNEL_TYPE_D0); - int count = baseMapper.selectCount(qWrapperAccountD1); - if (count == 0) { - account.setChannelType(Account.CHANNEL_TYPE_D0); - save(account); - } - //TODO - // 如果不存在D1的结算信息,则直接将D0的结算信息带过来 - LambdaQueryWrapper qWrapperAccountD0 = Wrappers.lambdaQuery(); - qWrapperAccountD0.eq(Account::getUserId, accountDTO.getUserId()).eq(Account::getChannelType, Account.CHANNEL_TYPE_D1); - int countD0 = baseMapper.selectCount(qWrapperAccountD0); - if (countD0 == 0) { - account.setChannelType(Account.CHANNEL_TYPE_D1); - save(account); - } +// LambdaQueryWrapper qWrapperAccountD1 = Wrappers.lambdaQuery(); +// qWrapperAccountD1.eq(Account::getUserId, accountDTO.getUserId()).eq(Account::getChannelType, Account.CHANNEL_TYPE_D0); +// int count = baseMapper.selectCount(qWrapperAccountD1); +// if (count == 0) { +// account.setChannelType(Account.CHANNEL_TYPE_D0); +// save(account); +// } +// //TODO +// // 如果不存在D1的结算信息,则直接将D0的结算信息带过来 +// LambdaQueryWrapper qWrapperAccountD0 = Wrappers.lambdaQuery(); +// qWrapperAccountD0.eq(Account::getUserId, accountDTO.getUserId()).eq(Account::getChannelType, Account.CHANNEL_TYPE_D1); +// int countD0 = baseMapper.selectCount(qWrapperAccountD0); +// if (countD0 == 0) { +// account.setChannelType(Account.CHANNEL_TYPE_D1); +// save(account); +// } } @Override @Transactional(rollbackFor = Exception.class) public void realNameAudit(CertificationDTO certificationDTO) { //验证唯一性 - Integer countIdCard = idCardService.getCountIdCard(certificationDTO.getCertnum()); - if (countIdCard > 0){ - throw new MsgException("身份证已注册"); - } +// Integer countIdCard = idCardService.getCountIdCard(certificationDTO.getCertnum()); +// if (countIdCard > 0){ +// throw new MsgException("身份证已注册"); +// } UserApp tokenUa = uaService.queryUserAppByToken(); if ("agent".equals(tokenUa.getUserType()) && "ZY_BST".equals(tokenUa.getRoleCode())) { IdCard condition = new IdCard().setCertNo(certificationDTO.getCertnum()); diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/userInfo/impl/BaseUserInfoService.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/userInfo/impl/BaseUserInfoService.java index 6187b08..66a1c2e 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/userInfo/impl/BaseUserInfoService.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/userInfo/impl/BaseUserInfoService.java @@ -7,7 +7,6 @@ import cn.pluss.platform.constants.CommonError; import cn.pluss.platform.dto.ChangePwdDTO; import cn.pluss.platform.entity.*; import cn.pluss.platform.exception.MsgException; -import cn.pluss.platform.ipLocation.IpLocationService; import cn.pluss.platform.mapper.*; import cn.pluss.platform.merchant.MerchantBaseInfoService; import cn.pluss.platform.merchant.MerchantRateNewRecordService; @@ -38,20 +37,13 @@ import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.*; @@ -215,6 +207,9 @@ public abstract class BaseUserInfoService extends ServiceImpl