|
@ -28,6 +28,9 @@ package com.yxt.anrui.fin.biz.finpayment; |
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
import com.yxt.anrui.fin.api.finpaymentapply.FinPaymentapplyVo; |
|
|
|
|
|
import com.yxt.anrui.portal.api.sysuser.PrivilegeQuery; |
|
|
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
@ -41,6 +44,7 @@ import com.yxt.anrui.fin.api.finpayment.FinPaymentDetailsVo; |
|
|
import com.yxt.anrui.fin.api.finpayment.FinPaymentDto; |
|
|
import com.yxt.anrui.fin.api.finpayment.FinPaymentDto; |
|
|
import com.yxt.anrui.fin.api.finpayment.FinPaymentFeign; |
|
|
import com.yxt.anrui.fin.api.finpayment.FinPaymentFeign; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
import java.util.List; |
|
@ -60,29 +64,84 @@ import java.util.List; |
|
|
*/ |
|
|
*/ |
|
|
@Service |
|
|
@Service |
|
|
public class FinPaymentService extends MybatisBaseService<FinPaymentMapper, FinPayment> { |
|
|
public class FinPaymentService extends MybatisBaseService<FinPaymentMapper, FinPayment> { |
|
|
private QueryWrapper<FinPayment> createQueryWrapper(FinPaymentQuery query) { |
|
|
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
@Autowired |
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
private SysUserFeign sysUserFeign; |
|
|
QueryWrapper<FinPayment> qw = new QueryWrapper<>(); |
|
|
|
|
|
return qw; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PagerVo<FinPaymentVo> listPageVo(PagerQuery<FinPaymentQuery> pq) { |
|
|
public PagerVo<FinPaymentVo> listPageVo(PagerQuery<FinPaymentQuery> pq) { |
|
|
FinPaymentQuery query = pq.getParams(); |
|
|
FinPaymentQuery query = pq.getParams(); |
|
|
QueryWrapper<FinPayment> qw = createQueryWrapper(query); |
|
|
QueryWrapper<FinPayment> qw = new QueryWrapper<>(); |
|
|
|
|
|
//========================================数据授权开始
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getMenuUrl())) { |
|
|
|
|
|
PrivilegeQuery privilegeQuery = new PrivilegeQuery(); |
|
|
|
|
|
privilegeQuery.setOrgPath(query.getOrgPath()); |
|
|
|
|
|
privilegeQuery.setMenuUrl(query.getMenuUrl()); |
|
|
|
|
|
privilegeQuery.setUserSid(query.getUserSid()); |
|
|
|
|
|
ResultBean<String> defaultIdReltBean = sysUserFeign.selectPrivilegeLevel(privilegeQuery); |
|
|
|
|
|
if (StringUtils.isNotBlank(defaultIdReltBean.getData())) { |
|
|
|
|
|
//数据权限ID(1集团、2事业部、3分公司、4部门、5个人)
|
|
|
|
|
|
String orgSidPath = query.getOrgPath(); |
|
|
|
|
|
orgSidPath = orgSidPath + "/"; |
|
|
|
|
|
int i1 = orgSidPath.indexOf("/"); |
|
|
|
|
|
int i2 = orgSidPath.indexOf("/", i1 + 1); |
|
|
|
|
|
int i3 = orgSidPath.indexOf("/", i2 + 1); |
|
|
|
|
|
int i4 = orgSidPath.indexOf("/", i3 + 1); |
|
|
|
|
|
String orgLevelKey = defaultIdReltBean.getData(); |
|
|
|
|
|
if ("1".equals(orgLevelKey)) { |
|
|
|
|
|
orgSidPath = orgSidPath.substring(0, i1); |
|
|
|
|
|
qw.like("u.orgSidPath", orgSidPath); |
|
|
|
|
|
} else if ("2".equals(orgLevelKey)) { |
|
|
|
|
|
orgSidPath = orgSidPath.substring(0, i2); |
|
|
|
|
|
qw.like("u.orgSidPath", orgSidPath); |
|
|
|
|
|
} else if ("3".equals(orgLevelKey)) { |
|
|
|
|
|
orgSidPath = orgSidPath.substring(0, i3); |
|
|
|
|
|
qw.like("u.orgSidPath", orgSidPath); |
|
|
|
|
|
} else if ("4".equals(orgLevelKey)) { |
|
|
|
|
|
orgSidPath = orgSidPath.substring(0, i4); |
|
|
|
|
|
qw.like("u.orgSidPath", orgSidPath); |
|
|
|
|
|
} else if ("5".equals(orgLevelKey)) { |
|
|
|
|
|
qw.eq("fp.createBySid", query.getUserSid()); |
|
|
|
|
|
} else { |
|
|
|
|
|
PagerVo<FinPaymentVo> p = new PagerVo<>(); |
|
|
|
|
|
return p; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
PagerVo<FinPaymentVo> p = new PagerVo<>(); |
|
|
|
|
|
return p; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getCompanyName())) { |
|
|
|
|
|
qw.like("fp.companyName", query.getCompanyName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getReceivingAccount())) { |
|
|
|
|
|
qw.like("fp.receivingAccount", query.getReceivingAccount()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getBusinessTypeValue())) { |
|
|
|
|
|
qw.like("fp.businessTypeValue", query.getBusinessTypeValue()); |
|
|
|
|
|
} |
|
|
IPage<FinPayment> page = PagerUtil.queryToPage(pq); |
|
|
IPage<FinPayment> page = PagerUtil.queryToPage(pq); |
|
|
IPage<FinPaymentVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
IPage<FinPaymentVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
PagerVo<FinPaymentVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
PagerVo<FinPaymentVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
return p; |
|
|
return p; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void saveOrUpdateDto(FinPaymentDto dto) { |
|
|
public ResultBean saveOrUpdateDto(FinPaymentDto dto) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
String dtoSid = dto.getSid(); |
|
|
String dtoSid = dto.getSid(); |
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
|
|
int count = baseMapper.checkSave(dto.getUseOrgSid(), dto.getCompanyCode()); |
|
|
|
|
|
if (count > 0) { |
|
|
|
|
|
return rb.setMsg("该分公司下单位编码已存在"); |
|
|
|
|
|
} |
|
|
this.insertByDto(dto); |
|
|
this.insertByDto(dto); |
|
|
return; |
|
|
return rb.success(); |
|
|
|
|
|
} |
|
|
|
|
|
int count = baseMapper.checkUpdate(dto.getUseOrgSid(), dto.getCompanyCode(), dtoSid); |
|
|
|
|
|
if (count > 0) { |
|
|
|
|
|
return rb.setMsg("该分公司下单位编码已存在"); |
|
|
} |
|
|
} |
|
|
this.updateByDto(dto); |
|
|
this.updateByDto(dto); |
|
|
|
|
|
return rb.success(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void insertByDto(FinPaymentDto dto) { |
|
|
public void insertByDto(FinPaymentDto dto) { |
|
|