3 files added
17 files modified
| | |
| | | //范围参数 |
| | | RANGE_SWITCH("RANGE_SETTING", "RANGE_SWITCH"), |
| | | RANGE_SIZE("RANGE_SETTING", "RANGE_SIZE"), |
| | | //团长返利参数 |
| | | BONUS_SWITCH("LEADERBONUS_SETTING", "BONUS_SWITCH"), |
| | | BONUS_PERCENT("LEADERBONUS_SETTING", "BONUS_PERCENT"), |
| | | |
| | | SCORE_SIGN_SETTING("SCORE_SETTING", "SCORE_SIGN_SETTING"), |
| | | STATIC_BONUS("BONUS_TYPE", "STATIC_BONUS"), |
| | |
| | | /** |
| | | * 抽奖 |
| | | */ |
| | | PRIZE(17); |
| | | PRIZE(17), |
| | | |
| | | /** |
| | | * 充值 |
| | | */ |
| | | RECHARGE(18); |
| | | |
| | | private final int value; |
| | | |
| | |
| | | private String xcxSecret; |
| | | |
| | | private String wecharPaynotifyUrl; |
| | | |
| | | private String wecharRechargePaynotifyUrl; |
| | | //测试支付的开关,true:支付0.01元 |
| | | private Boolean debug; |
| | | //支付证书地址 |
| | |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; |
| | | import cc.mrbird.febs.mall.dto.AdminLeaderAddDto; |
| | | import cc.mrbird.febs.mall.dto.AdminLeaderUpdateDto; |
| | | import cc.mrbird.febs.mall.dto.ApiApplayLeaderDto; |
| | | import cc.mrbird.febs.mall.entity.MallGoodsCategory; |
| | | import cc.mrbird.febs.mall.entity.MallLeaderStock; |
| | | import cc.mrbird.febs.mall.entity.MallMember; |
| | | import cc.mrbird.febs.mall.entity.MallTeamLeader; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper; |
| | | import cc.mrbird.febs.mall.service.IAdminMallTeamLeaderService; |
| | | import cc.mrbird.febs.mall.vo.AdminLeaderBonusSettingVo; |
| | | import cc.mrbird.febs.mall.vo.AdminRangeSettingVo; |
| | | import cc.mrbird.febs.mall.vo.AdminSelectListLeaderVo; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | |
| | | private final IAdminMallTeamLeaderService iAdminMallTeamLeaderService; |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | |
| | | /** |
| | | * 团长信息--列表 |
| | |
| | | return new FebsResponse().success().data(dataTable); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 团长每日分成设置 -- 更新 |
| | | */ |
| | | @PostMapping(value = "/leaderBonusSetUpdate") |
| | | public FebsResponse leaderBonusSetUpdate(AdminLeaderBonusSettingVo adminLeaderBonusSettingVo) { |
| | | Integer bonusSwitch = adminLeaderBonusSettingVo.getBonusSwitch(); |
| | | DataDictionaryCustom bonusSwitchDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.BONUS_SWITCH.getType(), DataDictionaryEnum.BONUS_SWITCH.getCode()); |
| | | bonusSwitchDic.setValue(bonusSwitch.toString()); |
| | | dataDictionaryCustomMapper.updateById(bonusSwitchDic); |
| | | |
| | | Double bonusPercent = adminLeaderBonusSettingVo.getBonusPercent(); |
| | | if(1 <= bonusPercent || 0 >= bonusPercent){ |
| | | return new FebsResponse().fail().message("请输入合适的百分比小数"); |
| | | } |
| | | DataDictionaryCustom bonusPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.BONUS_PERCENT.getType(), DataDictionaryEnum.BONUS_PERCENT.getCode()); |
| | | bonusPercentDic.setValue(bonusPercent.toString()); |
| | | dataDictionaryCustomMapper.updateById(bonusPercentDic); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | @ApiOperation(value = "充值余额") |
| | | @PostMapping(value = "/rechargeWallet") |
| | | public FebsResponse rechargeWallet(@RequestBody @Validated ApiRechargeWalletDto apiRechargeWalletDto) { |
| | | return memberService.rechargeWallet(apiRechargeWalletDto); |
| | | } |
| | | |
| | | } |
| | |
| | | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.mall.entity.DataDictionaryCustom; |
| | | import cc.mrbird.febs.mall.service.IAdminMallOrderService; |
| | | import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper; |
| | | import cc.mrbird.febs.mall.service.IAdminMallTeamLeaderService; |
| | | import cc.mrbird.febs.mall.vo.AdminMallOrderVo; |
| | | import cc.mrbird.febs.mall.vo.AdminLeaderBonusSettingVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallTeamLeaderVo; |
| | | import cc.mrbird.febs.mall.vo.AdminRangeSettingVo; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | |
| | | public class ViewMallTeamLeaderController extends BaseController { |
| | | |
| | | private final IAdminMallTeamLeaderService iAdminMallTeamLeaderService; |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | |
| | | /** |
| | | * 团长信息--列表 |
| | |
| | | */ |
| | | @GetMapping("/leaderBonusSetting") |
| | | public String deliverySetting(Model model) { |
| | | // AdminRangeSettingVo adminRangeSettingVo = new AdminRangeSettingVo(); |
| | | // DataDictionaryCustom deliverySetting = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.HOME_DELIVERY_AMOUNT.getType(), DataDictionaryEnum.HOME_DELIVERY_AMOUNT.getCode()); |
| | | // if (ObjectUtil.isNotNull(deliverySetting)) { |
| | | // adminRangeSettingVo.setHomeDeliveryAmount(Double.parseDouble(deliverySetting.getValue())); |
| | | // } |
| | | // DataDictionaryCustom rangeSwitch = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.RANGE_SWITCH.getType(), DataDictionaryEnum.RANGE_SWITCH.getCode()); |
| | | // if (ObjectUtil.isNotNull(rangeSwitch)) { |
| | | // adminRangeSettingVo.setRangeSwitch(Integer.parseInt(rangeSwitch.getValue())); |
| | | // } |
| | | // DataDictionaryCustom rangeSize = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.RANGE_SIZE.getType(), DataDictionaryEnum.RANGE_SIZE.getCode()); |
| | | // if (ObjectUtil.isNotNull(rangeSize)) { |
| | | // adminRangeSettingVo.setRangeSize(Integer.parseInt(rangeSize.getValue())); |
| | | // } |
| | | // model.addAttribute("deliverySetting", adminRangeSettingVo); |
| | | return FebsUtil.view("modules/goods/deliverySetting"); |
| | | AdminLeaderBonusSettingVo adminLeaderBonusSettingVo = new AdminLeaderBonusSettingVo(); |
| | | DataDictionaryCustom bonusSwitch = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.BONUS_SWITCH.getType(), DataDictionaryEnum.BONUS_SWITCH.getCode()); |
| | | if (ObjectUtil.isNotNull(bonusSwitch)) { |
| | | adminLeaderBonusSettingVo.setBonusSwitch(Integer.parseInt(bonusSwitch.getValue())); |
| | | } |
| | | DataDictionaryCustom bonusPercent = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.BONUS_PERCENT.getType(), DataDictionaryEnum.BONUS_PERCENT.getCode()); |
| | | if (ObjectUtil.isNotNull(bonusPercent)) { |
| | | adminLeaderBonusSettingVo.setBonusPercent(Double.parseDouble(bonusSwitch.getValue())); |
| | | } |
| | | model.addAttribute("leaderBonusSetting", adminLeaderBonusSettingVo); |
| | | return FebsUtil.view("modules/leader/leaderBonusSetting"); |
| | | } |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "ApiRechargeWalletDto", description = "余额充值接收类") |
| | | public class ApiRechargeWalletDto { |
| | | |
| | | @ApiModelProperty(value = "充值金额", example = "10") |
| | | private BigDecimal amount; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long memberId; |
| | | |
| | | } |
| | |
| | | BigDecimal selectCommissionIncome(@Param("type") Integer type, @Param("date") Date date, @Param("memberId") Long memebrid); |
| | | |
| | | BigDecimal selectThankfulCommission(@Param("date") Date date, @Param("memberId") Long memberId); |
| | | |
| | | MallMoneyFlow selectOneByOrderNoAndMemberId(@Param("rechargeNo")String rechargeNo, @Param("memberId")Long memberId); |
| | | } |
| | |
| | | FebsResponse xcxPhoneLogin(ApiXcxPhoneLoginDto apiXcxPhoneLoginDto); |
| | | |
| | | FebsResponse xcxOpen(ApiXcxOpenDto apiXcxOpenDto); |
| | | |
| | | FebsResponse rechargeWallet(ApiRechargeWalletDto apiRechargeWalletDto); |
| | | } |
| | |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.mall.service.ICommonService; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import cc.mrbird.febs.pay.model.BrandWCPayRequestData; |
| | | import cc.mrbird.febs.pay.service.IXcxPayService; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.IdUtil; |
| | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.crypto.asymmetric.KeyType; |
| | | import cn.hutool.crypto.asymmetric.RSA; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | return new FebsResponse().success().data(1); |
| | | } |
| | | |
| | | private final IXcxPayService iXcxPayService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public FebsResponse rechargeWallet(ApiRechargeWalletDto apiRechargeWalletDto) { |
| | | Long memberId = LoginUserUtil.getLoginUser().getId(); |
| | | BigDecimal amount = apiRechargeWalletDto.getAmount(); |
| | | if(BigDecimal.ZERO.compareTo(amount)>0){ |
| | | return new FebsResponse().fail().message("请输入正确的充值金额"); |
| | | } |
| | | apiRechargeWalletDto.setMemberId(memberId); |
| | | BrandWCPayRequestData brandWCPayRequestData = null; |
| | | try { |
| | | brandWCPayRequestData = iXcxPayService.startRechargeWallet(apiRechargeWalletDto); |
| | | } catch (Exception e) { |
| | | throw new FebsException("支付失败"); |
| | | } |
| | | String wxResultStr = JSONUtil.toJsonStr(brandWCPayRequestData); |
| | | String payResultStr = brandWCPayRequestData.getPrepay_id(); |
| | | return new FebsResponse().success().message("充值即将到账"); |
| | | } |
| | | |
| | | private String getXcxLoginUrl(String code) { |
| | | String wechatLoginUrl =xcxProperties.getWecharLoginUrl(); |
| | | return String.format(wechatLoginUrl, xcxProperties.getXcxAppid(), xcxProperties.getXcxSecret(), code); |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "AdminLeaderBonusSettingVo", description = "信息返回类") |
| | | public class AdminLeaderBonusSettingVo { |
| | | //团长返利开关1:开启2:关闭 |
| | | private Integer bonusSwitch; |
| | | //返利百分比 |
| | | private Double bonusPercent; |
| | | } |
| | |
| | | import cc.mrbird.febs.common.properties.XcxProperties; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.common.utils.SpringContextHolder; |
| | | import cc.mrbird.febs.mall.entity.MallMemberWallet; |
| | | import cc.mrbird.febs.mall.entity.MallMoneyFlow; |
| | | import cc.mrbird.febs.mall.entity.MallOrderInfo; |
| | | import cc.mrbird.febs.mall.mapper.MallMemberWalletMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallMoneyFlowMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallOrderInfoMapper; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.pay.model.NotifyData; |
| | | import cc.mrbird.febs.pay.model.OrderStateDto; |
| | | import cc.mrbird.febs.pay.model.OrderStateMsgVo; |
| | |
| | | import cc.mrbird.febs.pay.util.Signature; |
| | | import cc.mrbird.febs.pay.util.Util; |
| | | import cc.mrbird.febs.pay.util.WechatConfigure; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | @Autowired |
| | | MallOrderInfoMapper mallOrderInfoMapper; |
| | | @Autowired |
| | | MallMoneyFlowMapper mallMoneyFlowMapper; |
| | | @Autowired |
| | | MallMemberWalletMapper mallMemberWalletMapper; |
| | | @Autowired |
| | | RedisUtils redisUtils; |
| | | @Autowired |
| | | private IApiMallMemberWalletService memberWalletService; |
| | | |
| | | @Autowired |
| | | private IXcxPayService iXcxPayService; |
| | | |
| | | private final XcxProperties xcxProperties = SpringContextHolder.getBean(XcxProperties.class); |
| | | /** |
| | | * 微信充值回调接口 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @RequestMapping(value = "/rechargeCallBack") |
| | | public void rechargeCallBack(HttpServletResponse response, HttpServletRequest request) throws IOException { |
| | | log.info("微信充值回调start...."); |
| | | |
| | | // 获取输入参数 |
| | | String inputLine; |
| | | StringBuffer notityXml = new StringBuffer(); |
| | | String resXml = ""; |
| | | |
| | | // String attrStr = "{'rechargeNo':"+rechargeNo+",'memberId':"+mallMember.getId()+"}"; |
| | | String attrStr = ""; |
| | | |
| | | FebsResponse threadResult = new FebsResponse(); |
| | | try { |
| | | while ((inputLine = request.getReader().readLine()) != null) { |
| | | notityXml.append(inputLine); |
| | | } |
| | | request.getReader().close(); |
| | | log.info("notityXml ---- :{} ", notityXml); |
| | | |
| | | |
| | | // XMl转对象 |
| | | Object bb = Util.getObjectFromXML(notityXml.toString(), NotifyData.class); |
| | | NotifyData data = new NotifyData(); |
| | | BeanUtils.copyProperties(bb,data); |
| | | log.info("----return_code = {}", data.getReturn_code()); |
| | | // 返回状态码 SUCCESS/FAIL |
| | | if (WechatConfigure.CODE_SUCCESS.equals(data.getReturn_code())) { |
| | | attrStr = data.getAttach(); |
| | | JSONObject jsonObject = JSONUtil.parseObj(attrStr); |
| | | String rechargeNo = (String) jsonObject.get("rechargeNo"); |
| | | Long memberId = (Long) jsonObject.get("memberId"); |
| | | // 检验订单状态 |
| | | MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectOneByOrderNoAndMemberId(rechargeNo,memberId); |
| | | // 校验签名 |
| | | // String paySecret = WechatConfigure.WECHARPAY_SECRET; |
| | | String paySecret = xcxProperties.getWecharpaySecret(); |
| | | if (Signature.checkIsSignValidFromResponseString(notityXml.toString(),paySecret)) { |
| | | // 校验业务结果 |
| | | if (WechatConfigure.CODE_SUCCESS.equals(data.getResult_code())) { |
| | | // 返回SUCCESS报文 |
| | | resXml = WechatConfigure.RESULT_XML_SUCCESS; |
| | | // 支付费用 |
| | | Double total_fee = Double.parseDouble(data.getTotal_fee()); |
| | | // 商户订单号 |
| | | String payNum = data.getOut_trade_no(); |
| | | |
| | | log.info("支付回调关键信息---total_fee:{},payNum:{},rechargeNo:{}", total_fee, payNum, rechargeNo); |
| | | // 订单ID |
| | | BigDecimal payMoney = new BigDecimal(total_fee).divide(new BigDecimal(100), 2, |
| | | RoundingMode.HALF_UP); |
| | | |
| | | if (ObjectUtil.isNotEmpty(mallMoneyFlow)) { |
| | | log.debug("检查支付金额payMoney={},mallMoneyFlow.getPayMoney()={}", payMoney, mallMoneyFlow.getAmount()); |
| | | MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); |
| | | if(ObjectUtil.isNotEmpty(mallMemberWallet)){ |
| | | memberWalletService.addBalance(payMoney,memberId); |
| | | } |
| | | threadResult.success().message("充值成功"); |
| | | } else { |
| | | log.info("充值失败", attrStr); |
| | | } |
| | | } else { |
| | | log.info("微信标识业务是失败"); |
| | | threadResult.fail().message("查询支付信息失败,请联系客服或者刷新支付信息(错误码:001)"); |
| | | // resXml = AppConstance.RESULT_XML_FAIL.replace(ERRORMSG, "微信标识业务是失败"); |
| | | } |
| | | } else { |
| | | log.info("无效签名"); |
| | | threadResult.fail().message("查询支付信息失败,请联系客服或者刷新支付信息(错误码:002)"); |
| | | // resXml = AppConstance.RESULT_XML_FAIL.replace(ERRORMSG, "微信标识业务是失败"); |
| | | } |
| | | } else { |
| | | log.info("通信标识失败"); |
| | | threadResult.fail().message("查询支付信息失败,请联系客服或者刷新支付信息(错误码:003)"); |
| | | // resXml = AppConstance.RESULT_XML_FAIL.replace(ERRORMSG, "通信标识失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("支付回调签名错误", e); |
| | | threadResult.fail().message("查询支付信息失败,请联系客服或者刷新支付信息(错误码:004)"); |
| | | // resXml = AppConstance.RESULT_XML_FAIL.replace(ERRORMSG, "支付回调签名错误"); |
| | | } finally { |
| | | // 通知线程消息 |
| | | // PayThreadPool.notifyThread(Integer.valueOf(orderId), threadResult); |
| | | sendResultBack(response, resXml); |
| | | } |
| | | return; |
| | | |
| | | } |
| | | /** |
| | | * 微信支付回调接口 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | package cc.mrbird.febs.pay.service; |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.mall.dto.ApiRechargeWalletDto; |
| | | import cc.mrbird.febs.mall.entity.MallOrderInfo; |
| | | import cc.mrbird.febs.pay.model.BrandWCPayRequestData; |
| | | import cc.mrbird.febs.pay.model.OrderStateDto; |
| | |
| | | * 生成小程序二维码 |
| | | */ |
| | | FebsResponse generateQrCode(WxGenerateQrCodeDto wxGenerateQrCodeDto); |
| | | |
| | | /** |
| | | * 发起充值(创建预付订单) |
| | | */ |
| | | BrandWCPayRequestData startRechargeWallet(ApiRechargeWalletDto apiRechargeWalletDto) throws Exception; |
| | | } |
| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; |
| | | import cc.mrbird.febs.common.enumerates.FlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; |
| | | import cc.mrbird.febs.common.properties.XcxProperties; |
| | | import cc.mrbird.febs.common.utils.MallUtils; |
| | | import cc.mrbird.febs.common.utils.OssUtils; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.common.utils.SpringContextHolder; |
| | | import cc.mrbird.febs.mall.dto.ApiRechargeWalletDto; |
| | | import cc.mrbird.febs.mall.entity.DataDictionaryCustom; |
| | | import cc.mrbird.febs.mall.entity.MallMember; |
| | | import cc.mrbird.febs.mall.entity.MallOrderInfo; |
| | |
| | | import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallMemberMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallOrderInfoMapper; |
| | | import cc.mrbird.febs.mall.service.IMallMoneyFlowService; |
| | | import cc.mrbird.febs.pay.model.*; |
| | | import cc.mrbird.febs.pay.service.IXcxPayService; |
| | | import cc.mrbird.febs.pay.util.WechatConfigure; |
| | |
| | | WeixinServiceUtil weixinServiceUtil; |
| | | @Autowired |
| | | private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | private final IMallMoneyFlowService mallMoneyFlowService; |
| | | @Autowired |
| | | RedisUtils redisUtils; |
| | | |
| | |
| | | private final XcxProperties xcxProperties = SpringContextHolder.getBean(XcxProperties.class); |
| | | |
| | | @Override |
| | | public BrandWCPayRequestData startRechargeWallet(ApiRechargeWalletDto apiRechargeWalletDto) throws Exception { |
| | | BigDecimal unit = new BigDecimal("100"); |
| | | BigDecimal money = new BigDecimal(apiRechargeWalletDto.getAmount().toString()); |
| | | BrandWCPayRequestData payData; |
| | | String productNames = "小程序充值"; |
| | | MallMember mallMember = mallMemberMapper.selectById(apiRechargeWalletDto.getMemberId()); |
| | | String rechargeNo = "CZ_"+MallUtils.getOrderNum(); |
| | | Boolean debug = xcxProperties.getDebug(); |
| | | String attrStr = "{'rechargeNo':"+rechargeNo+",'memberId':"+mallMember.getId()+"}"; |
| | | if (debug) { |
| | | payData = weixinServiceUtil.createRechargeWallet("[测试]" + productNames, rechargeNo, |
| | | 1, mallMember.getOpenId(), attrStr); |
| | | } else { |
| | | payData = weixinServiceUtil.createRechargeWallet(productNames, rechargeNo, |
| | | unit.multiply(money).intValue(),mallMember.getOpenId(), attrStr); |
| | | } |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | mallMember.getId(), |
| | | money, |
| | | MoneyFlowTypeEnum.RECHARGE.getValue(), |
| | | rechargeNo, |
| | | FlowTypeEnum.BALANCE.getValue()); |
| | | return payData; |
| | | } |
| | | |
| | | @Override |
| | | public BrandWCPayRequestData startPayment(MallOrderInfo mallOrderInfo) throws Exception { |
| | | BigDecimal unit = new BigDecimal("100"); |
| | | BigDecimal money = new BigDecimal(mallOrderInfo.getAmount().toString()); |
| | |
| | | return buildBrandWCPayRequestData(desc, outTradeNo, price, openId, attach, wecharPaynotifyUrl); |
| | | } |
| | | |
| | | public BrandWCPayRequestData createRechargeWallet(String desc, String outTradeNo, int price, String openId, String attach) throws Exception { |
| | | String wecharRechargePaynotifyUrl = xcxProperties.getWecharRechargePaynotifyUrl(); |
| | | return buildBrandWCPayRequestData(desc, outTradeNo, price, openId, attach, wecharRechargePaynotifyUrl); |
| | | } |
| | | |
| | | private BrandWCPayRequestData buildBrandWCPayRequestData(String desc, String outTradeNo, int price, String openId, String attach, String notifyUrl) throws Exception { |
| | | // 创建微信支付预付接口 |
| | | JsApiPayBusiness jsApiPayBusiness = new JsApiPayBusiness(); |
| | |
| | | xcx_secret: 8d3d3c14221f7dc37650b861dc0fc570 |
| | | debug: false |
| | | wecharPaynotifyUrl: http://groupbuy.csxuncong.com/api/xcxPay/wxpayCallback |
| | | wecharRechargePaynotifyUrl: http://groupbuy.csxuncong.com/api/xcxPay/rechargeCallBack |
| | | certLocalPath: /home/yyscCert/apiclient_cert.p12 |
| | | wecharpayMchid: 1631084809 |
| | | wecharpaySecret: YYSC13875978057YYSC13875978057SH |
| | |
| | | xcx_secret: 8d3d3c14221f7dc37650b861dc0fc570 |
| | | debug: false |
| | | wecharPaynotifyUrl: http://groupbuy.csxuncong.com/api/xcxPay/wxpayCallback |
| | | wecharRechargePaynotifyUrl: http://groupbuy.csxuncong.com/api/xcxPay/rechargeCallBack |
| | | certLocalPath: /home/yyscCert/apiclient_cert.p12 |
| | | wecharpayMchid: 1631084809 |
| | | wecharpaySecret: YYSC13875978057YYSC13875978057SH |
| | |
| | | xcx_secret: 8d3d3c14221f7dc37650b861dc0fc570 |
| | | debug: false |
| | | wecharPaynotifyUrl: http://groupbuy.csxuncong.com/api/xcxPay/wxpayCallback |
| | | wecharRechargePaynotifyUrl: http://groupbuy.csxuncong.com/api/xcxPay/rechargeCallBack |
| | | certLocalPath: /home/yyscCert/apiclient_cert.p12 |
| | | wecharpayMchid: 1631084809 |
| | | wecharpaySecret: YYSC13875978057YYSC13875978057SH |
| | |
| | | and date_format(created_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d') |
| | | and type in (2,3,4) |
| | | </select> |
| | | |
| | | <select id="selectOneByOrderNoAndMemberId" resultType="cc.mrbird.febs.mall.entity.MallMoneyFlow"> |
| | | select a.* from mall_money_flow a |
| | | where a.order_no = #{} and a.member_id = #{memberId} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="leader-bonus-setting" lay-title="团长返利设置"> |
| | | <div class="layui-row layui-col-space8 febs-container"> |
| | | <form class="layui-form" action="" lay-filter="leader-bonus-setting-form"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">返利开关:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="bonusSwitch" value="1" title="开启"> |
| | | <input type="radio" name="bonusSwitch" value="2" title="关闭"> |
| | | </div> |
| | | <div class="layui-form-mid layui-word-aux">返利开关,开启之后,团长按照每天按返利百分比,返还业绩</div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">返利百分比:</label> |
| | | <div class="layui-input-inline" style="width: 200px"> |
| | | <input type="text" name="bonusPercent" data-th-id="${leaderBonusSetting.bonusPercent}" |
| | | lay-verify="required" autocomplete="off" class="layui-input" > |
| | | <div class="layui-form-mid layui-word-aux">(填入0到1之间的小数)</div> |
| | | </div> |
| | | <div class="layui-form-mid">如0.15,表示返利百分比为15%</div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-card-footer"> |
| | | <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="leader-bonus-setting-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | <style> |
| | | .layui-form-label { |
| | | width: 120px; |
| | | } |
| | | |
| | | .layui-form-item .layui-input-block { |
| | | margin-left: 150px; |
| | | } |
| | | |
| | | .layui-table-form .layui-form-item { |
| | | margin-bottom: 20px !important; |
| | | } |
| | | </style> |
| | | <script data-th-inline="javascript" type="text/javascript"> |
| | | layui.use(['dropdown', 'jquery', 'validate', 'febs', 'form', 'eleTree'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | validate = layui.validate, |
| | | leaderBonusSetting = [[${leaderBonusSetting}]], |
| | | $view = $('#leader-bonus-setting'); |
| | | |
| | | form.verify(validate); |
| | | form.render(); |
| | | initUserValue(); |
| | | |
| | | function initUserValue() { |
| | | form.val("leader-bonus-setting-form", { |
| | | "bonusSwitch": leaderBonusSetting.bonusSwitch, |
| | | "bonusPercent": leaderBonusSetting.bonusPercent |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(leader-bonus-setting-form-submit)', function (data) { |
| | | console.log(data); |
| | | febs.post(ctx + 'admin/leader/leaderBonusSetUpdate', data.field, function (res) { |
| | | febs.alert.success('设置成功'); |
| | | }); |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |