服务指令-请领流程指令工单
This commit is contained in:
parent
4272480855
commit
116ab16fab
|
|
@ -2,7 +2,7 @@ package com.nu.modules.pad.instruction.invoicing;
|
|||
|
||||
import com.nu.entity.InvoicingDirectiveEntity;
|
||||
import com.nu.modules.care.api.IDirectiveConfigApi;
|
||||
import com.nu.modules.care.api.IInvoicingDirectivePlanApi;
|
||||
import com.nu.modules.invoicing.api.IInvoicingDirectivePlanApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
|||
|
|
@ -91,6 +91,8 @@ public class InvoicingOrdersEntity implements Serializable {
|
|||
private String izStart;
|
||||
/**是否完成 Y是 N否*/
|
||||
private String izFinish;
|
||||
/**是否回退 Y是 N否*/
|
||||
private String izRollback;
|
||||
/**创建人*/
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
|
|
@ -141,4 +143,7 @@ public class InvoicingOrdersEntity implements Serializable {
|
|||
private String initiatorId;
|
||||
/**发起人姓名*/
|
||||
private String initiatorName;
|
||||
|
||||
/**流程指令编码*/
|
||||
private String flowCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
package com.nu.modules.care.api;
|
||||
|
||||
import com.nu.entity.InvoicingOrdersEntity;
|
||||
|
||||
/**
|
||||
* @Description: 仓库类服务指令工单主表
|
||||
* @Author: zmy
|
||||
* @Date: 2025-12-2
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IInvoicingOrdersApi {
|
||||
//插入数据
|
||||
int insertData(InvoicingOrdersEntity orderEntity);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.nu.modules.care.api;
|
||||
package com.nu.modules.invoicing.api;
|
||||
|
||||
import com.nu.entity.*;
|
||||
import java.util.Map;
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package com.nu.modules.invoicing.api;
|
||||
|
||||
import com.nu.entity.InvoicingOrdersEntity;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
||||
/**
|
||||
* @Description: 仓库类服务指令工单主表
|
||||
* @Author: zmy
|
||||
* @Date: 2025-12-2
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IInvoicingOrdersApi {
|
||||
|
||||
/**
|
||||
* 点击开始
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
Result<String> beginOrder(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
/**
|
||||
* 点击完成
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
Result<String> finishOrder(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
/**
|
||||
* 请领流程-请领申请 ql_sq
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
Result<String> flowQlsq(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
/**
|
||||
* 请领流程-重新请领申请 ql_sqr
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
Result<String> flowQlsqR(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
/**
|
||||
* 请领流程-出库 ql_ck
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
Result<String> flowQlck(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
/**
|
||||
* 请领流程-回退 ql_ht
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
Result<String> flowQlht(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
/**
|
||||
* 请领流程-作废 ql_zf
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
Result<String> flowQlzf(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
/**
|
||||
* 请领流程-回退作废 ql_htzf
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
Result<String> flowQlhtzf(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
/**
|
||||
* 单元退货-单元申请 dyth_dysq
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
Result<String> flowDythDysq(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
/**
|
||||
* 单元退货-仓库收货 dyth_cksh
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
Result<String> flowDythCksh(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
}
|
||||
|
|
@ -33,8 +33,10 @@ public class InvoicingOrders implements Serializable {
|
|||
private String id;
|
||||
/**数据池子表ID*/
|
||||
private String poolId;
|
||||
/**主表id*/
|
||||
/**业务主表id,或者主表单号*/
|
||||
private String bizId;
|
||||
/**业务类型*/
|
||||
private String bizType;
|
||||
/**护理单元id*/
|
||||
private String nuId;
|
||||
/**护理单元名称*/
|
||||
|
|
@ -97,6 +99,8 @@ public class InvoicingOrders implements Serializable {
|
|||
private String izStart;
|
||||
/**是否完成 Y是 N否*/
|
||||
private String izFinish;
|
||||
/**是否回退 Y是 N否*/
|
||||
private String izRollback;
|
||||
/**创建人*/
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
|
|
@ -115,6 +119,8 @@ public class InvoicingOrders implements Serializable {
|
|||
private String initiatorId;
|
||||
/**发起人姓名*/
|
||||
private String initiatorName;
|
||||
/**备注*/
|
||||
private String remarks;
|
||||
/**接单上限*/
|
||||
@TableField(exist = false)
|
||||
private Integer orderCap;
|
||||
|
|
@ -155,4 +161,24 @@ public class InvoicingOrders implements Serializable {
|
|||
//空闲状态提高3级 指定护理员提高2级
|
||||
@TableField(exist = false)
|
||||
private Integer level;
|
||||
|
||||
/**流程主表ID*/
|
||||
@TableField(exist = false)
|
||||
private String flowMainId;
|
||||
/**流程ID*/
|
||||
@TableField(exist = false)
|
||||
private String flowId;
|
||||
/**流程名称*/
|
||||
@TableField(exist = false)
|
||||
private String flowName;
|
||||
/**下一流程节点ID*/
|
||||
@TableField(exist = false)
|
||||
private String subId;
|
||||
/**流程编码*/
|
||||
@TableField(exist = false)
|
||||
private String flowCode;
|
||||
/**是否启用 Y启用 N未启用*/
|
||||
@TableField(exist = false)
|
||||
private String izEnabled;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nu.modules.biz.invoicing.order.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.entity.InvoicingOrdersEntity;
|
||||
import com.nu.modules.biz.invoicing.order.entity.InvoicingOrders;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -14,8 +15,12 @@ import java.util.List;
|
|||
* @Version: V1.0
|
||||
*/
|
||||
public interface InvoicingOrdersMapper extends BaseMapper<InvoicingOrders> {
|
||||
InvoicingOrders getOnLineEmployeeById(@Param("employeeId") String employeeId);
|
||||
List<InvoicingOrders> queryDataPoolList(InvoicingOrders orders);
|
||||
List<InvoicingOrders> getEmpPermissionAndOnline(@Param("directiveId") String directiveId, @Param("startTime") Date startTime);
|
||||
InvoicingOrders getEmpOrderly(@Param("customerId") String customerId);
|
||||
List<InvoicingOrders> getPermissionEmps(@Param("directiveIds") String directiveIds);
|
||||
List<InvoicingOrders> getFlowList(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
InvoicingOrders getFlowOne(InvoicingOrders invoicingOrders);
|
||||
void updateOrder(InvoicingOrders invoicingOrders);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,17 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.biz.invoicing.order.mapper.InvoicingOrdersMapper">
|
||||
|
||||
<select id="getOnLineEmployeeById" resultType="com.nu.modules.biz.invoicing.order.entity.InvoicingOrders">
|
||||
select
|
||||
a.id as employeeId,
|
||||
a.name as employeeName
|
||||
from nu_biz_employees_info a
|
||||
where a.del_flag = '0'
|
||||
and a.iz_freeze = 'N'
|
||||
and a.iz_online = 'Y'
|
||||
and a.id = #{employeeId}
|
||||
</select>
|
||||
|
||||
<select id="queryDataPoolList" resultType="com.nu.modules.biz.invoicing.order.entity.InvoicingOrders">
|
||||
select
|
||||
a.id as poolId,
|
||||
|
|
@ -63,6 +74,7 @@
|
|||
from nu_biz_nu_invoicing_directive_order
|
||||
where start_time >=DATE_FORMAT(NOW(), '%Y-%m-%d 00:00:00')
|
||||
and start_time <=DATE_FORMAT(NOW(), '%Y-%m-%d 23:59:59')
|
||||
and del_flag = '0'
|
||||
group by employee_id
|
||||
) e on a.id = e.employee_id
|
||||
left join (
|
||||
|
|
@ -70,6 +82,7 @@
|
|||
from nu_biz_nu_invoicing_directive_order
|
||||
where start_time = #{startTime}
|
||||
or (start_time < #{startTime} and end_time > #{startTime})
|
||||
and del_flag = '0'
|
||||
group by employee_id
|
||||
) f on a.id = f.employee_id
|
||||
where a.del_flag = '0'
|
||||
|
|
@ -101,4 +114,94 @@
|
|||
group by a.id
|
||||
</select>
|
||||
|
||||
<select id="getFlowList" resultType="com.nu.modules.biz.invoicing.order.entity.InvoicingOrders">
|
||||
select
|
||||
a.id as flowId,
|
||||
a.name as flowName,
|
||||
a.main_id as flowMainId,
|
||||
a.sub_id as subId,
|
||||
a.flow_code as flowCode,
|
||||
a.directive_id as directiveId,
|
||||
b.directive_name as directiveName,
|
||||
b.cycle_type as cycleTypeId,
|
||||
dict.item_text as cycleType,
|
||||
b.preview_file as previewFile,
|
||||
b.preview_file_small as previewFileSmall,
|
||||
b.mp3_file as mp3File,
|
||||
b.mp4_file as mp4File,
|
||||
b.service_duration as serviceDuration,
|
||||
b.service_content as serviceContent
|
||||
from nu_config_service_flow_sub a
|
||||
inner join nu_config_service_directive b on b.id = a.directive_id
|
||||
LEFT JOIN (select * from sys_dict_item where dict_id = '1900374791386140674') dict on b.cycle_type = dict.item_value
|
||||
<where>
|
||||
<if test="flowCode != null and flowCode != ''">
|
||||
AND a.flow_code = #{flowCode}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getFlowOne" resultType="com.nu.modules.biz.invoicing.order.entity.InvoicingOrders">
|
||||
select
|
||||
a.id as flowId,
|
||||
a.name as flowName,
|
||||
a.main_id as flowMainId,
|
||||
a.sub_id as subId,
|
||||
a.flow_code as flowCode,
|
||||
a.directive_id as directiveId,
|
||||
b.directive_name as directiveName,
|
||||
b.cycle_type as cycleTypeId,
|
||||
dict.item_text as cycleType,
|
||||
b.preview_file as previewFile,
|
||||
b.preview_file_small as previewFileSmall,
|
||||
b.mp3_file as mp3File,
|
||||
b.mp4_file as mp4File,
|
||||
b.service_duration as serviceDuration,
|
||||
b.service_content as serviceContent
|
||||
from nu_config_service_flow_sub a
|
||||
inner join nu_config_service_directive b on b.id = a.directive_id
|
||||
LEFT JOIN (select * from sys_dict_item where dict_id = '1900374791386140674') dict on b.cycle_type = dict.item_value
|
||||
where a.id = #{flowId}
|
||||
</select>
|
||||
|
||||
<update id="updateOrder">
|
||||
update nu_biz_nu_invoicing_directive_order
|
||||
set update_time = #{updateTime}
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
,update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="beginTime != null and beginTime != ''">
|
||||
,begin_time = #{beginTime}
|
||||
</if>
|
||||
<if test="IzStart != null and IzStart != ''">
|
||||
,iz_start = #{IzStart}
|
||||
</if>
|
||||
<if test="finishTime != null and finishTime != ''">
|
||||
,finish_time = #{finishTime}
|
||||
</if>
|
||||
<if test="izFinish != null and izFinish != ''">
|
||||
,iz_finish = #{izFinish}
|
||||
</if>
|
||||
<where>
|
||||
<if test="id != null and id != ''">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="bizId != null and bizId != ''">
|
||||
and biz_id = #{bizId}
|
||||
</if>
|
||||
<if test="nuId != null and nuId != ''">
|
||||
and nu_id = #{nuId}
|
||||
</if>
|
||||
<if test="customerId != null and customerId != ''">
|
||||
and customer_id = #{customerId}
|
||||
</if>
|
||||
<if test="directiveId != null and directiveId != ''">
|
||||
and directive_id = #{directiveId}
|
||||
</if>
|
||||
<if test="bizType != null and bizType != ''">
|
||||
and biz_type = #{bizType}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.nu.modules.biz.invoicing.order.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.biz.invoicing.order.entity.InvoicingOrders;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 仓库类服务指令工单-根据规则获得员工
|
||||
* @Author: caolei
|
||||
* @Date: 2025-12-10
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IEmpOrdersService extends IService<InvoicingOrders> {
|
||||
|
||||
InvoicingOrders employeeScreening(String directiveId, String customerId, Date startTime);
|
||||
|
||||
InvoicingOrders getOnLineEmployeeById(String employeeId);
|
||||
}
|
||||
|
|
@ -1,15 +1,23 @@
|
|||
package com.nu.modules.biz.invoicing.order.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.entity.InvoicingOrdersEntity;
|
||||
import com.nu.modules.biz.invoicing.order.entity.InvoicingOrders;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 仓库类服务指令工单主表
|
||||
* @Description: 仓库类服务指令工单
|
||||
* @Author: caolei
|
||||
* @Date: 2025-12-1
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IInvoicingOrdersService extends IService<InvoicingOrders> {
|
||||
/**
|
||||
* 指令池批量生成工单-定时调用
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Result<?> generateOrdersBatch();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
package com.nu.modules.biz.invoicing.order.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.entity.InvoicingOrdersEntity;
|
||||
import com.nu.modules.biz.invoicing.order.entity.InvoicingOrders;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
||||
/**
|
||||
* @Description: 仓库类服务指令-请领工单
|
||||
* @Author: caolei
|
||||
* @Date: 2025-12-10
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IQlOrdersService extends IService<InvoicingOrders> {
|
||||
|
||||
/**
|
||||
* 请领申请,护理员点击提交按钮,修改请领指令工单bizId,获取下一节点,获取库管,生成一条未开始出库指令工单,ws推送通知库管
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
void flowQlsq(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
/**
|
||||
* 请领申请-回退后重新申请
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
void flowQlsqR(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
/**
|
||||
* 请领出库,1、库管点击出库按钮,完成出库工单,2、获取下一节点,生成一条未开始(发给护理员收货)的工单,ws推送通知护理员
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
void flowQlck(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
/**
|
||||
* 请领回退,1、库管回退,获取未完成未作废的(发给库管)的工单,将工单作废,2、获取下一节点,生成一条未开始(发给护理员请领申请)的工单,ws推送通知护理员
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
void flowQlht(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
/**
|
||||
* 请领出库作废,未完成未作废的出库指定工单。
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
void flowQlzf(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
/**
|
||||
* 请领出库回退作废,
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
void flowQlhtzf(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.nu.modules.biz.invoicing.order.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.entity.InvoicingOrdersEntity;
|
||||
import com.nu.modules.biz.invoicing.order.entity.InvoicingOrders;
|
||||
|
||||
/**
|
||||
* @Description: 仓库类服务指令-退货工单
|
||||
* @Author: caolei
|
||||
* @Date: 2025-12-10
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IThOrdersService extends IService<InvoicingOrders> {
|
||||
|
||||
/**
|
||||
* 单元退货-单元申请
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
void flowDythDysq(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
/**
|
||||
* 单元退货-仓库收货
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
void flowDythCksh(InvoicingOrdersEntity invoicingOrdersEntity);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,420 @@
|
|||
package com.nu.modules.biz.invoicing.order.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.entity.InvoicingOrdersEntity;
|
||||
import com.nu.modules.biz.invoicing.order.entity.InvoicingOrders;
|
||||
import com.nu.modules.biz.invoicing.order.mapper.InvoicingOrdersMapper;
|
||||
import com.nu.modules.biz.invoicing.order.service.IEmpOrdersService;
|
||||
import com.nu.modules.biz.invoicing.order.service.IInvoicingOrdersService;
|
||||
import com.nu.modules.biz.invoicing.order.service.IQlOrdersService;
|
||||
import com.nu.modules.biz.invoicing.order.service.IThOrdersService;
|
||||
import com.nu.modules.config.sendorderrule.entity.SendOrderRule;
|
||||
import com.nu.modules.config.sendorderrule.entity.SendOrderRuleSub;
|
||||
import com.nu.modules.config.sendorderrule.service.ISendOrderRuleService;
|
||||
import com.nu.modules.config.sendorderrule.service.ISendOrderRuleSubService;
|
||||
import com.nu.modules.invoicing.api.IInvoicingOrdersApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 仓库类服务指令工单-根据规则获得员工
|
||||
* @Author: caolei
|
||||
* @Date: 2025-12-10
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class EmpOrdersServiceImpl extends ServiceImpl<InvoicingOrdersMapper, InvoicingOrders> implements IEmpOrdersService {
|
||||
|
||||
@Autowired
|
||||
ISendOrderRuleService sendOrderRuleService;
|
||||
@Autowired
|
||||
ISendOrderRuleSubService sendOrderRuleSubService;
|
||||
|
||||
private SendOrderRule sendOrderRule;
|
||||
private List<SendOrderRuleSub> ruleSubList;
|
||||
|
||||
/**
|
||||
* 获取派单规则
|
||||
*/
|
||||
@Override
|
||||
public InvoicingOrders getOnLineEmployeeById(String employeeId){
|
||||
return baseMapper.getOnLineEmployeeById(employeeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取派单规则
|
||||
*/
|
||||
private void getSendOrderRule(){
|
||||
if(sendOrderRule == null){
|
||||
QueryWrapper<SendOrderRule> qw = new QueryWrapper<>();
|
||||
qw.eq("iz_enabled", "Y");
|
||||
sendOrderRule = sendOrderRuleService.getOne(qw);
|
||||
QueryWrapper<SendOrderRuleSub> subqw = new QueryWrapper<>();
|
||||
subqw.eq("iz_enabled", "Y");
|
||||
subqw.eq("main_id", sendOrderRule.getId());
|
||||
subqw.orderByAsc("sort");
|
||||
ruleSubList = sendOrderRuleSubService.list(subqw);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取在线,有指令权限的员工,并获取员工的接单上限、收益、服务时长、单次
|
||||
*
|
||||
* @param directiveId
|
||||
* @return
|
||||
*/
|
||||
private List<InvoicingOrders> getEmpPermissionAndOnline(String directiveId, Date startTime) {
|
||||
return baseMapper.getEmpPermissionAndOnline(directiveId, startTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取长者指定所有护理员
|
||||
*
|
||||
* @param customerId
|
||||
* @return
|
||||
*/
|
||||
private Map<String, String> getEmpOrderly(String customerId) {
|
||||
Map<String, String> map = null;
|
||||
InvoicingOrders orders = baseMapper.getEmpOrderly(customerId);
|
||||
if (orders != null) {
|
||||
String empIds = orders.getEmployeeIds();
|
||||
if (empIds != null && !empIds.equals("")) {
|
||||
String[] pairs = empIds.split(",");
|
||||
if (pairs.length > 0) {
|
||||
map = new HashMap<>();
|
||||
for (String pair : pairs) {
|
||||
map.put(pair, pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取满足条件的员工
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public InvoicingOrders employeeScreening(String directiveId, String customerId, Date startTime) {
|
||||
getSendOrderRule();
|
||||
if (sendOrderRule.getRuleCode().equals("1")) {
|
||||
//按优先级
|
||||
return getByPriority(directiveId, customerId, startTime);
|
||||
}
|
||||
if (sendOrderRule.getRuleCode().equals("2")) {
|
||||
//按人头
|
||||
return getByHeadCount(directiveId, customerId, startTime);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 优先级派单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private InvoicingOrders getByPriority(String directiveId, String customerId, Date startTime) {
|
||||
List<InvoicingOrders> empList = getEmpPermissionAndOnline(directiveId, startTime);
|
||||
if (empList.size() > 0) {
|
||||
if(ruleSubList.size()>0){
|
||||
for(SendOrderRuleSub ruleSub : ruleSubList){
|
||||
switch (ruleSub.getRuleCode()) {
|
||||
case 1:
|
||||
//空闲积分
|
||||
sortByIzFree(empList,ruleSub.getCoefficient());
|
||||
break;
|
||||
case 2:
|
||||
//专员积分
|
||||
sortByOrderly(empList,ruleSub.getCoefficient(),customerId);
|
||||
break;
|
||||
case 3:
|
||||
//单次积分
|
||||
sortByNumAndSetLevel(empList,ruleSub.getCoefficient());
|
||||
break;
|
||||
case 4:
|
||||
//收益积分
|
||||
sortByPriceAndSetLevel(empList,ruleSub.getCoefficient());
|
||||
break;
|
||||
case 5:
|
||||
//服务时长积分
|
||||
sortByDurationAndSetLevel(empList,ruleSub.getCoefficient());
|
||||
break;
|
||||
case 6:
|
||||
//最后接单时间积分
|
||||
sortByMaxTimeAndSetLevel(empList,ruleSub.getCoefficient());
|
||||
break;
|
||||
case 7:
|
||||
//超出上限积分
|
||||
sortByLimit(empList,ruleSub.getCoefficient());
|
||||
break;
|
||||
}
|
||||
}
|
||||
//获取员工信息
|
||||
sortEmpList(empList);
|
||||
return empList.get(0);
|
||||
}else{
|
||||
//随机获取一个员工
|
||||
Random random = new Random();
|
||||
return empList.get(random.nextInt(empList.size()));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按人头派单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private InvoicingOrders getByHeadCount(String directiveId, String customerId, Date startTime) {
|
||||
List<InvoicingOrders> empList = getEmpPermissionAndOnline(directiveId,startTime);
|
||||
if (empList.size() > 0) {
|
||||
for(int i=0;i<empList.size();i++){
|
||||
InvoicingOrders emp = empList.get(i);
|
||||
System.out.println("员工信息:"+emp.getEmployeeName()+","+emp.getOrderCap()+","+emp.getOrderNum()+","+emp.getTotalDuration()+","+emp.getTotalComPrice()+","+emp.getMaxTime()+","+emp.getOwnCn()+","+emp.getIzFree());
|
||||
}
|
||||
|
||||
//****************获取指定护理员工列表,不指定的排除掉=============================>
|
||||
getByOrderly(empList,customerId);
|
||||
|
||||
if(ruleSubList.size()>0){
|
||||
for(SendOrderRuleSub ruleSub : ruleSubList){
|
||||
switch (ruleSub.getRuleCode()) {
|
||||
case 1:
|
||||
//空闲积分
|
||||
sortByIzFree(empList,ruleSub.getCoefficient());
|
||||
break;
|
||||
case 2:
|
||||
//单次积分
|
||||
sortByNumAndSetLevel(empList,ruleSub.getCoefficient());
|
||||
break;
|
||||
case 3:
|
||||
//收益积分
|
||||
sortByPriceAndSetLevel(empList,ruleSub.getCoefficient());
|
||||
break;
|
||||
case 4:
|
||||
//服务时长积分
|
||||
sortByDurationAndSetLevel(empList,ruleSub.getCoefficient());
|
||||
break;
|
||||
case 5:
|
||||
//最后接单时间积分
|
||||
sortByMaxTimeAndSetLevel(empList,ruleSub.getCoefficient());
|
||||
break;
|
||||
case 6:
|
||||
//超出上限积分
|
||||
sortByLimit(empList,ruleSub.getCoefficient());
|
||||
break;
|
||||
}
|
||||
}
|
||||
//获取员工信息
|
||||
sortEmpList(empList);
|
||||
return empList.get(0);
|
||||
}else{
|
||||
//随机获取一个员工
|
||||
Random random = new Random();
|
||||
return empList.get(random.nextInt(empList.size()));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过员工空闲状态来设置优先级
|
||||
*
|
||||
* @param empList
|
||||
*/
|
||||
public void sortByIzFree(List<InvoicingOrders> empList, Integer coefficient) {
|
||||
for (int i = 0; i < empList.size(); i++) {
|
||||
InvoicingOrders emp = empList.get(i);
|
||||
if (emp.getIzFree().equals(1)) {
|
||||
Integer empLevel = emp.getLevel();
|
||||
empLevel = empLevel + empList.size() * coefficient; //提高5N等级
|
||||
emp.setLevel(empLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过员工专项指定状态来设置优先级
|
||||
*
|
||||
* @param empList
|
||||
*/
|
||||
public void sortByOrderly(List<InvoicingOrders> empList, Integer coefficient, String customerId) {
|
||||
for (int i = 0; i < empList.size(); i++) {
|
||||
InvoicingOrders emp = empList.get(i);
|
||||
String employeeId = emp.getEmployeeId();
|
||||
Map<String, String> orderlyMap = getEmpOrderly(customerId);
|
||||
if (orderlyMap != null) {
|
||||
String orderlyId = orderlyMap.get(employeeId);
|
||||
if (orderlyId != null && !orderlyId.equals("")) {
|
||||
Integer empLevel = emp.getLevel();
|
||||
empLevel = empLevel + empList.size() * coefficient; //提高4N等级
|
||||
emp.setLevel(empLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过工单次数排序数据来设置优先级
|
||||
*
|
||||
* @param empList
|
||||
*/
|
||||
public void sortByNumAndSetLevel(List<InvoicingOrders> empList, Integer coefficient) {
|
||||
// 根据orderNum倒序排序,并为level顺序赋值
|
||||
List<InvoicingOrders> sortedEmployees = empList.stream()
|
||||
.sorted(Comparator.comparing(InvoicingOrders::getOrderNum).reversed())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 为level字段顺序赋值1,2,3...
|
||||
for (int i = 0; i < sortedEmployees.size(); i++) {
|
||||
Integer levle = sortedEmployees.get(i).getLevel()*coefficient + i + 1;
|
||||
sortedEmployees.get(i).setLevel(levle);
|
||||
}
|
||||
|
||||
// 如果需要返回新列表,可以返回sortedEmployees
|
||||
// 如果要在原列表上修改,可以清空原列表并添加所有元素
|
||||
empList.clear();
|
||||
empList.addAll(sortedEmployees);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过总收益排序数据来设置优先级
|
||||
*
|
||||
* @param empList
|
||||
*/
|
||||
public void sortByPriceAndSetLevel(List<InvoicingOrders> empList, Integer coefficient) {
|
||||
// 根据totalComPrice倒序排序,并为level顺序赋值
|
||||
List<InvoicingOrders> sortedEmployees = empList.stream()
|
||||
.sorted(Comparator.comparing(InvoicingOrders::getTotalComPrice).reversed())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 为level字段顺序赋值1,2,3...
|
||||
for (int i = 0; i < sortedEmployees.size(); i++) {
|
||||
Integer levle = sortedEmployees.get(i).getLevel()*coefficient + i + 1;
|
||||
sortedEmployees.get(i).setLevel(levle);
|
||||
}
|
||||
|
||||
// 如果需要返回新列表,可以返回sortedEmployees
|
||||
// 如果要在原列表上修改,可以清空原列表并添加所有元素
|
||||
empList.clear();
|
||||
empList.addAll(sortedEmployees);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过服务时长排序数据来设置优先级
|
||||
*
|
||||
* @param empList
|
||||
*/
|
||||
public void sortByDurationAndSetLevel(List<InvoicingOrders> empList, Integer coefficient) {
|
||||
// 根据totalDuration倒序排序,并为level顺序赋值
|
||||
List<InvoicingOrders> sortedEmployees = empList.stream()
|
||||
.sorted(Comparator.comparing(InvoicingOrders::getTotalDuration).reversed())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 为level字段顺序赋值1,2,3...
|
||||
for (int i = 0; i < sortedEmployees.size(); i++) {
|
||||
Integer levle = sortedEmployees.get(i).getLevel()*coefficient + i + 1;
|
||||
sortedEmployees.get(i).setLevel(levle);
|
||||
}
|
||||
|
||||
// 如果需要返回新列表,可以返回sortedEmployees
|
||||
// 如果要在原列表上修改,可以清空原列表并添加所有元素
|
||||
empList.clear();
|
||||
empList.addAll(sortedEmployees);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过最后一次接收派单时间排序数据来设置优先级
|
||||
*
|
||||
* @param empList
|
||||
*/
|
||||
public void sortByMaxTimeAndSetLevel(List<InvoicingOrders> empList, Integer coefficient) {
|
||||
// 根据maxTime倒序排序,并为level顺序赋值
|
||||
List<InvoicingOrders> sortedEmployees = empList.stream()
|
||||
.sorted(Comparator.comparing(
|
||||
InvoicingOrders::getMaxTime,
|
||||
Comparator.nullsLast(Comparator.reverseOrder())
|
||||
))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 为level字段顺序赋值1,2,3...
|
||||
for (int i = 0; i < sortedEmployees.size(); i++) {
|
||||
Integer levle = sortedEmployees.get(i).getLevel()*coefficient + i + 1;
|
||||
sortedEmployees.get(i).setLevel(levle);
|
||||
}
|
||||
|
||||
// 如果需要返回新列表,可以返回sortedEmployees
|
||||
// 如果要在原列表上修改,可以清空原列表并添加所有元素
|
||||
empList.clear();
|
||||
empList.addAll(sortedEmployees);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过接单上限来排序数据来设置优先级
|
||||
*
|
||||
* @param empList
|
||||
*/
|
||||
public void sortByLimit(List<InvoicingOrders> empList, Integer coefficient) {
|
||||
for (int i = 0; i < empList.size(); i++) {
|
||||
//工单超出接单上限,降4N级
|
||||
if (empList.get(i).getOwnCn() >= empList.get(i).getOrderCap()) {
|
||||
Integer levle = empList.get(i).getLevel() + empList.size() * coefficient;
|
||||
empList.get(i).setLevel(levle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按优先级排序数据
|
||||
*
|
||||
* @param empList
|
||||
*/
|
||||
public void sortEmpList(List<InvoicingOrders> empList) {
|
||||
//为level顺序
|
||||
List<InvoicingOrders> sortedEmployees = empList.stream()
|
||||
.sorted(Comparator.comparing(InvoicingOrders::getLevel).reversed())
|
||||
.collect(Collectors.toList());
|
||||
// 如果需要返回新列表,可以返回sortedEmployees
|
||||
// 如果要在原列表上修改,可以清空原列表并添加所有元素
|
||||
empList.clear();
|
||||
empList.addAll(sortedEmployees);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定护理员工列表
|
||||
*
|
||||
* @param empList
|
||||
*/
|
||||
public void getByOrderly(List<InvoicingOrders> empList, String customerId) {
|
||||
List<InvoicingOrders> newList = new ArrayList();
|
||||
for (int i = 0; i < empList.size(); i++) {
|
||||
InvoicingOrders emp = empList.get(i);
|
||||
String employeeId = emp.getEmployeeId();
|
||||
Map<String, String> orderlyMap = getEmpOrderly(customerId);
|
||||
if (orderlyMap != null) {
|
||||
String orderlyId = orderlyMap.get(employeeId);
|
||||
if (orderlyId != null && !orderlyId.equals("")) {
|
||||
newList.add(emp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
empList.clear();
|
||||
empList.addAll(newList);
|
||||
for(int i=0;i<empList.size();i++){
|
||||
InvoicingOrders emp = empList.get(i);
|
||||
System.out.println("获取指定护理员工信息:"+emp.getEmployeeId()+"-"+emp.getEmployeeName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,372 @@
|
|||
package com.nu.modules.biz.invoicing.order.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.entity.InvoicingOrdersEntity;
|
||||
import com.nu.modules.biz.invoicing.order.entity.InvoicingOrders;
|
||||
import com.nu.modules.biz.invoicing.order.mapper.InvoicingOrdersMapper;
|
||||
import com.nu.modules.biz.invoicing.order.service.IEmpOrdersService;
|
||||
import com.nu.modules.biz.invoicing.order.service.IInvoicingOrdersService;
|
||||
import com.nu.modules.biz.invoicing.order.service.IQlOrdersService;
|
||||
import com.nu.modules.config.sendorderrule.entity.SendOrderRule;
|
||||
import com.nu.modules.config.sendorderrule.entity.SendOrderRuleSub;
|
||||
import com.nu.modules.config.sendorderrule.service.ISendOrderRuleService;
|
||||
import com.nu.modules.config.sendorderrule.service.ISendOrderRuleSubService;
|
||||
import com.nu.modules.invoicing.api.IInvoicingOrdersApi;
|
||||
import com.nu.modules.sysconfig.ISysConfigApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 仓库类服务指令-请领工单
|
||||
* @Author: caolei
|
||||
* @Date: 2025-12-1
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class QlOrdersServiceImpl extends ServiceImpl<InvoicingOrdersMapper, InvoicingOrders> implements IQlOrdersService {
|
||||
|
||||
@Autowired
|
||||
IEmpOrdersService empOrdersService;
|
||||
@Autowired
|
||||
private ISysConfigApi sysConfigApi;
|
||||
private String serverNetUrl;
|
||||
|
||||
private InvoicingOrders getOrderInfo(InvoicingOrdersEntity invoicingOrdersEntity,InvoicingOrders flow){
|
||||
QueryWrapper<InvoicingOrders> ioQw = new QueryWrapper<>();
|
||||
ioQw.eq("directive_id", flow.getDirectiveId());
|
||||
ioQw.eq("nu_id", invoicingOrdersEntity.getNuId());
|
||||
ioQw.eq("customer_id", invoicingOrdersEntity.getCustomerId());
|
||||
ioQw.eq("iz_finish", "N");
|
||||
ioQw.eq("iz_rollback", "N");
|
||||
ioQw.eq("del_flag", "0");
|
||||
ioQw.eq("biz_type", invoicingOrdersEntity.getFlowCode());
|
||||
if(invoicingOrdersEntity.getBizId()!=null&&!invoicingOrdersEntity.getBizId().equals("")){
|
||||
ioQw.eq("biz_id", invoicingOrdersEntity.getBizId());
|
||||
}
|
||||
InvoicingOrders order = this.getOne(ioQw);
|
||||
return order;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请领申请
|
||||
* 护理员点击提交按钮,修改请领指令工单bizId
|
||||
* 获取下一节点,派单规则获取库管,生成一条未开始出库指令工单
|
||||
* ws推送通知库管
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
@Override
|
||||
public void flowQlsq(InvoicingOrdersEntity invoicingOrdersEntity){
|
||||
List<InvoicingOrders> flowList = baseMapper.getFlowList(invoicingOrdersEntity);
|
||||
if(flowList!=null){
|
||||
Calendar c = Calendar.getInstance();
|
||||
InvoicingOrders flow = flowList.get(0);
|
||||
InvoicingOrders order = getOrderInfo(invoicingOrdersEntity,flow);
|
||||
if(order!=null){
|
||||
//修改请领单的bizId
|
||||
InvoicingOrders entity = new InvoicingOrders();
|
||||
entity.setId(order.getId());
|
||||
entity.setBizId(invoicingOrdersEntity.getBizId());
|
||||
this.updateById(entity);
|
||||
}
|
||||
String subId = flow.getSubId();
|
||||
if(subId!=null&&!subId.equals("")){
|
||||
InvoicingOrders invoicingOrders = new InvoicingOrders();
|
||||
invoicingOrders.setFlowId(subId);
|
||||
InvoicingOrders flowSub = baseMapper.getFlowOne(invoicingOrders);
|
||||
InvoicingOrders employee = empOrdersService.employeeScreening(flowSub.getDirectiveId(), invoicingOrdersEntity.getCustomerId(), c.getTime());
|
||||
insertNextOrder(flowSub,invoicingOrdersEntity,employee.getEmployeeId(),employee.getEmployeeName(),invoicingOrdersEntity.getInitiatorId(),invoicingOrdersEntity.getInitiatorName(),flowSub.getFlowCode(),"N");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请领申请-回退后重新申请
|
||||
* 护理员点击提交按钮,修改请领指令工单bizId
|
||||
* 获取下一节点,派单规则获取库管,生成一条未开始出库指令工单
|
||||
* ws推送通知库管
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
@Override
|
||||
public void flowQlsqR(InvoicingOrdersEntity invoicingOrdersEntity){
|
||||
InvoicingOrdersEntity flowCode = new InvoicingOrdersEntity();
|
||||
flowCode.setFlowCode("ql_sq");
|
||||
List<InvoicingOrders> flowList = baseMapper.getFlowList(flowCode);
|
||||
if(flowList!=null){
|
||||
Calendar c = Calendar.getInstance();
|
||||
InvoicingOrders flow = flowList.get(0);
|
||||
String subId = flow.getSubId();
|
||||
if(subId!=null&&!subId.equals("")){
|
||||
InvoicingOrders invoicingOrders = new InvoicingOrders();
|
||||
invoicingOrders.setFlowId(subId);
|
||||
InvoicingOrders flowSub = baseMapper.getFlowOne(invoicingOrders);
|
||||
InvoicingOrders employee = empOrdersService.employeeScreening(flowSub.getDirectiveId(), invoicingOrdersEntity.getCustomerId(), c.getTime());
|
||||
insertNextOrder(flowSub,invoicingOrdersEntity,employee.getEmployeeId(),employee.getEmployeeName(),invoicingOrdersEntity.getInitiatorId(),invoicingOrdersEntity.getInitiatorName(),flowSub.getFlowCode(),"N");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请领出库
|
||||
* 库管点击出库按钮,获取下一节点
|
||||
* 派单申请人是否在线,在线获取此护理员,不在线则派单规则获取护理员,生成一条未开始收货指令工单
|
||||
* ws推送通知护理员
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
@Override
|
||||
public void flowQlck(InvoicingOrdersEntity invoicingOrdersEntity){
|
||||
List<InvoicingOrders> flowList = baseMapper.getFlowList(invoicingOrdersEntity);
|
||||
if(flowList!=null){
|
||||
Calendar c = Calendar.getInstance();
|
||||
InvoicingOrders flow = flowList.get(0);
|
||||
InvoicingOrders order = getOrderInfo(invoicingOrdersEntity,flow);
|
||||
String initiatorId = "";
|
||||
String initiatorName = "";
|
||||
if(order!=null){
|
||||
initiatorId = order.getInitiatorId();
|
||||
initiatorName = order.getInitiatorName();
|
||||
InvoicingOrders employee = empOrdersService.getOnLineEmployeeById(initiatorId); //获取是否在线
|
||||
String subId = flow.getSubId();
|
||||
if(subId!=null&&!subId.equals("")){
|
||||
InvoicingOrders invoicingOrders = new InvoicingOrders();
|
||||
invoicingOrders.setFlowId(subId);
|
||||
InvoicingOrders flowSub = baseMapper.getFlowOne(invoicingOrders);
|
||||
if(employee==null){
|
||||
employee = empOrdersService.employeeScreening(flowSub.getDirectiveId(), invoicingOrdersEntity.getCustomerId(), c.getTime());
|
||||
}
|
||||
insertNextOrder(flowSub,invoicingOrdersEntity,employee.getEmployeeId(),employee.getEmployeeName(),initiatorId,initiatorName,flowSub.getFlowCode(),"N");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请领回退
|
||||
* 库管点击回退按钮,获取未完成未作废的(发给库管)的出库指令工单,获取申请人,并将此工单标记成回退
|
||||
* 获取下一节点,生成一条未开始(发给护理员请领申请)的工单
|
||||
* ws推送通知护理员
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
@Override
|
||||
public void flowQlht(InvoicingOrdersEntity invoicingOrdersEntity){
|
||||
InvoicingOrdersEntity flowCode = new InvoicingOrdersEntity();
|
||||
flowCode.setFlowCode("ql_ck");
|
||||
List<InvoicingOrders> flowList = baseMapper.getFlowList(flowCode);
|
||||
if(flowList!=null){
|
||||
InvoicingOrders flow = flowList.get(0);
|
||||
QueryWrapper<InvoicingOrders> ioQw = new QueryWrapper<>();
|
||||
ioQw.eq("directive_id", flow.getDirectiveId());
|
||||
ioQw.eq("nu_id", invoicingOrdersEntity.getNuId());
|
||||
ioQw.eq("customer_id", invoicingOrdersEntity.getCustomerId());
|
||||
ioQw.eq("iz_finish", "N");
|
||||
ioQw.eq("del_flag", "0");
|
||||
ioQw.eq("biz_type", "ql_ck");
|
||||
ioQw.eq("biz_id", invoicingOrdersEntity.getBizId());
|
||||
InvoicingOrders order = this.getOne(ioQw);
|
||||
if(order!=null){
|
||||
String employeeId = order.getInitiatorId();
|
||||
String employeeName = order.getInitiatorName();
|
||||
InvoicingOrders entity = new InvoicingOrders();
|
||||
entity.setId(order.getId());
|
||||
entity.setIzRollback("Y");
|
||||
entity.setRemarks("请领回退");
|
||||
this.updateById(entity);
|
||||
//回退指令
|
||||
List<InvoicingOrders> htFlowList = baseMapper.getFlowList(invoicingOrdersEntity);
|
||||
for(int i=0;i<htFlowList.size();i++){
|
||||
InvoicingOrders htFlow = htFlowList.get(i);
|
||||
insertNextOrder(htFlow,invoicingOrdersEntity,employeeId,employeeName,employeeId,employeeName,"ql_sq","Y");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请领出库作废,未完成未作废的出库指定工单。
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
@Override
|
||||
public void flowQlzf(InvoicingOrdersEntity invoicingOrdersEntity){
|
||||
InvoicingOrdersEntity flowCode = new InvoicingOrdersEntity();
|
||||
flowCode.setFlowCode("ql_ck");
|
||||
List<InvoicingOrders> flowList = baseMapper.getFlowList(flowCode);
|
||||
if(flowList!=null){
|
||||
InvoicingOrders flow = flowList.get(0);
|
||||
QueryWrapper<InvoicingOrders> ioQw = new QueryWrapper<>();
|
||||
ioQw.eq("directive_id", flow.getDirectiveId());
|
||||
ioQw.eq("nu_id", invoicingOrdersEntity.getNuId());
|
||||
ioQw.eq("customer_id", invoicingOrdersEntity.getCustomerId());
|
||||
ioQw.eq("iz_finish", "N");
|
||||
ioQw.eq("del_flag", "0");
|
||||
ioQw.eq("biz_type", "ql_ck");
|
||||
ioQw.eq("biz_id", invoicingOrdersEntity.getBizId());
|
||||
InvoicingOrders order = this.getOne(ioQw);
|
||||
if(order!=null){
|
||||
Calendar c = Calendar.getInstance();
|
||||
InvoicingOrders entity = new InvoicingOrders();
|
||||
entity.setId(order.getId());
|
||||
entity.setDelFlag("1");
|
||||
entity.setIzFinish("Y");
|
||||
entity.setFinishTime(c.getTime());
|
||||
entity.setUpdateBy(invoicingOrdersEntity.getInitiatorId());
|
||||
entity.setUpdateTime(c.getTime());
|
||||
entity.setRemarks("请领申请作废");
|
||||
this.updateById(entity);
|
||||
|
||||
//ws推送
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请领出库回退作废,
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
@Override
|
||||
public void flowQlhtzf(InvoicingOrdersEntity invoicingOrdersEntity){
|
||||
InvoicingOrdersEntity flowCode = new InvoicingOrdersEntity();
|
||||
flowCode.setFlowCode("ql_sq");
|
||||
List<InvoicingOrders> flowList = baseMapper.getFlowList(flowCode);
|
||||
if(flowList!=null){
|
||||
InvoicingOrders flow = flowList.get(0);
|
||||
QueryWrapper<InvoicingOrders> ioQw = new QueryWrapper<>();
|
||||
ioQw.eq("directive_id", flow.getDirectiveId());
|
||||
ioQw.eq("nu_id", invoicingOrdersEntity.getNuId());
|
||||
ioQw.eq("customer_id", invoicingOrdersEntity.getCustomerId());
|
||||
ioQw.eq("iz_finish", "N");
|
||||
ioQw.eq("iz_rollback", "Y");
|
||||
ioQw.eq("del_flag", "0");
|
||||
ioQw.eq("biz_type", "ql_sq");
|
||||
ioQw.eq("biz_id", invoicingOrdersEntity.getBizId());
|
||||
InvoicingOrders order = this.getOne(ioQw);
|
||||
if(order!=null){
|
||||
Calendar c = Calendar.getInstance();
|
||||
InvoicingOrders entity = new InvoicingOrders();
|
||||
entity.setId(order.getId());
|
||||
entity.setDelFlag("1");
|
||||
entity.setIzFinish("Y");
|
||||
entity.setFinishTime(c.getTime());
|
||||
entity.setUpdateBy(invoicingOrdersEntity.getInitiatorId());
|
||||
entity.setUpdateTime(c.getTime());
|
||||
entity.setRemarks("请领回退作废");
|
||||
this.updateById(entity);
|
||||
|
||||
//ws推送
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加下一步的工单
|
||||
* @param invoicingOrdersEntity
|
||||
* @param flowSub 下一节点
|
||||
* @param invoicingOrdersEntity 业务数据
|
||||
* @param employeeId 员工ID
|
||||
* @param employeeName 员工名称
|
||||
* @param bizType 操作指令编码
|
||||
*/
|
||||
private void insertNextOrder(InvoicingOrders flowSub,InvoicingOrdersEntity invoicingOrdersEntity,String employeeId,String employeeName,String initiatorId,String initiatorName,String bizType,String izRollback){
|
||||
Calendar c = Calendar.getInstance();
|
||||
getNetImages(flowSub);
|
||||
InvoicingOrders nextEntity = new InvoicingOrders();
|
||||
nextEntity.setBizId(invoicingOrdersEntity.getBizId());
|
||||
nextEntity.setBizType(bizType);
|
||||
nextEntity.setNuId(invoicingOrdersEntity.getNuId());
|
||||
nextEntity.setNuName(invoicingOrdersEntity.getNuName());
|
||||
nextEntity.setCustomerId(invoicingOrdersEntity.getCustomerId());
|
||||
nextEntity.setCustomerName(invoicingOrdersEntity.getCustomerName());
|
||||
nextEntity.setDirectiveId(flowSub.getDirectiveId());
|
||||
nextEntity.setDirectiveName(flowSub.getDirectiveName());
|
||||
nextEntity.setCycleTypeId(flowSub.getCycleTypeId());
|
||||
nextEntity.setCycleType(flowSub.getCycleType());
|
||||
nextEntity.setPreviewFile(flowSub.getPreviewFile());
|
||||
nextEntity.setNetPreviewFile(flowSub.getNetPreviewFile());
|
||||
nextEntity.setPreviewFileSmall(flowSub.getPreviewFileSmall());
|
||||
nextEntity.setNetPreviewFileSmall(flowSub.getNetPreviewFileSmall());
|
||||
nextEntity.setMp3File(flowSub.getMp3File());
|
||||
nextEntity.setNetMp3File(flowSub.getNetMp3File());
|
||||
nextEntity.setMp4File(flowSub.getMp4File());
|
||||
nextEntity.setNetMp4File(flowSub.getNetMp4File());
|
||||
nextEntity.setServiceDuration(flowSub.getServiceDuration());
|
||||
nextEntity.setServiceContent(flowSub.getServiceContent());
|
||||
nextEntity.setIzStart("N");
|
||||
nextEntity.setIzFinish("N");
|
||||
nextEntity.setIzRollback(izRollback);
|
||||
nextEntity.setCreateBy(invoicingOrdersEntity.getInitiatorId());
|
||||
nextEntity.setCreateTime(c.getTime());
|
||||
nextEntity.setDelFlag("0");
|
||||
nextEntity.setInitiatorId(initiatorId);
|
||||
nextEntity.setInitiatorName(initiatorName);
|
||||
nextEntity.setBeginTime(c.getTime());
|
||||
c.add(Calendar.MINUTE,Integer.valueOf(flowSub.getServiceDuration()));
|
||||
nextEntity.setEndTime(c.getTime());
|
||||
nextEntity.setEmployeeId(employeeId);
|
||||
nextEntity.setEmployeeName(employeeName);
|
||||
baseMapper.insert(nextEntity);
|
||||
|
||||
//ws推送 employeeId
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取管理平台静态资源路径
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private void getOpeMediaAddress() {
|
||||
if (serverNetUrl == null || serverNetUrl.equals("")) {
|
||||
JSONObject json = sysConfigApi.getByKey("ope_media_address");
|
||||
if (json != null) {
|
||||
String configValue = json.getString("configValue");
|
||||
if (!configValue.endsWith("/")) {
|
||||
configValue += "/";
|
||||
}
|
||||
serverNetUrl = configValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getImageNetUrl(String imageUrl) {
|
||||
getOpeMediaAddress();
|
||||
return serverNetUrl + imageUrl;
|
||||
}
|
||||
|
||||
private InvoicingOrders getNetImages(InvoicingOrders invoicingOrders) {
|
||||
if (invoicingOrders.getPreviewFile() != null && !invoicingOrders.getPreviewFile().equals("")) {
|
||||
String netPreviewFile = getImageNetUrl(invoicingOrders.getPreviewFile());
|
||||
invoicingOrders.setNetPreviewFile(netPreviewFile);
|
||||
} else {
|
||||
invoicingOrders.setPreviewFile("");
|
||||
invoicingOrders.setNetPreviewFile("");
|
||||
}
|
||||
if (invoicingOrders.getPreviewFileSmall() != null && !invoicingOrders.getPreviewFileSmall().equals("")) {
|
||||
String netPreviewFileSmall = getImageNetUrl(invoicingOrders.getPreviewFileSmall());
|
||||
invoicingOrders.setNetPreviewFileSmall(netPreviewFileSmall);
|
||||
} else {
|
||||
invoicingOrders.setPreviewFileSmall("");
|
||||
invoicingOrders.setNetPreviewFileSmall("");
|
||||
}
|
||||
if (invoicingOrders.getMp3File() != null && !invoicingOrders.getMp3File().equals("")) {
|
||||
String netMp3File = getImageNetUrl(invoicingOrders.getMp3File());
|
||||
invoicingOrders.setNetMp3File(netMp3File);
|
||||
} else {
|
||||
invoicingOrders.setMp3File("");
|
||||
invoicingOrders.setNetMp3File("");
|
||||
}
|
||||
if (invoicingOrders.getMp4File() != null && !invoicingOrders.getMp4File().equals("")) {
|
||||
String netMp4File = getImageNetUrl(invoicingOrders.getMp4File());
|
||||
invoicingOrders.setNetMp4File(netMp4File);
|
||||
} else {
|
||||
invoicingOrders.setMp4File("");
|
||||
invoicingOrders.setNetMp4File("");
|
||||
}
|
||||
return invoicingOrders;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package com.nu.modules.biz.invoicing.order.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.entity.InvoicingOrdersEntity;
|
||||
import com.nu.modules.biz.invoicing.order.entity.InvoicingOrders;
|
||||
import com.nu.modules.biz.invoicing.order.mapper.InvoicingOrdersMapper;
|
||||
import com.nu.modules.biz.invoicing.order.service.IEmpOrdersService;
|
||||
import com.nu.modules.biz.invoicing.order.service.IInvoicingOrdersService;
|
||||
import com.nu.modules.biz.invoicing.order.service.IQlOrdersService;
|
||||
import com.nu.modules.biz.invoicing.order.service.IThOrdersService;
|
||||
import com.nu.modules.sysconfig.ISysConfigApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 仓库类服务指令-请领工单
|
||||
* @Author: caolei
|
||||
* @Date: 2025-12-1
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ThOrdersServiceImpl extends ServiceImpl<InvoicingOrdersMapper, InvoicingOrders> implements IThOrdersService {
|
||||
|
||||
@Autowired
|
||||
IEmpOrdersService empOrdersService;
|
||||
@Autowired
|
||||
private ISysConfigApi sysConfigApi;
|
||||
private String serverNetUrl;
|
||||
|
||||
/**
|
||||
* 单元退货-单元申请
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
@Override
|
||||
public void flowDythDysq(InvoicingOrdersEntity invoicingOrdersEntity){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 单元退货-仓库收货
|
||||
* @param invoicingOrdersEntity
|
||||
*/
|
||||
@Override
|
||||
public void flowDythCksh(InvoicingOrdersEntity invoicingOrdersEntity){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取管理平台静态资源路径
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private void getOpeMediaAddress() {
|
||||
if (serverNetUrl == null || serverNetUrl.equals("")) {
|
||||
JSONObject json = sysConfigApi.getByKey("ope_media_address");
|
||||
if (json != null) {
|
||||
String configValue = json.getString("configValue");
|
||||
if (!configValue.endsWith("/")) {
|
||||
configValue += "/";
|
||||
}
|
||||
serverNetUrl = configValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getImageNetUrl(String imageUrl) {
|
||||
getOpeMediaAddress();
|
||||
return serverNetUrl + imageUrl;
|
||||
}
|
||||
|
||||
private InvoicingOrders getNetImages(InvoicingOrders invoicingOrders) {
|
||||
if (invoicingOrders.getPreviewFile() != null && !invoicingOrders.getPreviewFile().equals("")) {
|
||||
String netPreviewFile = getImageNetUrl(invoicingOrders.getPreviewFile());
|
||||
invoicingOrders.setNetPreviewFile(netPreviewFile);
|
||||
} else {
|
||||
invoicingOrders.setPreviewFile("");
|
||||
invoicingOrders.setNetPreviewFile("");
|
||||
}
|
||||
if (invoicingOrders.getPreviewFileSmall() != null && !invoicingOrders.getPreviewFileSmall().equals("")) {
|
||||
String netPreviewFileSmall = getImageNetUrl(invoicingOrders.getPreviewFileSmall());
|
||||
invoicingOrders.setNetPreviewFileSmall(netPreviewFileSmall);
|
||||
} else {
|
||||
invoicingOrders.setPreviewFileSmall("");
|
||||
invoicingOrders.setNetPreviewFileSmall("");
|
||||
}
|
||||
if (invoicingOrders.getMp3File() != null && !invoicingOrders.getMp3File().equals("")) {
|
||||
String netMp3File = getImageNetUrl(invoicingOrders.getMp3File());
|
||||
invoicingOrders.setNetMp3File(netMp3File);
|
||||
} else {
|
||||
invoicingOrders.setMp3File("");
|
||||
invoicingOrders.setNetMp3File("");
|
||||
}
|
||||
if (invoicingOrders.getMp4File() != null && !invoicingOrders.getMp4File().equals("")) {
|
||||
String netMp4File = getImageNetUrl(invoicingOrders.getMp4File());
|
||||
invoicingOrders.setNetMp4File(netMp4File);
|
||||
} else {
|
||||
invoicingOrders.setMp4File("");
|
||||
invoicingOrders.setNetMp4File("");
|
||||
}
|
||||
return invoicingOrders;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ import com.nu.modules.biz.invoicing.datapool.service.IInvoicingDataPoolService;
|
|||
import com.nu.modules.biz.invoicing.plan.entity.PlanBizNuCustomerInvoicingServer;
|
||||
import com.nu.modules.biz.invoicing.plan.mapper.PlanBizNuCustomerInvoicingServerMapper;
|
||||
import com.nu.modules.biz.invoicing.plan.service.IPlanBizNuCustomerInvoicingServerService;
|
||||
import com.nu.modules.care.api.IInvoicingDirectivePlanApi;
|
||||
import com.nu.modules.invoicing.api.IInvoicingDirectivePlanApi;
|
||||
import com.nu.modules.sysconfig.ISysConfigApi;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
|||
Loading…
Reference in New Issue