init
This commit is contained in:
@@ -57,8 +57,7 @@ public class AccountChangeLogController extends BaseController {
|
|||||||
@SaCheckPermission("cai:accountChangeLog:list")
|
@SaCheckPermission("cai:accountChangeLog:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<AccountChangeLog> list(AccountChangeLog bo, PageQuery pageQuery) {
|
public TableDataInfo<AccountChangeLog> list(AccountChangeLog bo, PageQuery pageQuery) {
|
||||||
Page<AccountChangeLog> page = accountChangeLogService.page(pageQuery.build(),
|
Page<AccountChangeLog> page = accountChangeLogService.pageAdmin(pageQuery, bo);
|
||||||
Wrappers.lambdaQuery(bo).orderByDesc(AccountChangeLog::getCreateTime));
|
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,9 +83,10 @@ public class ConsumeLogController extends BaseController {
|
|||||||
@SaCheckPermission("cai:consumeLog:edit")
|
@SaCheckPermission("cai:consumeLog:edit")
|
||||||
@Log(title = "消费记录", businessType = BusinessType.UPDATE)
|
@Log(title = "消费记录", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PutMapping()
|
@GetMapping("/consumer")
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ConsumeLog bo) {
|
public R<Void> consumer(Long id) {
|
||||||
return toAjax(consumeLogService.updateById(bo));
|
consumeLogService.dealFenxiao(id,false);
|
||||||
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.cai.domain;
|
package com.ruoyi.cai.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.ruoyi.cai.enums.account.AccountChangeCodeEnum;
|
import com.ruoyi.cai.enums.account.AccountChangeCodeEnum;
|
||||||
@@ -47,7 +48,6 @@ public class AccountChangeLog implements Serializable {
|
|||||||
* 名称
|
* 名称
|
||||||
*/
|
*/
|
||||||
private String cateAdminName;
|
private String cateAdminName;
|
||||||
private String cateAppName;
|
|
||||||
private Long traceId;
|
private Long traceId;
|
||||||
private String traceLinkType;
|
private String traceLinkType;
|
||||||
/**
|
/**
|
||||||
@@ -70,11 +70,13 @@ public class AccountChangeLog implements Serializable {
|
|||||||
|
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String showMessage;
|
||||||
|
|
||||||
|
|
||||||
public void init(AccountChangeCodeEnum change){
|
public void init(AccountChangeCodeEnum change){
|
||||||
this.setAccountType(change.getAccountType().getCode());
|
this.setAccountType(change.getAccountType().getCode());
|
||||||
this.setCateId(change.getCate().getCode());
|
this.setCateId(change.getCate().getCode());
|
||||||
this.setCateAppName(change.getText());
|
|
||||||
this.setCateAdminName(change.getText());
|
this.setCateAdminName(change.getText());
|
||||||
this.setTraceLinkType(change.getCate().name());
|
this.setTraceLinkType(change.getCate().name());
|
||||||
this.setRemark(change.getDesc());
|
this.setRemark(change.getDesc());
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package com.ruoyi.cai.service;
|
package com.ruoyi.cai.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.cai.domain.AccountChangeLog;
|
import com.ruoyi.cai.domain.AccountChangeLog;
|
||||||
import com.ruoyi.cai.domain.Gift;
|
import com.ruoyi.cai.domain.Gift;
|
||||||
import com.ruoyi.cai.enums.account.AccountChangeCodeEnum;
|
import com.ruoyi.cai.enums.account.AccountChangeCodeEnum;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账户明细Service接口
|
* 账户明细Service接口
|
||||||
@@ -24,4 +26,6 @@ public interface AccountChangeLogService extends IService<AccountChangeLog> {
|
|||||||
, Long tarUserId, Gift gift);
|
, Long tarUserId, Gift gift);
|
||||||
|
|
||||||
AccountChangeLog saveLogAdmin(Long userId, String usercode, AccountChangeCodeEnum change, Long price, Long traceId);
|
AccountChangeLog saveLogAdmin(Long userId, String usercode, AccountChangeCodeEnum change, Long price, Long traceId);
|
||||||
|
|
||||||
|
Page<AccountChangeLog> pageAdmin(PageQuery pageQuery, AccountChangeLog bo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,26 @@
|
|||||||
package com.ruoyi.cai.service.impl;
|
package com.ruoyi.cai.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.cai.domain.AccountChangeLog;
|
import com.ruoyi.cai.domain.AccountChangeLog;
|
||||||
import com.ruoyi.cai.domain.Gift;
|
import com.ruoyi.cai.domain.Gift;
|
||||||
|
import com.ruoyi.cai.domain.User;
|
||||||
|
import com.ruoyi.cai.enums.account.AccountCateEnum;
|
||||||
import com.ruoyi.cai.enums.account.AccountChangeCodeEnum;
|
import com.ruoyi.cai.enums.account.AccountChangeCodeEnum;
|
||||||
import com.ruoyi.cai.mapper.AccountChangeLogMapper;
|
import com.ruoyi.cai.mapper.AccountChangeLogMapper;
|
||||||
import com.ruoyi.cai.service.AccountChangeLogService;
|
import com.ruoyi.cai.service.AccountChangeLogService;
|
||||||
|
import com.ruoyi.cai.service.UserService;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账户明细Service业务层处理
|
* 账户明细Service业务层处理
|
||||||
*
|
*
|
||||||
@@ -69,5 +82,39 @@ public class AccountChangeLogServiceImpl extends ServiceImpl<AccountChangeLogMap
|
|||||||
return changeLog;
|
return changeLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<AccountChangeLog> pageAdmin(PageQuery pageQuery, AccountChangeLog bo) {
|
||||||
|
Page<AccountChangeLog> page = this.page(pageQuery.build(), Wrappers.lambdaQuery(bo).orderByDesc(AccountChangeLog::getCreateTime));
|
||||||
|
List<AccountChangeLog> records = page.getRecords();
|
||||||
|
Set<Long> userIds = records.stream().map(AccountChangeLog::getTarUserId).collect(Collectors.toSet());
|
||||||
|
if(records.isEmpty()){
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
List<User> users = userService.listByIds(userIds);
|
||||||
|
Map<Long, User> userMap = users.stream().collect(Collectors.toMap(User::getId, Function.identity()));
|
||||||
|
for (AccountChangeLog record : records) {
|
||||||
|
User user = userMap.get(record.getTarUserId());
|
||||||
|
if(user != null){
|
||||||
|
String format = String.format("%s来自【%s】", record.getCateAdminName(), user.getNickname());
|
||||||
|
record.setShowMessage(format);
|
||||||
|
}else{
|
||||||
|
record.setShowMessage(record.getCateAdminName());
|
||||||
|
}
|
||||||
|
if(AccountCateEnum.IM.getCode().equals(record.getCateId())
|
||||||
|
|| AccountCateEnum.SYSTEM.getCode().equals(record.getCateId())
|
||||||
|
|| AccountCateEnum.UNION.getCode().equals(record.getCateId())){
|
||||||
|
if(record.getTarUserId() != null){
|
||||||
|
if(user != null){
|
||||||
|
record.setTarImg(user.getAvatar());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,13 +112,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
}
|
}
|
||||||
if(incomeCoin != 0){
|
if(incomeCoin != 0){
|
||||||
AccountChangeCodeEnum change = ConsumeLogType.getSourceChange(consumeLogType, AccountTypeEnum.INCOME_COIN);
|
AccountChangeCodeEnum change = ConsumeLogType.getSourceChange(consumeLogType, AccountTypeEnum.INCOME_COIN);
|
||||||
accountChangeLogService.saveLogNoAdmin(userId, consumeLog.getSourceUsercode(), change, coin, consumeLog.getTraceId()
|
accountChangeLogService.saveLogNoAdmin(userId, consumeLog.getSourceUsercode(), change, incomeCoin, consumeLog.getTraceId()
|
||||||
,consumeLog.getTargetUserId(),gift);
|
,consumeLog.getTargetUserId(),gift);
|
||||||
}
|
}
|
||||||
// 记录接收方的流水
|
// 记录接收方的流水
|
||||||
if(targetUserId != null){
|
if(targetUserId != null){
|
||||||
AccountChangeCodeEnum change = ConsumeLogType.getTargetChange(consumeLogType);
|
AccountChangeCodeEnum change = ConsumeLogType.getTargetChange(consumeLogType);
|
||||||
accountChangeLogService.saveLogNoAdmin(userId, consumeLog.getSourceUsercode(), change, coin, consumeLog.getTraceId()
|
accountChangeLogService.saveLogNoAdmin(userId, consumeLog.getSourceUsercode(), change, consumeLog.getAnchorAmount(), consumeLog.getTraceId()
|
||||||
,consumeLog.getSourceUserId(),gift);
|
,consumeLog.getSourceUserId(),gift);
|
||||||
}
|
}
|
||||||
// 获取分销的比例和用户
|
// 获取分销的比例和用户
|
||||||
|
|||||||
Reference in New Issue
Block a user