1.4.0后端:

feat(分款):完成财务分款所有功能开发
dev
xs 1 month ago
parent 9a3856f748
commit 13bfbbac3c

@ -2,10 +2,13 @@ package org.dromara.oa.erp.controller;
import java.util.List; import java.util.List;
import cn.hutool.core.bean.BeanUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import org.dromara.common.excel.core.ExcelResult;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit; import org.dromara.common.idempotent.annotation.RepeatSubmit;
@ -21,6 +24,7 @@ import org.dromara.oa.erp.domain.vo.ErpFinAccountInstallmentVo;
import org.dromara.oa.erp.domain.bo.ErpFinAccountInstallmentBo; import org.dromara.oa.erp.domain.bo.ErpFinAccountInstallmentBo;
import org.dromara.oa.erp.service.IErpFinAccountInstallmentService; import org.dromara.oa.erp.service.IErpFinAccountInstallmentService;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* *
@ -32,7 +36,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
@Validated @Validated
@RequiredArgsConstructor @RequiredArgsConstructor
@RestController @RestController
@RequestMapping("/finAccountInstallment") @RequestMapping("/erp/finAccountInstallment")
public class ErpFinAccountInstallmentController extends BaseController { public class ErpFinAccountInstallmentController extends BaseController {
private final IErpFinAccountInstallmentService erpFinAccountInstallmentService; private final IErpFinAccountInstallmentService erpFinAccountInstallmentService;
@ -46,6 +50,22 @@ public class ErpFinAccountInstallmentController extends BaseController {
return erpFinAccountInstallmentService.queryPageList(bo, pageQuery); return erpFinAccountInstallmentService.queryPageList(bo, pageQuery);
} }
/**
*
*
* @param file
* @param updateSupport
*/
@Log(title = "分款管理", businessType = BusinessType.IMPORT)
@SaCheckPermission("oa/erp:finAccountInstallment:import")
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception {
ExcelResult<ErpFinAccountInstallmentVo> excelResult = ExcelUtil.importExcel(file.getInputStream(), ErpFinAccountInstallmentVo.class, true);
List<ErpFinAccountInstallmentVo> volist = excelResult.getList();
erpFinAccountInstallmentService.importInstallmentData(volist);
return R.ok(excelResult.getAnalysis());
}
/** /**
* *
*/ */

@ -0,0 +1,128 @@
package org.dromara.oa.erp.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.erp.domain.vo.ErpFinAccountInstallmentDetailVo;
import org.dromara.oa.erp.domain.bo.ErpFinAccountInstallmentDetailBo;
import org.dromara.oa.erp.service.IErpFinAccountInstallmentDetailService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
*
* 访:/oa/erp/finAccountInstallmentDetail
*
* @author xins
* @date 2026-03-09
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/erp/finAccountInstallmentDetail")
public class ErpFinAccountInstallmentDetailController extends BaseController {
private final IErpFinAccountInstallmentDetailService erpFinAccountInstallmentDetailService;
/**
*
*/
@SaCheckPermission("oa/erp:finAccountInstallmentDetail:list")
@GetMapping("/list")
public TableDataInfo<ErpFinAccountInstallmentDetailVo> list(ErpFinAccountInstallmentDetailBo bo, PageQuery pageQuery) {
return erpFinAccountInstallmentDetailService.queryPageList(bo, pageQuery);
}
/**
*
*/
@SaCheckPermission("oa/erp:finAccountInstallmentDetail:export")
@Log(title = "分款明细信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(ErpFinAccountInstallmentDetailBo bo, HttpServletResponse response) {
List<ErpFinAccountInstallmentDetailVo> list = erpFinAccountInstallmentDetailService.queryList(bo);
ExcelUtil.exportExcel(list, "分款明细信息", ErpFinAccountInstallmentDetailVo.class, response);
}
/**
*
*
* @param installmentDetailId
*/
@SaCheckPermission("oa/erp:finAccountInstallmentDetail:query")
@GetMapping("/{installmentDetailId}")
public R<ErpFinAccountInstallmentDetailVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable("installmentDetailId") Long installmentDetailId) {
return R.ok(erpFinAccountInstallmentDetailService.queryById(installmentDetailId));
}
/**
*
*/
@SaCheckPermission("oa/erp:finAccountInstallmentDetail:add")
@Log(title = "分款明细信息", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody ErpFinAccountInstallmentDetailBo bo) {
return toAjax(erpFinAccountInstallmentDetailService.insertByBo(bo));
}
/**
*
*/
@SaCheckPermission("oa/erp:finAccountInstallmentDetail:edit")
@Log(title = "分款明细信息", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ErpFinAccountInstallmentDetailBo bo) {
return toAjax(erpFinAccountInstallmentDetailService.updateByBo(bo));
}
/**
*
*
* @param installmentDetailIds
*/
@SaCheckPermission("oa/erp:finAccountInstallmentDetail:remove")
@Log(title = "分款明细信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{installmentDetailIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable("installmentDetailIds") Long[] installmentDetailIds) {
return toAjax(erpFinAccountInstallmentDetailService.deleteWithValidByIds(List.of(installmentDetailIds), true));
}
/**
*
*/
@GetMapping("/getErpFinAccountInstallmentDetailList")
public R<List<ErpFinAccountInstallmentDetailVo>> getErpFinAccountInstallmentDetailList(ErpFinAccountInstallmentDetailBo bo) {
List<ErpFinAccountInstallmentDetailVo> list = erpFinAccountInstallmentDetailService.queryJoinList(bo);
return R.ok(list);
}
/**
*
*
*/
@SaCheckPermission("oa/erp:finAccountInstallmentDetail:remove")
@Log(title = "分款明细信息", businessType = BusinessType.DELETE)
@PostMapping("/deleteInstallmentDetailByBo")
public R<Void> deleteInstallmentDetailByBo(@RequestBody ErpFinAccountInstallmentDetailBo bo) {
return toAjax(erpFinAccountInstallmentDetailService.deleteAccountInstallmentDetail(bo));
}
}

@ -13,7 +13,7 @@ import java.io.Serial;
* erp_fin_account_installment * erp_fin_account_installment
* *
* @author xins * @author xins
* @date 2026-03-09 * @date 2026-03-20
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ -30,7 +30,7 @@ public class ErpFinAccountInstallment extends TenantEntity {
private Long accountInstallmentId; private Long accountInstallmentId;
/** /**
* *
*/ */
private String installmentCode; private String installmentCode;
@ -64,21 +64,6 @@ public class ErpFinAccountInstallment extends TenantEntity {
*/ */
private String remark; private String remark;
/**
*
*/
private Long dispatchUserId;
/**
*
*/
private Long dispatchDeptId;
/**
*
*/
private Date dispatchDate;
/** /**
* 0稿 1 2 * 0稿 1 2
*/ */

@ -69,4 +69,12 @@ public class ErpFinAccountInstallmentDetail extends BaseEntity {
private String remark; private String remark;
@TableField(exist = false)
private String contractCode;
@TableField(exist = false)
private String contractName;
@TableField(exist = false)
private String stageName;
} }

@ -15,7 +15,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
* erp_fin_account_installment * erp_fin_account_installment
* *
* @author xins * @author xins
* @date 2026-03-09 * @date 2026-03-20
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ -29,7 +29,7 @@ public class ErpFinAccountInstallmentBo extends BaseEntity {
private Long accountInstallmentId; private Long accountInstallmentId;
/** /**
* *
*/ */
private String installmentCode; private String installmentCode;
@ -64,21 +64,6 @@ public class ErpFinAccountInstallmentBo extends BaseEntity {
*/ */
private String remark; private String remark;
/**
*
*/
private Long dispatchUserId;
/**
*
*/
private Long dispatchDeptId;
/**
*
*/
private Date dispatchDate;
/** /**
* 0稿 1 2 * 0稿 1 2
*/ */

@ -70,5 +70,9 @@ public class ErpFinAccountInstallmentDetailBo extends BaseEntity {
*/ */
private String remark; private String remark;
/**
*
*/
private String installmentStatus;
} }

@ -1,5 +1,6 @@
package org.dromara.oa.erp.domain.vo; package org.dromara.oa.erp.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import org.dromara.oa.erp.domain.ErpFinAccountInstallmentDetail; import org.dromara.oa.erp.domain.ErpFinAccountInstallmentDetail;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated; import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty; import cn.idev.excel.annotation.ExcelProperty;
@ -84,4 +85,9 @@ public class ErpFinAccountInstallmentDetailVo implements Serializable {
private String remark; private String remark;
private String contractCode;
private String contractName;
private String stageName;
} }

@ -20,7 +20,7 @@ import java.util.Date;
* erp_fin_account_installment * erp_fin_account_installment
* *
* @author xins * @author xins
* @date 2026-03-09 * @date 2026-03-20
*/ */
@Data @Data
@ExcelIgnoreUnannotated @ExcelIgnoreUnannotated
@ -37,9 +37,9 @@ public class ErpFinAccountInstallmentVo implements Serializable {
private Long accountInstallmentId; private Long accountInstallmentId;
/** /**
* *
*/ */
@ExcelProperty(value = "分款编号") @ExcelProperty(value = "回款编号,同一批导入的回款信息")
private String installmentCode; private String installmentCode;
/** /**
@ -51,7 +51,7 @@ public class ErpFinAccountInstallmentVo implements Serializable {
/** /**
* *
*/ */
@ExcelProperty(value = "客户名称,冗余") @ExcelProperty(value = "客户名称")
private String customerName; private String customerName;
/** /**
@ -78,24 +78,6 @@ public class ErpFinAccountInstallmentVo implements Serializable {
@ExcelProperty(value = "备注") @ExcelProperty(value = "备注")
private String remark; private String remark;
/**
*
*/
@ExcelProperty(value = "发出人员")
private Long dispatchUserId;
/**
*
*/
@ExcelProperty(value = "发出部门")
private Long dispatchDeptId;
/**
*
*/
@ExcelProperty(value = "发出日期")
private Date dispatchDate;
/** /**
* 0稿 1 2 * 0稿 1 2
*/ */

@ -0,0 +1,84 @@
package org.dromara.oa.erp.service;
import org.dromara.oa.erp.domain.ErpFinAccountInstallmentDetail;
import org.dromara.oa.erp.domain.vo.ErpFinAccountInstallmentDetailVo;
import org.dromara.oa.erp.domain.bo.ErpFinAccountInstallmentDetailBo;
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 xins
* @date 2026-03-09
*/
public interface IErpFinAccountInstallmentDetailService {
/**
*
*
* @param installmentDetailId
* @return
*/
ErpFinAccountInstallmentDetailVo queryById(Long installmentDetailId);
/**
*
*
* @param bo
* @param pageQuery
* @return
*/
TableDataInfo<ErpFinAccountInstallmentDetailVo> queryPageList(ErpFinAccountInstallmentDetailBo bo, PageQuery pageQuery);
/**
*
*
* @param bo
* @return
*/
List<ErpFinAccountInstallmentDetailVo> queryList(ErpFinAccountInstallmentDetailBo bo);
/**
* ,Join contractpaymentstage
*
* @param bo
* @return
*/
public List<ErpFinAccountInstallmentDetailVo> queryJoinList(ErpFinAccountInstallmentDetailBo bo);
/**
*
*
* @param bo
* @return
*/
Boolean insertByBo(ErpFinAccountInstallmentDetailBo bo);
/**
*
*
* @param bo
* @return
*/
Boolean updateByBo(ErpFinAccountInstallmentDetailBo bo);
/**
*
*
* @param ids
* @param isValid
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
*
* @param bo
* @return
*/
public Boolean deleteAccountInstallmentDetail(ErpFinAccountInstallmentDetailBo bo);
}

@ -50,6 +50,14 @@ public interface IErpFinAccountInstallmentService {
*/ */
Boolean insertByBo(ErpFinAccountInstallmentBo bo); Boolean insertByBo(ErpFinAccountInstallmentBo bo);
/**
*
*
* @param installmentVolist
* @return
*/
public String importInstallmentData(List<ErpFinAccountInstallmentVo> installmentVolist);
/** /**
* *
* *

@ -0,0 +1,202 @@
package org.dromara.oa.erp.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 com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.oa.base.domain.BasePaymentStage;
import org.dromara.oa.erp.domain.ErpContractInfo;
import org.dromara.oa.erp.domain.ErpFinAccountInstallment;
import org.dromara.oa.erp.mapper.ErpFinAccountInstallmentMapper;
import org.springframework.stereotype.Service;
import org.dromara.oa.erp.domain.bo.ErpFinAccountInstallmentDetailBo;
import org.dromara.oa.erp.domain.vo.ErpFinAccountInstallmentDetailVo;
import org.dromara.oa.erp.domain.ErpFinAccountInstallmentDetail;
import org.dromara.oa.erp.mapper.ErpFinAccountInstallmentDetailMapper;
import org.dromara.oa.erp.service.IErpFinAccountInstallmentDetailService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* Service
*
* @author xins
* @date 2026-03-09
*/
@RequiredArgsConstructor
@Service
public class ErpFinAccountInstallmentDetailServiceImpl implements IErpFinAccountInstallmentDetailService {
private final ErpFinAccountInstallmentDetailMapper baseMapper;
private final ErpFinAccountInstallmentMapper finAccountInstallmentMapper;
/**
*
*
* @param installmentDetailId
* @return
*/
@Override
public ErpFinAccountInstallmentDetailVo queryById(Long installmentDetailId) {
return baseMapper.selectVoById(installmentDetailId);
}
/**
*
*
* @param bo
* @param pageQuery
* @return
*/
@Override
public TableDataInfo<ErpFinAccountInstallmentDetailVo> queryPageList(ErpFinAccountInstallmentDetailBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<ErpFinAccountInstallmentDetail> lqw = buildQueryWrapper(bo);
Page<ErpFinAccountInstallmentDetailVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
*
*
* @param bo
* @return
*/
@Override
public List<ErpFinAccountInstallmentDetailVo> queryList(ErpFinAccountInstallmentDetailBo bo) {
MPJLambdaWrapper<ErpFinAccountInstallmentDetail> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private MPJLambdaWrapper<ErpFinAccountInstallmentDetail> buildQueryWrapper(ErpFinAccountInstallmentDetailBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<ErpFinAccountInstallmentDetail> lqw = JoinWrappers.lambda(ErpFinAccountInstallmentDetail.class)
.selectAll(ErpFinAccountInstallmentDetail.class)
.eq(bo.getAccountInstallmentId() != null, ErpFinAccountInstallmentDetail::getAccountInstallmentId, bo.getAccountInstallmentId())
.eq(bo.getProjectId() != null, ErpFinAccountInstallmentDetail::getProjectId, bo.getProjectId())
.eq(StringUtils.isNotBlank(bo.getProjectCode()), ErpFinAccountInstallmentDetail::getProjectCode, bo.getProjectCode())
.like(StringUtils.isNotBlank(bo.getProjectName()), ErpFinAccountInstallmentDetail::getProjectName, bo.getProjectName())
.eq(bo.getContractId() != null, ErpFinAccountInstallmentDetail::getContractId, bo.getContractId())
.eq(bo.getPaymentStageId() != null, ErpFinAccountInstallmentDetail::getPaymentStageId, bo.getPaymentStageId())
.eq(bo.getDetailAmount() != null, ErpFinAccountInstallmentDetail::getDetailAmount, bo.getDetailAmount());
return lqw;
}
/**
* ,Join contractpaymentstage
*
* @param bo
* @return
*/
@Override
public List<ErpFinAccountInstallmentDetailVo> queryJoinList(ErpFinAccountInstallmentDetailBo bo) {
MPJLambdaWrapper<ErpFinAccountInstallmentDetail> lqw = buildJoinQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private MPJLambdaWrapper<ErpFinAccountInstallmentDetail> buildJoinQueryWrapper(ErpFinAccountInstallmentDetailBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<ErpFinAccountInstallmentDetail> lqw = JoinWrappers.lambda(ErpFinAccountInstallmentDetail.class)
.selectAll(ErpFinAccountInstallmentDetail.class)
.select(ErpContractInfo::getContractCode)
.select(ErpContractInfo::getContractName)
.select(BasePaymentStage::getStageName)
.leftJoin(ErpContractInfo.class, ErpContractInfo::getContractId, ErpFinAccountInstallmentDetail::getContractId)
.leftJoin(BasePaymentStage.class, BasePaymentStage::getPaymentStageId, ErpFinAccountInstallmentDetail::getPaymentStageId)
.eq(bo.getAccountInstallmentId() != null, ErpFinAccountInstallmentDetail::getAccountInstallmentId, bo.getAccountInstallmentId())
.eq(bo.getProjectId() != null, ErpFinAccountInstallmentDetail::getProjectId, bo.getProjectId())
.eq(StringUtils.isNotBlank(bo.getProjectCode()), ErpFinAccountInstallmentDetail::getProjectCode, bo.getProjectCode())
.like(StringUtils.isNotBlank(bo.getProjectName()), ErpFinAccountInstallmentDetail::getProjectName, bo.getProjectName())
.eq(bo.getContractId() != null, ErpFinAccountInstallmentDetail::getContractId, bo.getContractId())
.eq(bo.getPaymentStageId() != null, ErpFinAccountInstallmentDetail::getPaymentStageId, bo.getPaymentStageId())
.eq(bo.getDetailAmount() != null, ErpFinAccountInstallmentDetail::getDetailAmount, bo.getDetailAmount());
return lqw;
}
/**
*
*
* @param bo
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(ErpFinAccountInstallmentDetailBo bo) {
ErpFinAccountInstallmentDetail add = MapstructUtils.convert(bo, ErpFinAccountInstallmentDetail.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setInstallmentDetailId(add.getInstallmentDetailId());
}
ErpFinAccountInstallment erpFinAccountInstallment = finAccountInstallmentMapper.selectById(bo.getAccountInstallmentId());
erpFinAccountInstallment.setInstallmentStatus(bo.getInstallmentStatus());
finAccountInstallmentMapper.updateById(erpFinAccountInstallment);
return flag;
}
/**
*
*
* @param bo
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(ErpFinAccountInstallmentDetailBo bo) {
ErpFinAccountInstallmentDetail update = MapstructUtils.convert(bo, ErpFinAccountInstallmentDetail.class);
validEntityBeforeSave(update);
ErpFinAccountInstallment erpFinAccountInstallment = finAccountInstallmentMapper.selectById(bo.getAccountInstallmentId());
erpFinAccountInstallment.setInstallmentStatus(bo.getInstallmentStatus());
finAccountInstallmentMapper.updateById(erpFinAccountInstallment);
return baseMapper.updateById(update) > 0;
}
/**
*
*/
private void validEntityBeforeSave(ErpFinAccountInstallmentDetail entity) {
//TODO 做一些数据校验,如唯一约束
}
/**
*
*
* @param ids
* @param isValid
* @return
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
/**
*
* @param bo
* @return
*/
@Override
public Boolean deleteAccountInstallmentDetail(ErpFinAccountInstallmentDetailBo bo) {
ErpFinAccountInstallment erpFinAccountInstallment = new ErpFinAccountInstallment();
erpFinAccountInstallment.setAccountInstallmentId(bo.getAccountInstallmentId());
erpFinAccountInstallment.setInstallmentStatus(bo.getInstallmentStatus());
finAccountInstallmentMapper.updateById(erpFinAccountInstallment);
return baseMapper.deleteById(bo.getInstallmentDetailId()) > 0;
}
}

@ -1,5 +1,9 @@
package org.dromara.oa.erp.service.impl; package org.dromara.oa.erp.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -9,6 +13,9 @@ import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.dromara.oa.crm.domain.CrmShippingTariff;
import org.dromara.oa.crm.domain.bo.CrmShippingTariffBo;
import org.dromara.system.api.RemoteCodeRuleService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.dromara.oa.erp.domain.bo.ErpFinAccountInstallmentBo; import org.dromara.oa.erp.domain.bo.ErpFinAccountInstallmentBo;
import org.dromara.oa.erp.domain.vo.ErpFinAccountInstallmentVo; import org.dromara.oa.erp.domain.vo.ErpFinAccountInstallmentVo;
@ -30,8 +37,13 @@ import java.util.Collection;
@Service @Service
public class ErpFinAccountInstallmentServiceImpl implements IErpFinAccountInstallmentService { public class ErpFinAccountInstallmentServiceImpl implements IErpFinAccountInstallmentService {
private static final String ACCOUNT_INSTALLMENT_CODE_RULE = "1031";
private final ErpFinAccountInstallmentMapper baseMapper; private final ErpFinAccountInstallmentMapper baseMapper;
@DubboReference(timeout = 30000)
private RemoteCodeRuleService remoteCodeRuleService;
/** /**
* *
* *
@ -79,11 +91,10 @@ public class ErpFinAccountInstallmentServiceImpl implements IErpFinAccountInstal
.eq(StringUtils.isNotBlank(bo.getCurrency()), ErpFinAccountInstallment::getCurrency, bo.getCurrency()) .eq(StringUtils.isNotBlank(bo.getCurrency()), ErpFinAccountInstallment::getCurrency, bo.getCurrency())
.eq(bo.getPaymentAmount() != null, ErpFinAccountInstallment::getPaymentAmount, bo.getPaymentAmount()) .eq(bo.getPaymentAmount() != null, ErpFinAccountInstallment::getPaymentAmount, bo.getPaymentAmount())
.eq(bo.getPaymentDate() != null, ErpFinAccountInstallment::getPaymentDate, bo.getPaymentDate()) .eq(bo.getPaymentDate() != null, ErpFinAccountInstallment::getPaymentDate, bo.getPaymentDate())
.eq(bo.getDispatchUserId() != null, ErpFinAccountInstallment::getDispatchUserId, bo.getDispatchUserId())
.eq(bo.getDispatchDeptId() != null, ErpFinAccountInstallment::getDispatchDeptId, bo.getDispatchDeptId())
.eq(bo.getDispatchDate() != null, ErpFinAccountInstallment::getDispatchDate, bo.getDispatchDate())
.eq(StringUtils.isNotBlank(bo.getInstallmentStatus()), ErpFinAccountInstallment::getInstallmentStatus, bo.getInstallmentStatus()) .eq(StringUtils.isNotBlank(bo.getInstallmentStatus()), ErpFinAccountInstallment::getInstallmentStatus, bo.getInstallmentStatus())
.eq(bo.getAccountManageId() != null, ErpFinAccountInstallment::getAccountManageId, bo.getAccountManageId()) .eq(bo.getAccountManageId() != null, ErpFinAccountInstallment::getAccountManageId, bo.getAccountManageId())
.orderByAsc(ErpFinAccountInstallment::getInstallmentStatus)
.orderByDesc(ErpFinAccountInstallment::getCreateTime)
; ;
return lqw; return lqw;
} }
@ -105,6 +116,74 @@ public class ErpFinAccountInstallmentServiceImpl implements IErpFinAccountInstal
return flag; return flag;
} }
/**
*
*
* @param installmentVolist
* @return
*/
@Override
public String importInstallmentData(List<ErpFinAccountInstallmentVo> installmentVolist) {
try
{
if (StringUtils.isNull(installmentVolist) || installmentVolist.isEmpty())
{
throw new ServiceException("导入数据不能为空!");
}
String code = remoteCodeRuleService.selectCodeRuleCode(ACCOUNT_INSTALLMENT_CODE_RULE);
if (StringUtils.isBlank(code)) {
throw new ServiceException("生成项目计划编号失败");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (ErpFinAccountInstallmentVo installmentVo : installmentVolist)
{
try
{
// 检查必填字段
if (StringUtils.isEmpty(installmentVo.getCustomerName()) || installmentVo.getPaymentAmount() == null || installmentVo.getPaymentDate() == null)
{
failureNum++;
failureMsg.append("<br/>第" + (failureNum + 1) + "行数据不完整,缺少必填字段");
continue;
}
ErpFinAccountInstallment add = MapstructUtils.convert(installmentVo, ErpFinAccountInstallment.class);
add.setInstallmentCode(code);
baseMapper.insert(add);
successNum++;
successMsg.append("<br/>" + successNum + "、" + installmentVo.getCustomerName() + " 导入成功");
}
catch (Exception e)
{
failureNum++;
String msg = "<br/>" + installmentVo.getCustomerName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
}
}
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
}
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
catch (Exception e)
{
throw new ServiceException("导入Excel数据失败:" + e.getMessage());
}
}
/** /**
* *
* *

@ -0,0 +1,14 @@
<?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.erp.mapper.ErpFinAccountInstallmentDetailMapper">
<resultMap type="org.dromara.oa.erp.domain.vo.ErpFinAccountInstallmentDetailVo" id="ErpFinAccountInstallmentDetailResult">
</resultMap>
<select id="selectCustomErpFinAccountInstallmentDetailVoList" resultMap="ErpFinAccountInstallmentDetailResult">
select installment_detail_id, account_installment_id, project_id, project_code, project_name, contract_id, payment_stage_id, detail_amount, remark, create_dept, create_by, create_time, update_by, update_time from erp_fin_account_installment_detail t
${ew.getCustomSqlSegment}
</select>
</mapper>
Loading…
Cancel
Save