1.0.57 添加客户付款账户信息维护
parent
0cb7136d46
commit
76e99e99de
@ -0,0 +1,116 @@
|
||||
package org.dromara.oa.crm.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.oa.crm.domain.vo.CrmPaymentAccountVo;
|
||||
import org.dromara.oa.crm.domain.bo.CrmPaymentAccountBo;
|
||||
import org.dromara.oa.crm.service.ICrmPaymentAccountService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 付款账户信息
|
||||
* 前端访问路由地址为:/oa/crm/paymentAccount
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2026-01-26
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/crm/paymentAccount")
|
||||
public class CrmPaymentAccountController extends BaseController {
|
||||
|
||||
private final ICrmPaymentAccountService crmPaymentAccountService;
|
||||
|
||||
/**
|
||||
* 查询付款账户信息列表
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:paymentAccount:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CrmPaymentAccountVo> list(CrmPaymentAccountBo bo, PageQuery pageQuery) {
|
||||
return crmPaymentAccountService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出付款账户信息列表
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:paymentAccount:export")
|
||||
@Log(title = "付款账户信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(CrmPaymentAccountBo bo, HttpServletResponse response) {
|
||||
List<CrmPaymentAccountVo> list = crmPaymentAccountService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "付款账户信息", CrmPaymentAccountVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取付款账户信息详细信息
|
||||
*
|
||||
* @param paymentAccountId 主键
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:paymentAccount:query")
|
||||
@GetMapping("/{paymentAccountId}")
|
||||
public R<CrmPaymentAccountVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("paymentAccountId") Long paymentAccountId) {
|
||||
return R.ok(crmPaymentAccountService.queryById(paymentAccountId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增付款账户信息
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:paymentAccount:add")
|
||||
@Log(title = "付款账户信息", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody CrmPaymentAccountBo bo) {
|
||||
return toAjax(crmPaymentAccountService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改付款账户信息
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:paymentAccount:edit")
|
||||
@Log(title = "付款账户信息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody CrmPaymentAccountBo bo) {
|
||||
return toAjax(crmPaymentAccountService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除付款账户信息
|
||||
*
|
||||
* @param paymentAccountIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("oa/crm:paymentAccount:remove")
|
||||
@Log(title = "付款账户信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{paymentAccountIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("paymentAccountIds") Long[] paymentAccountIds) {
|
||||
return toAjax(crmPaymentAccountService.deleteWithValidByIds(List.of(paymentAccountIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉框查询付款账户信息列表
|
||||
*/
|
||||
@GetMapping("/getCrmPaymentAccountList")
|
||||
public R<List<CrmPaymentAccountVo>> getCrmPaymentAccountList(CrmPaymentAccountBo bo) {
|
||||
List<CrmPaymentAccountVo> list = crmPaymentAccountService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package org.dromara.oa.crm.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.oa.crm.domain.CrmPaymentAccount;
|
||||
import org.dromara.oa.crm.domain.vo.CrmPaymentAccountVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 付款账户信息Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2026-01-26
|
||||
*/
|
||||
public interface CrmPaymentAccountMapper extends BaseMapperPlus<CrmPaymentAccount, CrmPaymentAccountVo> {
|
||||
|
||||
/**
|
||||
* 查询付款账户信息列表
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 条件
|
||||
* @return 付款账户信息集合
|
||||
*/
|
||||
public Page<CrmPaymentAccountVo> selectCustomCrmPaymentAccountVoList(@Param("page") Page<CrmPaymentAccountVo> page, @Param(Constants.WRAPPER) MPJLambdaWrapper<CrmPaymentAccount> queryWrapper);
|
||||
|
||||
/**
|
||||
* 查询付款账户信息列表
|
||||
*
|
||||
* @param queryWrapper 条件
|
||||
* @return 付款账户信息集合
|
||||
*/
|
||||
public List<CrmPaymentAccountVo> selectCustomCrmPaymentAccountVoList(@Param(Constants.WRAPPER) MPJLambdaWrapper<CrmPaymentAccount> queryWrapper);
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package org.dromara.oa.crm.service;
|
||||
|
||||
import org.dromara.oa.crm.domain.CrmPaymentAccount;
|
||||
import org.dromara.oa.crm.domain.vo.CrmPaymentAccountVo;
|
||||
import org.dromara.oa.crm.domain.bo.CrmPaymentAccountBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 付款账户信息Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2026-01-26
|
||||
*/
|
||||
public interface ICrmPaymentAccountService {
|
||||
|
||||
/**
|
||||
* 查询付款账户信息
|
||||
*
|
||||
* @param paymentAccountId 主键
|
||||
* @return 付款账户信息
|
||||
*/
|
||||
CrmPaymentAccountVo queryById(Long paymentAccountId);
|
||||
|
||||
/**
|
||||
* 分页查询付款账户信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 付款账户信息分页列表
|
||||
*/
|
||||
TableDataInfo<CrmPaymentAccountVo> queryPageList(CrmPaymentAccountBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的付款账户信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 付款账户信息列表
|
||||
*/
|
||||
List<CrmPaymentAccountVo> queryList(CrmPaymentAccountBo bo);
|
||||
|
||||
/**
|
||||
* 新增付款账户信息
|
||||
*
|
||||
* @param bo 付款账户信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(CrmPaymentAccountBo bo);
|
||||
|
||||
/**
|
||||
* 修改付款账户信息
|
||||
*
|
||||
* @param bo 付款账户信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(CrmPaymentAccountBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除付款账户信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,140 @@
|
||||
package org.dromara.oa.crm.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.oa.crm.domain.bo.CrmPaymentAccountBo;
|
||||
import org.dromara.oa.crm.domain.vo.CrmPaymentAccountVo;
|
||||
import org.dromara.oa.crm.domain.CrmPaymentAccount;
|
||||
import org.dromara.oa.crm.mapper.CrmPaymentAccountMapper;
|
||||
import org.dromara.oa.crm.service.ICrmPaymentAccountService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 付款账户信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2026-01-26
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class CrmPaymentAccountServiceImpl implements ICrmPaymentAccountService {
|
||||
|
||||
private final CrmPaymentAccountMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询付款账户信息
|
||||
*
|
||||
* @param paymentAccountId 主键
|
||||
* @return 付款账户信息
|
||||
*/
|
||||
@Override
|
||||
public CrmPaymentAccountVo queryById(Long paymentAccountId) {
|
||||
return baseMapper.selectVoById(paymentAccountId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询付款账户信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 付款账户信息分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<CrmPaymentAccountVo> queryPageList(CrmPaymentAccountBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<CrmPaymentAccount> lqw = buildQueryWrapper(bo);
|
||||
Page<CrmPaymentAccountVo> result = baseMapper.selectCustomCrmPaymentAccountVoList(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的付款账户信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 付款账户信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<CrmPaymentAccountVo> queryList(CrmPaymentAccountBo bo) {
|
||||
MPJLambdaWrapper<CrmPaymentAccount> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectCustomCrmPaymentAccountVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<CrmPaymentAccount> buildQueryWrapper(CrmPaymentAccountBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<CrmPaymentAccount> lqw = JoinWrappers.lambda(CrmPaymentAccount.class)
|
||||
.selectAll(CrmPaymentAccount.class)
|
||||
.eq(CrmPaymentAccount::getDelFlag, "0")
|
||||
.eq(bo.getCustomerId() != null, CrmPaymentAccount::getCustomerId, bo.getCustomerId())
|
||||
.eq(StringUtils.isNotBlank(bo.getAccountType()), CrmPaymentAccount::getAccountType, bo.getAccountType())
|
||||
.like(StringUtils.isNotBlank(bo.getAccountName()), CrmPaymentAccount::getAccountName, bo.getAccountName())
|
||||
.eq(StringUtils.isNotBlank(bo.getAccountNumber()), CrmPaymentAccount::getAccountNumber, bo.getAccountNumber())
|
||||
.like(StringUtils.isNotBlank(bo.getBankName()), CrmPaymentAccount::getBankName, bo.getBankName())
|
||||
.eq(StringUtils.isNotBlank(bo.getBankCode()), CrmPaymentAccount::getBankCode, bo.getBankCode())
|
||||
.eq(StringUtils.isNotBlank(bo.getSwiftCode()), CrmPaymentAccount::getSwiftCode, bo.getSwiftCode())
|
||||
.eq(StringUtils.isNotBlank(bo.getCurrency()), CrmPaymentAccount::getCurrency, bo.getCurrency())
|
||||
.eq(bo.getSortOrder() != null, CrmPaymentAccount::getSortOrder, bo.getSortOrder())
|
||||
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), CrmPaymentAccount::getActiveFlag, bo.getActiveFlag());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增付款账户信息
|
||||
*
|
||||
* @param bo 付款账户信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(CrmPaymentAccountBo bo) {
|
||||
CrmPaymentAccount add = MapstructUtils.convert(bo, CrmPaymentAccount.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setPaymentAccountId(add.getPaymentAccountId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改付款账户信息
|
||||
*
|
||||
* @param bo 付款账户信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(CrmPaymentAccountBo bo) {
|
||||
CrmPaymentAccount update = MapstructUtils.convert(bo, CrmPaymentAccount.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(CrmPaymentAccount entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除付款账户信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.oa.crm.mapper.CrmPaymentAccountMapper">
|
||||
<resultMap type="org.dromara.oa.crm.domain.vo.CrmPaymentAccountVo" id="CrmPaymentAccountResult">
|
||||
</resultMap>
|
||||
|
||||
<select id="selectCustomCrmPaymentAccountVoList" resultMap="CrmPaymentAccountResult">
|
||||
select payment_account_id,
|
||||
customer_id,
|
||||
account_type,
|
||||
account_name,
|
||||
account_number,
|
||||
bank_name,
|
||||
bank_code,
|
||||
swift_code,
|
||||
currency,
|
||||
sort_order,
|
||||
remark,
|
||||
active_flag,
|
||||
del_flag,
|
||||
create_dept,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
from crm_payment_account t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue