| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.admin.api.entity.FranchiseeVO; |
| | | import com.ruoyi.admin.config.WeChatConfig; |
| | | import com.ruoyi.admin.entity.*; |
| | | import com.ruoyi.admin.service.*; |
| | |
| | | import lombok.Getter; |
| | | import org.apache.commons.codec.CharEncoding; |
| | | import org.apache.poi.util.IOUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | |
| | | TFranchiseeBalanceChange tFranchiseeBalanceChange = new TFranchiseeBalanceChange(); |
| | | tFranchiseeBalanceChange.setAmount(money.multiply(new BigDecimal("0.9972")).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | tFranchiseeBalanceChange.setAmount(money.multiply(new BigDecimal("0.9962")).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | tFranchiseeBalanceChange.setIs_pay(0); |
| | | tFranchiseeBalanceChange.setFranchiseeName(byId.getName()); |
| | | tFranchiseeBalanceChange.setFranchiseeId(String.valueOf(byId.getId())); |
| | |
| | | BigDecimal money = new BigDecimal(2); |
| | | |
| | | |
| | | System.err.println(money.multiply(new BigDecimal("0.9972")).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | System.err.println(money.multiply(new BigDecimal("0.9962")).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | } |
| | | |
| | | @ApiOperation(value = "扫码支付",tags = {"后台2.0-加盟商列表余额"}) |
| | |
| | | // com.wechat.pay.java.service.payments.nativepay.model.PrepayResponse prepay = nativePayService.prepay(prepayRequest); |
| | | //预支付成功,创建预支付订单 |
| | | TFranchiseeBalanceChange tFranchiseeBalanceChange = new TFranchiseeBalanceChange(); |
| | | tFranchiseeBalanceChange.setAmount(money.multiply(new BigDecimal("0.9972")).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | tFranchiseeBalanceChange.setAmount(money.multiply(new BigDecimal("0.9962")).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | tFranchiseeBalanceChange.setIs_pay(0); |
| | | tFranchiseeBalanceChange.setFranchiseeName(byId.getName()); |
| | | tFranchiseeBalanceChange.setFranchiseeId(String.valueOf(byId.getId())); |
| | |
| | | // com.wechat.pay.java.service.payments.nativepay.model.PrepayResponse prepay = nativePayService.prepay(prepayRequest); |
| | | //预支付成功,创建预支付订单 |
| | | TFranchiseeBalanceChange tFranchiseeBalanceChange = new TFranchiseeBalanceChange(); |
| | | tFranchiseeBalanceChange.setAmount(money.multiply(new BigDecimal("0.9972")).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | tFranchiseeBalanceChange.setAmount(money.multiply(new BigDecimal("0.9962")).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | tFranchiseeBalanceChange.setIs_pay(0); |
| | | tFranchiseeBalanceChange.setFranchiseeName(byId.getName()); |
| | | tFranchiseeBalanceChange.setFranchiseeId(String.valueOf(byId.getId())); |
| | |
| | | MasterWorker byId = masterWorkerService.getById(id); |
| | | return R.ok(byId.getProfilePicture()); |
| | | } |
| | | @GetMapping(value = "/getFranchiseeInfo") |
| | | public R<FranchiseeVO> getFranchiseeInfo(@RequestParam("franchiseeId") Integer franchiseeId) { |
| | | Franchisee franchisee = franchiseeService.getById(franchiseeId); |
| | | FranchiseeVO franchiseeVO = new FranchiseeVO(); |
| | | BeanUtils.copyProperties(franchisee, franchiseeVO); |
| | | return R.ok(franchiseeVO); |
| | | } |
| | | |
| | | /** |
| | | * 新增加盟商信息 |
| | |
| | | .eq(SysUser::getIsEnable, 1).eq(SysUser::getIsDelete, 0).list(); |
| | | if(!list1.isEmpty()){ |
| | | return R.passwordError("该管理员账号已存在!"); |
| | | } |
| | | // 设置加盟商初始密码 |
| | | List<Franchisee> franchiseeList = franchiseeService.list(); |
| | | if (!CollectionUtils.isEmpty(franchiseeList)){ |
| | | franchisee.setPayPassword(franchiseeList.get(0).getPayPassword()); |
| | | } |
| | | boolean save = franchiseeService.save(franchisee); |
| | | // 生成sysUser账号 |
| | |
| | | @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("加盟商信息不存在!"); |
| | | List<Franchisee> franchisee = franchiseeService.list(); |
| | | for (Franchisee franchisee1 : franchisee) { |
| | | franchisee1.setPayPassword(payPassword); |
| | | } |
| | | Franchisee franchisee = franchiseeService.getById(sysUser.getFranchiseeId()); |
| | | franchisee.setPayPassword(SecurityUtils.encryptPassword(payPassword)); |
| | | return franchiseeService.updateById(franchisee) ? R.ok() : R.fail(); |
| | | return franchiseeService.updateBatchById(franchisee) ? R.ok() : R.fail(); |
| | | } |
| | | @ApiOperation(value = "获取加盟商操作密码", tags = {"后台-加盟商管理"}) |
| | | @PutMapping(value = "/getPayPassword") |
| | | public R<String> getPayPassword() { |
| | | List<Franchisee> franchisee = franchiseeService.list(); |
| | | if (!franchisee.isEmpty()){ |
| | | return R.ok(franchisee.get(0).getPayPassword()); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @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())){ |
| | | if(!payPassword.equals(franchisee.getPayPassword())){ |
| | | return R.fail("密码错误!"); |
| | | } |
| | | |
| | | franchisee.setBalance(franchisee.getBalance().add(balanceChange.getAmount())); |
| | | franchiseeService.updateById(franchisee); |
| | | |
| | | // 删除操作记录 |
| | | balanceChangeService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 设置加盟商是否显示司机信息 |
| | | * |
| | | */ |
| | | @ApiOperation(value = "加盟商设置是否显示【202509】",notes = "id:加盟商id,isDisplay:是否显示 1=是 0=否", tags = {"后台-加盟商管理"}) |
| | | @PutMapping(value = "/setIsDisplay") |
| | | public R<String> setIsDisplay(@RequestParam(value = "id") Integer id, |
| | | @RequestParam(value = "isDisplay") Integer isDisplay) { |
| | | Franchisee franchisee = franchiseeService.getById(id); |
| | | franchisee.setIsDisplay(isDisplay); |
| | | franchiseeService.updateById(franchisee); |
| | | return R.ok(); |
| | | } |
| | | |