master
parent
0c7cd31afb
commit
820f28fd17
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.njzscloud.dispose.finance.constant;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import com.njzscloud.common.core.ienum.DictStr;
|
||||||
|
/**
|
||||||
|
* 字典代码:money_change_category
|
||||||
|
* 字典名称:变动类型
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public enum MoneyChangeCategory implements DictStr {
|
||||||
|
ChongZhi("ChongZhi", "充值"),
|
||||||
|
|
||||||
|
YingShou("YingShou", "营收"),
|
||||||
|
|
||||||
|
TuiKuan("TuiKuan", "退款"),
|
||||||
|
|
||||||
|
TiaoZhang("TiaoZhang", "调账"),
|
||||||
|
|
||||||
|
ZhiFu("ZhiFu", "支付"),
|
||||||
|
|
||||||
|
;
|
||||||
|
private final String val;
|
||||||
|
|
||||||
|
private final String txt;
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,7 @@ import com.njzscloud.common.core.utils.R;
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
import com.njzscloud.dispose.finance.pojo.entity.MoneyAccountEntity;
|
import com.njzscloud.dispose.finance.pojo.entity.MoneyAccountEntity;
|
||||||
|
import com.njzscloud.dispose.finance.pojo.param.RechargeParam;
|
||||||
import com.njzscloud.dispose.finance.pojo.param.SearchMoneyAccountParam;
|
import com.njzscloud.dispose.finance.pojo.param.SearchMoneyAccountParam;
|
||||||
import com.njzscloud.dispose.finance.pojo.result.MoneyAccountResult;
|
import com.njzscloud.dispose.finance.pojo.result.MoneyAccountResult;
|
||||||
import com.njzscloud.dispose.finance.service.MoneyAccountService;
|
import com.njzscloud.dispose.finance.service.MoneyAccountService;
|
||||||
|
|
@ -35,11 +36,11 @@ public class MoneyAccountController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改
|
* 充值
|
||||||
*/
|
*/
|
||||||
@PostMapping("/modify")
|
@PostMapping("/modify")
|
||||||
public R<?> modify(@RequestBody MoneyAccountEntity moneyAccountEntity) {
|
public R<?> modify(@RequestBody RechargeParam param) {
|
||||||
moneyAccountService.modify(moneyAccountEntity);
|
moneyAccountService.modify(param);
|
||||||
return R.success();
|
return R.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,8 @@ public class ExpenseItemEntity extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 收费项目类型,QiTa-->其他、ChanPin-->产品、YunFei-->运费
|
* 收费项目类型,QiTa-->其他、ChanPin-->产品、YunFei-->运费
|
||||||
*/
|
*/
|
||||||
private String expenseItemCategory;
|
private ExpenseItemCategory expenseItemCategory;
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String expenseItemCategoryName;
|
|
||||||
/**
|
/**
|
||||||
* 付费项名称
|
* 付费项名称
|
||||||
*/
|
*/
|
||||||
|
|
@ -49,10 +47,7 @@ public class ExpenseItemEntity extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 计费策略;字典代码:expense_strategy
|
* 计费策略;字典代码:expense_strategy
|
||||||
*/
|
*/
|
||||||
private String expenseStrategy;
|
private ExpenseStrategy expenseStrategy;
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String expenseStrategyName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计量单位;字典代码:unit
|
* 计量单位;字典代码:unit
|
||||||
|
|
@ -67,10 +62,7 @@ public class ExpenseItemEntity extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 付费方;字典代码:payer
|
* 付费方;字典代码:payer
|
||||||
*/
|
*/
|
||||||
private String payer;
|
private Payer payer;
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String payerName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单价;单位:元,弹性模式-->每档价格
|
* 单价;单位:元,弹性模式-->每档价格
|
||||||
|
|
@ -122,44 +114,5 @@ public class ExpenseItemEntity extends BaseEntity {
|
||||||
|
|
||||||
private Long goodsId;
|
private Long goodsId;
|
||||||
|
|
||||||
public String getExpenseItemCategoryName() {
|
|
||||||
if (expenseItemCategory == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (ExpenseItemCategory type : ExpenseItemCategory.values()) {
|
|
||||||
if (type.getVal().equals(expenseItemCategory)) {
|
|
||||||
expenseItemCategoryName = type.getTxt();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return expenseItemCategoryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getExpenseStrategyName() {
|
|
||||||
if (expenseStrategy == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (ExpenseStrategy type : ExpenseStrategy.values()) {
|
|
||||||
if (type.getVal().equals(expenseStrategy)) {
|
|
||||||
expenseStrategyName = type.getTxt();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return expenseStrategyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPayerName() {
|
|
||||||
if (payer == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (Payer type : Payer.values()) {
|
|
||||||
if (type.getVal().equals(payer)) {
|
|
||||||
payerName = type.getTxt();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return payerName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,20 @@
|
||||||
package com.njzscloud.dispose.finance.pojo.entity;
|
package com.njzscloud.dispose.finance.pojo.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.njzscloud.dispose.common.pojo.entity.BaseEntity;
|
import com.njzscloud.common.mp.support.handler.j.JsonTypeHandler;
|
||||||
|
import com.njzscloud.dispose.finance.constant.MoneyChangeCategory;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资金流水
|
* 资金流水
|
||||||
|
*
|
||||||
* @author ljw
|
* @author ljw
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
|
|
@ -18,7 +22,13 @@ import java.math.BigDecimal;
|
||||||
@ToString
|
@ToString
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName(value = "fin_money_flow", autoResultMap = true)
|
@TableName(value = "fin_money_flow", autoResultMap = true)
|
||||||
public class MoneyFlowEntity extends BaseEntity {
|
public class MoneyFlowEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单 Id
|
* 订单 Id
|
||||||
|
|
@ -58,12 +68,48 @@ public class MoneyFlowEntity extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 变动类型;字典代码:money_change_category
|
* 变动类型;字典代码:money_change_category
|
||||||
*/
|
*/
|
||||||
private String moneyChangeCategory;
|
private MoneyChangeCategory moneyChangeCategory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
private String memo;
|
private String memo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件地址
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = JsonTypeHandler.class)
|
||||||
|
private List<String> fileUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人 Id;sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人 Id; sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Long modifierId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime modifyTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除; 0-->未删除、1-->已删除
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private Boolean deleted;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.njzscloud.dispose.finance.pojo.param;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资金账户表
|
||||||
|
*
|
||||||
|
* @author ljw
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class RechargeParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账户ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值金额
|
||||||
|
*/
|
||||||
|
private BigDecimal rechargeMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件地址
|
||||||
|
*/
|
||||||
|
private List<String> fileUrl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,42 +1,61 @@
|
||||||
package com.njzscloud.dispose.finance.service;
|
package com.njzscloud.dispose.finance.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.dispose.finance.mapper.BillMapper;
|
||||||
import com.njzscloud.dispose.finance.pojo.entity.BillEntity;
|
import com.njzscloud.dispose.finance.pojo.entity.BillEntity;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对账单
|
* 对账单
|
||||||
|
*
|
||||||
* @author ljw
|
* @author ljw
|
||||||
*/
|
*/
|
||||||
public interface BillService extends IService<BillEntity> {
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class BillService extends ServiceImpl<BillMapper, BillEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
void add(BillEntity billEntity);
|
public void add(BillEntity billEntity) {
|
||||||
|
this.save(billEntity);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改
|
* 修改
|
||||||
*/
|
*/
|
||||||
void modify(BillEntity billEntity);
|
public void modify(BillEntity billEntity) {
|
||||||
|
this.updateById(billEntity);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
void del(List<Long> ids);
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void del(List<Long> ids) {
|
||||||
|
this.removeBatchByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
*/
|
*/
|
||||||
BillEntity detail(Long id);
|
public BillEntity detail(Long id) {
|
||||||
|
return this.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*/
|
*/
|
||||||
PageResult<BillEntity> paging(PageParam pageParam, BillEntity billEntity);
|
public PageResult<BillEntity> paging(PageParam pageParam, BillEntity billEntity) {
|
||||||
|
return PageResult.of(this.page(pageParam.toPage(), Wrappers.query(billEntity)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,43 +1,64 @@
|
||||||
package com.njzscloud.dispose.finance.service;
|
package com.njzscloud.dispose.finance.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.dispose.finance.mapper.ExpenseItemMapper;
|
||||||
import com.njzscloud.dispose.finance.pojo.entity.ExpenseItemEntity;
|
import com.njzscloud.dispose.finance.pojo.entity.ExpenseItemEntity;
|
||||||
import com.njzscloud.dispose.finance.pojo.param.AddExpenseItemParam;
|
import com.njzscloud.dispose.finance.pojo.param.AddExpenseItemParam;
|
||||||
import com.njzscloud.dispose.finance.pojo.param.ModifyExpenseItemParam;
|
import com.njzscloud.dispose.finance.pojo.param.ModifyExpenseItemParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收费项目
|
* 收费项目
|
||||||
|
*
|
||||||
* @author ljw
|
* @author ljw
|
||||||
*/
|
*/
|
||||||
public interface ExpenseItemService extends IService<ExpenseItemEntity> {
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ExpenseItemService extends ServiceImpl<ExpenseItemMapper, ExpenseItemEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
void add(AddExpenseItemParam addExpenseItemParam);
|
public void add(AddExpenseItemParam addExpenseItemParam) {
|
||||||
|
this.save(BeanUtil.copyProperties(addExpenseItemParam, ExpenseItemEntity.class));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改
|
* 修改
|
||||||
*/
|
*/
|
||||||
void modify(ModifyExpenseItemParam modifyExpenseItemParam);
|
public void modify(ModifyExpenseItemParam modifyExpenseItemParam) {
|
||||||
|
this.updateById(BeanUtil.copyProperties(modifyExpenseItemParam, ExpenseItemEntity.class));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
void del(List<Long> ids);
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void del(List<Long> ids) {
|
||||||
|
this.removeBatchByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
*/
|
*/
|
||||||
ExpenseItemEntity detail(Long id);
|
public ExpenseItemEntity detail(Long id) {
|
||||||
|
return this.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*/
|
*/
|
||||||
PageResult<ExpenseItemEntity> paging(PageParam pageParam, ExpenseItemEntity expenseItemEntity);
|
public PageResult<ExpenseItemEntity> paging(PageParam pageParam, ExpenseItemEntity expenseItemEntity) {
|
||||||
|
return PageResult.of(this.page(pageParam.toPage(), Wrappers.query(expenseItemEntity)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,23 @@
|
||||||
package com.njzscloud.dispose.finance.service;
|
package com.njzscloud.dispose.finance.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njzscloud.common.core.ex.Exceptions;
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.common.sn.support.SnUtil;
|
||||||
|
import com.njzscloud.dispose.finance.constant.MoneyChangeCategory;
|
||||||
|
import com.njzscloud.dispose.finance.mapper.MoneyAccountMapper;
|
||||||
import com.njzscloud.dispose.finance.pojo.entity.MoneyAccountEntity;
|
import com.njzscloud.dispose.finance.pojo.entity.MoneyAccountEntity;
|
||||||
|
import com.njzscloud.dispose.finance.pojo.entity.MoneyFlowEntity;
|
||||||
|
import com.njzscloud.dispose.finance.pojo.param.RechargeParam;
|
||||||
import com.njzscloud.dispose.finance.pojo.param.SearchMoneyAccountParam;
|
import com.njzscloud.dispose.finance.pojo.param.SearchMoneyAccountParam;
|
||||||
import com.njzscloud.dispose.finance.pojo.result.MoneyAccountResult;
|
import com.njzscloud.dispose.finance.pojo.result.MoneyAccountResult;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -14,31 +26,96 @@ import java.util.List;
|
||||||
*
|
*
|
||||||
* @author ljw
|
* @author ljw
|
||||||
*/
|
*/
|
||||||
public interface MoneyAccountService extends IService<MoneyAccountEntity> {
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MoneyAccountService extends ServiceImpl<MoneyAccountMapper, MoneyAccountEntity> {
|
||||||
|
|
||||||
|
private final MoneyFlowService moneyFlowService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
void add(MoneyAccountEntity moneyAccountEntity);
|
public void add(MoneyAccountEntity moneyAccountEntity) {
|
||||||
|
moneyAccountEntity.setSn(this.generateSn());
|
||||||
|
this.save(moneyAccountEntity);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改
|
* 修改
|
||||||
*/
|
*/
|
||||||
void modify(MoneyAccountEntity moneyAccountEntity);
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void modify(RechargeParam param) {
|
||||||
|
if (param.getRechargeMoney() == null || param.getRechargeMoney().signum() <= 0) {
|
||||||
|
throw Exceptions.clierr("充值金额需大于0");
|
||||||
|
}
|
||||||
|
MoneyAccountEntity accountEntity = this.getById(param.getId());
|
||||||
|
if (accountEntity == null) {
|
||||||
|
throw Exceptions.clierr("未找到该账户");
|
||||||
|
}
|
||||||
|
// 记录资金流水
|
||||||
|
MoneyFlowEntity flowEntity = new MoneyFlowEntity()
|
||||||
|
.setMoneyAccountId(accountEntity.getId())
|
||||||
|
.setBeforeBalance(accountEntity.getRecharge())
|
||||||
|
// 充值
|
||||||
|
.setDelta(param.getRechargeMoney())
|
||||||
|
.setMoneyChangeCategory(MoneyChangeCategory.ChongZhi)
|
||||||
|
.setFileUrl(param.getFileUrl())
|
||||||
|
.setMemo("账户充值");
|
||||||
|
|
||||||
|
accountEntity.setRecharge(accountEntity.getRecharge().add(param.getRechargeMoney()));
|
||||||
|
|
||||||
|
flowEntity.setAfterBalance(accountEntity.getRecharge());
|
||||||
|
this.updateById(accountEntity);
|
||||||
|
|
||||||
|
moneyFlowService.save(flowEntity);
|
||||||
|
|
||||||
|
log.info("公司账户充值成功,充值金额:{},充值前余额:{} -> 充值前余额:{}",
|
||||||
|
param.getRechargeMoney(), flowEntity.getBeforeBalance(), flowEntity.getAfterBalance());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
void del(List<Long> ids);
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void del(List<Long> ids) {
|
||||||
|
this.removeBatchByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
*/
|
*/
|
||||||
MoneyAccountResult detail(Long id);
|
public MoneyAccountResult detail(Long id) {
|
||||||
|
return baseMapper.detail(id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*/
|
*/
|
||||||
PageResult<MoneyAccountResult> paging(PageParam pageParam, SearchMoneyAccountParam param);
|
public PageResult<MoneyAccountResult> paging(PageParam pageParam, SearchMoneyAccountParam param) {
|
||||||
|
return PageResult.of(baseMapper.paging(pageParam.toPage(), Wrappers.query()
|
||||||
|
.eq("fma.deleted", 0)
|
||||||
|
.like(StrUtil.isNotBlank(param.getSn()), "fma.sn", param.getSn())
|
||||||
|
.and(StrUtil.isNotBlank(param.getAccountName()), wrapper ->
|
||||||
|
wrapper.like("cc.customer_name", param.getAccountName())
|
||||||
|
.or()
|
||||||
|
.like("co.org_name", param.getAccountName())
|
||||||
|
)
|
||||||
|
.eq(param.getAccountType() != null, "fma.account_type", param.getAccountType())
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成账户编号
|
||||||
|
*
|
||||||
|
* @return sn 账户编号
|
||||||
|
*/
|
||||||
|
public String generateSn() {
|
||||||
|
String sn = SnUtil.next("Account-SN");
|
||||||
|
if (this.exists(Wrappers.<MoneyAccountEntity>lambdaQuery().eq(MoneyAccountEntity::getSn, sn)
|
||||||
|
.eq(MoneyAccountEntity::getDeleted, Boolean.FALSE))) {
|
||||||
|
this.generateSn();
|
||||||
|
}
|
||||||
|
return sn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,61 @@
|
||||||
package com.njzscloud.dispose.finance.service;
|
package com.njzscloud.dispose.finance.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.dispose.finance.mapper.MoneyFlowMapper;
|
||||||
import com.njzscloud.dispose.finance.pojo.entity.MoneyFlowEntity;
|
import com.njzscloud.dispose.finance.pojo.entity.MoneyFlowEntity;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资金流水
|
* 资金流水
|
||||||
|
*
|
||||||
* @author ljw
|
* @author ljw
|
||||||
*/
|
*/
|
||||||
public interface MoneyFlowService extends IService<MoneyFlowEntity> {
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MoneyFlowService extends ServiceImpl<MoneyFlowMapper, MoneyFlowEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
void add(MoneyFlowEntity moneyFlowEntity);
|
public void add(MoneyFlowEntity moneyFlowEntity) {
|
||||||
|
this.save(moneyFlowEntity);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改
|
* 修改
|
||||||
*/
|
*/
|
||||||
void modify(MoneyFlowEntity moneyFlowEntity);
|
public void modify(MoneyFlowEntity moneyFlowEntity) {
|
||||||
|
this.updateById(moneyFlowEntity);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
void del(List<Long> ids);
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void del(List<Long> ids) {
|
||||||
|
this.removeBatchByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
*/
|
*/
|
||||||
MoneyFlowEntity detail(Long id);
|
public MoneyFlowEntity detail(Long id) {
|
||||||
|
return this.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*/
|
*/
|
||||||
PageResult<MoneyFlowEntity> paging(PageParam pageParam, MoneyFlowEntity moneyFlowEntity);
|
public PageResult<MoneyFlowEntity> paging(PageParam pageParam, MoneyFlowEntity moneyFlowEntity) {
|
||||||
|
return PageResult.of(this.page(pageParam.toPage(), Wrappers.query(moneyFlowEntity)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
package com.njzscloud.dispose.finance.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
|
||||||
import com.njzscloud.dispose.finance.mapper.BillMapper;
|
|
||||||
import com.njzscloud.dispose.finance.pojo.entity.BillEntity;
|
|
||||||
import com.njzscloud.dispose.finance.service.BillService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 对账单
|
|
||||||
*
|
|
||||||
* @author ljw
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class BillServiceImpl extends ServiceImpl<BillMapper, BillEntity> implements BillService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void add(BillEntity billEntity) {
|
|
||||||
this.save(billEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void modify(BillEntity billEntity) {
|
|
||||||
this.updateById(billEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void del(List<Long> ids) {
|
|
||||||
this.removeBatchByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 详情
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public BillEntity detail(Long id) {
|
|
||||||
return this.getById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public PageResult<BillEntity> paging(PageParam pageParam, BillEntity billEntity) {
|
|
||||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.query(billEntity)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
package com.njzscloud.dispose.finance.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
|
||||||
import com.njzscloud.dispose.finance.mapper.ExpenseItemMapper;
|
|
||||||
import com.njzscloud.dispose.finance.pojo.entity.ExpenseItemEntity;
|
|
||||||
import com.njzscloud.dispose.finance.pojo.param.AddExpenseItemParam;
|
|
||||||
import com.njzscloud.dispose.finance.pojo.param.ModifyExpenseItemParam;
|
|
||||||
import com.njzscloud.dispose.finance.service.ExpenseItemService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 收费项目
|
|
||||||
*
|
|
||||||
* @author ljw
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class ExpenseItemServiceImpl extends ServiceImpl<ExpenseItemMapper, ExpenseItemEntity> implements ExpenseItemService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void add(AddExpenseItemParam addExpenseItemParam) {
|
|
||||||
this.save(BeanUtil.copyProperties(addExpenseItemParam, ExpenseItemEntity.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void modify(ModifyExpenseItemParam modifyExpenseItemParam) {
|
|
||||||
this.updateById(BeanUtil.copyProperties(modifyExpenseItemParam, ExpenseItemEntity.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void del(List<Long> ids) {
|
|
||||||
this.removeBatchByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 详情
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ExpenseItemEntity detail(Long id) {
|
|
||||||
return this.getById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public PageResult<ExpenseItemEntity> paging(PageParam pageParam, ExpenseItemEntity expenseItemEntity) {
|
|
||||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.query(expenseItemEntity)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
package com.njzscloud.dispose.finance.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
|
||||||
import com.njzscloud.common.sn.support.SnUtil;
|
|
||||||
import com.njzscloud.dispose.finance.mapper.MoneyAccountMapper;
|
|
||||||
import com.njzscloud.dispose.finance.pojo.entity.MoneyAccountEntity;
|
|
||||||
import com.njzscloud.dispose.finance.pojo.param.SearchMoneyAccountParam;
|
|
||||||
import com.njzscloud.dispose.finance.pojo.result.MoneyAccountResult;
|
|
||||||
import com.njzscloud.dispose.finance.service.MoneyAccountService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 资金账户表
|
|
||||||
*
|
|
||||||
* @author ljw
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class MoneyAccountServiceImpl extends ServiceImpl<MoneyAccountMapper, MoneyAccountEntity> implements MoneyAccountService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void add(MoneyAccountEntity moneyAccountEntity) {
|
|
||||||
moneyAccountEntity.setSn(this.generateSn());
|
|
||||||
this.save(moneyAccountEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void modify(MoneyAccountEntity moneyAccountEntity) {
|
|
||||||
this.updateById(moneyAccountEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void del(List<Long> ids) {
|
|
||||||
this.removeBatchByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 详情
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MoneyAccountResult detail(Long id) {
|
|
||||||
return baseMapper.detail(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public PageResult<MoneyAccountResult> paging(PageParam pageParam, SearchMoneyAccountParam param) {
|
|
||||||
return PageResult.of(baseMapper.paging(pageParam.toPage(), Wrappers.query()
|
|
||||||
.eq("fma.deleted", 0)
|
|
||||||
.like(StrUtil.isNotBlank(param.getSn()), "fma.sn", param.getSn())
|
|
||||||
.and(StrUtil.isNotBlank(param.getAccountName()), wrapper ->
|
|
||||||
wrapper.like("cc.customer_name", param.getAccountName())
|
|
||||||
.or()
|
|
||||||
.like("co.org_name", param.getAccountName())
|
|
||||||
)
|
|
||||||
.eq(param.getAccountType() != null, "fma.account_type", param.getAccountType())
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成账户编号
|
|
||||||
*
|
|
||||||
* @return sn 账户编号
|
|
||||||
*/
|
|
||||||
public String generateSn() {
|
|
||||||
String sn = SnUtil.next("Account-SN");
|
|
||||||
if (this.exists(Wrappers.<MoneyAccountEntity>lambdaQuery().eq(MoneyAccountEntity::getSn, sn)
|
|
||||||
.eq(MoneyAccountEntity::getDeleted, Boolean.FALSE))) {
|
|
||||||
this.generateSn();
|
|
||||||
}
|
|
||||||
return sn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
package com.njzscloud.dispose.finance.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
|
||||||
import com.njzscloud.dispose.finance.mapper.MoneyFlowMapper;
|
|
||||||
import com.njzscloud.dispose.finance.pojo.entity.MoneyFlowEntity;
|
|
||||||
import com.njzscloud.dispose.finance.service.MoneyFlowService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 资金流水
|
|
||||||
*
|
|
||||||
* @author ljw
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class MoneyFlowServiceImpl extends ServiceImpl<MoneyFlowMapper, MoneyFlowEntity> implements MoneyFlowService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void add(MoneyFlowEntity moneyFlowEntity) {
|
|
||||||
this.save(moneyFlowEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void modify(MoneyFlowEntity moneyFlowEntity) {
|
|
||||||
this.updateById(moneyFlowEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void del(List<Long> ids) {
|
|
||||||
this.removeBatchByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 详情
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MoneyFlowEntity detail(Long id) {
|
|
||||||
return this.getById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public PageResult<MoneyFlowEntity> paging(PageParam pageParam, MoneyFlowEntity moneyFlowEntity) {
|
|
||||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.query(moneyFlowEntity)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue