11-14-更改银行相关

This commit is contained in:
2025-11-14 19:24:17 +08:00
parent 4bb24fe464
commit 1eaf29b282
13 changed files with 172 additions and 32 deletions

View File

@ -65,10 +65,10 @@ public class XzdBxBxsq extends BaseEntity {
*/
private Long xm;
/**
* 开户银行
*/
private String khyh;
// /**
// * 开户银行
// */
// private Long khyh;
/**
* 开户银行账号

View File

@ -6,6 +6,7 @@ import lombok.EqualsAndHashCode;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.xzd.bx.bxsq.domain.XzdBxBxsq;
import org.dromara.xzd.bx.bxsq.fymx.domain.XzdBxBxsqFymx;
import org.dromara.xzd.domain.XzdSupplierOpenBank;
import java.math.BigDecimal;
import java.time.LocalDate;
@ -60,7 +61,7 @@ public class XzdBxBxsqBo extends BaseEntity {
/**
* 开户银行
*/
private String khyh;
private List <XzdSupplierOpenBank> khyh;
/**
* 开户银行账号

View File

@ -6,6 +6,7 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.xzd.bx.bxsq.domain.XzdBxBxsq;
import org.dromara.xzd.bx.bxsq.fymx.domain.vo.XzdBxBxsqFymxVo;
import org.dromara.xzd.domain.XzdSupplierOpenBank;
import java.io.Serial;
import java.io.Serializable;
@ -99,7 +100,12 @@ public class XzdBxBxsqVo implements Serializable {
/**
* 开户银行
*/
private String khyh;
private List<XzdSupplierOpenBank> khyh;
/**
* 开户银行名称
*/
private String khyhmc;
/**
* 开户银行账号

View File

@ -30,7 +30,12 @@ import org.dromara.xzd.bx.bxsq.fymx.service.impl.XzdBxBxsqFymxServiceImpl;
import org.dromara.xzd.bx.bxsq.mapper.XzdBxBxsqMapper;
import org.dromara.xzd.bx.bxsq.service.IXzdBxBxsqService;
import org.dromara.xzd.domain.XzdProject;
import org.dromara.xzd.domain.XzdSupplierOpenBank;
import org.dromara.xzd.domain.XzdYhxx;
import org.dromara.xzd.domain.bo.XzdYhxxBo;
import org.dromara.xzd.service.impl.XzdProjectServiceImpl;
import org.dromara.xzd.service.impl.XzdSupplierOpenBankServiceImpl;
import org.dromara.xzd.service.impl.XzdYhxxServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
@ -64,6 +69,10 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
private XzdBxBxsqBxlxServiceImpl xzdBxBxsqBxlxService;
@Autowired
private SysUserServiceImpl sysUserService;
@Autowired
private XzdYhxxServiceImpl xzdYhxxService;
@Autowired
private XzdSupplierOpenBankServiceImpl xzdSupplierOpenBankService;
/**
@ -176,6 +185,19 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
xzdBxBxsqFymxService.saveBatch(bo.getFymx());
}
//开户银行
if(bo.getKhyh() != null && !bo.getKhyh().isEmpty()){
for (XzdSupplierOpenBank bank : bo.getKhyh()) {
XzdYhxxBo xzdYhxxBo = new XzdYhxxBo();
xzdYhxxBo.setYhId(bank.getId());
xzdYhxxBo.setMainId(add.getId());
xzdYhxxBo.setSfmr(bank.getIsDefault());
xzdYhxxBo.setAccount(bank.getAccount());
xzdYhxxBo.setType("3");
xzdYhxxService.insertByBo(xzdYhxxBo);
}
}
return flag;
}
@ -192,7 +214,7 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
validEntityBeforeSave(update);
XzdBxBxsqVo old = queryById(bo.getId());
//合同文本-预收款项
//费用明细
if (bo.getFymx() != null && !bo.getFymx().isEmpty()){
if (old.getFymx() != null && !old.getFymx().isEmpty()){
xzdBxBxsqFymxService.removeByIds(old.getFymx());
@ -206,6 +228,43 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
xzdBxBxsqFymxService.removeByIds(old.getFymx());
}
}
//开户银行
if(bo.getKhyh() != null && !bo.getKhyh().isEmpty()){
//先获取老数据银行关联表
LambdaQueryWrapper<XzdYhxx> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(XzdYhxx::getMainId, old.getId());
List<XzdYhxx> oldList = xzdYhxxService.list(queryWrapper);
if (oldList != null && !oldList.isEmpty()){
//先删除老的
xzdYhxxService.removeByIds(oldList);
}
//保存此次的
for (XzdSupplierOpenBank bank : bo.getKhyh()) {
XzdYhxxBo xzdYhxxBo = new XzdYhxxBo();
xzdYhxxBo.setYhId(bank.getId());
xzdYhxxBo.setMainId(update.getId());
xzdYhxxBo.setSfmr(bank.getIsDefault());
xzdYhxxBo.setAccount(bank.getAccount());
xzdYhxxBo.setType("3");
xzdYhxxService.insertByBo(xzdYhxxBo);
}
}else {
//先获取老数据银行关联表
LambdaQueryWrapper<XzdYhxx> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(XzdYhxx::getMainId, old.getId());
List<XzdYhxx> oldList = xzdYhxxService.list(queryWrapper);
//如果不为空则删除
if (oldList != null && !oldList.isEmpty()){
xzdYhxxService.remove(queryWrapper);
}
}
return baseMapper.updateById(update) > 0;
}
@ -233,11 +292,48 @@ public class XzdBxBxsqServiceImpl extends ServiceImpl<XzdBxBxsqMapper, XzdBxBxsq
lqw.in(XzdBxBxsqFymx::getBxId, ids);
xzdBxBxsqFymxService.remove(lqw);
//删除银行中间表
LambdaQueryWrapper<XzdYhxx> lqw2 = new LambdaQueryWrapper<>();
lqw2.in(XzdYhxx::getMainId, ids);
xzdYhxxService.remove(lqw2);
return baseMapper.deleteByIds(ids) > 0;
}
public void setValue(List<XzdBxBxsqVo> vos){
for (XzdBxBxsqVo vo : vos) {
//开户银行
LambdaQueryWrapper<XzdYhxx> lqw3 = new LambdaQueryWrapper<>();
lqw3.eq(XzdYhxx::getMainId, vo.getId());
lqw3.eq(XzdYhxx::getSfmr,"1");
XzdYhxx one = xzdYhxxService.getOne(lqw3);
if (one != null){
XzdSupplierOpenBank byId = xzdSupplierOpenBankService.getById(one.getYhId());
if (byId != null){
vo.setKhyhmc(byId.getOpenBank());
vo.setKhyhzh(byId.getAccount());
vo.setKhhhm(byId.getPersonName());
}
}
lqw3.clear();
lqw3.eq(XzdYhxx::getMainId,vo.getId());
List<XzdYhxx> xzdYhxxList = xzdYhxxService.list(lqw3);
if (xzdYhxxList!= null && !xzdYhxxList.isEmpty()) {
List<XzdSupplierOpenBank> openBanks = new ArrayList<>();
for (XzdYhxx yhxx : xzdYhxxList) {
XzdSupplierOpenBank byId = xzdSupplierOpenBankService.getById(yhxx.getYhId());
if (byId != null){
byId.setAccount(yhxx.getAccount());
byId.setIsDefault(yhxx.getSfmr());
byId.setPersonName(yhxx.getKhhm());
openBanks.add(byId);
}
}
vo.setKhyh(openBanks);
}
//费用明细
LambdaQueryWrapper<XzdBxBxsqFymx> lqw = new LambdaQueryWrapper<>();
lqw.eq(XzdBxBxsqFymx::getBxId, vo.getId());

View File

@ -6,6 +6,7 @@ import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
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.excel.utils.ExcelUtil;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
@ -76,7 +77,7 @@ public class XzdSupplierOpenBankController extends BaseController {
@Log(title = "供应商信息-开户银行", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<XzdSupplierOpenBank> add(XzdSupplierOpenBankBo bo) {
public R<XzdSupplierOpenBank> add(@Validated(AddGroup.class) @RequestBody XzdSupplierOpenBankBo bo) {
return xzdSupplierOpenBankService.insertByBo(bo);
}

View File

@ -43,10 +43,19 @@ public class XzdYhxx extends BaseEntity {
*/
private String account;
/**
* 开户户名
*/
private String khhm;
/**
* 是否默认0否1是
*/
private String sfmr;
/**
* 类型1供应商2客户3报销
*/
private String type;
}

View File

@ -39,7 +39,7 @@ public class XzdSupplierOpenBankBo extends BaseEntity {
/**
* 开户账号
*/
@NotBlank(message = "开户账号不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "开户账号不能为空", groups = { AddGroup.class, EditGroup.class })
private String account;
/**
@ -70,7 +70,7 @@ public class XzdSupplierOpenBankBo extends BaseEntity {
/**
* 1是2否
*/
@NotBlank(message = "1是2否不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "1是2否不能为空", groups = { AddGroup.class, EditGroup.class })
private String isDefault;

View File

@ -37,10 +37,19 @@ public class XzdYhxxBo extends BaseEntity {
*/
private String account;
/**
* 开户户名
*/
private String khhm;
/**
* 是否默认0否1是
*/
private String sfmr;
/**
* 类型1供应商2客户3报销
*/
private String type;
}

View File

@ -48,11 +48,20 @@ public class XzdYhxxVo implements Serializable {
*/
private String account;
/**
* 开户户名
*/
private String khhm;
/**
* 是否默认0否1是
*/
@ExcelProperty(value = "是否默认0否1是")
private String sfmr;
/**
* 类型1供应商2客户3报销
*/
private String type;
}

View File

@ -83,9 +83,14 @@ public class XzdContractChangeServiceImpl extends ServiceImpl<XzdContractChangeM
@Override
public XzdContractChangeVo queryById(Long id){
XzdContractChangeVo changeVo = baseMapper.selectVoById(id);
List<XzdContractChangeVo> changeVo1 = List.of(changeVo);
setValue(changeVo1);
return changeVo1.getFirst();
List<XzdContractChangeVo> changeVo1;
if (changeVo != null) {
changeVo1 = List.of(changeVo);
setValue(changeVo1);
return changeVo1.getFirst();
}else {
return null;
}
}
/**

View File

@ -124,8 +124,9 @@ public class XzdContractDetailsServiceImpl extends ServiceImpl<XzdContractDetail
private LambdaQueryWrapper<XzdContractDetails> buildQueryWrapper(XzdContractDetailsBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<XzdContractDetails> lqw = Wrappers.lambdaQuery();
lqw.orderByDesc(XzdContractDetails::getId);
lqw.orderByDesc(XzdContractDetails::getCreateTime);
lqw.eq(StringUtils.isNotBlank(bo.getHtzt()), XzdContractDetails::getHtzt, bo.getHtzt());
lqw.eq(bo.getId() != null, XzdContractDetails::getId, bo.getId());
lqw.eq(StringUtils.isNotBlank(bo.getContractType()), XzdContractDetails::getContractType, bo.getContractType());
lqw.eq(StringUtils.isNotBlank(bo.getContractCode()), XzdContractDetails::getContractCode, bo.getContractCode());
lqw.like(StringUtils.isNotBlank(bo.getContractName()), XzdContractDetails::getContractName, bo.getContractName());

View File

@ -290,6 +290,8 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
xzdYhxxBo.setMainId(add.getId());
xzdYhxxBo.setSfmr(bank.getIsDefault());
xzdYhxxBo.setAccount(bank.getAccount());
xzdYhxxBo.setKhhm(bank.getPersonName());
xzdYhxxBo.setType("1");
xzdYhxxService.insertByBo(xzdYhxxBo);
}
}
@ -361,12 +363,11 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
* @return 是否修改成功
*/
@Override
// @Transactional
@Transactional
public Boolean updateByBo(XzdSupplierInfoBo bo) {
XzdSupplierInfo update = MapstructUtils.convert(bo, XzdSupplierInfo.class);
XzdSupplierInfoVo old = baseMapper.selectVoById(update.getId());
// setValue(Collections.singletonList(old));
XzdSupplierInfoVo old = this.queryById(update.getId());
validEntityBeforeSave(update);
boolean b = baseMapper.updateById(update) > 0;
@ -491,6 +492,9 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
xzdYhxxBo.setYhId(bank.getId());
xzdYhxxBo.setMainId(update.getId());
xzdYhxxBo.setSfmr(bank.getIsDefault());
xzdYhxxBo.setAccount(bank.getAccount());
xzdYhxxBo.setKhhm(bank.getPersonName());
xzdYhxxBo.setType("1");
xzdYhxxService.insertByBo(xzdYhxxBo);
}
}else {
@ -564,10 +568,10 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
//供应商评价
if (bo.getEvaluations() != null && !bo.getEvaluations().isEmpty()){
if (old.getEvaluations() != null && !old.getEvaluations().isEmpty()){
LambdaQueryWrapper<XzdSupplierEvaluation> xzdCustomertypeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdSupplierEvaluation::getSupplierId, update.getId());
xzdSupplierEvaluationService.remove(xzdCustomertypeInfoLambdaQueryWrapper);
// xzdSupplierEvaluationService.removeByIds(old.getEvaluations());
// LambdaQueryWrapper<XzdSupplierEvaluation> xzdCustomertypeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
// xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdSupplierEvaluation::getSupplierId, update.getId());
// xzdSupplierEvaluationService.remove(xzdCustomertypeInfoLambdaQueryWrapper);
xzdSupplierEvaluationService.removeByIds(old.getEvaluations());
}
for (XzdSupplierEvaluation customerType : bo.getEvaluations()) {
customerType.setSupplierId(update.getId());
@ -575,10 +579,10 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
xzdSupplierEvaluationService.saveBatch(bo.getEvaluations());
}else {
if (old.getEvaluations() != null && !old.getEvaluations().isEmpty()){
LambdaQueryWrapper<XzdSupplierEvaluation> xzdCustomertypeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdSupplierEvaluation::getSupplierId, update.getId());
xzdSupplierEvaluationService.remove(xzdCustomertypeInfoLambdaQueryWrapper);
// xzdSupplierEvaluationService.removeByIds(old.getEvaluations());
// LambdaQueryWrapper<XzdSupplierEvaluation> xzdCustomertypeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
// xzdCustomertypeInfoLambdaQueryWrapper.eq(XzdSupplierEvaluation::getSupplierId, update.getId());
// xzdSupplierEvaluationService.remove(xzdCustomertypeInfoLambdaQueryWrapper);
xzdSupplierEvaluationService.removeByIds(old.getEvaluations());
}
}
@ -931,10 +935,6 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
vo.setKhyh(openBank.getOpenBank());
vo.setKhhzh(xzdYhxx.getAccount());
vo.setKhhhm(openBank.getOpenBank());
} else {
vo.setKhyh("暂无数据");
vo.setKhhzh("暂无数据");
vo.setKhhhm("暂无数据");
}
}
@ -946,6 +946,9 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl<XzdSupplierInfoMappe
for (XzdYhxx yhxx : xzdYhxxList) {
XzdSupplierOpenBank byId = xzdSupplierOpenBankService.getById(yhxx.getYhId());
if (byId != null){
byId.setAccount(yhxx.getAccount());
byId.setIsDefault(yhxx.getSfmr());
byId.setPersonName(yhxx.getKhhm());
openBanks.add(byId);
}
}

View File

@ -13,7 +13,7 @@
info.city_code as cityCode,
info.shzt as shzt,
bank.open_bank as khyh,
bank.account as khhzh,
yhxx.account as khhzh,
supplement.creator as createByUser,
info.create_time as createTime,
info.update_time as updateTime,
@ -37,8 +37,8 @@
LEFT JOIN xzd_supplier_supplement as supplement ON info.id = supplement.supplier_id
LEFT JOIN xzd_settlement_info as settlement ON info.id = settlement.customerinformation_id
LEFT JOIN xzd_contact as contact ON info.id = contact.customerinformation_id AND contact.type like '2' AND contact.is_main_contact = 1
LEFT JOIN xzd_yhxx as yhxx ON info.id = yhxx.main_id
LEFT JOIN xzd_supplier_open_bank as bank ON yhxx.yh_id = bank.id AND bank.is_default = 1
LEFT JOIN xzd_yhxx as yhxx ON info.id = yhxx.main_id and yhxx.sfmr like '1'
LEFT JOIN xzd_supplier_open_bank as bank ON yhxx.yh_id = bank.id
<where>
<if test='bo.unifiedSocialCreditCode != null and bo.unifiedSocialCreditCode != ""'>