feat:抵抹账条件新增付款金额小于开票金额,红票审核拒绝后蓝票可重新开红票
8个文件已修改
97 ■■■■■ 已修改文件
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractAddDTO.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/BusinessCustomer.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractSubjectMatter.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/MeterReadRecordServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractAddDTO.java
@@ -63,6 +63,11 @@
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Schema(description = "生效日期")
    private String effectiveDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Schema(description = "到期日期")
    private String expirationDate;
@@ -81,8 +86,8 @@
    @Schema(description = "执行周期 1/周 2/月 3/季度 4/半年 5/年")
    private String execFrequency;
    @Schema(description = "执行次数")
    private Integer execTimes;
//    @Schema(description = "执行次数")
//    private Integer execTimes;
    @Schema(description = "执行日期后多少天生成应收")
    private Integer execDay;
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/BusinessCustomer.java
@@ -73,8 +73,8 @@
   // 煤炭、有色、黑色、电力、其它、氧化铝、化工、水泥、船运
    @Schema(description = "注册资本")
    @Column(columnDefinition = "VARCHAR(128) comment '注册资本'")
    @Schema(description = "注册名称")
    @Column(columnDefinition = "VARCHAR(128) comment '注册名称'")
    private String registerName;
    @Schema(description = "开户银行")
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractSubjectMatter.java
@@ -53,7 +53,7 @@
    private String materialCode;
    @Schema(description = "标的物编码(内部唯一名称)")
    @Column(columnDefinition = "VARCHAR(64) comment '标的物名称(内部)'")
    @Column(columnDefinition = "VARCHAR(200) comment '标的物名称(内部)'")
    private String materialInternalName;
    @Schema(description = "标的物规格/型号")
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractController.java
@@ -51,7 +51,7 @@
    /**
     * 分页查询
     * @param page 分页对象
     * @param contract 合同管理
     * @param queryDTO 合同管理
     * @return
     */
    @Operation(summary = "分页查询" , description = "分页查询" )
@@ -184,7 +184,9 @@
    @GetMapping("/listByBusId/{busId}" )
    public R listByBusId(@PathVariable("busId" ) Long busId) {
        return R.ok(contractService.listByScope(Wrappers.<Contract>lambdaQuery().eq(Contract::getPartyAId,busId)
                .gt(Contract::getBillingAmout,new BigDecimal("0"))));
                .eq(Contract::getPartyBId,SecurityUtils.getUser().getCompId())
                .gt(Contract::getBillingAmout,new BigDecimal("0"))
                .apply("paid_amount < billing_amout")));
    }
    /**
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java
@@ -117,7 +117,7 @@
    private GenInvoiceInfoVo genInvoiceInfoVo(GenInvoiceInfoDTO genInvoiceInfoDTO, Contract contract, SysDept b) {
        GenInvoiceInfoVo vo = new GenInvoiceInfoVo();
        BusinessCustomer a = businessCustomerMapper.selectById(contract.getPartyAId());
        vo.setPartyA(a.getCompanyName());
        vo.setPartyA(a.getRegisterName());
        vo.setPartyAOrgCode(a.getCreditCode());
        vo.setPartyAOpenBank(a.getBankName());
        vo.setPartyABankAccount(a.getBankAccount());
@@ -629,8 +629,11 @@
            }
            //更新合同开票状态
            contract.setBillingStatus("2");
            contract.setBillingAmout(contract.getAmount().subtract(invoice.getInvoiceTotalPriceTax()));
            contract.setBillingAmout(contract.getBillingAmout().subtract(invoice.getInvoiceTotalPriceTax()));
            contractMapper.updateById(contract);
            blueInvoice.setRedReversal("1");
            baseMapper.updateById(blueInvoice);
            //更新合同出库单状态
            List<ContractOutBoundInvoiceVo> outBoundInvoiceVoList = BeanUtil.copyToList(JSONArray.parseArray(blueInvoice.getInvoicePreviewParam()),ContractOutBoundInvoiceVo.class);
@@ -658,5 +661,9 @@
        });
        invoice.setApprovalStatus("2");
        baseMapper.updateById(invoice);
        ContractInvoice blueInvoice = baseMapper.selectById(invoice.getBlueInvoiceId());
        blueInvoice.setRedReversal("0");
        baseMapper.updateById(blueInvoice);
    }
}
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java
@@ -33,7 +33,6 @@
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
@@ -278,10 +277,10 @@
                    .eq(ContractSubjectMatter::getContractId,id));
            if (ArrayUtil.isNotEmpty(subjectMatterList.toArray())) {
                subjectMatterList.stream().forEach(contractSubjectMatter -> {
                for (ContractSubjectMatter contractSubjectMatter: subjectMatterList)  {
                    if (StrUtil.equals(contract.getExecFrequency(), "1")) {
                        Long weeksTrue = DateUtil.betweenWeek(DateUtil.beginOfWeek(contract.getEffectiveDate()),
                                DateUtil.endOfWeek(contract.getExpirationDate()), true);
                                DateUtil.endOfWeek(contract.getExpirationDate()), true)+1;
                        //循环日期
                        Date execDate0 = DateUtil.offsetDay(DateUtil.beginOfWeek(contract.getEffectiveDate()), contract.getExecDay());
                        for (int i = 0; i < weeksTrue.intValue(); i++) {
@@ -298,7 +297,7 @@
                    }
                    if (StrUtil.equals(contract.getExecFrequency(), "2")) {
                        Long weeksTrue = DateUtil.betweenMonth(DateUtil.beginOfMonth(contract.getEffectiveDate()),
                                DateUtil.endOfMonth(contract.getExpirationDate()), true);
                                DateUtil.endOfMonth(contract.getExpirationDate()), true)+1;
                        //循环日期
                        Date execDate0 = DateUtil.offsetDay(DateUtil.beginOfMonth(contract.getEffectiveDate()), contract.getExecDay());
                        for (int i = 0; i < weeksTrue.intValue(); i++) {
@@ -314,11 +313,11 @@
                        }
                    }
                    if (StrUtil.equals(contract.getExecFrequency(), "3")) {
                        Long weeksTrue = DateUtil.betweenMonth(DateUtil.beginOfQuarter(contract.getEffectiveDate()),
                                DateUtil.endOfQuarter(contract.getExpirationDate()), true)/3;
                        Long weeksTrue = (DateUtil.betweenMonth(DateUtil.beginOfQuarter(contract.getEffectiveDate()),
                                DateUtil.endOfQuarter(contract.getExpirationDate()), true)+1)/3;
                        //循环日期
                        Date execDate0 = DateUtil.offsetDay(DateUtil.beginOfWeek(contract.getExpirationDate()), contract.getExecDay());
                        Date execDate0 = DateUtil.offsetDay(DateUtil.beginOfQuarter(contract.getEffectiveDate()), contract.getExecDay());
                        for (int i = 0; i < weeksTrue.intValue(); i++) {
                            Date execDatei = DateUtil.offsetMonth(execDate0, i*3);
                            ContractExecDate execDate = new ContractExecDate();
@@ -348,9 +347,9 @@
                        if (7<=endMonth&&endMonth<=12){
                            endDate = DateUtil.endOfYear(endDate);
                        }
                        Long weeksTrue = DateUtil.betweenMonth(startDate,endDate, true)/6;
                        Long weeksTrue = (DateUtil.betweenMonth(startDate,endDate, true)+1)/6;
                        //循环日期
                        Date execDate0 = DateUtil.offsetDay(DateUtil.beginOfWeek(contract.getExpirationDate()), contract.getExecDay());
                        Date execDate0 = DateUtil.offsetDay(startDate, contract.getExecDay());
                        for (int i = 0; i < weeksTrue.intValue(); i++) {
                            Date execDatei = DateUtil.offsetMonth(execDate0, i*6);
                            ContractExecDate execDate = new ContractExecDate();
@@ -365,7 +364,7 @@
                    }
                    if (StrUtil.equals(contract.getExecFrequency(), "5")) {
                        Long weeksTrue = DateUtil.betweenWeek(DateUtil.beginOfYear(contract.getEffectiveDate()),
                                DateUtil.endOfYear(contract.getExpirationDate()), true);
                                DateUtil.endOfYear(contract.getExpirationDate()), true)+1;
                        //循环日期
                        Date execDate0 = DateUtil.offsetDay(DateUtil.beginOfYear(contract.getEffectiveDate()), contract.getExecDay());
                        for (int i = 0; i < weeksTrue.intValue(); i++) {
@@ -381,7 +380,7 @@
                        }
                    }
                });
                }
            }
        } else {
            ContractPaymentSchedule fitstSchedule = contractPaymentScheduleMapper.selectOne(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, contract.getId())
@@ -698,7 +697,7 @@
        map.put("items", items);
        //定制方
        BusinessCustomer customer = businessCustomerMapper.selectById(contract.getPartyAId());
        map.put("companyName", customer.getCompanyName());
        map.put("companyName", customer.getRegisterName());
        map.put("legalPerson", customer.getLegalPerson());
        map.put("contactPhone", customer.getContactPhone());
        map.put("bankName", customer.getBankName());
@@ -867,7 +866,7 @@
        map.put("items", items);
        //定制方
        BusinessCustomer customer = businessCustomerMapper.selectById(contract.getPartyAId());
        map.put("companyName", customer.getCompanyName());
        map.put("companyName", customer.getRegisterName());
        map.put("legalPerson", customer.getLegalPerson());
        map.put("contactPhone", customer.getContactPhone());
        map.put("bankName", customer.getBankName());
@@ -953,7 +952,7 @@
        map.put("items", items);
        //定制方
        BusinessCustomer customer = businessCustomerMapper.selectById(contract.getPartyAId());
        map.put("companyName", customer.getCompanyName());
        map.put("companyName", customer.getRegisterName());
        map.put("legalPerson", customer.getLegalPerson());
        map.put("contactPhone", customer.getContactPhone());
        map.put("bankName", customer.getBankName());
@@ -1088,7 +1087,7 @@
        map.put("items", items);
        //定制方
        BusinessCustomer customer = businessCustomerMapper.selectById(contract.getPartyAId());
        map.put("companyName", customer.getCompanyName());
        map.put("companyName", customer.getRegisterName());
        map.put("legalPerson", customer.getLegalPerson());
        map.put("contactPhone", customer.getContactPhone());
        map.put("bankName", customer.getBankName());
@@ -1148,6 +1147,8 @@
        Map<String,Object> map = new HashMap<>();
        map.put("contractId",contract.getId());
        map.put("contractName",contract.getContractName());
        map.put("partyA",contract.getPartyA());
        map.put("partyB",contract.getPartyB());
        map.put("delayDay",dto.getDelayDay());
        map.put("applyName",SecurityUtils.getUser().getUsername());
        map.put("applyTime",DateUtil.format(delayOut.getApplyTime(),DatePattern.NORM_DATETIME_FORMAT));
@@ -1165,7 +1166,13 @@
    @Override
    public Page pageScope(Page page, ContracQueryDTO queryDTO) {
        return baseMapper.pageScope(page,queryDTO, DataScope.of("comp_id"));
    }
    public static void main(String[] args) {
        System.out.println(DateUtil.beginOfQuarter(DateUtil.parseDate("2026-06-05")));
        System.out.println(DateUtil.endOfQuarter(DateUtil.parseDate("2026-09-30")));
        System.out.println(DateUtil.betweenMonth(DateUtil.beginOfQuarter(DateUtil.parseDate("2026-06-05")),
                DateUtil.endOfQuarter(DateUtil.parseDate("2026-09-30")),true));
    }
}
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/MeterReadRecordServiceImpl.java
@@ -35,10 +35,10 @@
                .eq(MeterReadRecord::getMeterReadCode,updateDTO.getMeterReadCode()).lt(MeterReadRecord::getCreateTime,record.getCreateTime())
                .orderByDesc(MeterReadRecord::getCreateTime).last("limit 1"));
        if(ObjUtil.isNull(lastRecord)){
            return R.failed("无最近抄号记录");
            return R.failed("无最近抄表记录");
        }
        if (updateDTO.getMeterReadNum().compareTo(lastRecord.getMeterReadNum())<0){
            return R.failed("抄号数字不能比上次少");
        if (updateDTO.getMeterReadNum().compareTo(lastRecord.getMeterReadNum())<=0){
            return R.failed("抄表数字不能比上次少");
        }
        record.setMeterReadTime(updateDTO.getMeterReadTime());
        record.setMeterReadNum(updateDTO.getMeterReadNum());
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java
@@ -74,7 +74,7 @@
        if (StrUtil.isNotBlank(addDTO.getContractNo())) {
            Contract contract = contractService.getOne(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo, addDTO.getContractNo()));
            BusinessCustomer customer = businessCustomerService.getOne(Wrappers.<BusinessCustomer>lambdaQuery()
                    .eq(StrUtil.isNotBlank(addDTO.getBusGuestName()), BusinessCustomer::getCompanyName, addDTO.getBusGuestName())
                    .eq(StrUtil.isNotBlank(addDTO.getBusGuestName()), BusinessCustomer::getRegisterName, addDTO.getBusGuestName())
                    .eq(StrUtil.isNotBlank(addDTO.getBusGuestId()), BusinessCustomer::getId, addDTO.getBusGuestId()));
            if (ObjUtil.isNull(customer)) {
                return R.failed("客商查询失败,请检查客商");
@@ -99,7 +99,7 @@
                    entity.setScheduleName(lastConfirm.getScheduleName());
                }
                entity.setBusGuestId(customer.getId());
                entity.setBusGuestName(customer.getCompanyName());
                entity.setBusGuestName(customer.getRegisterName());
                entity.setBusinessType("客户付款");
                if (newtotal.compareTo(new BigDecimal("0")) > 0) {
                    entity.setTransationAmount(addDTO.getTransationAmount());
@@ -193,7 +193,7 @@
                entity.setContractNo(addDTO.getContractNo());
                entity.setBusGuestId(customer.getId());
                entity.setBusGuestName(customer.getCompanyName());
                entity.setBusGuestName(customer.getRegisterName());
                entity.setBusinessType("");
                entity.setTransationAmount(addDTO.getTransationAmount());
                BigDecimal newtotal = addDTO.getTransationAmount().multiply(new BigDecimal("-1")).add(lastConfirm.getTotalAmount());
@@ -225,7 +225,7 @@
                return R.failed("为查询到未付款合同");
            }
            BusinessCustomer customer = businessCustomerService.getOne(Wrappers.<BusinessCustomer>lambdaQuery()
                    .eq(StrUtil.isNotBlank(addDTO.getBusGuestName()), BusinessCustomer::getCompanyName, addDTO.getBusGuestName())
                    .eq(StrUtil.isNotBlank(addDTO.getBusGuestName()), BusinessCustomer::getRegisterName, addDTO.getBusGuestName())
                    .eq(ObjUtil.isNotNull(addDTO.getBusGuestId()), BusinessCustomer::getId, addDTO.getBusGuestId())
                    .last("limit 1"));
            if (ObjUtil.isNull(customer)) {
@@ -234,7 +234,7 @@
            //新增付款单
            PaymentSlip slip = new PaymentSlip();
            slip.setBusGuestId(customer.getId());
            slip.setBusGuestName(customer.getCompanyName());
            slip.setBusGuestName(customer.getRegisterName());
            slip.setPayeeCompId(SecurityUtils.getUser().getCompId());
            slip.setPaymentTime(addDTO.getConfirmTime());
            slip.setPaymentAmount(addDTO.getTransationAmount());
@@ -285,7 +285,7 @@
                    entity.setScheduleName(lastConfirm.getScheduleName());
                }
                entity.setBusGuestId(customer.getId());
                entity.setBusGuestName(customer.getCompanyName());
                entity.setBusGuestName(customer.getRegisterName());
                entity.setBusinessType("客户付款");
                if (transtionRemainAmount.compareTo(new BigDecimal("0")) > 0) {
                    entity.setConfirmTime(payDate);
@@ -571,7 +571,7 @@
            return;
        }
        BusinessCustomer customer = businessCustomerService.getOne(Wrappers.<BusinessCustomer>lambdaQuery()
                .eq(StrUtil.isNotBlank(record.getString("bodyItemCustomerName")), BusinessCustomer::getCompanyName, record.getString("bodyItemCustomerName"))
                .eq(StrUtil.isNotBlank(record.getString("bodyItemCustomerName")), BusinessCustomer::getRegisterName, record.getString("bodyItemCustomerName"))
        );
        if (ObjUtil.isNull(customer)) {
            log.error("付款单id:{},客商查询失败,请检查客商", record.getString("id"));
@@ -627,7 +627,7 @@
                entity.setScheduleName(lastConfirm.getScheduleName());
            }
            entity.setBusGuestId(customer.getId());
            entity.setBusGuestName(customer.getCompanyName());
            entity.setBusGuestName(customer.getRegisterName());
            entity.setBusinessType("客户付款");
            entity.setIsBip(1);
            entity.setPaymentCode(record.getString("code"));
@@ -784,7 +784,7 @@
    private Boolean savePaymentSlip(BusinessCustomer customer, JSONObject record,SysDept dept) {
        PaymentSlip slip = new PaymentSlip();
        slip.setBusGuestId(customer.getId());
        slip.setBusGuestName(customer.getCompanyName());
        slip.setBusGuestName(customer.getRegisterName());
        slip.setPayee(dept.getName());
        slip.setPayeeCompId(dept.getDeptId());
        slip.setPaymentTime(ObjUtil.isNotNull(record.get("billDate"))?
@@ -821,7 +821,7 @@
        }
        entity.setBusGuestId(customer.getId());
        entity.setBusGuestName(customer.getCompanyName());
        entity.setBusGuestName(customer.getRegisterName());
        entity.setBusinessType("客户付款");
        if (ObjUtil.isNotNull(record)){
            entity.setIsBip(1);