diff --git a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/domain/dto/BusinessDocumentDTO.java b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/domain/dto/BusinessDocumentDTO.java index 4dde2d249..67055a95b 100644 --- a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/domain/dto/BusinessDocumentDTO.java +++ b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/domain/dto/BusinessDocumentDTO.java @@ -229,4 +229,8 @@ public class BusinessDocumentDTO extends BaseVOEntity{ private String salesmanId; @ApiModelProperty("业务员名称") private String salesmanName; + @ApiModelProperty("收款帐户") + private String paymentAccountId; + @ApiModelProperty("收款帐户名称") + private String paymentAccountName; } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/Lease/LeaseApplicationService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/Lease/LeaseApplicationService.java index 1a6920473..dd2c3ab74 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/Lease/LeaseApplicationService.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/Lease/LeaseApplicationService.java @@ -545,4 +545,4 @@ public class LeaseApplicationService { // } // leaseDO.setContainerTypeName(storageTypeDictData.getDictLabel()); // } -} +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/lease/entity/Lease.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/lease/entity/Lease.java index 4033134d2..49b2ca714 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/lease/entity/Lease.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/lease/entity/Lease.java @@ -90,4 +90,7 @@ public class Lease extends BaseVOEntity{ @ApiModelProperty("结算币种") private String settlementCurrency; -} + + @ApiModelProperty("推送时间") + private String pushTime; +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/lease/repository/po/LeasePO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/lease/repository/po/LeasePO.java index 42f7e3419..e823d48af 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/lease/repository/po/LeasePO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/lease/repository/po/LeasePO.java @@ -91,4 +91,7 @@ public class LeasePO extends BaseVOEntity{ @ApiModelProperty("结算币种") private String settlementCurrency; -} + + @ApiModelProperty("推送时间") + private String pushTime; +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/lease/repository/todo/LeaseDO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/lease/repository/todo/LeaseDO.java index a04eac36f..ee2d24c23 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/lease/repository/todo/LeaseDO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/lease/repository/todo/LeaseDO.java @@ -107,4 +107,7 @@ public class LeaseDO extends BaseVOEntity{ @ApiModelProperty(name = "修改时间查询条件结束日期") private String updateTimeEnd; -} + + @ApiModelProperty("推送时间") + private String pushTime; +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/entity/ScheduledTask.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/entity/ScheduledTask.java new file mode 100644 index 000000000..e910d3078 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/entity/ScheduledTask.java @@ -0,0 +1,59 @@ +package com.mhd.basic.domain.scheduledTask.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import com.mhd.common.core.web.domain.BaseVOEntity; +import lombok.Data; + +import java.time.LocalTime; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; + + +/** + * + * @author gen + * @date 2024-06-07 + */ + +@Data +public class ScheduledTask extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("类型") + private String taskType; + + @ApiModelProperty("参数") + private String taskData; + + @ApiModelProperty("业务id") + private Long busId; + + @ApiModelProperty("任务状态") + private String taskStatus; + + @ApiModelProperty("") + private Integer retryCount; + + @ApiModelProperty("计划执行时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date executeTime; + + + @ApiModelProperty(name = "出账日") + private Integer billDays; + + @ApiModelProperty("出账时间") + @JsonFormat(timezone = "GMT+8", pattern = "HH:mm:ss") + @DateTimeFormat(pattern = "HH:mm:ss") + private LocalTime billTime; + + @ApiModelProperty("推送时间") + private String pushTime; +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/repository/facade/ScheduledTaskService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/repository/facade/ScheduledTaskService.java new file mode 100644 index 000000000..55168eec7 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/repository/facade/ScheduledTaskService.java @@ -0,0 +1,25 @@ +package com.mhd.basic.domain.scheduledTask.repository.facade; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.mhd.basic.domain.scheduledTask.entity.ScheduledTask; +import com.mhd.basic.domain.lease.entity.Lease; + +import java.time.LocalDateTime; + +public interface ScheduledTaskService extends IService { + + public void saveBillingTask(LocalDateTime billingTime, Lease lease); + + /** + * 执行出账 + * @param busId 出账数据 + * @return 出账结果 + */ + void executeBilling(Long busId); + + //推送散租到bms + public void ScatteredRentalSynchronization(Long busId); + //推送整租到bms + public void wholeRentSynchronization(Long busId); + +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/repository/mapper/ScheduledTaskMapper.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/repository/mapper/ScheduledTaskMapper.java new file mode 100644 index 000000000..641765e50 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/repository/mapper/ScheduledTaskMapper.java @@ -0,0 +1,58 @@ +package com.mhd.basic.domain.scheduledTask.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mhd.basic.domain.scheduledTask.entity.ScheduledTask; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; + +import java.time.LocalDateTime; +import java.util.List; + +public interface ScheduledTaskMapper extends BaseMapper { + /** + * 查询待执行的任务 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @param status 任务状态 + * @param limit 限制条数 + * @return 任务列表 + */ + List findPendingTasks( + @Param("startTime") LocalDateTime startTime, + @Param("endTime") LocalDateTime endTime, + @Param("status") String status, + @Param("limit") Integer limit); + + /** + * 通过乐观锁更新任务状态 + * @param id 任务ID + * @param oldStatus 旧状态 + * @param newStatus 新状态 + * @return 更新的记录数 + */ + @Update("UPDATE scheduled_task SET task_status = #{newStatus}, update_time = NOW() " + + "WHERE id = #{id} AND task_status = #{oldStatus}") + int updateStatusIfPending( + @Param("id") Long id, + @Param("oldStatus") String oldStatus, + @Param("newStatus") String newStatus); + + /** + * 更新任务状态 + * @param id 任务ID + * @param status 新状态 + * @return 更新的记录数 + */ + @Update("UPDATE scheduled_task SET task_status = #{status}, update_time = NOW() " + + "WHERE id = #{id}") + int updateStatus(@Param("id") Long id, @Param("status") String status); + + /** + * 增加重试次数 + * @param id 任务ID + * @return 更新的记录数 + */ + @Update("UPDATE scheduled_task SET retry_count = retry_count + 1, update_time = NOW() " + + "WHERE id = #{id}") + int incrementRetryCount(@Param("id") Long id); +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/repository/persistence/ScheduledTaskServiceImpl.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/repository/persistence/ScheduledTaskServiceImpl.java new file mode 100644 index 000000000..08b0e2fe3 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/repository/persistence/ScheduledTaskServiceImpl.java @@ -0,0 +1,162 @@ +package com.mhd.basic.domain.scheduledTask.repository.persistence; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.mhd.basic.application.service.Lease.LeaseApplicationService; +import com.mhd.basic.domain.scheduledTask.entity.ScheduledTask; +import com.mhd.basic.domain.scheduledTask.repository.facade.ScheduledTaskService; +import com.mhd.basic.domain.scheduledTask.repository.mapper.ScheduledTaskMapper; +import com.mhd.basic.domain.lease.entity.Lease; +import com.mhd.basic.domain.lease.repository.facade.ILeaseService; +import com.mhd.basic.domain.lease.repository.po.LeasePO; +import com.mhd.basic.domain.lease.repository.todo.LeaseDO; +import com.mhd.common.core.domain.dto.BusinessDataPushDTO; +import com.mhd.common.core.web.domain.AjaxResult; +import com.mhd.system.api.BmsServiceFeign; +import com.mhd.system.api.WmsServiceFeign; +import com.mhd.system.api.domain.MaterialInventoryDTO; +import com.mhd.system.api.domain.MaterialInventoryPO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.Date; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.List; +import java.util.Objects; + +@Slf4j +@Service +public class ScheduledTaskServiceImpl extends ServiceImpl implements ScheduledTaskService { + + @Resource + private ScheduledTaskMapper taskMapper; + + @Resource + private ObjectMapper objectMapper; + + @Resource + private BmsServiceFeign bmsServiceFeign; + + @Resource + private WmsServiceFeign WmsServiceFeign; + + @Resource + private LeaseApplicationService leaseApplicationService; + + @Resource + private ILeaseService leaseService; + + public void saveBillingTask(LocalDateTime billingTime, Lease lease) { + ScheduledTask task = new ScheduledTask(); + task.setTaskType("LeaseToBms"); + task.setExecuteTime(Date.from(billingTime.atZone(ZoneId.systemDefault()).toInstant())); + task.setTaskData(JSON.toJSONString(lease)); + task.setBusId(lease.getId()); + task.setTaskStatus("PENDING"); + taskMapper.insert(task); + } + + + @Override + public void executeBilling(Long busId) { + try { + log.info("开始执行出账业务"); + LeasePO leasePO = leaseService.getInfo(busId); + String leaseType = leasePO.getLeaseType(); + if ("整租".equals(leaseType)) { + wholeRentSynchronization(busId); + } else if ("散租".equals(leaseType)) { + ScatteredRentalSynchronization(busId); + } + } catch (Exception e) { + log.error("出账业务异常", e); + } + } + + + /** + * 定时任务整租推送到bms + */ + public void wholeRentSynchronization(Long busId) { + log.info("定时任务整租推送到bms触发--开始"); + LeaseDO leaseDO = new LeaseDO(); + leaseDO.setTime(new Date()); + leaseDO.setLeaseType("整租"); + leaseDO.setId(busId); + List leasePOList = leaseApplicationService.queryList(leaseDO); + log.info("整租数据{}", JSONObject.toJSONString(leasePOList)); + for (LeasePO leasePO: leasePOList) { + if (leasePO.getShipperId() == null) { + continue; + } + log.info("开始执行{}",JSONObject.toJSONString(leasePOList)); + BusinessDataPushDTO businessDataPushDTO = new BusinessDataPushDTO(); + businessDataPushDTO.setOrganizationId(leasePO.getOrganizationId()); + businessDataPushDTO.setTopOrganizationId(leasePO.getTopOrganizationId()); + businessDataPushDTO.setOrganizationName(leasePO.getOrganizationName()); + businessDataPushDTO.setBelongModuleCode("wms"); +// businessDataPushDTO.setBillAmount();//计费金额 + JSONObject jsonObject = new JSONObject(); + jsonObject.put("lease_area",leasePO.getLeaseArea());//租赁面积 + jsonObject.put("jiecun_cbm",0);//结存体积 + businessDataPushDTO.setDocumentFormJson(jsonObject.toJSONString()); + businessDataPushDTO.setDocumentTypeCode("TY_ZL"); + businessDataPushDTO.setSettlementEntityId(leasePO.getShipperId()); + businessDataPushDTO.setSecondSubjectCode(leasePO.getSecondSubjectCode()); + businessDataPushDTO.setServiceItemsCode(leasePO.getServiceItemsCode()); + businessDataPushDTO.setDataSources(1); + bmsServiceFeign.businessDocumentApiSave(businessDataPushDTO); + } + log.info("定时任务整租推送到bms触发--结束"); + } + + + /** + * 定时任务散租推送到bms + */ + public void ScatteredRentalSynchronization(Long busId) { + LeaseDO leaseDO = new LeaseDO(); + leaseDO.setTime(new Date()); + leaseDO.setLeaseType("散租"); + leaseDO.setId(busId); + List leasePOList = leaseApplicationService.queryList(leaseDO); + for (LeasePO leasePO: leasePOList) { + if (leasePO.getShipperId() == null) { + continue; + } + MaterialInventoryDTO materialInventoryDTO = new MaterialInventoryDTO(); + materialInventoryDTO.setShipperId(leasePO.getShipperId()); + BigDecimal totalVolume = BigDecimal.ZERO; + AjaxResult ajaxResult = WmsServiceFeign.materialInventoryApiListAll(materialInventoryDTO); + if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) { + List batchDetailFeignPOList = JSON.parseArray( + com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), MaterialInventoryPO.class); + totalVolume = batchDetailFeignPOList.stream() + .map(MaterialInventoryPO::getVolume) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + } + BusinessDataPushDTO businessDataPushDTO = new BusinessDataPushDTO(); + businessDataPushDTO.setOrganizationId(leasePO.getOrganizationId()); + businessDataPushDTO.setTopOrganizationId(leasePO.getTopOrganizationId()); + businessDataPushDTO.setOrganizationName(leasePO.getOrganizationName()); + businessDataPushDTO.setBelongModuleCode("wms"); +// businessDataPushDTO.setBillAmount();//计费金额 + JSONObject jsonObject = new JSONObject(); + jsonObject.put("lease_area",0);//租赁面积 + jsonObject.put("jiecun_cbm",totalVolume);//结存体积 + businessDataPushDTO.setDocumentFormJson(jsonObject.toJSONString()); + businessDataPushDTO.setDocumentTypeCode("TY_ZL"); + businessDataPushDTO.setSettlementEntityId(leasePO.getShipperId()); + businessDataPushDTO.setSecondSubjectCode(leasePO.getSecondSubjectCode()); + businessDataPushDTO.setServiceItemsCode(leasePO.getServiceItemsCode()); + businessDataPushDTO.setDataSources(1); + bmsServiceFeign.businessDocumentApiSave(businessDataPushDTO); + } + } +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/repository/task/BillingScheduler.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/repository/task/BillingScheduler.java new file mode 100644 index 000000000..e48eb3e5c --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/scheduledTask/repository/task/BillingScheduler.java @@ -0,0 +1,69 @@ +package com.mhd.basic.domain.scheduledTask.repository.task; + +import com.mhd.basic.domain.scheduledTask.entity.ScheduledTask; +import com.mhd.basic.domain.scheduledTask.repository.facade.ScheduledTaskService; +import com.mhd.basic.domain.scheduledTask.repository.mapper.ScheduledTaskMapper; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +@Component +public class BillingScheduler { + + @Resource + private ScheduledTaskMapper scheduledTaskMapper; + + @Resource + private ScheduledTaskService scheduledTaskService; + + // 每10秒扫描一次 + //@Scheduled(fixedDelay = 10000) + @Transactional + public void scanAndExecute() { + // 查询当前时间前1分钟内待执行的任务 + LocalDateTime now = LocalDateTime.now(); + LocalDateTime start = now.minusMinutes(1); + + List tasks = scheduledTaskMapper.findPendingTasks( + start, now, "PENDING", 100); + + for (ScheduledTask task : tasks) { + try { + // 乐观锁更新状态,防止重复执行 + int updated = scheduledTaskMapper.updateStatusIfPending( + task.getId(), "PENDING", "PROCESSING"); + + if (updated > 0) { + // 异步执行具体业务 + CompletableFuture.runAsync(() -> { + executeTask(task); + }); + } + } catch (Exception e) { + scheduledTaskMapper.updateStatus(task.getId(), "FAILED"); + } + } + } + + private void executeTask(ScheduledTask task) { + try { + // 执行具体的出账逻辑 + scheduledTaskService.executeBilling(task.getBusId()); + + scheduledTaskMapper.updateStatus(task.getId(), "SUCCESS"); + } catch (Exception e) { + // 重试机制 + scheduledTaskMapper.incrementRetryCount(task.getId()); + if (task.getRetryCount() < 3) { + scheduledTaskMapper.updateStatus(task.getId(), "PENDING"); + } else { + scheduledTaskMapper.updateStatus(task.getId(), "FAILED"); + } + } + } +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/lease/LeaseDTO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/lease/LeaseDTO.java index 323d7ef55..18dfc3844 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/lease/LeaseDTO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/lease/LeaseDTO.java @@ -104,4 +104,7 @@ public class LeaseDTO extends BaseVOEntity{ @ApiModelProperty(name = "修改时间查询条件结束日期") private String updateTimeEnd; -} + + @ApiModelProperty("推送时间") + private String pushTime; +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/resources/mapper/basic/ScheduledTaskMapper.xml b/mhd-modules/mhd-system/src/main/resources/mapper/basic/ScheduledTaskMapper.xml new file mode 100644 index 000000000..7c73c94cc --- /dev/null +++ b/mhd-modules/mhd-system/src/main/resources/mapper/basic/ScheduledTaskMapper.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + id, task_type, execute_time, task_data, task_status, retry_count, create_time, update_time, bill_days, bill_time,bus_id + + + + + + + + UPDATE scheduled_task + SET task_status = #{newStatus}, + update_time = NOW() + WHERE id IN + + #{id} + + AND task_status = #{oldStatus} + + + + + + + + + \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/businessDocument/BusinessDocumentApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/businessDocument/BusinessDocumentApplicationService.java index 8c50e8ef8..3226c3a7e 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/businessDocument/BusinessDocumentApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/businessDocument/BusinessDocumentApplicationService.java @@ -891,6 +891,11 @@ public class BusinessDocumentApplicationService { businessDocumentDO.setEstimatedCost(billingCostPo.getComputationalCost()); businessDocumentDO.setBillAmount(billingCostPo.getComputationalCost());//计费金额与计算金额一致 log.info("定时任务进入BMS业务单据保存--结束"); - return businessDocumentDomainService.insert(businessDocumentDO); + BusinessDocument businessDocument = businessDocumentDomainService.insertRetrun(businessDocumentDO); + BusinessDocumentDTO businessDocumentDTO = new BusinessDocumentDTO(); + businessDocumentDTO.setBusinessDocumentIds(String.valueOf(businessDocument.getBusinessDocumentId())); + this.takeEffectByIds(businessDocumentDTO); + this.auditByIds(businessDocumentDTO); + return true; } } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java index 9371c55bc..4b84de622 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java @@ -287,6 +287,7 @@ public class SettlementCustomersApplicationService { saveEntity.setSettlementMethodCode("monthly_settle"); saveEntity.setMainRole(1); saveEntity.setCustomerTypeCode("customer"); //从货主同步过来的 默认客户 + saveEntity.setNcCode(userShipperPo.getCustomerNcCode()); Long settlementEntityId = saveEntity.getSettlementEntityId(); List settlementCustomers = settlementCustomersMapper.selectList(new LambdaQueryWrapper().eq(SettlementCustomers::getSettlementEntityId, settlementEntityId)); if(settlementCustomers != null && settlementCustomers.size() > 0){ diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/entity/BillManage.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/entity/BillManage.java index 4a95fe41b..700726cea 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/entity/BillManage.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/entity/BillManage.java @@ -239,4 +239,8 @@ public class BillManage extends BaseVOEntity{ @ApiModelProperty("业务员ID") private String salesmanName; + @ApiModelProperty("收款帐户") + private String paymentAccountId; + @ApiModelProperty("收款帐户名称") + private String paymentAccountName; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/po/BillManagePO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/po/BillManagePO.java index 2b5d178e9..724a36e00 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/po/BillManagePO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/po/BillManagePO.java @@ -257,5 +257,9 @@ public class BillManagePO extends BaseVOEntity{ @ApiModelProperty("业务员ID") private String salesmanName; + @ApiModelProperty("收款帐户") + private String paymentAccountId; + @ApiModelProperty("收款帐户名称") + private String paymentAccountName; private List billDetailList; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillManageDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillManageDO.java index c41235194..92aabee3f 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillManageDO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillManageDO.java @@ -260,5 +260,8 @@ public class BillManageDO extends BaseVOEntity{ private String receivablePushTimeStart; private String paymentPushTimeEnd; private String paymentPushTimeStart; - + @ApiModelProperty("收款帐户") + private String paymentAccountId; + @ApiModelProperty("收款帐户名称") + private String paymentAccountName; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java index dd7dcbb4f..fc0fbff95 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java @@ -149,6 +149,8 @@ public class BillManageDomainService { billManage.setSettlementCustomersCode(billingStatementPOS.get(0).getSettlementCustomersCode()); billManage.setSalesmanId(billingStatementPOS.get(0).getSalesmanId()); billManage.setSalesmanName(billingStatementPOS.get(0).getSalesmanName()); + billManage.setPaymentAccountId(billingStatementPOS.get(0).getPaymentAccountId()); + billManage.setPaymentAccountName(billingStatementPOS.get(0).getPaymentAccountName()); billManage.setBillRemark(billingRemark); //查询结算对象信息 SettlementCustomersPO settlementCustomersPO = settlementCustomersDomainService.getInfo(billingStatementPOS.get(0).getSettlementCustomersId()); @@ -239,6 +241,21 @@ public class BillManageDomainService { BillingStatementDO billingStatementDO = new BillingStatementDO(); billingStatementDO.setBillingStatementIdSet(billingSet); List billingStatementPOS = billingStatementDomainService.queryList(billingStatementDO); + + //获取最新一条的业务员信息 + String salesmanId = null; + String salesmanName = null; + if (billingStatementPOS != null && !billingStatementPOS.isEmpty()) { + billingStatementPOS.sort((a, b) -> { + if (a.getCreateTime() == null && b.getCreateTime() == null) return 0; + if (a.getCreateTime() == null) return 1; + if (b.getCreateTime() == null) return -1; + return b.getCreateTime().compareTo(a.getCreateTime()); + }); + salesmanId = billingStatementPOS.get(0).getSalesmanId(); + salesmanName = billingStatementPOS.get(0).getSalesmanName(); + } + List billingStatementList = billingStatementDTO.getBillingStatementList(); for (BillingStatementPO billingStatementPO : billingStatementPOS) { String billingStatementId = billingStatementPO.getBillingStatementId() == null ? "" : String.valueOf(billingStatementPO.getBillingStatementId()); @@ -252,6 +269,10 @@ public class BillManageDomainService { billingStatementPO.setInvoiceItemName(billingStatementADDVO.getInvoiceItemName()); billingStatementPO.setBillingAmount(billingStatementADDVO.getBillingAmount()); billingStatementPO.setBillingStatementIdStr(billingStatementADDVO.getBillingStatementId()); + if (salesmanName != null && !salesmanName.isEmpty() && salesmanId != null && !salesmanId.isEmpty()) { + billingStatementPO.setSalesmanId(salesmanId); + billingStatementPO.setSalesmanName(salesmanName); + } } List distinctList = billingStatementPOS.stream() .filter(Objects::nonNull) @@ -262,7 +283,6 @@ public class BillManageDomainService { )) .values() .stream().collect(Collectors.toList()); - if(billingStatementPOS==null || billingStatementPOS.size()==0){ throw new ServiceException("所选流水信息未找到"); } diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/entity/BillingStatement.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/entity/BillingStatement.java index c5586e885..3be326aac 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/entity/BillingStatement.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/entity/BillingStatement.java @@ -205,4 +205,9 @@ public class BillingStatement extends BaseVOEntity{ private String salesmanName; @ApiModelProperty("账单管理id") private Long billManageId; + + @ApiModelProperty("收款帐户") + private String paymentAccountId; + @ApiModelProperty("收款帐户名称") + private String paymentAccountName; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementADDVO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementADDVO.java index 5dc48fe1d..5fd01b7d9 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementADDVO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementADDVO.java @@ -53,5 +53,8 @@ public class BillingStatementADDVO extends BaseVOEntity { private String invoiceItemName; @ApiModelProperty(value = "费用类别") private String feeType; - + @ApiModelProperty("收款帐户") + private String paymentAccountId; + @ApiModelProperty("收款帐户名称") + private String paymentAccountName; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementPO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementPO.java index be62797ce..f77d82eda 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementPO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementPO.java @@ -217,5 +217,8 @@ public class BillingStatementPO extends BaseVOEntity{ private String billingStatementIdStr; @ApiModelProperty("账单管理id") private Long billManageId; - + @ApiModelProperty("收款帐户") + private String paymentAccountId; + @ApiModelProperty("收款帐户名称") + private String paymentAccountName; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementDO.java index b1d99c74b..bdc1ee675 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementDO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementDO.java @@ -235,4 +235,8 @@ public class BillingStatementDO extends BaseVOEntity{ @ApiModelProperty("业务员ID") private String salesmanName; + @ApiModelProperty("收款帐户") + private String paymentAccountId; + @ApiModelProperty("收款帐户名称") + private String paymentAccountName; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/service/BillingStatementDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/service/BillingStatementDomainService.java index 4b35318fc..b4bfbcbde 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/service/BillingStatementDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/service/BillingStatementDomainService.java @@ -414,6 +414,9 @@ public class BillingStatementDomainService { billingStatementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); billingStatementDO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); billingStatementDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); + //收款帐户信息 + billingStatementDO.setPaymentAccountId(businessDocumentPO.getPaymentAccountId()); //收款帐户ID + billingStatementDO.setPaymentAccountName(businessDocumentPO.getPaymentAccountName()); //收款帐户名称 BigDecimal billingAmount = billingStatementDO.getBillingAmount(); Double taxRate = billingStatementDO.getTaxRate() != null ? billingStatementDO.getTaxRate() : 0.0; diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/entity/BusinessDocument.java b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/entity/BusinessDocument.java index 3cbddbeda..b767c2440 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/entity/BusinessDocument.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/entity/BusinessDocument.java @@ -178,4 +178,8 @@ public class BusinessDocument extends BaseVOEntity{ private String salesmanName; @ApiModelProperty("税率") private String taxRate; + @ApiModelProperty("收款帐户") + private String paymentAccountId; + @ApiModelProperty("收款帐户名称") + private String paymentAccountName; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/facade/IBusinessDocumentService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/facade/IBusinessDocumentService.java index d45a8c0d9..6af668b24 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/facade/IBusinessDocumentService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/facade/IBusinessDocumentService.java @@ -25,6 +25,11 @@ public interface IBusinessDocumentService extends IService */ public Boolean insert(BusinessDocumentDO businessDocumentDO); + /** + * 新增业务单据 + */ + public BusinessDocument insertReturn(BusinessDocumentDO businessDocumentDO); + /** * 修改业务单据 */ @@ -42,4 +47,4 @@ public interface IBusinessDocumentService extends IService public BusinessDocumentPO getInfo(Long businessDocumentId); BusinessDocumentPO queryByOriginalBusinessNumAndSubjectCode(String originalBusinessNum, String secondSubjectCode); -} +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/persistence/BusinessDocumentImpl.java b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/persistence/BusinessDocumentImpl.java index e5acd00d1..eeeebf6a0 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/persistence/BusinessDocumentImpl.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/persistence/BusinessDocumentImpl.java @@ -44,6 +44,20 @@ public class BusinessDocumentImpl extends ServiceImpl businessDocumentList) { return businessDocumentService.saveOrUpdateBatch(businessDocumentList); } -} +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/entity/SettlementCustomers.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/entity/SettlementCustomers.java index 57e6892e1..62b95a182 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/entity/SettlementCustomers.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/entity/SettlementCustomers.java @@ -89,7 +89,8 @@ public class SettlementCustomers extends BaseVOEntity{ @ApiModelProperty("项目名称") private String projectName; + @ApiModelProperty(name = "nc编码") + private String ncCode; - -} +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/po/SettlementCustomersPO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/po/SettlementCustomersPO.java index eb3f42b7e..ede94cf81 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/po/SettlementCustomersPO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/po/SettlementCustomersPO.java @@ -90,6 +90,7 @@ public class SettlementCustomersPO extends BaseVOEntity{ private String projectName; private String settlementObject; + @ApiModelProperty(name = "nc编码") + private String ncCode; - -} +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java index 0d8147a26..fa4454ba9 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java @@ -102,6 +102,7 @@ public class SettlementCustomersDO extends BaseVOEntity{ @ApiModelProperty("项目名称") private String projectName; + @ApiModelProperty(name = "nc编码") + private String ncCode; - -} +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageDTO.java index 72f9b9a5c..98d8cf99f 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageDTO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageDTO.java @@ -272,4 +272,8 @@ public class BillManageDTO extends BaseVOEntity{ private String receivablePushTimeStart; private String paymentPushTimeEnd; private String paymentPushTimeStart; + @ApiModelProperty("收款帐户") + private String paymentAccountId; + @ApiModelProperty("收款帐户名称") + private String paymentAccountName; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementDTO.java index f25c650cb..1fc8a6da9 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementDTO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementDTO.java @@ -244,6 +244,10 @@ public class BillingStatementDTO extends BaseVOEntity{ @ApiModelProperty("业务员ID") private String salesmanName; + @ApiModelProperty("收款帐户") + private String paymentAccountId; + @ApiModelProperty("收款帐户名称") + private String paymentAccountName; private List billingStatementList; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/businessDocument/BusinessDocumentDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/businessDocument/BusinessDocumentDTO.java index 57d710bc5..16d62d006 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/businessDocument/BusinessDocumentDTO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/businessDocument/BusinessDocumentDTO.java @@ -209,4 +209,8 @@ public class BusinessDocumentDTO extends BaseVOEntity{ private String salesmanName; @ApiModelProperty("税率") private String taxRate; + @ApiModelProperty("收款帐户") + private String paymentAccountId; + @ApiModelProperty("收款帐户名称") + private String paymentAccountName; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java index 4600483d7..4094cc9fe 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java @@ -101,5 +101,6 @@ public class SettlementCustomersDTO extends BaseVOEntity{ @ApiModelProperty("项目名称") private String projectName; - -} + @ApiModelProperty(name = "nc编码") + private String ncCode; +} \ No newline at end of file