| | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner; |
| | | import com.wechat.pay.contrib.apache.httpclient.util.PemUtil; |
| | | import com.wechat.pay.java.core.exception.MalformedMessageException; |
| | |
| | | return franchiseeService.updateBatchById(list) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 设置加盟商操作密码 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "设置加盟商操作密码【202506】", tags = {"后台-加盟商管理"}) |
| | | @PutMapping(value = "/setPayPassword") |
| | | public R<String> setPayPassword(@RequestParam(value = "payPassword") String payPassword) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserService.getById(userid); |
| | | if(Objects.isNull(sysUser.getFranchiseeId())){ |
| | | return R.fail("加盟商信息不存在!"); |
| | | } |
| | | Franchisee franchisee = franchiseeService.getById(sysUser.getFranchiseeId()); |
| | | franchisee.setPayPassword(SecurityUtils.encryptPassword(payPassword)); |
| | | return franchiseeService.updateById(franchisee) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 设置加盟商操作密码 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "加盟商余额扣除撤回【202506】", tags = {"后台-加盟商管理"}) |
| | | @PutMapping(value = "/balanceWithdraw") |
| | | public R<String> balanceWithdraw(@RequestParam(value = "id") Integer id, |
| | | @RequestParam(value = "payPassword") String payPassword) { |
| | | |
| | | TFranchiseeBalanceChange balanceChange = balanceChangeService.getById(id); |
| | | |
| | | Franchisee franchisee = franchiseeService.getById(balanceChange.getFranchiseeId()); |
| | | |
| | | if(!SecurityUtils.matchesPassword(payPassword, franchisee.getPayPassword())){ |
| | | return R.fail("密码错误!"); |
| | | } |
| | | |
| | | franchisee.setBalance(franchisee.getBalance().add(balanceChange.getAmount())); |
| | | franchiseeService.updateById(franchisee); |
| | | |
| | | // 删除操作记录 |
| | | balanceChangeService.removeById(id); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |