Compare commits
2 Commits
25190d46bd
...
200bc1ee3a
| Author | SHA1 | Date |
|---|---|---|
|
|
200bc1ee3a | |
|
|
9d5da6f075 |
|
|
@ -30,6 +30,9 @@ public class DiscountManageEntity {
|
||||||
*/
|
*/
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 费用类型:goods 产品 service 服务费
|
* 费用类型:goods 产品 service 服务费
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,16 @@ package com.njzscloud.supervisory.discount.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
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.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.supervisory.biz.pojo.entity.BizCompanyEntity;
|
||||||
|
import com.njzscloud.supervisory.biz.service.BizCompanyService;
|
||||||
import com.njzscloud.supervisory.discount.mapper.DiscountManageMapper;
|
import com.njzscloud.supervisory.discount.mapper.DiscountManageMapper;
|
||||||
import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity;
|
import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity;
|
||||||
import com.njzscloud.supervisory.discount.service.DiscountManageService;
|
import com.njzscloud.supervisory.discount.service.DiscountManageService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
@ -18,8 +22,11 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class DiscountManageServiceImpl extends ServiceImpl<DiscountManageMapper, DiscountManageEntity> implements DiscountManageService {
|
public class DiscountManageServiceImpl extends ServiceImpl<DiscountManageMapper, DiscountManageEntity> implements DiscountManageService {
|
||||||
|
|
||||||
|
private final BizCompanyService bizCompanyService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
|
|
@ -49,7 +56,12 @@ public class DiscountManageServiceImpl extends ServiceImpl<DiscountManageMapper,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DiscountManageEntity detail(Long id) {
|
public DiscountManageEntity detail(Long id) {
|
||||||
return this.getById(id);
|
DiscountManageEntity entity = this.getById(id);
|
||||||
|
BizCompanyEntity companyEntity = bizCompanyService.getById(entity.getCompanyId());
|
||||||
|
if (null != companyEntity) {
|
||||||
|
entity.setCompanyName(companyEntity.getCompanyName());
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -57,13 +69,20 @@ public class DiscountManageServiceImpl extends ServiceImpl<DiscountManageMapper,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageResult<DiscountManageEntity> paging(PageParam pageParam, DiscountManageEntity discountManageEntity) {
|
public PageResult<DiscountManageEntity> paging(PageParam pageParam, DiscountManageEntity discountManageEntity) {
|
||||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<DiscountManageEntity>lambdaQuery()
|
Page<DiscountManageEntity> page = this.page(pageParam.toPage(), Wrappers.<DiscountManageEntity>lambdaQuery()
|
||||||
.eq(discountManageEntity.getCompanyId() != null, DiscountManageEntity::getCompanyId, discountManageEntity.getCompanyId())
|
.eq(discountManageEntity.getCompanyId() != null, DiscountManageEntity::getCompanyId, discountManageEntity.getCompanyId())
|
||||||
.eq(StrUtil.isNotBlank(discountManageEntity.getFeeType()), DiscountManageEntity::getFeeType, discountManageEntity.getFeeType())
|
.eq(StrUtil.isNotBlank(discountManageEntity.getFeeType()), DiscountManageEntity::getFeeType, discountManageEntity.getFeeType())
|
||||||
.eq(discountManageEntity.getExpenseId() != null, DiscountManageEntity::getExpenseId, discountManageEntity.getExpenseId())
|
.eq(discountManageEntity.getExpenseId() != null, DiscountManageEntity::getExpenseId, discountManageEntity.getExpenseId())
|
||||||
.eq(StrUtil.isNotBlank(discountManageEntity.getType()), DiscountManageEntity::getType, discountManageEntity.getType())
|
.eq(StrUtil.isNotBlank(discountManageEntity.getType()), DiscountManageEntity::getType, discountManageEntity.getType())
|
||||||
.eq(discountManageEntity.getDeleted() != null, DiscountManageEntity::getDeleted, Boolean.FALSE)
|
.eq(discountManageEntity.getDeleted() != null, DiscountManageEntity::getDeleted, Boolean.FALSE)
|
||||||
.orderByDesc(DiscountManageEntity::getCreateTime)));
|
.orderByDesc(DiscountManageEntity::getCreateTime));
|
||||||
|
for (DiscountManageEntity entity: page.getRecords()) {
|
||||||
|
BizCompanyEntity companyEntity = bizCompanyService.getById(entity.getCompanyId());
|
||||||
|
if (null != companyEntity) {
|
||||||
|
entity.setCompanyName(companyEntity.getCompanyName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PageResult.of(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import com.njzscloud.supervisory.order.pojo.param.*;
|
||||||
import com.njzscloud.supervisory.order.pojo.result.OrderCertificateResult;
|
import com.njzscloud.supervisory.order.pojo.result.OrderCertificateResult;
|
||||||
import com.njzscloud.supervisory.order.pojo.result.OrderPagingResult;
|
import com.njzscloud.supervisory.order.pojo.result.OrderPagingResult;
|
||||||
import com.njzscloud.supervisory.order.pojo.result.TrainBillResult;
|
import com.njzscloud.supervisory.order.pojo.result.TrainBillResult;
|
||||||
|
import com.njzscloud.supervisory.order.service.AccountRegulationService;
|
||||||
import com.njzscloud.supervisory.order.service.OrderInfoService;
|
import com.njzscloud.supervisory.order.service.OrderInfoService;
|
||||||
import com.njzscloud.supervisory.sys.log.annotation.Log;
|
import com.njzscloud.supervisory.sys.log.annotation.Log;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
@ -31,6 +32,8 @@ import java.util.List;
|
||||||
public class OrderInfoController {
|
public class OrderInfoController {
|
||||||
private final OrderInfoService orderInfoService;
|
private final OrderInfoService orderInfoService;
|
||||||
|
|
||||||
|
private final AccountRegulationService accountRegulationService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
|
|
@ -268,4 +271,14 @@ public class OrderInfoController {
|
||||||
return R.success();
|
return R.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调账
|
||||||
|
*/
|
||||||
|
@Log("业务调账")
|
||||||
|
@PostMapping("/account_regulation")
|
||||||
|
public R<?> accountRegulation(@RequestBody RegulationParam param) {
|
||||||
|
accountRegulationService.accountRegulation(param);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.njzscloud.supervisory.order.pojo.param;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调账入参
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class RegulationParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清运公司Id
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单sn
|
||||||
|
*/
|
||||||
|
private String sn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 变动金额
|
||||||
|
*/
|
||||||
|
private String delta;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String memo;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.njzscloud.supervisory.order.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.njzscloud.common.core.ex.Exceptions;
|
||||||
|
import com.njzscloud.supervisory.order.pojo.entity.OrderInfoEntity;
|
||||||
|
import com.njzscloud.supervisory.order.pojo.param.ChangePriceParam;
|
||||||
|
import com.njzscloud.supervisory.order.pojo.param.RegulationParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调账
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AccountRegulationService {
|
||||||
|
|
||||||
|
private final OrderInfoService orderInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务调账
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void accountRegulation(RegulationParam param) {
|
||||||
|
OrderInfoEntity order = orderInfoService.getOne(Wrappers.<OrderInfoEntity>lambdaQuery().eq(OrderInfoEntity::getSn, param.getSn()));
|
||||||
|
Assert.notNull(order, () -> Exceptions.clierr("订单不存在"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue