feat:新增房屋租赁/水电代缴合同新增功能 新增逾期出库功能 新增水电代缴合同抄表功能
| | |
| | | @Schema(description = "签署日期") |
| | | private Date signDate; |
| | | |
| | | @Schema(description = "备注") |
| | | private String signPlace; |
| | | |
| | | @Schema(description = "交付周期") |
| | | private Integer deliveryCycle; |
| | | |
| | |
| | | @Schema(description = "抄表单据路径") |
| | | private String meterReadAttPaths; |
| | | |
| | | @Schema(description = "计量单位") |
| | | private String unit; |
| | | |
| | | @Schema(description = "单重") |
| | | private BigDecimal singleWight; |
| | | |
| | | @Schema(description = "总重") |
| | | private BigDecimal totalWight; |
| | | |
| | | } |
| New file |
| | |
| | | package com.by4cloud.platformx.business.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class DeliveryOverdueQueryDTO { |
| | | |
| | | private String industryId; |
| | | |
| | | private String areaId; |
| | | |
| | | private String partyB; |
| | | |
| | | private String contractName; |
| | | |
| | | } |
| | |
| | | @Schema(description = "抄表单据路径") |
| | | @Column(columnDefinition="text comment '单据路径'") |
| | | private String meterReadAttPaths; |
| | | |
| | | @Schema(description = "单重") |
| | | @Column(columnDefinition = "decimal(10,2) comment '单重 /kg'") |
| | | private BigDecimal singleWight; |
| | | |
| | | @Schema(description = "总重") |
| | | @Column(columnDefinition = "decimal(10,2) comment '总重 /kg'") |
| | | private BigDecimal totalWight; |
| | | } |
| New file |
| | |
| | | package com.by4cloud.platformx.business.entity; |
| | | |
| | | import com.by4cloud.platformx.common.data.mybatis.BaseModel; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.persistence.Column; |
| | | import jakarta.persistence.Entity; |
| | | import lombok.Data; |
| | | import org.hibernate.annotations.Table; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 2026年5月28日 10:52:02 |
| | | * syt |
| | | */ |
| | | @Data |
| | | @Entity//加了才能自动生成表 |
| | | @Table(appliesTo="delivery_overdue",comment = "出货逾期")//给表加注释 |
| | | @jakarta.persistence.Table(name = "delivery_overdue")//数据库创建的表明 |
| | | public class DeliveryOverdue extends BaseModel<DeliveryOverdue> { |
| | | |
| | | @Schema(description = "客商名称") |
| | | @Column(columnDefinition="VARCHAR(64) comment '客商名称'") |
| | | private String busGuestName; |
| | | |
| | | @Schema(description = "客商ID") |
| | | @Column(columnDefinition="bigint comment '客商ID'") |
| | | private Long busGuestId; |
| | | |
| | | @Schema(description = "合同名称") |
| | | @Column(columnDefinition="VARCHAR(64) comment '合同名称'") |
| | | private String contractName; |
| | | |
| | | @Schema(description = "合同ID") |
| | | @Column(columnDefinition="bigint comment '合同ID'") |
| | | private Long contractId; |
| | | |
| | | @Schema(description = "标的物名称") |
| | | @Column(columnDefinition = "VARCHAR(200) comment '标的物名称'") |
| | | private String materialName; |
| | | |
| | | @Schema(description = "标的物编码(内部唯一编码)") |
| | | @Column(columnDefinition = "VARCHAR(64) comment '标的物编码'") |
| | | private String materialCode; |
| | | |
| | | @Schema(description = "标的物编码(内部唯一名称)") |
| | | @Column(columnDefinition = "VARCHAR(64) comment '标的物名称(内部)'") |
| | | private String materialInternalName; |
| | | |
| | | @Schema(description = "逾期交付数量") |
| | | @Column(columnDefinition="decimal(10,2) comment '逾期交付数量'") |
| | | private BigDecimal overdueNum; |
| | | |
| | | @Schema(description = "总金额") |
| | | @Column(columnDefinition="decimal(10,2) comment '总金额 /元 两位小数'") |
| | | private BigDecimal totalAmount; |
| | | |
| | | @Schema(description = "逾期时长") |
| | | @Column(columnDefinition="decimal(10,0) comment '逾期时长 /天'") |
| | | private BigDecimal overdueDuration; |
| | | |
| | | } |
| | |
| | | @Schema(description = "模版ID") |
| | | private Long templateId; |
| | | |
| | | @Schema(description = "合同分类") |
| | | private String contractCategory; |
| | | |
| | | private List<ContractPaymentSchedule> contractPaymentSchedule; |
| | | |
| | | private List<ContractSubjectMatter> contractSubjectMatter; |
| New file |
| | |
| | | package com.by4cloud.platformx.business.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.persistence.Column; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class DeliveryOverduePageVo { |
| | | |
| | | private Long id; |
| | | |
| | | @Schema(description = "客商名称") |
| | | private String busGuestName; |
| | | |
| | | @Schema(description = "客商ID") |
| | | private Long busGuestId; |
| | | |
| | | @Schema(description = "合同名称") |
| | | private String contractName; |
| | | |
| | | @Schema(description = "合同ID") |
| | | private Long contractId; |
| | | |
| | | @Schema(description = "标的物名称") |
| | | private String materialName; |
| | | |
| | | @Schema(description = "标的物编码(内部唯一编码)") |
| | | private String materialCode; |
| | | |
| | | @Schema(description = "标的物编码(内部唯一名称)") |
| | | private String materialInternalName; |
| | | |
| | | @Schema(description = "逾期交付数量") |
| | | private BigDecimal overdueNum; |
| | | |
| | | @Schema(description = "总金额") |
| | | private BigDecimal totalAmount; |
| | | |
| | | @Schema(description = "逾期时长") |
| | | private BigDecimal overdueDuration; |
| | | |
| | | @Schema(description = "生产单位") |
| | | private String partyA; |
| | | } |
| New file |
| | |
| | | package com.by4cloud.platformx.business.controller; |
| | | |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.by4cloud.platformx.business.dto.DeliveryOverdueQueryDTO; |
| | | import com.by4cloud.platformx.common.core.util.R; |
| | | import com.by4cloud.platformx.common.log.annotation.SysLog; |
| | | import com.by4cloud.platformx.business.entity.DeliveryOverdue; |
| | | import com.by4cloud.platformx.business.service.DeliveryOverdueService; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import com.by4cloud.platformx.common.excel.annotation.ResponseExcel; |
| | | import io.swagger.v3.oas.annotations.security.SecurityRequirement; |
| | | import org.springdoc.core.annotations.ParameterObject; |
| | | import org.springframework.http.HttpHeaders; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 出货逾期 |
| | | * |
| | | * @author syt |
| | | * @date 2026-05-28 11:01:05 |
| | | */ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @RequestMapping("/deliveryOverdue" ) |
| | | @Tag(description = "deliveryOverdue" , name = "出货逾期管理" ) |
| | | @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) |
| | | public class DeliveryOverdueController { |
| | | |
| | | private final DeliveryOverdueService deliveryOverdueService; |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param page 分页对象 |
| | | * @param queryDTO 出货逾期 |
| | | * @return |
| | | */ |
| | | @Operation(summary = "分页查询" , description = "分页查询" ) |
| | | @GetMapping("/page" ) |
| | | @PreAuthorize("@pms.hasPermission('business_deliveryOverdue_view')" ) |
| | | public R getDeliveryOverduePage(@ParameterObject Page page, @ParameterObject DeliveryOverdueQueryDTO queryDTO) { |
| | | LambdaQueryWrapper<DeliveryOverdue> wrapper = Wrappers.lambdaQuery(); |
| | | return R.ok(deliveryOverdueService.pageNew(page, queryDTO)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过id查询出货逾期 |
| | | * @param id id |
| | | * @return R |
| | | */ |
| | | @Operation(summary = "通过id查询" , description = "通过id查询" ) |
| | | @GetMapping("/{id}" ) |
| | | @PreAuthorize("@pms.hasPermission('business_deliveryOverdue_view')" ) |
| | | public R getById(@PathVariable("id" ) Long id) { |
| | | return R.ok(deliveryOverdueService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 新增出货逾期 |
| | | * @param deliveryOverdue 出货逾期 |
| | | * @return R |
| | | */ |
| | | @Operation(summary = "新增出货逾期" , description = "新增出货逾期" ) |
| | | @SysLog("新增出货逾期" ) |
| | | @PostMapping |
| | | @PreAuthorize("@pms.hasPermission('business_deliveryOverdue_add')" ) |
| | | public R save(@RequestBody DeliveryOverdue deliveryOverdue) { |
| | | return R.ok(deliveryOverdueService.save(deliveryOverdue)); |
| | | } |
| | | |
| | | /** |
| | | * 修改出货逾期 |
| | | * @param deliveryOverdue 出货逾期 |
| | | * @return R |
| | | */ |
| | | @Operation(summary = "修改出货逾期" , description = "修改出货逾期" ) |
| | | @SysLog("修改出货逾期" ) |
| | | @PutMapping |
| | | @PreAuthorize("@pms.hasPermission('business_deliveryOverdue_edit')" ) |
| | | public R updateById(@RequestBody DeliveryOverdue deliveryOverdue) { |
| | | return R.ok(deliveryOverdueService.updateById(deliveryOverdue)); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除出货逾期 |
| | | * @param ids id列表 |
| | | * @return R |
| | | */ |
| | | @Operation(summary = "通过id删除出货逾期" , description = "通过id删除出货逾期" ) |
| | | @SysLog("通过id删除出货逾期" ) |
| | | @DeleteMapping |
| | | @PreAuthorize("@pms.hasPermission('business_deliveryOverdue_del')" ) |
| | | public R removeById(@RequestBody Long[] ids) { |
| | | return R.ok(deliveryOverdueService.removeBatchByIds(CollUtil.toList(ids))); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出excel 表格 |
| | | * @param deliveryOverdue 查询条件 |
| | | * @param ids 导出指定ID |
| | | * @return excel 文件流 |
| | | */ |
| | | @ResponseExcel |
| | | @GetMapping("/export") |
| | | @PreAuthorize("@pms.hasPermission('business_deliveryOverdue_export')" ) |
| | | public List<DeliveryOverdue> export(DeliveryOverdue deliveryOverdue,Long[] ids) { |
| | | return deliveryOverdueService.list(Wrappers.lambdaQuery(deliveryOverdue).in(ArrayUtil.isNotEmpty(ids), DeliveryOverdue::getId, ids)); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.by4cloud.platformx.business.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.by4cloud.platformx.business.dto.DeliveryOverdueQueryDTO; |
| | | import com.by4cloud.platformx.business.entity.DeliveryOverdue; |
| | | import com.by4cloud.platformx.business.vo.DeliveryOverduePageVo; |
| | | import com.by4cloud.platformx.common.data.datascope.DataScope; |
| | | import com.by4cloud.platformx.common.data.datascope.PlatformxBaseMapper; |
| | | ; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | @Mapper |
| | | public interface DeliveryOverdueMapper extends PlatformxBaseMapper<DeliveryOverdue> { |
| | | |
| | | |
| | | Page<DeliveryOverduePageVo> pageNew(Page page, @Param("queryDTO") DeliveryOverdueQueryDTO queryDTO, DataScope comp_id); |
| | | } |
| New file |
| | |
| | | package com.by4cloud.platformx.business.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.by4cloud.platformx.business.dto.DeliveryOverdueQueryDTO; |
| | | import com.by4cloud.platformx.business.entity.DeliveryOverdue; |
| | | import com.by4cloud.platformx.common.data.mybatis.IIService; |
| | | |
| | | public interface DeliveryOverdueService extends IIService<DeliveryOverdue> { |
| | | |
| | | Page pageNew(Page page, DeliveryOverdueQueryDTO queryDTO); |
| | | } |
| | |
| | | subjectMatter.setDeliveredQuantity(new BigDecimal("0")); |
| | | subjectMatter.setDeliveryStatus(0); |
| | | contractSubjectMatterMapper.insert(subjectMatter); |
| | | //水电类必须有初次表号 |
| | | if (StrUtil.isNotEmpty(contractSubjectMatterAddDTO.getMeterReadCode()) && |
| | | ObjUtil.isNotNull(contractSubjectMatterAddDTO.getMeterReadNum())) { |
| | | meterReadRecordMapper.delete(Wrappers.<MeterReadRecord>lambdaQuery().eq(MeterReadRecord::getContractId, contract.getId())); |
| | | MeterReadRecord record = BeanUtil.copyProperties(contractSubjectMatterAddDTO, MeterReadRecord.class,"id"); |
| | | record.setContractId(contract.getId()); |
| | | record.setMatterId(subjectMatter.getId()); |
| | | record.setContractName(contract.getContractName()); |
| | | record.setBusGuestId(contract.getPartyAId()); |
| | | record.setBusGuestName(contract.getPartyA()); |
| | | record.setMeterReadTime(new Date()); |
| | | meterReadRecordMapper.insert(record); |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | PaymentConfirm oiverdueConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getScheduleId, contractPaymentSchedule.getId()) |
| | | .eq(PaymentConfirm::getBusinessType, "应收超期")); |
| | | if (ObjUtil.isNull(oiverdueConfirm) && overdueConfirm.getTransationAmount().compareTo(new BigDecimal("0")) > 0) { |
| | | overdueConfirm.setCompId(contractPaymentSchedule.getCompId()); |
| | | paymentConfirmMapper.insert(overdueConfirm); |
| | | } |
| | | //当前逾期 |
| | |
| | | CurrentOverdue overdue = currentOverdueMapper.selectOne(Wrappers.<CurrentOverdue>lambdaQuery().eq(CurrentOverdue::getContractId, currentOverdue.getContractId()) |
| | | .eq(CurrentOverdue::getScheduleId, currentOverdue.getScheduleId()).last("limit 1")); |
| | | if (ObjUtil.isNull(overdue)) { |
| | | currentOverdue.setCompId(contractPaymentSchedule.getCompId()); |
| | | if (currentOverdue.getReceivableAmount().compareTo(new BigDecimal("0")) > 0) { |
| | | currentOverdueMapper.insert(currentOverdue); |
| | | } |
| | |
| | | Map<String, Object> item = new HashMap<>(); |
| | | item.put("no", no); |
| | | item.put("materialName", contractSubjectMatter.getMaterialName()); |
| | | item.put("guige", ""); |
| | | item.put("unit", ""); |
| | | item.put("guige", contractSubjectMatter.getSpecification()); |
| | | item.put("unit", contractSubjectMatter.getUnit()); |
| | | item.put("quantity", contractSubjectMatter.getQuantity()); |
| | | item.put("danzhong", ""); |
| | | item.put("zongzhong", ""); |
| | | item.put("danzhong", contractSubjectMatter.getSingleWight()); |
| | | item.put("zongzhong", contractSubjectMatter.getTotalWight()); |
| | | item.put("unitPrice", contractSubjectMatter.getUnitPrice()); |
| | | item.put("price", contractSubjectMatter.getTotalAmount()); |
| | | items.add(item); |
| | |
| | | record.setBusGuestName(contract.getPartyA()); |
| | | meterReadRecordMapper.insert(record); |
| | | }else { |
| | | //创建收款节点 |
| | | //查询上次收款节点 |
| | | ContractPaymentSchedule lastSchedule = contractPaymentScheduleMapper.selectOne(Wrappers.<ContractPaymentSchedule>lambdaQuery() |
| | | .eq(ContractPaymentSchedule::getContractId,contract.getId()) |
| | | .orderByDesc(ContractPaymentSchedule::getCreateTime).last("limit 1")); |
| | | ContractPaymentSchedule schedule = new ContractPaymentSchedule(); |
| | | schedule.setStageName("房租租赁缴费"); |
| | | schedule.setContractId(contract.getId()); |
| | | schedule.setContractName(contract.getContractName()); |
| | | schedule.setPlannedAmount(subjectMatter.getUnitPrice().multiply(subjectMatter.getQuantity())); |
| | | schedule.setEffectiveEndDate(contractExecDate.getExecDate()); |
| | | schedule.setStageOrder(1); |
| | | if (ObjUtil.isNotNull(lastSchedule)){ |
| | | schedule.setStageOrder(lastSchedule.getStageOrder()+1); |
| | | } |
| | | schedule.setPaymentStatus(0); |
| | | schedule.setActualAmount(new BigDecimal("0")); |
| | | schedule.setCompId(contract.getCompId()); |
| | | contractPaymentScheduleMapper.insert(schedule); |
| | | //房屋租赁生成应收 |
| | | PaymentConfirm confirm = new PaymentConfirm(); |
| | | confirm.setBusinessType("房屋租赁应收"); |
| | |
| | | confirm.setContractId(contract.getId()); |
| | | confirm.setContractName(contract.getContractName()); |
| | | confirm.setContractNo(contract.getContractNo()); |
| | | confirm.setScheduleId(schedule.getId()); |
| | | confirm.setScheduleName(schedule.getStageName()); |
| | | confirm.setConfirmTime(contractExecDate.getExecDate()); |
| | | confirm.setTransationAmount(subjectMatter.getUnitPrice().multiply(subjectMatter.getQuantity())); |
| | | confirm.setTotalAmount(confirm.getTransationAmount().multiply(new BigDecimal("-1"))); |
| New file |
| | |
| | | package com.by4cloud.platformx.business.service.impl; |
| | | |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.by4cloud.platformx.business.dto.DeliveryOverdueQueryDTO; |
| | | import com.by4cloud.platformx.business.entity.BusinessCustomer; |
| | | import com.by4cloud.platformx.business.entity.Contract; |
| | | import com.by4cloud.platformx.business.entity.DeliveryOverdue; |
| | | import com.by4cloud.platformx.business.mapper.DeliveryOverdueMapper; |
| | | import com.by4cloud.platformx.business.service.DeliveryOverdueService; |
| | | import com.by4cloud.platformx.business.vo.DeliveryOverduePageVo; |
| | | import com.by4cloud.platformx.common.data.datascope.DataScope; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.springframework.stereotype.Service; |
| | | /** |
| | | * 出货逾期 |
| | | * |
| | | * @author syt |
| | | * @date 2026-05-28 11:01:05 |
| | | */ |
| | | @Service |
| | | public class DeliveryOverdueServiceImpl extends ServiceImpl<DeliveryOverdueMapper, DeliveryOverdue> implements DeliveryOverdueService { |
| | | @Override |
| | | public Page pageNew(Page page, DeliveryOverdueQueryDTO queryDTO) { |
| | | MPJLambdaWrapper<DeliveryOverdue> wrapper = new MPJLambdaWrapper<DeliveryOverdue>() |
| | | .selectAll(DeliveryOverdue.class) |
| | | .leftJoin(Contract.class,Contract::getId,DeliveryOverdue::getContractId) |
| | | .leftJoin(BusinessCustomer.class,BusinessCustomer::getId,Contract::getPartyAId) |
| | | .eq(ObjUtil.isNotNull(queryDTO.getAreaId()),BusinessCustomer::getAreaId,queryDTO.getAreaId()) |
| | | .eq(ObjUtil.isNotNull(queryDTO.getIndustryId()),BusinessCustomer::getIndustryId,queryDTO.getIndustryId()) |
| | | .like(StrUtil.isNotBlank(queryDTO.getPartyB()),Contract::getPartyB,queryDTO.getPartyB()) |
| | | .like(StrUtil.isNotBlank(queryDTO.getContractName()),Contract::getContractName,queryDTO.getContractName()) |
| | | .orderByDesc(DeliveryOverdue::getCreateTime); |
| | | return baseMapper.pageNew(page,queryDTO, DataScope.of("comp_id")); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.by4cloud.platformx.business.dto.MeterReadRecordUpdateDTO; |
| | | import com.by4cloud.platformx.business.entity.Contract; |
| | | import com.by4cloud.platformx.business.entity.ContractSubjectMatter; |
| | | import com.by4cloud.platformx.business.entity.MeterReadRecord; |
| | | import com.by4cloud.platformx.business.entity.PaymentConfirm; |
| | | import com.by4cloud.platformx.business.mapper.ContractMapper; |
| | | import com.by4cloud.platformx.business.mapper.ContractSubjectMatterMapper; |
| | | import com.by4cloud.platformx.business.mapper.MeterReadRecordMapper; |
| | | import com.by4cloud.platformx.business.mapper.PaymentConfirmMapper; |
| | | import com.by4cloud.platformx.business.entity.*; |
| | | import com.by4cloud.platformx.business.mapper.*; |
| | | import com.by4cloud.platformx.business.service.MeterReadRecordService; |
| | | import com.by4cloud.platformx.common.core.util.R; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | |
| | | private final ContractMapper contractMapper; |
| | | private final ContractSubjectMatterMapper contractSubjectMatterMapper; |
| | | private final ContractPaymentScheduleMapper contractPaymentScheduleMapper; |
| | | private final PaymentConfirmMapper paymentConfirmMapper; |
| | | |
| | | @Override |
| | |
| | | if(ObjUtil.isNull(lastRecord)){ |
| | | R.failed("无合同信息,请联系技术人员"); |
| | | } |
| | | //创建收款节点 |
| | | //查询上次收款节点 |
| | | ContractPaymentSchedule lastSchedule = contractPaymentScheduleMapper.selectOne(Wrappers.<ContractPaymentSchedule>lambdaQuery() |
| | | .eq(ContractPaymentSchedule::getContractId,contract.getId()) |
| | | .orderByDesc(ContractPaymentSchedule::getCreateTime).last("limit 1")); |
| | | ContractPaymentSchedule schedule = new ContractPaymentSchedule(); |
| | | schedule.setStageName("水电代缴"); |
| | | schedule.setContractId(contract.getId()); |
| | | schedule.setContractName(contract.getContractName()); |
| | | schedule.setPlannedAmount(subjectMatter.getUnitPrice().multiply(updateDTO.getMeterReadNum().subtract(lastRecord.getMeterReadNum()))); |
| | | schedule.setEffectiveEndDate(updateDTO.getMeterReadTime()); |
| | | schedule.setStageOrder(1); |
| | | if (ObjUtil.isNotNull(lastSchedule)){ |
| | | schedule.setStageOrder(lastSchedule.getStageOrder()+1); |
| | | } |
| | | schedule.setPaymentStatus(0); |
| | | schedule.setActualAmount(new BigDecimal("0")); |
| | | contractPaymentScheduleMapper.insert(schedule); |
| | | //房屋租赁生成应收 |
| | | PaymentConfirm confirm = new PaymentConfirm(); |
| | | confirm.setBusinessType(subjectMatter.getMaterialInternalName()+"应收"); |
| | | confirm.setBusGuestId(contract.getPartyAId()); |
| | |
| | | private final ContractMapper contractMapper; |
| | | private final ContractPaymentScheduleProcessMapper scheduleProcessMapper; |
| | | private final ContractOutBoundMapper contractOutBoundMapper; |
| | | private final DeliveryOverdueMapper deliveryOverdueMapper; |
| | | |
| | | @Override |
| | | public R add(OutBoundAddDTO addDTO) { |
| | |
| | | contractOutBound.setOutBoundAttPaths(addDTO.getOutBoundAttPaths()); |
| | | contractOutBound.setOutBoundId(outBoundId); |
| | | contractOutBoundMapper.insert(contractOutBound); |
| | | if (StrUtil.isEmpty(contract.getContractCategory())){ |
| | | if (DateUtil.compare(addDTO.getOutBoundTime(),contract.getExpirationDate())>0){ |
| | | saveOverdueOutBound(contract, addDTO, subjectMatter); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void saveOverdueOutBound(Contract contract, OutBoundAddDTO addDTO, ContractSubjectMatter subjectMatter) { |
| | | DeliveryOverdue overdue = new DeliveryOverdue(); |
| | | overdue.setContractId(contract.getId()); |
| | | overdue.setContractName(contract.getContractName()); |
| | | overdue.setBusGuestId(contract.getPartyAId()); |
| | | overdue.setBusGuestName(contract.getPartyA()); |
| | | overdue.setMaterialName(subjectMatter.getMaterialName()); |
| | | overdue.setMaterialInternalName(subjectMatter.getMaterialInternalName()); |
| | | overdue.setMaterialCode(subjectMatter.getMaterialCode()); |
| | | overdue.setOverdueNum(subjectMatter.getLastDeliveredQuantity()); |
| | | overdue.setTotalAmount(subjectMatter.getUnitPrice().multiply(subjectMatter.getLastDeliveredQuantity())); |
| | | overdue.setOverdueDuration(new BigDecimal(DateUtil.betweenDay(addDTO.getOutBoundTime(),contract.getExpirationDate(),true))); |
| | | deliveryOverdueMapper.insert(overdue); |
| | | } |
| | | } |
| | |
| | | private final HistoryOverdueMapper historyOverdueMapper; |
| | | private final PaymentSlipMapper paymentSlipMapper; |
| | | private final BipRequestRecordMapper bipRequestRecordMapper; |
| | | private final ContractExecDateMapper contractExecDateMapper; |
| | | private final RemoteDeptService remoteDeptService; |
| | | private final RedisTemplate redisTemplate; |
| | | |
| | |
| | | if (contract.getAmount().compareTo(contract.getPaidAmount()) > 0) { |
| | | payNoCompleteContractList.add(contract); |
| | | } |
| | | contractService.updateById(contract); |
| | | if (StrUtil.isNotEmpty(contract.getContractCategory())&&StrUtil.equals(contract.getContractCategory(),"water_house")){ |
| | | List<ContractExecDate> execDateList = contractExecDateMapper.selectList(Wrappers.<ContractExecDate>lambdaQuery() |
| | | .eq(ContractExecDate::getContractId,contract.getId()).eq(ContractExecDate::getGenFlag,"0")); |
| | | if (ArrayUtil.isEmpty(execDateList.toArray())){ |
| | | List<ContractPaymentSchedule> contractPaymentScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery() |
| | | .eq(ContractPaymentSchedule::getContractId, contract.getId())); |
| | | if (ArrayUtil.isNotEmpty(contractPaymentScheduleList.toArray())&&contractPaymentScheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) { |
| | | contract.setContractStatus(3); |
| | | contractService.updateById(contract); |
| | | } |
| | | } |
| | | }else { |
| | | contractService.updateById(contract); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | |
| | |
| | | if (contract.getAmount().compareTo(contract.getPaidAmount()) > 0) { |
| | | payNoCompleteContractList.add(contract); |
| | | } |
| | | contractService.updateById(contract); |
| | | if (StrUtil.isNotEmpty(contract.getContractCategory())&&StrUtil.equals(contract.getContractCategory(),"water_house")){ |
| | | List<ContractExecDate> execDateList = contractExecDateMapper.selectList(Wrappers.<ContractExecDate>lambdaQuery() |
| | | .eq(ContractExecDate::getContractId,contract.getId()).eq(ContractExecDate::getGenFlag,"0")); |
| | | if (ArrayUtil.isEmpty(execDateList)){ |
| | | List<ContractPaymentSchedule> contractPaymentScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery() |
| | | .eq(ContractPaymentSchedule::getContractId, contract.getId())); |
| | | if (ArrayUtil.isNotEmpty(contractPaymentScheduleList.toArray())&&contractPaymentScheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) { |
| | | contract.setContractStatus(3); |
| | | contractService.updateById(contract); |
| | | } |
| | | } |
| | | }else { |
| | | contractService.updateById(contract); |
| | | } |
| | | } |
| | | }); |
| | | |
| New file |
| | |
| | | <?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.by4cloud.platformx.business.mapper.DeliveryOverdueMapper"> |
| | | |
| | | <resultMap id="deliveryOverdueMap" type="com.by4cloud.platformx.business.entity.DeliveryOverdue"> |
| | | <id property="id" column="id"/> |
| | | <result property="compId" column="comp_id"/> |
| | | <result property="busGuestId" column="bus_guest_id"/> |
| | | <result property="busGuestName" column="bus_guest_name"/> |
| | | <result property="contractId" column="contract_id"/> |
| | | <result property="contractName" column="contract_name"/> |
| | | <result property="materialCode" column="material_code"/> |
| | | <result property="materialInternalName" column="material_internal_name"/> |
| | | <result property="materialName" column="material_name"/> |
| | | <result property="overdueDuration" column="overdue_duration"/> |
| | | <result property="overdueNum" column="overdue_num"/> |
| | | <result property="totalAmount" column="total_amount"/> |
| | | <result property="createBy" column="create_by"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateBy" column="update_by"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | <result property="delFlag" column="del_flag"/> |
| | | </resultMap> |
| | | <select id="pageNew" resultType="com.by4cloud.platformx.business.vo.DeliveryOverduePageVo"> |
| | | SELECT |
| | | t.id, |
| | | t.bus_guest_name, |
| | | t.bus_guest_id, |
| | | t.contract_name, |
| | | t.contract_id, |
| | | t.material_name, |
| | | t.material_code, |
| | | t.material_internal_name, |
| | | t.overdue_num, |
| | | t.total_amount, |
| | | t.overdue_duration, |
| | | t.create_by, |
| | | t.update_by, |
| | | t.create_time, |
| | | t.update_time, |
| | | t.del_flag, |
| | | t.comp_id, |
| | | t1.party_a |
| | | FROM |
| | | delivery_overdue t |
| | | LEFT JOIN contract t1 ON ( t1.id = t.contract_id AND t1.del_flag = '0' ) |
| | | LEFT JOIN business_customer t2 ON ( t2.id = t1.party_a_id AND t2.del_flag = '0' ) |
| | | WHERE |
| | | t.del_flag = '0' |
| | | <if test="queryDTO.areaId !=null and queryDTO.areaId !='' "> |
| | | and t2.area_id = #{queryDTO.areaId} |
| | | </if> |
| | | <if test="queryDTO.industryId !=null and queryDTO.industryId !=''"> |
| | | and t2.industry_id = #{queryDTO.industryId} |
| | | </if> |
| | | <if test="queryDTO.partyB !=null and queryDTO.partyB !=''"> |
| | | and t1.party_b LIKE CONCAT('%', #{queryDTO.partyB}, '%') |
| | | </if> |
| | | <if test="queryDTO.contractName !=null and queryDTO.contractName !=''"> |
| | | and t1.contract_name LIKE CONCAT('%', #{queryDTO.contractName}, '%') |
| | | </if> |
| | | ORDER BY |
| | | t.create_time DESC |
| | | </select> |
| | | </mapper> |