feat:退款退库存

This commit is contained in:
dzc committed 2025-01-14 09:33:09 +08:00
1 parent 1327fac21e
commit 7d038b41ef
13 files changed
+140 -94

No files matched your search

@@ -109,7 +109,7 @@ public class MchManageController {
@GetMapping("/page-join")
@PreAuthorize("@pms.hasPermission('wallet_mchManage_view')")
public R getMchManagePageJoin(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
return R.ok(mchManageService.pageJoin(page, dto));
return R.ok(mchManageService.scopePageList(page, dto));
}
@Operation(summary = "分页不要权限下拉", description = "分页不要权限下拉")
@@ -19,6 +19,8 @@ public interface MchManageService extends IService<MchManageEntity> {
Page<MchManageVo> pageJoin(Page page, MchManageDto dto);
Page<MchManageVo> scopePageList(Page page, MchManageDto dto);
MchManageVo join(Long id);
List<MchManageVo> list(MchManageDto dto);
@@ -1,6 +1,7 @@
package com.bsd.pjcloud.wallet.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -22,6 +23,7 @@ import com.bsd.pjcloud.wallet.mapper.MchManageMapper;
import com.bsd.pjcloud.wallet.service.MchManageService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.StringRedisTemplate;
@@ -92,15 +94,15 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
}
@Override
@CachePut(value = CacheConstants.WALLET_MCH, key = "dto.getId()", condition = "dto.getId() != null", unless = "#result == null ")
@CacheEvict(value = CacheConstants.WALLET_MCH, key = "#dto.getId()", condition = "#dto.getId() != null")
public void edit(MchManageEntity dto) {
if (existName(dto.getName(), null)) {
if (existName(dto.getName(), dto.getId())) {
throw new CheckedException("商户名不能重复");
}
if (existDeptId(dto.getDeptId(), null)) {
if (existDeptId(dto.getDeptId(), dto.getId())) {
throw new CheckedException("改部门已经绑定过商户");
}
MchManageEntity mchManage = getById(dto.getId());
MchManageEntity mchManage = getSelf().getById(dto.getId());
if (ObjectUtil.isEmpty(mchManage)) {
throw new CheckedException("商户不存在");
}
@@ -117,13 +119,31 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
@Override
public Page<MchManageVo> pageJoin(Page page, MchManageDto dto) {
Page<MchManageVo> list = baseMapper.pageJoin(page, dto);
if (ObjectUtil.isNotEmpty(list.getRecords())) {
// 部门
List<Long> deptIds = list.getRecords().stream().map(MchManageVo::getDeptId).distinct().toList();
if (ObjectUtil.isNotEmpty(deptIds)) {
R<Map<Long, SysDept>> deptList = remoteDeptService.getDeptByDeptIds(deptIds);
if (ObjectUtil.isNotEmpty(deptList.getData())) {
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
}
}
}
return list;
}
@Override
public Page<MchManageVo> scopePageList(Page page, MchManageDto dto) {
Page<MchManageVo> list = baseMapper.scopePageList(page, dto);
if (ObjectUtil.isNotEmpty(list.getRecords())) {
// 部门
List<Long> deptIds = list.getRecords().stream().map(MchManageVo::getDeptId).distinct().toList();
R<Map<Long, SysDept>> deptList = remoteDeptService.getDeptByDeptIds(deptIds);
if (ObjectUtil.isNotEmpty(deptList.getData())) {
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
if (ObjectUtil.isNotEmpty(deptIds)) {
R<Map<Long, SysDept>> deptList = remoteDeptService.getDeptByDeptIds(deptIds);
if (ObjectUtil.isNotEmpty(deptList.getData())) {
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
}
}
}
return list;
@@ -190,4 +210,8 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
}
return count > 0;
}
private MchManageServiceImpl getSelf() {
return SpringUtil.getBean(getClass());
}
}
@@ -38,7 +38,7 @@
<sql id="whereA">
a.del_flag = 0
<if test="dto.userIds">
<if test="dto.userIds != null and dto.userIds.size() != 0">
and a.user_id in
<foreach collection="dto.userIds" item="v" open="(" close=")" separator=",">
#{v}