ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppUserController.java
@@ -173,6 +173,35 @@ return R.ok(tAppUserVo); } @ApiOperation(value = "小程序用户金币导入模板下载") @GetMapping("/import-template_gold") public void importTemplateGold() { List<AppUserGoldImport> imports = new ArrayList<>(); AppUserGoldImport goldImport = new AppUserGoldImport(); imports.add(goldImport); Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), AppUserGoldImport.class, imports); HttpServletResponse response = WebUtils.response(); ServletOutputStream outputStream = null; try { String fileName = URLEncoder.encode("金币导入模板.xls", "utf-8"); response.setHeader("Content-Disposition", "attachment;filename=" + fileName); response.setHeader("content-Type", "application/vnd.ms-excel"); response.setHeader("Pragma", "no-cache"); response.setHeader("Cache-Control", "no-cache"); outputStream = response.getOutputStream(); workbook.write(outputStream); } catch (IOException e) { e.printStackTrace(); System.out.println("金币导入模板下载失败!"); } finally { try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } @Log(title = "小程序用户-金币导入", businessType = BusinessType.IMPORT) @ApiOperation(value = "小程序用户-金币导入") @@ -248,6 +277,36 @@ } @ApiOperation(value = "小程序用户导入模板下载") @GetMapping("/import-template_user") public void importTemplate() { List<AppUserImport> imports = new ArrayList<>(); AppUserImport appUserImport = new AppUserImport(); imports.add(appUserImport); Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), AppUserImport.class, imports); HttpServletResponse response = WebUtils.response(); ServletOutputStream outputStream = null; try { String fileName = URLEncoder.encode("小程序用户导入模板.xls", "utf-8"); response.setHeader("Content-Disposition", "attachment;filename=" + fileName); response.setHeader("content-Type", "application/vnd.ms-excel"); response.setHeader("Pragma", "no-cache"); response.setHeader("Cache-Control", "no-cache"); outputStream = response.getOutputStream(); workbook.write(outputStream); } catch (IOException e) { e.printStackTrace(); System.out.println("小程序用户导入模板下载失败!"); } finally { try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } @Log(title = "小程序用户-用户导入", businessType = BusinessType.IMPORT) @ApiOperation(value = "小程序用户-用户导入") @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) @@ -294,6 +353,10 @@ result.append("第" + i + "行:[", "出生日期" + "]不能为空"); continue; } if (!StringUtils.hasLength(appUserImport.getPromotion())) { result.append("第" + i + "行:[", "推广权限" + "]不能为空"); continue; } if (!StringUtils.hasLength(appUserImport.getRole())) { result.append("第" + i + "行:[", "角色" + "]不能为空"); continue; @@ -321,6 +384,13 @@ continue; } String promotion = appUserImport.getPromotion(); Integer promotionType = "是".equals(promotion) ? 1 : "否".equals(promotion) ? 0 : null; if (promotionType == null) { result.append("第" + i + "行:[", "推广权限" + "]格式错误"); continue; } String birth = appUserImport.getBirth(); LocalDate birthday = null; try { @@ -344,6 +414,7 @@ tAppUser.setGender(gender); tAppUser.setBirthday(birthday); tAppUser.setUserType(userType); tAppUser.setPromotionStatus(promotionType); if (appUserImport.getReferrerCode() != null) { TAppUser referrerUser = appUserService.getOne(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getCode, appUserImport.getReferrerCode()).ne(TAppUser::getStatus, 3).last("LIMIT 1")); ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCompanyController.java
@@ -118,6 +118,10 @@ public R<String> add(@RequestBody TCompany company) { company.setStatus(1); company.setCreateUserId(getUserId()); if(company.getAccount()!=null && "admin".equals(company.getAccount())){ return R.fail("账号不能为admin"); } SysUser user = new SysUser(); user.setRoleType(2); user.setDeptId(124l); @@ -153,6 +157,9 @@ @PostMapping(value = "/edit") @Log(title = "修改公司-修改", businessType = BusinessType.UPDATE) public R<String> edit(@RequestBody TCompany company) { if(company.getAccount()!=null && "admin".equals(company.getAccount())){ return R.fail("账号不能为admin"); } SysUser user = userService.getUserByCompanyId(company.getId()); if (!userService.checkUserNameUnique(user)) { return R.fail("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); @@ -160,8 +167,9 @@ return R.fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); } user.setUserName(company.getAccount()); user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); user.setPassword(SecurityUtils.encryptPassword(company.getPassword())); company.setUpdateUserId(getUserId()); user.setRoleId(2L); int count = userService.updateUser(user); if (count > 0) { boolean update = companyService.updateById(company); @@ -255,6 +263,9 @@ @PostMapping("/system/user/add") public R<String> add(@RequestBody SysUser user) { if(user.getUserName()!=null && "admin".equals(user.getUserName())){ return R.fail("账号不能为admin"); } user.setUserName(user.getUserName()); if (!userService.checkUserNameUnique(user)) { @@ -303,6 +314,9 @@ @PostMapping("/system/user/edit") public R edit(@RequestBody SysUser user) { if(user.getUserName()!=null && "admin".equals(user.getUserName())){ return R.fail("账号不能为admin"); } user.setUserName(user.getPhonenumber()); // userService.checkUserAllowed(user); // userService.checkUserDataScope(user.getUserId()); @@ -318,6 +332,7 @@ if(StringUtils.isNotEmpty(user.getPassword())){ user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); } user.setRoleId(2L); // 移除之前的二维码 redisTemplate.delete("ADMIN_WX_IMG" + user.getUserId()); return R.ok(userService.updateUser(user)); ruoyi-admin/src/main/resources/application.yml
@@ -1,4 +1,4 @@ # 项目相关配置 spring: profiles: active: prod active: test ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java
@@ -128,6 +128,10 @@ return passwordEncoder.encode(password); } public static void main(String[] args) { String s = encryptPassword("111111"); System.out.println(s); } /** * 判断密码是否相同 * ruoyi-system/src/main/java/com/ruoyi/system/export/AppUserImport.java
@@ -29,6 +29,10 @@ @Excel(name = "角色") private String role; @ApiModelProperty(value = "是否开启推广权限") @Excel(name = "是否开启推广权限") private String promotion; @ApiModelProperty(value = "推广号") @Excel(name = "推广号") private String code; ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRefundApplicationServiceImpl.java
@@ -1,5 +1,6 @@ package com.ruoyi.system.service.impl; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.exception.ServiceException; @@ -23,6 +24,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; @@ -104,19 +106,27 @@ vo.setCode(order.getCode()); vo.setCreateTime(order.getCreateTime()); vo.setOrderPrice(order.getOrderPrice()); vo.setPaymentType(order.getPaymentType()); vo.setRefundAmount(order.getPaymentPrice()); // 用户信息 TAppUser appUser = tAppUserService.getById(order.getAppUserId()); vo.setUserName(appUser.getName()); vo.setPhone(appUser.getPhone()); if(appUser!=null){ vo.setUserName(appUser.getName()); vo.setPhone(appUser.getPhone()); } // 商品信息 TBigGiftPackage tBigGiftPackage = tBigGiftPackageService.getById(order.getBigGiftPackageId()); vo.setBigGiftPackageName(tBigGiftPackage.getName()); vo.setBigGiftPackageCover(tBigGiftPackage.getCoverImage()); vo.setBigGiftPackagePrice(tBigGiftPackage.getTotalPrice()); vo.setBigGiftPackageIntro(tBigGiftPackage.getIntroduction()); String bigGiftPackage = order.getBigGiftPackage(); if(bigGiftPackage!=null){ JSONObject jsonObject = JSONObject.parseObject(bigGiftPackage); vo.setBigGiftPackageName(jsonObject.getString("name")); vo.setBigGiftPackageCover(jsonObject.getString("coverImage")); vo.setBigGiftPackagePrice(new BigDecimal(jsonObject.getString("totalPrice"))); vo.setBigGiftPackageIntro(jsonObject.getString("introduction")); } // 销量 long count = tBigGiftPackageOrderService.count(new LambdaQueryWrapper<TBigGiftPackageOrder>().eq(TBigGiftPackageOrder::getBigGiftPackageId, order.getBigGiftPackageId()).ne(TBigGiftPackageOrder::getStatus, 5)); ruoyi-system/src/main/java/com/ruoyi/system/vo/TRefundApplicationVo.java
@@ -99,6 +99,12 @@ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime auditTime; @ApiModelProperty(value = "支付方式1=订金+尾款,2=全款") private Integer paymentType; @ApiModelProperty(value = "退款金额") private BigDecimal refundAmount; ruoyi-system/src/main/resources/mapper/system/TRefundApplicationMapper.xml
@@ -21,7 +21,7 @@ id, big_gift_package_order_id, applicant_user_id, applicant_time, refund_reason, voucher_picture, status, audit_user_id, audit_time, audit_remark </sql> <select id="pageRefundList" resultType="com.ruoyi.system.model.TBigGiftPackageOrder"> select t1.id,t2.code,t2.create_time,t3.name userName,t3.phone,t2.order_price,t4.name bigGiftPackageName,t2.payment_type,t2.deposit,t2.final_payment,t1.status auditStatus from t_refund_application t1 left join t_big_gift_package_order t2 on t1.big_gift_package_order_id = t2.id select t1.id,t2.code,t2.create_time ,t3.name userName,t3.phone,t2.order_price,t4.name bigGiftPackageName,t2.payment_type,t2.deposit,t2.final_payment,t1.status auditStatus from t_refund_application t1 left join t_big_gift_package_order t2 on t1.big_gift_package_order_id = t2.id left join t_app_user t3 on t2.app_user_id = t3.id left join t_big_gift_package t4 on t2.big_gift_package_id = t4.id where t1.del_flag = 0 <if test="query.code != null and query.code != ''">