feat(cloud): 添加修改资金账户名称功能并优化相关服务
- 在 BatteryStation 实体类中添加 EqualsAndHashCode 注解 - 在 CloudService 接口中添加 updateName 方法 - 修改 GZHMessageTemplateService 中的模板 ID 引用- 在 PageListWalletRequest 中添加 uname 字段 - 在 WalletAccountController 中添加 updateName 接口 - 在 WalletAccountService 接口中添加 updateName 方法 - 实现 WalletAccountServiceImpl 中的 updateName 方法 - 在 WechatUserService 实现类中调用 updateName 方法更新微信用户信息
This commit is contained in:
parent
1a68ba3e9e
commit
aa096bb997
@ -11,6 +11,7 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
@ -23,6 +24,7 @@ import lombok.Data;
|
||||
* @author zrb
|
||||
* @since 2024-10-15
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("hd_cloud_manage.yt_t_battery_station")
|
||||
@Schema(name = "BatteryStation", description = "换电站")
|
||||
|
||||
@ -19,6 +19,9 @@ public class PageListWalletRequest extends BasePageRequest {
|
||||
@Schema(description = "户主ID")
|
||||
private String ownerId;
|
||||
|
||||
@Schema(description = "用户名")
|
||||
private String uname;
|
||||
|
||||
@Schema(description = "编码")
|
||||
private String code;
|
||||
|
||||
|
||||
@ -54,6 +54,7 @@ public class WalletAccountController {
|
||||
public Result<Integer> update(@ParameterObject WalletAccount wa) {
|
||||
return walletAccountService.update(wa);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "查询")
|
||||
@GetMapping("/list")
|
||||
@ -92,15 +93,19 @@ public class WalletAccountController {
|
||||
}
|
||||
@Operation(summary = "获取WalleCode")
|
||||
@PostMapping("/getWalleCode")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@ApiOperationSupport(order = 9)
|
||||
public Result<String> getWalleCode(String wuid) {
|
||||
return walletAccountService.getWalleCode(wuid);
|
||||
}
|
||||
@Operation(summary = "获取附加信息")
|
||||
@PostMapping("/getPayAttach")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@ApiOperationSupport(order = 10)
|
||||
public Result<WechatPayAttach> getPayAttach(String wuid) {
|
||||
return walletAccountService.getPayAttach(wuid);
|
||||
}
|
||||
|
||||
@PostMapping({"/updateName"})
|
||||
@ApiOperationSupport(order = 11)
|
||||
public Result<Integer> updateName(@ParameterObject WalletAccount wa) {
|
||||
return walletAccountService.updateName(wa);
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,4 +30,6 @@ public interface WalletAccountService {
|
||||
public Result<String> getWalleCode(String wuid);
|
||||
|
||||
public Result<WechatPayAttach> getPayAttach(String wuid);
|
||||
|
||||
public Result<Integer> updateName(WalletAccount wa);
|
||||
}
|
||||
|
||||
@ -125,23 +125,26 @@ public class WalletAccountServiceImpl implements WalletAccountService {
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
}
|
||||
|
||||
return new Result<Integer>().error("更新资金账户失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<WalletAccountVO>> list(PageListWalletRequest plwr) {
|
||||
Page<WalletAccount> page = new Page<WalletAccount>(plwr.getPageNo(), plwr.getPageSize());
|
||||
|
||||
page = walletAccountDao.selectPage(page, new QueryWrapper<WalletAccount>()
|
||||
QueryWrapper<WalletAccount> queryWrapper = new QueryWrapper<WalletAccount>()
|
||||
.eq(StringUtils.hasText(plwr.getCode()), "code", plwr.getCode())
|
||||
.like(StringUtils.hasText(plwr.getUname()), "acc_name", plwr.getUname())
|
||||
.eq(StringUtils.hasText(plwr.getStationCode()), "station_code", plwr.getStationCode())
|
||||
.eq(plwr.getOwnerType() != null, "owner_type", plwr.getOwnerType())
|
||||
.eq(StringUtils.hasText(plwr.getOwnerId()), "owner_id", plwr.getOwnerId())
|
||||
.orderByDesc("pk_id"));
|
||||
.orderByDesc("pk_id");
|
||||
page = walletAccountDao.selectPage(page, queryWrapper);
|
||||
|
||||
if (page.getRecords().isEmpty()) {
|
||||
return new Result<List<WalletAccountVO>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
|
||||
// 2. 转换为VO并查询用户信息
|
||||
List<WalletAccountVO> voList = page.getRecords().stream().map(account -> {
|
||||
WalletAccountVO vo = new WalletAccountVO();
|
||||
@ -276,6 +279,22 @@ public class WalletAccountServiceImpl implements WalletAccountService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> updateName(WalletAccount wa) {
|
||||
if (wa == null) {
|
||||
return new Result<Integer>().error("参数不能为空");
|
||||
}
|
||||
LambdaQueryWrapper<WalletAccount> walletAccountLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
walletAccountLambdaQueryWrapper.eq(WalletAccount::getOwnerId, wa.getOwnerId());
|
||||
WalletAccount walletAccount = walletAccountDao.selectOne(walletAccountLambdaQueryWrapper);
|
||||
if (walletAccount != null) {
|
||||
walletAccount.setAccName(wa.getAccName());
|
||||
walletAccountDao.updateById(walletAccount);
|
||||
return new Result<Integer>().success(1);
|
||||
}
|
||||
return new Result<Integer>().error("未找到对应的账户");
|
||||
}
|
||||
|
||||
// 查询 WechatUser 的封装方法
|
||||
private WechatUser queryWechatUserByWuid(String wuid) {
|
||||
LambdaQueryWrapper<WechatUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
@ -157,7 +157,7 @@ public class GZHMessageTemplateService {
|
||||
break;
|
||||
// 付款完成
|
||||
case 3:
|
||||
templateId = gzhProperties.getOrderSwapEndTemplateId();
|
||||
templateId = gzhProperties.getOrderEndTemplateId();
|
||||
miniprogram.setPath(orderDetailPage);
|
||||
PayTemplateData payData = new PayTemplateData();
|
||||
payData.setThing2(osb.getStationName());
|
||||
@ -170,6 +170,7 @@ public class GZHMessageTemplateService {
|
||||
break;
|
||||
//预约即将失效
|
||||
case 4:
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@ -45,6 +45,10 @@ public class WechatUserServiceImpl implements WechatUserService {
|
||||
if (n == 1) {
|
||||
return new Result<String>().success(1);
|
||||
}
|
||||
WalletAccount walletAccount = new WalletAccount();
|
||||
walletAccount.setOwnerId(wuser.getWuid());
|
||||
walletAccount.setAccName(wuser.getName());
|
||||
cloudService.updateName(walletAccount);
|
||||
return new Result<String>().error("修改微信用户信息出错!");
|
||||
}
|
||||
|
||||
|
||||
@ -93,4 +93,7 @@ public interface CloudService {
|
||||
|
||||
@PostMapping(value = "/wallet/getPayAttach", consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public Result<WechatPayAttach> getPayAttach(@NotBlank String wuid);
|
||||
|
||||
@PostMapping(value = "/wallet/updateName", consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public Result<WechatPayAttach> updateName(@NotBlank WalletAccount wa);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user