From 9926a6a4f76c9292e2bfbefbce9bcb4122fd577a Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期一, 29 十二月 2025 09:34:18 +0800
Subject: [PATCH] 修改bug
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppUserController.java | 126 +++++++++++++++++++++++++++++++-----------
1 files changed, 93 insertions(+), 33 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppUserController.java
index b8cd676..9561524 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppUserController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppUserController.java
@@ -22,9 +22,7 @@
import com.ruoyi.system.dto.BatchUpdateIntegralDto;
import com.ruoyi.system.dto.GoldChangeDto;
import com.ruoyi.system.dto.UpdateAppUserDto;
-import com.ruoyi.system.export.AppUserGoldImport;
-import com.ruoyi.system.export.AppUserImport;
-import com.ruoyi.system.export.BigGiftPackageImport;
+import com.ruoyi.system.export.*;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.model.*;
import com.ruoyi.system.query.*;
@@ -33,6 +31,7 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.transaction.annotation.Propagation;
@@ -71,34 +70,35 @@
@Api(tags = "(嘉视达)用户管理")
public class TAppUserController {
+ private final TAppUserService appUserService;
- @Resource
- private TAppUserService appUserService;
+ private final RedisTemplate redisTemplate;
+ private final TokenService tokenService;
- @Autowired
- private RedisTemplate redisTemplate;
+ private final TCompanyService companyService;
- @Autowired
- private TokenService tokenService;
+ private final TGoldChangeRecordService goldChangeRecordService;
- @Autowired
- private TCompanyService companyService;
+ private final TIntegralChangeRecordService integralChangeRecordService;
- @Autowired
- private TGoldChangeRecordService goldChangeRecordService;
+ private final SysUserMapper sysUserMapper;
- @Autowired
- private TIntegralChangeRecordService integralChangeRecordService;
+ private final TBigGiftPackageOrderService bigGiftPackageOrderService;
- @Autowired
- private SysUserMapper sysUserMapper;
+ private final TIntegralSettlementService integralSettlementService;
- @Autowired
- private TBigGiftPackageOrderService bigGiftPackageOrderService;
-
- @Autowired
- private TIntegralSettlementService integralSettlementService;
+ public TAppUserController(TAppUserService appUserService, RedisTemplate redisTemplate, TokenService tokenService, TCompanyService companyService, TGoldChangeRecordService goldChangeRecordService, TIntegralChangeRecordService integralChangeRecordService, SysUserMapper sysUserMapper, TBigGiftPackageOrderService bigGiftPackageOrderService, TIntegralSettlementService integralSettlementService) {
+ this.appUserService = appUserService;
+ this.redisTemplate = redisTemplate;
+ this.tokenService = tokenService;
+ this.companyService = companyService;
+ this.goldChangeRecordService = goldChangeRecordService;
+ this.integralChangeRecordService = integralChangeRecordService;
+ this.sysUserMapper = sysUserMapper;
+ this.bigGiftPackageOrderService = bigGiftPackageOrderService;
+ this.integralSettlementService = integralSettlementService;
+ }
@ApiOperation(value = "用户管理分页列表")
@@ -132,10 +132,14 @@
}
TAppUser appUser = appUserService.getById(dto.getId());
String code = appUser.getCode();
- if (dto.getCode() != null && !dto.getCode().isEmpty() && !code.equals(dto.getCode())) {
+ if(code==null){
appUser.setCode(dto.getCode());
- // 移除之前的二维码
- redisTemplate.delete("USER_WX_IMG" + appUser.getId());
+ }else {
+ if (dto.getCode() != null && !dto.getCode().isEmpty() && !dto.getCode().equals(code)) {
+ appUser.setCode(dto.getCode());
+ // 移除之前的二维码
+ redisTemplate.delete("USER_WX_IMG" + appUser.getId());
+ }
}
if (dto.getPromotionStatus() != null) {
appUser.setPromotionStatus(dto.getPromotionStatus());
@@ -156,8 +160,17 @@
@ApiOperation(value = "查看详情")
@GetMapping(value = "/detail")
- public R<TAppUser> detail(@RequestParam String id) {
- return R.ok(appUserService.getById(id));
+ public R<TAppUserVo> detail(@RequestParam String id) {
+ TAppUser appUser = appUserService.getById(id);
+ TAppUserVo tAppUserVo = new TAppUserVo();
+ BeanUtils.copyProperties(appUser, tAppUserVo);
+ if(appUser.getCompanyId()!=null){
+ tAppUserVo.setReferrerCompany(companyService.getById(appUser.getCompanyId()));
+ }
+ if(appUser.getReferrerUserId()!=null && appUser.getReferrerStatus()==2){
+ tAppUserVo.setReferrerUser(appUserService.getById(appUser.getReferrerUserId()));
+ }
+ return R.ok(tAppUserVo);
}
@@ -346,7 +359,7 @@
if (one != null) {
tAppUser.setCompanyId(one.getId());
}
- appUserService.save(user);
+ appUserService.save(tAppUser);
i++;
}
if (!result.isEmpty()) {
@@ -443,13 +456,11 @@
}
-
@ApiOperation(value = "积分修改记录")
@PostMapping(value = "/integralChangeRecord")
public R<PageInfo<IntegralChangeRecordVo>> integralChangeRecord(@RequestBody IntegralChangeRecordQuery query) {
return R.ok(integralChangeRecordService.integralChangeRecord(query));
}
-
@ApiOperation(value = "积分修改记录导出")
@@ -459,7 +470,7 @@
List<IntegralChangeRecordVo> list = integralChangeRecordService.integralChangeRecordExport(query);
- Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TAppUser.class, list);
+ Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), IntegralChangeRecordVo.class, list);
HttpServletResponse response = WebUtils.response();
assert response != null;
response.setContentType("application/vnd.ms-excel");
@@ -537,6 +548,7 @@
return R.ok();
}
+
@ApiOperation(value = "金币扣除")
@PostMapping(value = "/goldSub")
@Log(title = "小程序用户-金币扣除", businessType = BusinessType.UPDATE)
@@ -573,6 +585,55 @@
}
+ @ApiOperation(value = "用户-购买记录导出")
+ @PostMapping(value = "/pageOrderListExport")
+ @Log(title = "购买记录-导出", businessType = BusinessType.EXPORT)
+ public void pageOrderListExport(@RequestBody @Valid GoldChangeRecordQuery query){
+ List<TBigGiftPackageOrder> list = bigGiftPackageOrderService.pageOrderListExport(query);
+ ArrayList<TBigGiftPackageOrderUserExport> tBigGiftPackageOrderUserExports = new ArrayList<>();
+ for (TBigGiftPackageOrder order : list) {
+ TBigGiftPackageOrderUserExport export = new TBigGiftPackageOrderUserExport();
+ export.setOrderNo(order.getCode());
+ export.setCreateTime(order.getCreateTime());
+ export.setUsername(order.getUserName());
+ export.setUserPhone(order.getPhone());
+ export.setOrderAmount(order.getOrderPrice());
+ export.setGoodsName(order.getBigGiftPackageName());
+ export.setPayMethod("微信支付");
+ export.setDeposit(order.getDeposit());
+ export.setBalance(order.getFinalPayment());
+ export.setOrderStatus(order.getStatus());
+ tBigGiftPackageOrderUserExports.add(export);
+ }
+
+ Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TBigGiftPackageOrderUserExport.class, tBigGiftPackageOrderUserExports);
+ HttpServletResponse response = WebUtils.response();
+ assert response != null;
+ response.setContentType("application/vnd.ms-excel");
+ response.setCharacterEncoding("utf-8");
+ ServletOutputStream outputStream = null;
+ try {
+ String fileName = URLEncoder.encode("购买记录导出信息.xls", "utf-8");
+ response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+ response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+ response.setHeader("Pragma", "no-cache");
+ response.setHeader("Cache-Control", "no-cache");
+ outputStream = response.getOutputStream();
+ workbook.write(outputStream);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+
+
@ApiOperation(value = "用户- 推广记录")
@PostMapping("/promotionPageList")
public R<Page<UserPromotionPageListVo>> promotionPageList(@RequestBody @Valid UserPromotionPageListQuery query) {
@@ -581,7 +642,6 @@
page.setRecords(list);
return R.ok(page);
}
-
@ApiOperation(value = "用户-推广记录导出")
@@ -668,6 +728,7 @@
return R.ok(integralSettlementPage);
}
+
@ApiOperation(value = "用户结算记录导出")
@PostMapping(value = "/exportSettlementPageList")
@Log(title = "结算记录-导出", businessType = BusinessType.EXPORT)
@@ -698,7 +759,6 @@
}
}
}
-
}
--
Gitblit v1.7.1