Explorar o código

Merge branch 'master' of http://git.zthymaoyi.com/gdc/yiliangyiyun

ccj %!s(int64=3) %!d(string=hai) anos
pai
achega
5ea127a89d

+ 1 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/TranCarInfo.java

@@ -170,7 +170,7 @@ public class TranCarInfo extends BaseModel<TranCarInfo> {
      */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @DateTimeFormat(pattern = "yyyy-MM-dd")
-    private Date unLoadingDate;
+    private Date unloadingDate;
     /**
      * 到站日期/到港日期
      */

+ 55 - 4
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/CollectionManagementServiceImpl.java

@@ -3,15 +3,19 @@ package com.yh.saas.plugin.yiliangyiyun.service.impl;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.plugins.Page;
 import com.google.common.collect.Lists;
+import com.winsea.svc.base.base.entity.CommonStaff;
+import com.winsea.svc.base.base.service.ICommonStaffService;
+import com.winsea.svc.base.security.util.AuthSecurityUtils;
+import com.winsea.svc.notice.entity.NoticeTaskInfo;
+import com.winsea.svc.notice.entity.base.BaseNotice;
+import com.winsea.svc.notice.service.INoticeService;
+import com.winsea.svc.notice.service.INoticeTaskService;
 import com.yh.saas.common.support.util.IdGenerator;
 import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
 import com.yh.saas.plugin.yiliangyiyun.entity.*;
 import com.yh.saas.plugin.yiliangyiyun.mapper.CollectionManagementMapper;
-import com.yh.saas.plugin.yiliangyiyun.service.ICollectionManagementService;
+import com.yh.saas.plugin.yiliangyiyun.service.*;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.yh.saas.plugin.yiliangyiyun.service.ISalePlanInfoService;
-import com.yh.saas.plugin.yiliangyiyun.service.ISalesDeliveryReportService;
-import com.yh.saas.plugin.yiliangyiyun.service.IWarehouseInOutInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -37,6 +41,12 @@ public class CollectionManagementServiceImpl extends ServiceImpl<CollectionManag
     private ISalePlanInfoService salePlanInfoService;
     @Autowired
     private ISalesDeliveryReportService salesDeliveryReportService;
+    @Autowired
+    private INoticeService noticeService;
+    @Autowired
+    private INoticeTaskService noticeTaskService;
+    @Autowired
+    private ICommonStaffService staffService;
     /**
      * 收款列表查询
      * @param collectionManagement
@@ -110,6 +120,8 @@ public class CollectionManagementServiceImpl extends ServiceImpl<CollectionManag
         warehouseInOutInfo.setContractNo(collectionManagement.getContractNo());
         warehouseInOutInfo.setGoodsName(collectionManagement.getGoodsName());
         warehouseInOutInfoService.insert(warehouseInOutInfo);
+
+        tesk(warehouseInOutInfo,"1");
         return "ok";
     }
 
@@ -157,4 +169,43 @@ public class CollectionManagementServiceImpl extends ServiceImpl<CollectionManag
         CollectionManagement collectionManagement = this.selectById(id);
         return collectionManagement;
     }
+
+
+
+    /**
+     * 任务
+     *
+     * @param warehouseInOutInfo
+     */
+    private void tesk(WarehouseInOutInfo warehouseInOutInfo, String flag) {
+        // 先删除任务
+        noticeService.removeNotice(BaseNotice.NoticeStatus.TASK, "INOUTTASK-TASK-APPROVE",
+                warehouseInOutInfo.getId(), null);
+        String staffName = "XXX";
+        CommonStaff commitUserInfo = staffService.getInfo(AuthSecurityUtils.getCurrentUserId());
+        if (commitUserInfo != null) {
+            staffName = commitUserInfo.getMajorRole() != null
+                    ? commitUserInfo.getMajorRole().getRoleName() + " " + commitUserInfo.getStaffName()
+                    : commitUserInfo.getStaffName();
+        }
+        String taskContent = "";
+        // 向下一步操作人发送任务通知
+        if ("1".equals(flag)) {
+            taskContent = "您的合同(" + warehouseInOutInfo.getContractNo() + ")车辆:" + warehouseInOutInfo.getCarNo() + "已发出";
+        } else {
+            taskContent = "您的合同(" + warehouseInOutInfo.getContractNo() + ")车辆:" + warehouseInOutInfo.getCarNo() + "申请卸货,请及时确认";
+
+        }
+        NoticeTaskInfo taskInfo = new NoticeTaskInfo();
+        taskInfo.setCompId(commitUserInfo.getCompId());
+        taskInfo.setAcceptType(BaseNotice.AcceptStatus.STAFF);
+        taskInfo.setBusinessId(warehouseInOutInfo.getId());
+        taskInfo.setBusinessType("WAREHOUSE");
+        taskInfo.setMessageContent(taskContent);
+        taskInfo.setBusinessCode("INOUTTASK-TASK-APPROVE");
+//            taskInfo.setNoticeTaskStatus(NoticeTaskInfo.NoticeTaskStatus.RETURN);
+        noticeTaskService.createNoticeTask(Lists.newArrayList(AuthSecurityUtils.getCurrentUserId()),
+                null, taskInfo);
+
+    }
 }

+ 80 - 77
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/TranProcessInfoServiceImpl.java

@@ -185,93 +185,96 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                     if (tranCarInfo.getLoadNetWeight() > 0) {
                         tranCarInfo.setStatusFlag(StatusEnum.LOADED.getFlag());
                         tranCarInfo.setStatus(StatusEnum.LOADED.getName());
-                        List<TranSettlementReport> tranSettlementReportList = tranSettlementReportService.selectList(new EntityWrapper<TranSettlementReport>()
-                                .eq("car_id", tranCarInfo.getId()));
-                        if (!CollectionUtils.isEmpty(tranSettlementReportList)) {
-                            if (tranCarInfo.getUnloadNetWeight() > 0) {
-                                for (TranSettlementReport tranSettlementReport : tranSettlementReportList) {
-                                    tranSettlementReport.setLoadingImg(tranCarInfo.getLoadPoundImg());
-                                    tranSettlementReport.setUnloadingWeight(tranCarInfo.getUnloadNetWeight());
-                                    tranSettlementReport.setUnloadingImg(tranCarInfo.getUnloadPoundImg());
-                                    //损耗
-                                    tranSettlementReport.setLossWeight(tranCarInfo.getLoadNetWeight() - tranCarInfo.getUnloadNetWeight());
-                                    //结算重量
-                                    if ("0".equals(tranSettlementReport.getManualFlag())) {
-                                        //卸车不为空时,结算重量=装卸取小
-                                        tranSettlementReport.setSettlementWeight(tranCarInfo.getLoadNetWeight() > tranCarInfo.getUnloadNetWeight() ? tranCarInfo.getUnloadNetWeight() : tranCarInfo.getLoadNetWeight());
+                        //汽运类型
+                        if (tranCarInfo.getTranType().equals(NumberConstant.CONSTANT1)) {
+                            List<TranSettlementReport> tranSettlementReportList = tranSettlementReportService.selectList(new EntityWrapper<TranSettlementReport>()
+                                    .eq("car_id", tranCarInfo.getId()));
+                            if (!CollectionUtils.isEmpty(tranSettlementReportList)) {
+                                if (tranCarInfo.getUnloadNetWeight() > 0) {
+                                    for (TranSettlementReport tranSettlementReport : tranSettlementReportList) {
+                                        tranSettlementReport.setLoadingImg(tranCarInfo.getLoadPoundImg());
+                                        tranSettlementReport.setUnloadingWeight(tranCarInfo.getUnloadNetWeight());
+                                        tranSettlementReport.setUnloadingImg(tranCarInfo.getUnloadPoundImg());
+                                        //损耗
+                                        tranSettlementReport.setLossWeight(tranCarInfo.getLoadNetWeight() - tranCarInfo.getUnloadNetWeight());
+                                        //结算重量
+                                        if ("0".equals(tranSettlementReport.getManualFlag())) {
+                                            //卸车不为空时,结算重量=装卸取小
+                                            tranSettlementReport.setSettlementWeight(tranCarInfo.getLoadNetWeight() > tranCarInfo.getUnloadNetWeight() ? tranCarInfo.getUnloadNetWeight() : tranCarInfo.getLoadNetWeight());
+                                        }
+                                        //扣款
+                                        if (tranSettlementReport.getLossWeight() <= (tranCarInfo.getLoadNetWeight() / 1000)) {
+                                            tranSettlementReport.setDeductionAmount("0");
+                                            //应付=单价x结算重量-扣款
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
+                                        } else {
+                                            tranSettlementReport.setDeductionAmount(String.format("%.2f", (Float.valueOf(tranCarInfo.getLoadNetWeight() - tranCarInfo.getUnloadNetWeight()) - (tranCarInfo.getLoadNetWeight() / 1000)) * Float.valueOf(tranCarInfo.getTranPrice())));
+                                            //应付=单价x结算重量-扣款
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight() - Float.valueOf(tranSettlementReport.getDeductionAmount()));
+                                        }
+                                        tranSettlementReportService.updateById(tranSettlementReport);
                                     }
-                                    //扣款
-                                    if (tranSettlementReport.getLossWeight() <= (tranCarInfo.getLoadNetWeight() / 1000)) {
-                                        tranSettlementReport.setDeductionAmount("0");
-                                        //应付=单价x结算重量-扣款
-                                        tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
-                                    } else {
-                                        tranSettlementReport.setDeductionAmount(String.format("%.2f", (Float.valueOf(tranCarInfo.getLoadNetWeight() - tranCarInfo.getUnloadNetWeight()) - (tranCarInfo.getLoadNetWeight() / 1000)) * Float.valueOf(tranCarInfo.getTranPrice())));
-                                        //应付=单价x结算重量-扣款
-                                        tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight() - Float.valueOf(tranSettlementReport.getDeductionAmount()));
-                                    }
-                                    tranSettlementReportService.updateById(tranSettlementReport);
                                 }
-                            }
-                        } else {
-                            //生成汽运报表
-                            TranSettlementReport tranSettlementReport = new TranSettlementReport();
-                            TranTaskInfo tranTaskInfo = tranTaskInfoService.selectById(tranProcessInfo.getInfoId());
-                            tranSettlementReport.setCompId(tranTaskInfo.getCompId());
-                            tranSettlementReport.setCarId(tranCarInfo.getId());
-                            tranSettlementReport.setId(IdGenerator.generateUUID());
-                            tranSettlementReport.setContractNo(tranTaskInfo.getContractNo());
-                            tranSettlementReport.setProcessNo(tranProcessInfo.getProcessNo());
-                            tranSettlementReport.setName(tranCarInfo.getDriver());
-                            tranSettlementReport.setPhone(tranCarInfo.getDriverPhone());
-                            tranSettlementReport.setCarNo(tranCarInfo.getCarNo());
-                            //查询账户信息
-                            List<DriverViewInfo> driverViewInfoList = driverViewInfoService.selectList(new EntityWrapper<DriverViewInfo>()
-                                    .eq("driver_name", tranCarInfo.getDriver())
-                                    .eq("delete_flag", "0"));
-                            if (!CollectionUtils.isEmpty(driverViewInfoList)) {
-                                for (DriverViewInfo driverViewInfo : driverViewInfoList) {
-                                    List<DriverPayeeInfo> driverPayeeInfoList = driverPayeeInfoService.selectList(new EntityWrapper<DriverPayeeInfo>()
-                                            .eq("driver_id", driverViewInfo.getId())
-                                            .eq("delete_flag", "0"));
-                                    if (!CollectionUtils.isEmpty(driverPayeeInfoList)) {
-                                        //本次收款账户
-                                        tranSettlementReport.setCardNo(driverPayeeInfoList.get(0).getBankCard());
+                            } else {
+                                //生成汽运报表
+                                TranSettlementReport tranSettlementReport = new TranSettlementReport();
+                                TranTaskInfo tranTaskInfo = tranTaskInfoService.selectById(tranProcessInfo.getInfoId());
+                                tranSettlementReport.setCompId(tranTaskInfo.getCompId());
+                                tranSettlementReport.setCarId(tranCarInfo.getId());
+                                tranSettlementReport.setId(IdGenerator.generateUUID());
+                                tranSettlementReport.setContractNo(tranTaskInfo.getContractNo());
+                                tranSettlementReport.setProcessNo(tranProcessInfo.getProcessNo());
+                                tranSettlementReport.setName(tranCarInfo.getDriver());
+                                tranSettlementReport.setPhone(tranCarInfo.getDriverPhone());
+                                tranSettlementReport.setCarNo(tranCarInfo.getCarNo());
+                                //查询账户信息
+                                List<DriverViewInfo> driverViewInfoList = driverViewInfoService.selectList(new EntityWrapper<DriverViewInfo>()
+                                        .eq("driver_name", tranCarInfo.getDriver())
+                                        .eq("delete_flag", "0"));
+                                if (!CollectionUtils.isEmpty(driverViewInfoList)) {
+                                    for (DriverViewInfo driverViewInfo : driverViewInfoList) {
+                                        List<DriverPayeeInfo> driverPayeeInfoList = driverPayeeInfoService.selectList(new EntityWrapper<DriverPayeeInfo>()
+                                                .eq("driver_id", driverViewInfo.getId())
+                                                .eq("delete_flag", "0"));
+                                        if (!CollectionUtils.isEmpty(driverPayeeInfoList)) {
+                                            //本次收款账户
+                                            tranSettlementReport.setCardNo(driverPayeeInfoList.get(0).getBankCard());
+                                        }
                                     }
                                 }
-                            }
-                            tranSettlementReport.setSettlementWeight(tranCarInfo.getLoadNetWeight());
-                            //应付
-                            tranSettlementReport.setAmountIngPayable(tranProcessInfo.getTranPrice() * tranSettlementReport.getSettlementWeight());
-                            tranSettlementReport.setTranCarNo(tranCarInfo.getTranCarNo());
-                            tranSettlementReport.setLoadingWeight(tranCarInfo.getLoadNetWeight());
-                            tranSettlementReport.setLoadingImg(tranCarInfo.getLoadPoundImg());
-                            tranSettlementReport.setTransportPrice(tranProcessInfo.getTranPrice());
-                            tranSettlementReportService.insert(tranSettlementReport);
-                            boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(tranSettlementReport.getWorkflowId());
-                            // 不是退回的单子
-                            if (isStartWorkflow) {
-                                Workflow workflow = workflowService
-                                        .findLatestWorkflowByBusinessCodeByApp(tranSettlementReport.getCompId(), "TRANSPORTATION-SETTLEMENT-REPORT");
-                                // 没配置审核流程,直接结束并处理信息
-                                if (workflow == null) {
-                                    throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+                                tranSettlementReport.setSettlementWeight(tranCarInfo.getLoadNetWeight());
+                                //应付
+                                tranSettlementReport.setAmountIngPayable(tranProcessInfo.getTranPrice() * tranSettlementReport.getSettlementWeight());
+                                tranSettlementReport.setTranCarNo(tranCarInfo.getTranCarNo());
+                                tranSettlementReport.setLoadingWeight(tranCarInfo.getLoadNetWeight());
+                                tranSettlementReport.setLoadingImg(tranCarInfo.getLoadPoundImg());
+                                tranSettlementReport.setTransportPrice(tranProcessInfo.getTranPrice());
+                                tranSettlementReportService.insert(tranSettlementReport);
+                                boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(tranSettlementReport.getWorkflowId());
+                                // 不是退回的单子
+                                if (isStartWorkflow) {
+                                    Workflow workflow = workflowService
+                                            .findLatestWorkflowByBusinessCodeByApp(tranSettlementReport.getCompId(), "TRANSPORTATION-SETTLEMENT-REPORT");
+                                    // 没配置审核流程,直接结束并处理信息
+                                    if (workflow == null) {
+                                        throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+                                    }
+                                    // 开启审核流
+                                    else {
+
+                                        // 设置状态 已提交审核
+                                        tranSettlementReport.setWorkflowId(workflow.getId());
+                                        tranSettlementReportService.updateById(tranSettlementReport);
+                                        workflowService.startInstance(workflow.getId(), tranSettlementReport.getId());
+                                    }
                                 }
-                                // 开启审核流
+                                // 退回的单子 再启用
                                 else {
 
-                                    // 设置状态 已提交审核
-                                    tranSettlementReport.setWorkflowId(workflow.getId());
                                     tranSettlementReportService.updateById(tranSettlementReport);
-                                    workflowService.startInstance(workflow.getId(), tranSettlementReport.getId());
+                                    workflowService.activateInstance(tranSettlementReport.getWorkflowId(), tranSettlementReport.getId());
                                 }
                             }
-                            // 退回的单子 再启用
-                            else {
-
-                                tranSettlementReportService.updateById(tranSettlementReport);
-                                workflowService.activateInstance(tranSettlementReport.getWorkflowId(), tranSettlementReport.getId());
-                            }
                         }
                     }
                     //卸车反馈时状态改为已送达