合同资金拆分实现
This commit is contained in:
@@ -74,7 +74,12 @@ public class TmplInscItmBsnServiceImpl implements TmplInscItmBsnService {
|
|||||||
@Override
|
@Override
|
||||||
public void updateTmplInscItmBsnBatch(List<TmplInscItmBsnSaveReqVO> updateReqVOS) {
|
public void updateTmplInscItmBsnBatch(List<TmplInscItmBsnSaveReqVO> updateReqVOS) {
|
||||||
tmplInscItmBsnMapper.physicalDeleteByBsnIds(updateReqVOS.stream().map(TmplInscItmBsnSaveReqVO::getBsnId).toList());
|
tmplInscItmBsnMapper.physicalDeleteByBsnIds(updateReqVOS.stream().map(TmplInscItmBsnSaveReqVO::getBsnId).toList());
|
||||||
List<TmplInscItmBsnDO> bean = BeanUtils.toBean(updateReqVOS, TmplInscItmBsnDO.class);
|
List<TmplInscItmBsnDO> bean =new ArrayList<>();
|
||||||
|
updateReqVOS.forEach(updateReqVO -> {
|
||||||
|
TmplInscItmBsnDO tmplInscItmBsnDO = BeanUtils.toBean(updateReqVO, TmplInscItmBsnDO.class);
|
||||||
|
tmplInscItmBsnDO.setInscItmId(updateReqVO.getInstceItmId());
|
||||||
|
bean.add(tmplInscItmBsnDO);
|
||||||
|
});
|
||||||
tmplInscItmBsnMapper.insertBatch(bean);
|
tmplInscItmBsnMapper.insertBatch(bean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?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="com.zt.plat.module.bse.dal.dao.amountdismantle.AmountDismantleMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.zt.plat.module.contractorder.api.vo.contract;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import com.zt.plat.framework.common.pojo.PageParam;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 结算金额拆分分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class AmountDismantlePageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "物料名称", example = "赵六")
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
@Schema(description = "物料编码")
|
||||||
|
private String materialCode;
|
||||||
|
|
||||||
|
@Schema(description = "元素缩写")
|
||||||
|
private String elementAbbreviation;
|
||||||
|
|
||||||
|
@Schema(description = "元素名称", example = "张三")
|
||||||
|
private String elementName;
|
||||||
|
|
||||||
|
@Schema(description = "元素编码")
|
||||||
|
private String elementCode;
|
||||||
|
|
||||||
|
@Schema(description = "占比")
|
||||||
|
private BigDecimal ratio;
|
||||||
|
|
||||||
|
@Schema(description = "合同id", example = "3781")
|
||||||
|
private Long contractId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.zt.plat.module.contractorder.api.vo.contract;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 结算金额拆分 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class AmountDismantleRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "17357")
|
||||||
|
@ExcelProperty("主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "物料名称", example = "赵六")
|
||||||
|
@ExcelProperty("物料名称")
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
@Schema(description = "物料编码")
|
||||||
|
@ExcelProperty("物料编码")
|
||||||
|
private String materialCode;
|
||||||
|
|
||||||
|
@Schema(description = "元素缩写")
|
||||||
|
@ExcelProperty("元素缩写")
|
||||||
|
private String elementAbbreviation;
|
||||||
|
|
||||||
|
@Schema(description = "元素名称", example = "张三")
|
||||||
|
@ExcelProperty("元素名称")
|
||||||
|
private String elementName;
|
||||||
|
|
||||||
|
@Schema(description = "元素编码")
|
||||||
|
@ExcelProperty("元素编码")
|
||||||
|
private String elementCode;
|
||||||
|
|
||||||
|
@Schema(description = "占比")
|
||||||
|
@ExcelProperty("占比")
|
||||||
|
private BigDecimal ratio;
|
||||||
|
|
||||||
|
@Schema(description = "合同id", example = "3781")
|
||||||
|
@ExcelProperty("合同id")
|
||||||
|
private Long contractId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.zt.plat.module.contractorder.api.vo.contract;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 结算金额拆分新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class AmountDismantleSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "17357")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "物料名称", example = "赵六")
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
@Schema(description = "物料编码")
|
||||||
|
private String materialCode;
|
||||||
|
|
||||||
|
@Schema(description = "元素缩写")
|
||||||
|
private String elementAbbreviation;
|
||||||
|
|
||||||
|
@Schema(description = "元素名称", example = "张三")
|
||||||
|
private String elementName;
|
||||||
|
|
||||||
|
@Schema(description = "元素编码")
|
||||||
|
private String elementCode;
|
||||||
|
|
||||||
|
@Schema(description = "占比")
|
||||||
|
private BigDecimal ratio;
|
||||||
|
|
||||||
|
@Schema(description = "合同id", example = "3781")
|
||||||
|
private Long contractId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -244,6 +244,8 @@ public class ContractSaveReqVO {
|
|||||||
private String salesTaxNumber;
|
private String salesTaxNumber;
|
||||||
@Schema(description = "是否信用", example = "1")
|
@Schema(description = "是否信用", example = "1")
|
||||||
private String hasCredit;
|
private String hasCredit;
|
||||||
|
//资金拆分表
|
||||||
|
private List<AmountDismantleSaveReqVO> amountSplit;
|
||||||
// 收发货规则
|
// 收发货规则
|
||||||
private List<ContractReceiveSendSaveReqVO> contractReceiveSends;
|
private List<ContractReceiveSendSaveReqVO> contractReceiveSends;
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode CONTRACT_PARTNER_NOT_EXISTS = new ErrorCode(1_027_000_017, "客商信息不存在");
|
ErrorCode CONTRACT_PARTNER_NOT_EXISTS = new ErrorCode(1_027_000_017, "客商信息不存在");
|
||||||
ErrorCode CONTRACT_PUSH_FAIL = new ErrorCode(1_027_000_019, "推送合同失败:{}");
|
ErrorCode CONTRACT_PUSH_FAIL = new ErrorCode(1_027_000_019, "推送合同失败:{}");
|
||||||
ErrorCode CONTRACT_STATUS_NOT_CANCEL = new ErrorCode(1_027_000_020, "{}状态合同不允许作废");
|
ErrorCode CONTRACT_STATUS_NOT_CANCEL = new ErrorCode(1_027_000_020, "{}状态合同不允许作废");
|
||||||
|
ErrorCode AMOUNT_DISMANTLE_NOT_EXISTS = new ErrorCode(1_027_000_022, "资金拆分不存在");
|
||||||
ErrorCode CONTRACT_RECEIVE_SEND_NOT_EXISTS = new ErrorCode(1_027_000_021, "收发货规则不存在");
|
ErrorCode CONTRACT_RECEIVE_SEND_NOT_EXISTS = new ErrorCode(1_027_000_021, "收发货规则不存在");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
package com.zt.plat.module.contractorder.controller.admin.amountdismantle;
|
||||||
|
|
||||||
|
import com.zt.plat.module.contractorder.api.vo.contract.AmountDismantlePageReqVO;
|
||||||
|
import com.zt.plat.module.contractorder.api.vo.contract.AmountDismantleRespVO;
|
||||||
|
import com.zt.plat.module.contractorder.api.vo.contract.AmountDismantleSaveReqVO;
|
||||||
|
import com.zt.plat.module.contractorder.dal.dataobject.amountdismantle.AmountDismantleDO;
|
||||||
|
import com.zt.plat.module.contractorder.service.amountdismantle.AmountDismantleService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import jakarta.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||||
|
import com.zt.plat.framework.common.pojo.PageParam;
|
||||||
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
|
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 结算金额拆分")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/bse/amount-dismantle")
|
||||||
|
@Validated
|
||||||
|
public class AmountDismantleController implements BusinessControllerMarker {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AmountDismantleService amountDismantleService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建结算金额拆分")
|
||||||
|
@PreAuthorize("@ss.hasPermission('bse:amount-dismantle:create')")
|
||||||
|
public CommonResult<AmountDismantleRespVO> createAmountDismantle(@Valid @RequestBody AmountDismantleSaveReqVO createReqVO) {
|
||||||
|
return success(amountDismantleService.createAmountDismantle(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新结算金额拆分")
|
||||||
|
@PreAuthorize("@ss.hasPermission('bse:amount-dismantle:update')")
|
||||||
|
public CommonResult<Boolean> updateAmountDismantle(@Valid @RequestBody AmountDismantleSaveReqVO updateReqVO) {
|
||||||
|
amountDismantleService.updateAmountDismantle(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除结算金额拆分")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('bse:amount-dismantle:delete')")
|
||||||
|
public CommonResult<Boolean> deleteAmountDismantle(@RequestParam("id") Long id) {
|
||||||
|
amountDismantleService.deleteAmountDismantle(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除结算金额拆分")
|
||||||
|
@PreAuthorize("@ss.hasPermission('bse:amount-dismantle:delete')")
|
||||||
|
public CommonResult<Boolean> deleteAmountDismantleList(@RequestBody BatchDeleteReqVO req) {
|
||||||
|
amountDismantleService.deleteAmountDismantleListByIds(req.getIds());
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得结算金额拆分")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('bse:amount-dismantle:query')")
|
||||||
|
public CommonResult<AmountDismantleRespVO> getAmountDismantle(@RequestParam("id") Long id) {
|
||||||
|
AmountDismantleDO amountDismantle = amountDismantleService.getAmountDismantle(id);
|
||||||
|
return success(BeanUtils.toBean(amountDismantle, AmountDismantleRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得结算金额拆分分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('bse:amount-dismantle:query')")
|
||||||
|
public CommonResult<PageResult<AmountDismantleRespVO>> getAmountDismantlePage(@Valid AmountDismantlePageReqVO pageReqVO) {
|
||||||
|
PageResult<AmountDismantleDO> pageResult = amountDismantleService.getAmountDismantlePage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, AmountDismantleRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出结算金额拆分 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('bse:amount-dismantle:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportAmountDismantleExcel(@Valid AmountDismantlePageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<AmountDismantleDO> list = amountDismantleService.getAmountDismantlePage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "结算金额拆分.xls", "数据", AmountDismantleRespVO.class,
|
||||||
|
BeanUtils.toBean(list, AmountDismantleRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.zt.plat.module.contractorder.dal.dataobject.amountdismantle;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||||
|
/**
|
||||||
|
* 结算金额拆分 DO
|
||||||
|
*
|
||||||
|
* @author 后台管理-1
|
||||||
|
*/
|
||||||
|
@TableName("bse_amt_dsmt")
|
||||||
|
@KeySequence("bse_amt_dsmt_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
/**
|
||||||
|
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||||
|
*/
|
||||||
|
public class AmountDismantleDO extends BusinessBaseDO {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 物料名称
|
||||||
|
*/
|
||||||
|
@TableField("MTRL_NAME")
|
||||||
|
private String materialName;
|
||||||
|
/**
|
||||||
|
* 物料编码
|
||||||
|
*/
|
||||||
|
@TableField("MTRL_CD")
|
||||||
|
private String materialCode;
|
||||||
|
/**
|
||||||
|
* 元素缩写
|
||||||
|
*/
|
||||||
|
@TableField("ELEM_ABBR")
|
||||||
|
private String elementAbbreviation;
|
||||||
|
/**
|
||||||
|
* 元素名称
|
||||||
|
*/
|
||||||
|
@TableField("ELEM_NAME")
|
||||||
|
private String elementName;
|
||||||
|
/**
|
||||||
|
* 元素编码
|
||||||
|
*/
|
||||||
|
@TableField("ELEM_CD")
|
||||||
|
private String elementCode;
|
||||||
|
/**
|
||||||
|
* 占比
|
||||||
|
*/
|
||||||
|
@TableField("RTIO")
|
||||||
|
private BigDecimal ratio;
|
||||||
|
/**
|
||||||
|
* 合同id
|
||||||
|
*/
|
||||||
|
@TableField("CTRT_ID")
|
||||||
|
private Long contractId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.zt.plat.module.contractorder.dal.mysql.amountdismantle;
|
||||||
|
|
||||||
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
|
||||||
|
import com.zt.plat.module.contractorder.api.vo.contract.AmountDismantlePageReqVO;
|
||||||
|
import com.zt.plat.module.contractorder.dal.dataobject.amountdismantle.AmountDismantleDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算金额拆分 Mapper
|
||||||
|
*
|
||||||
|
* @author 后台管理-1
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface AmountDismantleMapper extends BaseMapperX<AmountDismantleDO> {
|
||||||
|
|
||||||
|
default PageResult<AmountDismantleDO> selectPage(AmountDismantlePageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<AmountDismantleDO>()
|
||||||
|
.likeIfPresent(AmountDismantleDO::getMaterialName, reqVO.getMaterialName())
|
||||||
|
.eqIfPresent(AmountDismantleDO::getMaterialCode, reqVO.getMaterialCode())
|
||||||
|
.eqIfPresent(AmountDismantleDO::getElementAbbreviation, reqVO.getElementAbbreviation())
|
||||||
|
.likeIfPresent(AmountDismantleDO::getElementName, reqVO.getElementName())
|
||||||
|
.eqIfPresent(AmountDismantleDO::getElementCode, reqVO.getElementCode())
|
||||||
|
.eqIfPresent(AmountDismantleDO::getRatio, reqVO.getRatio())
|
||||||
|
.eqIfPresent(AmountDismantleDO::getContractId, reqVO.getContractId())
|
||||||
|
.betweenIfPresent(AmountDismantleDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(AmountDismantleDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.zt.plat.module.contractorder.service.amountdismantle;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.zt.plat.module.contractorder.api.vo.contract.AmountDismantlePageReqVO;
|
||||||
|
import com.zt.plat.module.contractorder.api.vo.contract.AmountDismantleRespVO;
|
||||||
|
import com.zt.plat.module.contractorder.api.vo.contract.AmountDismantleSaveReqVO;
|
||||||
|
import com.zt.plat.module.contractorder.dal.dataobject.amountdismantle.AmountDismantleDO;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算金额拆分 Service 接口
|
||||||
|
*
|
||||||
|
* @author 后台管理-1
|
||||||
|
*/
|
||||||
|
public interface AmountDismantleService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建结算金额拆分
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
AmountDismantleRespVO createAmountDismantle(@Valid AmountDismantleSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新结算金额拆分
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateAmountDismantle(@Valid AmountDismantleSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除结算金额拆分
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteAmountDismantle(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除结算金额拆分
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteAmountDismantleListByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得结算金额拆分
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 结算金额拆分
|
||||||
|
*/
|
||||||
|
AmountDismantleDO getAmountDismantle(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得结算金额拆分分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 结算金额拆分分页
|
||||||
|
*/
|
||||||
|
PageResult<AmountDismantleDO> getAmountDismantlePage(AmountDismantlePageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过合同id查询结算金额拆分
|
||||||
|
*
|
||||||
|
* @param contractId 合同id
|
||||||
|
* @return 结算金额拆分列表
|
||||||
|
*/
|
||||||
|
List<AmountDismantleDO> getAmountDismantleListByContractId(Long contractId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package com.zt.plat.module.contractorder.service.amountdismantle;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.zt.plat.module.contractorder.api.vo.contract.AmountDismantlePageReqVO;
|
||||||
|
import com.zt.plat.module.contractorder.api.vo.contract.AmountDismantleRespVO;
|
||||||
|
import com.zt.plat.module.contractorder.api.vo.contract.AmountDismantleSaveReqVO;
|
||||||
|
import com.zt.plat.module.contractorder.dal.dataobject.amountdismantle.AmountDismantleDO;
|
||||||
|
import com.zt.plat.module.contractorder.dal.mysql.amountdismantle.AmountDismantleMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
|
||||||
|
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
import static com.zt.plat.module.contractorder.enums.ErrorCodeConstants.AMOUNT_DISMANTLE_NOT_EXISTS;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算金额拆分 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 后台管理-1
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class AmountDismantleServiceImpl implements AmountDismantleService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AmountDismantleMapper amountDismantleMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AmountDismantleRespVO createAmountDismantle(AmountDismantleSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
AmountDismantleDO amountDismantle = BeanUtils.toBean(createReqVO, AmountDismantleDO.class);
|
||||||
|
amountDismantleMapper.insert(amountDismantle);
|
||||||
|
// 返回
|
||||||
|
return BeanUtils.toBean(amountDismantle, AmountDismantleRespVO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void updateAmountDismantle(AmountDismantleSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateAmountDismantleExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
AmountDismantleDO updateObj = BeanUtils.toBean(updateReqVO, AmountDismantleDO.class);
|
||||||
|
amountDismantleMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteAmountDismantle(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateAmountDismantleExists(id);
|
||||||
|
// 删除
|
||||||
|
amountDismantleMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteAmountDismantleListByIds(List<Long> ids) {
|
||||||
|
// 校验存在
|
||||||
|
validateAmountDismantleExists(ids);
|
||||||
|
// 删除
|
||||||
|
amountDismantleMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateAmountDismantleExists(List<Long> ids) {
|
||||||
|
List<AmountDismantleDO> list = amountDismantleMapper.selectByIds(ids);
|
||||||
|
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||||
|
throw exception(AMOUNT_DISMANTLE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateAmountDismantleExists(Long id) {
|
||||||
|
if (amountDismantleMapper.selectById(id) == null) {
|
||||||
|
throw exception(AMOUNT_DISMANTLE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AmountDismantleDO getAmountDismantle(Long id) {
|
||||||
|
return amountDismantleMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<AmountDismantleDO> getAmountDismantlePage(AmountDismantlePageReqVO pageReqVO) {
|
||||||
|
return amountDismantleMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AmountDismantleDO> getAmountDismantleListByContractId(Long contractId) {
|
||||||
|
return amountDismantleMapper.selectList(AmountDismantleDO::getContractId, contractId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -27,6 +27,7 @@ import com.zt.plat.module.bpm.api.task.dto.*;
|
|||||||
import com.zt.plat.module.bpm.enums.task.BpmProcessInstanceStatusEnum;
|
import com.zt.plat.module.bpm.enums.task.BpmProcessInstanceStatusEnum;
|
||||||
import com.zt.plat.module.contractorder.api.dto.contract.*;
|
import com.zt.plat.module.contractorder.api.dto.contract.*;
|
||||||
import com.zt.plat.module.contractorder.api.vo.contract.*;
|
import com.zt.plat.module.contractorder.api.vo.contract.*;
|
||||||
|
import com.zt.plat.module.contractorder.dal.dataobject.amountdismantle.AmountDismantleDO;
|
||||||
import com.zt.plat.module.contractorder.dal.dataobject.contract.*;
|
import com.zt.plat.module.contractorder.dal.dataobject.contract.*;
|
||||||
import com.zt.plat.module.contractorder.dal.mysql.contract.*;
|
import com.zt.plat.module.contractorder.dal.mysql.contract.*;
|
||||||
import com.zt.plat.module.contractorder.enums.DateConstants;
|
import com.zt.plat.module.contractorder.enums.DateConstants;
|
||||||
@@ -34,6 +35,7 @@ import com.zt.plat.module.contractorder.enums.DictTypeConstants;
|
|||||||
import com.zt.plat.module.contractorder.enums.ProcessConstants;
|
import com.zt.plat.module.contractorder.enums.ProcessConstants;
|
||||||
import com.zt.plat.module.contractorder.enums.TableFieldConstants;
|
import com.zt.plat.module.contractorder.enums.TableFieldConstants;
|
||||||
import com.zt.plat.module.contractorder.enums.contract.DictEnum;
|
import com.zt.plat.module.contractorder.enums.contract.DictEnum;
|
||||||
|
import com.zt.plat.module.contractorder.service.amountdismantle.AmountDismantleService;
|
||||||
import com.zt.plat.module.contractorder.service.contractreceivesend.ContractReceiveSendService;
|
import com.zt.plat.module.contractorder.service.contractreceivesend.ContractReceiveSendService;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractPageReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractPageReqVO;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractSaveReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractSaveReqVO;
|
||||||
@@ -121,7 +123,8 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ContractReceiveSendService contractReceiveSendService;
|
private ContractReceiveSendService contractReceiveSendService;
|
||||||
|
@Resource
|
||||||
|
private AmountDismantleService amountDismantleService;
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
|
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
|
||||||
return contractMainMapper.selectContractPage(pageReqVO);
|
return contractMainMapper.selectContractPage(pageReqVO);
|
||||||
@@ -316,6 +319,13 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
contractReceiveSendService.createContractReceiveSend(contractReceiveSend);
|
contractReceiveSendService.createContractReceiveSend(contractReceiveSend);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
//插入资金拆分表
|
||||||
|
if(reqVO.getAmountSplit() != null && !reqVO.getAmountSplit().isEmpty()){
|
||||||
|
reqVO.getAmountSplit().forEach(amountDismantle -> {
|
||||||
|
amountDismantle.setContractId(contractId);
|
||||||
|
amountDismantleService.createAmountDismantle(amountDismantle);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return contractId;
|
return contractId;
|
||||||
}
|
}
|
||||||
@@ -950,7 +960,28 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// 执行中合同重新提交erp
|
// 执行中合同重新提交erp
|
||||||
submitErp(newContractMainDO.getId());
|
submitErp(newContractMainDO.getId());
|
||||||
}
|
}
|
||||||
|
//更新收发货规则
|
||||||
|
if (reqVO.getContractReceiveSends() != null && !reqVO.getContractReceiveSends().isEmpty()){
|
||||||
|
//通过合同id删除收发货规则
|
||||||
|
List<ContractReceiveSendRespVO> contractReceiveSendListByContract = contractReceiveSendService.getContractReceiveSendListByContractId(id);
|
||||||
|
contractReceiveSendService.deleteContractReceiveSendListByIds(contractReceiveSendListByContract.stream().map(ContractReceiveSendRespVO::getId).toList());
|
||||||
|
//重新插入收发货规则
|
||||||
|
reqVO.getContractReceiveSends().forEach(item->{
|
||||||
|
item.setContractId(id);
|
||||||
|
item.setId(null);
|
||||||
|
contractReceiveSendService.createContractReceiveSend(item);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//更新资金拆分表(直接先删除后面再插入)
|
||||||
|
if (reqVO.getAmountSplit()!=null &&!reqVO.getAmountSplit().isEmpty()){
|
||||||
|
List<AmountDismantleDO> amountDismantleList = amountDismantleService.getAmountDismantleListByContractId(id);
|
||||||
|
amountDismantleService.deleteAmountDismantleListByIds(amountDismantleList.stream().map(AmountDismantleDO::getId).toList());
|
||||||
|
reqVO.getAmountSplit().forEach(item->{
|
||||||
|
item.setContractId(id);
|
||||||
|
item.setId(null);
|
||||||
|
amountDismantleService.createAmountDismantle(item);
|
||||||
|
});
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user