Merge branch 'master' of http://47.115.223.229:8888/yangjun/nursing_unit_java
# Conflicts: # nursing-unit-services/nu-services-biz/src/main/java/com/nu/modules/biz/order/service/impl/DirectiveOrderPadServiceImpl.java
This commit is contained in:
commit
96c3db96ec
|
|
@ -110,7 +110,22 @@ public class ServiceOrderApi {
|
|||
@ApiOperation(value="服务指令工单-转单", notes="服务指令工单-转单")
|
||||
@AutoLog(value = "服务指令工单-转单",clientType="app", operateType = 3)
|
||||
@PostMapping(value = "/transferOrder")
|
||||
public Result<String> transferOrder(@RequestBody DirectiveOrderEntity directiveOrderEntity) {
|
||||
public Result<String> transferOrder(@RequestBody DirectiveOrderSubEntity dto) {
|
||||
if(StringUtils.isBlank(dto.getMainId()) ){
|
||||
return Result.error("缺少参数");
|
||||
}
|
||||
directiveOrderApi.transferOrder(dto);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
@ApiOperation(value="服务指令工单-协助执行", notes="服务指令工单-协助执行")
|
||||
@AutoLog(value = "服务指令工单-协助执行",clientType="app", operateType = 3)
|
||||
@PostMapping(value = "/assistOrder")
|
||||
public Result<String> assistOrder(@RequestBody DirectiveOrderSubEntity dto) {
|
||||
if(StringUtils.isBlank(dto.getMainId()) ){
|
||||
return Result.error("缺少参数");
|
||||
}
|
||||
directiveOrderApi.assistOrder(dto);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,4 +51,7 @@ public interface IDirectiveOrderApi {
|
|||
|
||||
Map<String, Object> generateOrdersInstant(DirectiveOrderEntity directiveOrderEntity);
|
||||
|
||||
void transferOrder(DirectiveOrderSubEntity dto);
|
||||
|
||||
void assistOrder(DirectiveOrderSubEntity dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,4 @@ public interface IInvoicingDataPoolService extends IService<DirectiveDataPool> {
|
|||
*/
|
||||
void editDataPool(InvoicingDirectivePlan invoicingDirectivePlan);
|
||||
|
||||
// Result<?> addInstant(InvoicingDataPool dataPool);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,4 +38,6 @@ public interface DirectiveOrderMapper extends BaseMapper<DirectiveOrder> {
|
|||
List<DirectiveOrderEntity> queryCurrent(@Param("dto") CareDirectiveEntity dto);
|
||||
|
||||
DirectiveOrder getDirectiveById(DirectiveOrder orders);
|
||||
|
||||
DirectiveOrder getEmployeeById(@Param("employeeId") String employeeId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.nu.modules.biz.order.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.biz.order.entity.DirectiveOrder;
|
||||
import com.nu.modules.biz.order.entity.DirectiveOrderSub;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -13,4 +15,6 @@ import java.util.List;
|
|||
*/
|
||||
public interface DirectiveOrderSubMapper extends BaseMapper<DirectiveOrderSub> {
|
||||
List<DirectiveOrderSub> queryDataPoolSubList(DirectiveOrder orders);
|
||||
List<DirectiveOrderSub> getDirectiveList(@Param("directiveId") String directiveId);
|
||||
List<DirectiveOrderSub> getSubDirectiveList(@Param("packageId") String packageId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@
|
|||
<select id="queryDataPoolList" resultType="com.nu.modules.biz.order.entity.DirectiveOrder">
|
||||
select
|
||||
a.id as poolId,
|
||||
a.pool_type as orderType,
|
||||
a.biz_id as bizId,
|
||||
a.nu_id as nuId,
|
||||
a.nu_name as nuName,
|
||||
|
|
@ -426,13 +427,15 @@
|
|||
|
||||
<select id="getDirectiveById" resultType="com.nu.modules.biz.order.entity.DirectiveOrder">
|
||||
select
|
||||
id,
|
||||
nu_id as nuId,
|
||||
nu_name as nuName,
|
||||
m.id as bizId,
|
||||
m.nu_id as nuId,
|
||||
m.nu_name as nuName,
|
||||
elder_id as elderId,
|
||||
elder_name as elderName,
|
||||
directive_id as directiveId,
|
||||
directive_name as directiveName,
|
||||
'3' as cycleTypeId,
|
||||
(select item_text from sys_dict_item where dict_id = '1900374791386140674' and item_value = '3') as cycleType,
|
||||
preview_file as previewFile,
|
||||
net_preview_file as netPreviewFile,
|
||||
preview_file_small as previewFileSmall,
|
||||
|
|
@ -443,9 +446,18 @@
|
|||
net_mp4_file as netMp4File,
|
||||
service_duration as serviceDuration,
|
||||
service_content as serviceContent,
|
||||
iz_package
|
||||
iz_package,
|
||||
(case when b.orderly is null then 2 else 1 end) as orderEmp
|
||||
from ${tableName} m
|
||||
left join nu_biz_elder_info b on m.elder_id = b.id
|
||||
where m.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getEmployeeById" resultType="com.nu.modules.biz.order.entity.DirectiveOrder">
|
||||
select a.id as employeeId,
|
||||
a.name as employeeName
|
||||
from nu_biz_employees_info a
|
||||
where a.id = #{employeeId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<select id="queryDataPoolSubList" resultType="com.nu.modules.biz.order.entity.DirectiveOrderSub">
|
||||
select
|
||||
id as poolSubId,
|
||||
pool_type as orderType,
|
||||
nu_id as nuId,
|
||||
nu_name as nuName,
|
||||
elder_id as elderId,
|
||||
|
|
@ -39,4 +40,57 @@
|
|||
where main_id = #{poolId}
|
||||
</select>
|
||||
|
||||
<select id="getDirectiveList" resultType="com.nu.modules.biz.order.entity.DirectiveOrderSub">
|
||||
select
|
||||
a.instruction_tag_id as instructionTagId,
|
||||
b.instruction_name as instructionTagName,
|
||||
a.category_id as categoryId,
|
||||
c.category_name AS categoryName,
|
||||
a.type_id as typeId,
|
||||
d.type_name as typeName,
|
||||
a.id as directiveId,
|
||||
a.directive_name as directiveName,
|
||||
a.cycle_type as cycleTypeId,
|
||||
f.item_text AS cycleType,
|
||||
a.preview_file as previewFile,
|
||||
a.preview_file_small as previewFileSmall,
|
||||
a.mp3_file as mp3File,
|
||||
a.mp4_file as mp4File,
|
||||
a.service_duration as serviceDuration,
|
||||
a.service_content as serviceContent
|
||||
from nu_config_service_directive a
|
||||
left join nu_config_service_instruction_tag b on a.instruction_tag_id = b.id
|
||||
left join nu_config_service_category c on a.category_id = c.id
|
||||
left join nu_config_service_type d on a.type_id = d.id
|
||||
left join sys_dict_item f on f.dict_id = '1900374791386140674' and f.item_value = a.cycle_type
|
||||
where a.id = #{directiveId}
|
||||
</select>
|
||||
|
||||
<select id="getSubDirectiveList" resultType="com.nu.modules.biz.order.entity.DirectiveOrderSub">
|
||||
select
|
||||
b.instruction_tag_id as instructionTagId,
|
||||
e.instruction_name as instructionTagName,
|
||||
b.category_id as categoryId,
|
||||
c.category_name AS categoryName,
|
||||
b.type_id as typeId,
|
||||
d.type_name as typeName,
|
||||
b.id as directiveId,
|
||||
b.directive_name as directiveName,
|
||||
b.cycle_type as cycleTypeId,
|
||||
f.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_package_directive a
|
||||
left join nu_config_service_directive b on a.directive_id = b.id
|
||||
left join nu_config_service_category c on b.category_id = c.id
|
||||
left join nu_config_service_type d on b.type_id = d.id
|
||||
left join nu_config_service_instruction_tag e on b.instruction_tag_id = e.id
|
||||
left join sys_dict_item f on f.dict_id = '1900374791386140674' and f.item_value = b.cycle_type
|
||||
where a.package_id = #{packageId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -3,6 +3,8 @@ package com.nu.modules.biz.order.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.biz.order.entity.DirectiveOrder;
|
||||
import com.nu.modules.biz.order.entity.DirectiveOrderSub;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -13,4 +15,6 @@ import java.util.List;
|
|||
*/
|
||||
public interface IDirectiveOrderSubService extends IService<DirectiveOrderSub> {
|
||||
List<DirectiveOrderSub> queryDataPoolSubList(DirectiveOrder orders);
|
||||
List<DirectiveOrderSub> getDirectiveList(String directiveId);
|
||||
List<DirectiveOrderSub> getSubDirectiveList(String packageId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nu.modules.biz.order.service.impl;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
|
@ -218,6 +219,7 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
|||
|
||||
/**
|
||||
* 生成即时服务指令工单
|
||||
*
|
||||
* @param directiveOrderEntity
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -228,4 +230,59 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
|||
return directiveOrderService.generateOrdersInstant(directiveOrder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferOrder(DirectiveOrderSubEntity dto) {
|
||||
DirectiveOrder main = new DirectiveOrder();
|
||||
DirectiveOrderSub sub = new DirectiveOrderSub();
|
||||
|
||||
String optType = "3";//转单
|
||||
|
||||
//执行类型
|
||||
main.setOptType(optType);
|
||||
sub.setOptType(optType);
|
||||
//主要执行人
|
||||
main.setEmployeeId(dto.getEmployeeId());
|
||||
main.setEmployeeName(dto.getEmployeeName());
|
||||
sub.setEmployeeId(dto.getEmployeeId());
|
||||
sub.setEmployeeName(dto.getEmployeeName());
|
||||
//实际执行人
|
||||
main.setOptIds(dto.getEmployeeId());
|
||||
main.setOptNames(dto.getEmployeeName());
|
||||
sub.setOptIds(dto.getEmployeeId());
|
||||
sub.setOptNames(dto.getEmployeeName());
|
||||
|
||||
//修改主表
|
||||
main.setId(dto.getMainId());
|
||||
directiveOrderService.updateById(main);
|
||||
//修改子表
|
||||
UpdateWrapper<DirectiveOrderSub> subUW = new UpdateWrapper<>();
|
||||
subUW.eq("main_id",dto.getMainId());
|
||||
directiveOrderSubMapper.update(sub,subUW);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void assistOrder(DirectiveOrderSubEntity dto) {
|
||||
DirectiveOrder main = new DirectiveOrder();
|
||||
DirectiveOrderSub sub = new DirectiveOrderSub();
|
||||
|
||||
String optType = "2";//协助
|
||||
|
||||
//执行类型
|
||||
main.setOptType(optType);
|
||||
sub.setOptType(optType);
|
||||
//实际执行人
|
||||
main.setOptIds(dto.getOptIds());
|
||||
main.setOptNames(dto.getOptNames());
|
||||
sub.setOptIds(dto.getOptIds());
|
||||
sub.setOptNames(dto.getOptNames());
|
||||
|
||||
//修改主表
|
||||
main.setId(dto.getMainId());
|
||||
directiveOrderService.updateById(main);
|
||||
//修改子表
|
||||
UpdateWrapper<DirectiveOrderSub> subUW = new UpdateWrapper<>();
|
||||
subUW.eq("main_id",dto.getMainId());
|
||||
directiveOrderSubMapper.update(sub,subUW);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ 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.sysconfig.ISysConfigApi;
|
||||
import com.nu.websocket.SdWebsocket;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
|
@ -49,6 +50,10 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
SendOrderRule sendOrderRule;
|
||||
List<SendOrderRuleSub> ruleSubList;
|
||||
private String allowedTimeout;
|
||||
private String serverNetUrl;
|
||||
|
||||
@Autowired
|
||||
private SdWebsocket sdWebsocket;
|
||||
|
||||
/**
|
||||
* 获取容错时长
|
||||
|
|
@ -85,6 +90,7 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
|
||||
/**
|
||||
* 获取在线,有指令权限的员工,并获取员工的接单上限、收益、服务时长、单次
|
||||
*
|
||||
* @param directiveId
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -94,6 +100,7 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
|
||||
/**
|
||||
* 获取长者指定所有护理员
|
||||
*
|
||||
* @param elderId
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -117,6 +124,7 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
|
||||
/**
|
||||
* 指令池批量生成工单-定时调用
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -128,13 +136,29 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
for (int i = 0; i < ordersList.size(); i++) {
|
||||
DirectiveOrder orders = ordersList.get(i);
|
||||
generateOrdersSub(orders);
|
||||
//todo
|
||||
//发送websocket消息
|
||||
try {
|
||||
// 发送数据
|
||||
JSONObject message = new JSONObject();
|
||||
message.put("type", "directiveOrder");//消息类型
|
||||
message.put("timestamp", System.currentTimeMillis());
|
||||
message.put("from", "system");//发送者
|
||||
message.put("to", orders.getEmployeeId());//接收用户
|
||||
message.put("data", orders);//业务数据
|
||||
String messageJson = message.toJSONString();
|
||||
//发送给单个用户
|
||||
sdWebsocket.sendMessage(orders.getEmployeeId(), messageJson);
|
||||
log.info("【ws消息推送】发送给用户 {}: {}", orders.getEmployeeId(), messageJson);
|
||||
} catch (Exception e) {
|
||||
log.error("ws发送消息失败", e);
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工单子表数据,并进行处理
|
||||
*
|
||||
* @param orders
|
||||
*/
|
||||
private void generateOrdersSub(DirectiveOrder orders) {
|
||||
|
|
@ -145,7 +169,7 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
//获取满足条件的员工
|
||||
DirectiveOrder employee = employeeScreening(directiveIds, orders.getElderId(), null, orders.getStartTime());
|
||||
if(employee!=null){
|
||||
String orderNo = getOrderNo();
|
||||
String orderNo = getOrderNo(orders.getOrderType());
|
||||
orders.setOrderNo(orderNo);
|
||||
orders.setEmployeeId(employee.getEmployeeId());
|
||||
orders.setEmployeeName(employee.getEmployeeName());
|
||||
|
|
@ -153,6 +177,7 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
orders.setIzFinish("N");
|
||||
orders.setOrderType("1");
|
||||
orders.setOptType("1");
|
||||
orders.setIzTimeout("N");
|
||||
orders.setOptIds(employee.getEmployeeId());
|
||||
orders.setOptNames(employee.getEmployeeName());
|
||||
orders.setServiceAllowedTimeout(allowedTimeout);
|
||||
|
|
@ -165,7 +190,11 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
ordersSub.setEmployeeName(employee.getEmployeeName());
|
||||
ordersSub.setIzStart("N");
|
||||
ordersSub.setIzFinish("N");
|
||||
ordersSub.setOrderType("1");
|
||||
ordersSub.setOptType("1");
|
||||
ordersSub.setIzTimeout("N");
|
||||
ordersSub.setOptIds(employee.getEmployeeId());
|
||||
ordersSub.setOptNames(employee.getEmployeeName());
|
||||
ordersSub.setServiceAllowedTimeout(allowedTimeout);
|
||||
ordersSubService.save(ordersSub);//生成工单子表
|
||||
}
|
||||
baseMapper.updatePoolIzOrder(orders.getPoolId());
|
||||
|
|
@ -180,7 +209,7 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
String employeeIds = emps.stream().map(DirectiveOrder::getEmployeeId).collect(Collectors.joining(","));
|
||||
DirectiveOrder employee = employeeScreening(directiveIds,orders.getElderId(),employeeIds,orders.getStartTime());
|
||||
if(employee!=null){
|
||||
String orderNo = getOrderNo();
|
||||
String orderNo = getOrderNo(orders.getOrderType());
|
||||
orders.setOrderNo(orderNo);
|
||||
orders.setEmployeeId(employee.getEmployeeId());
|
||||
orders.setEmployeeName(employee.getEmployeeName());
|
||||
|
|
@ -188,6 +217,7 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
orders.setIzFinish("N");
|
||||
orders.setOrderType("1");
|
||||
orders.setOptType("1");
|
||||
orders.setIzTimeout("N");
|
||||
orders.setOptIds(employee.getEmployeeId());
|
||||
orders.setOptNames(employee.getEmployeeName());
|
||||
orders.setServiceAllowedTimeout(allowedTimeout);
|
||||
|
|
@ -200,7 +230,11 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
ordersSub.setEmployeeName(employee.getEmployeeName());
|
||||
ordersSub.setIzStart("N");
|
||||
ordersSub.setIzFinish("N");
|
||||
ordersSub.setOrderType("1");
|
||||
ordersSub.setOptType("1");
|
||||
ordersSub.setIzTimeout("N");
|
||||
ordersSub.setOptIds(employee.getEmployeeId());
|
||||
ordersSub.setOptNames(employee.getEmployeeName());
|
||||
ordersSub.setServiceAllowedTimeout(allowedTimeout);
|
||||
ordersSubService.save(ordersSub);//生成工单子表
|
||||
}
|
||||
baseMapper.updatePoolIzOrder(orders.getPoolId());
|
||||
|
|
@ -215,6 +249,7 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
|
||||
/**
|
||||
* 获取满足条件的员工
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private DirectiveOrder employeeScreening(String directiveIds, String elderId, String employeeIds, Date startTime) {
|
||||
|
|
@ -562,14 +597,28 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
|
||||
/**
|
||||
* 获取单号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getOrderNo(){
|
||||
private String getOrderNo(String orderType){
|
||||
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
|
||||
String deptCode = deptInfo.getString("code");
|
||||
String today = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
// 构建今天的前缀模式
|
||||
String todayPrefix = "HL" + deptCode + today;
|
||||
String todayPrefix = "";
|
||||
if(orderType.equals("1")){
|
||||
todayPrefix = "HL";
|
||||
}
|
||||
if(orderType.equals("2")){
|
||||
todayPrefix = "YL";
|
||||
}
|
||||
if(orderType.equals("3")){
|
||||
todayPrefix = "CK";
|
||||
}
|
||||
if(orderType.equals("4")){
|
||||
todayPrefix = "HQ";
|
||||
}
|
||||
todayPrefix = todayPrefix + deptCode + today;
|
||||
QueryWrapper<DirectiveOrder> qw = new QueryWrapper<>();
|
||||
qw.likeRight("order_no", todayPrefix);
|
||||
qw.select("order_no");
|
||||
|
|
@ -591,6 +640,7 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
|
||||
/**
|
||||
* 获取子单号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getOrderSubNo(String mainOrderNo) {
|
||||
|
|
@ -615,6 +665,7 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
|
||||
/**
|
||||
* 生成即时服务指令工单
|
||||
*
|
||||
* @param directiveOrder
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -641,19 +692,216 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
|
|||
//后勤即时
|
||||
directiveOrder.setTableName("nu_biz_nu_logistics_directive_plan_instant");
|
||||
}
|
||||
DirectiveOrder directiveInfo = baseMapper.getDirectiveById(directiveOrder);
|
||||
getAllowedTimeout();
|
||||
DirectiveOrder orders = baseMapper.getDirectiveById(directiveOrder);
|
||||
List<DirectiveOrderSub> packageSubList = null;
|
||||
String employeeId = "";
|
||||
String employeeName = "";
|
||||
Calendar c = Calendar.getInstance();
|
||||
Date startTime = c.getTime();
|
||||
String duration = orders.getServiceDuration();
|
||||
if(duration.equals("")||duration.equals("0")){
|
||||
c.set(Calendar.YEAR,3000);
|
||||
c.set(Calendar.MONTH,Calendar.DECEMBER);
|
||||
c.set(Calendar.DAY_OF_MONTH,31);
|
||||
c.set(Calendar.HOUR_OF_DAY,0);
|
||||
c.set(Calendar.MINUTE,0);
|
||||
c.set(Calendar.SECOND,0);
|
||||
c.set(Calendar.MILLISECOND,0);
|
||||
}else{
|
||||
c.add(Calendar.MINUTE,Integer.valueOf(duration));
|
||||
}
|
||||
Date endTime = c.getTime();
|
||||
orders.setStartTime(startTime);
|
||||
orders.setEndTime(endTime);
|
||||
if(orders.getIzPackage().equals("N")){
|
||||
packageSubList = ordersSubService.getDirectiveList(orders.getDirectiveId());
|
||||
String directiveIds = packageSubList.stream().map(DirectiveOrderSub::getDirectiveId).collect(Collectors.joining(","));
|
||||
if(!directiveOrder.getTriggerMode().equals("1")){
|
||||
getSendOrderRule();
|
||||
DirectiveOrder employee = employeeScreening(directiveIds,orders.getElderId(),null,orders.getStartTime());
|
||||
employeeId = employee.getEmployeeId();
|
||||
employeeName = employee.getEmployeeName();
|
||||
}
|
||||
}else{
|
||||
orders.setPackageId(orders.getDirectiveId());
|
||||
orders.setPackageName(orders.getDirectiveName());
|
||||
orders.setDirectiveId(null);
|
||||
orders.setDirectiveName(null);
|
||||
packageSubList = ordersSubService.getSubDirectiveList(orders.getPackageId());
|
||||
String directiveIds = packageSubList.stream().map(DirectiveOrderSub::getDirectiveId).collect(Collectors.joining(","));
|
||||
if(!directiveOrder.getTriggerMode().equals("1")){
|
||||
getSendOrderRule();
|
||||
List<DirectiveOrder> emps = baseMapper.getPermissionEmps(directiveIds);//获取服务标签中的员工和数量
|
||||
if(packageSubList!=null){
|
||||
int size = packageSubList.size();
|
||||
emps.removeIf(data -> data.getOwnCn() < size);//删除没有权限的数据
|
||||
}
|
||||
String employeeIds = emps.stream().map(DirectiveOrder::getEmployeeId).collect(Collectors.joining(","));
|
||||
DirectiveOrder employee = employeeScreening(directiveIds,orders.getElderId(),employeeIds,orders.getStartTime());
|
||||
employeeId = employee.getEmployeeId();
|
||||
employeeName = employee.getEmployeeName();
|
||||
}
|
||||
}
|
||||
|
||||
if (directiveOrder.getTriggerMode().equals("1")) {
|
||||
//直接派单给发起人
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String employeeId = sysUser.getEmployessId();
|
||||
}else{
|
||||
//按规则派单
|
||||
getSendOrderRule();
|
||||
|
||||
employeeId = sysUser.getEmployessId();
|
||||
employeeName = getEmployeeName(employeeId);
|
||||
}
|
||||
|
||||
getNetImages(orders);
|
||||
String orderNo = getOrderNo(orderType);
|
||||
orders.setOrderNo(orderNo);
|
||||
orders.setOrderType(orderType);
|
||||
orders.setOptType("1");
|
||||
orders.setEmployeeId(employeeId);
|
||||
orders.setEmployeeName(employeeName);
|
||||
orders.setIzStart("N");
|
||||
orders.setIzFinish("N");
|
||||
orders.setIzTimeout("N");
|
||||
orders.setOptIds(employeeId);
|
||||
orders.setOptNames(employeeName);
|
||||
orders.setServiceAllowedTimeout(allowedTimeout);
|
||||
orders.setDelFlag("0");
|
||||
this.save(orders);//生成工单主表
|
||||
if(packageSubList!=null){
|
||||
for(int i=0;i<packageSubList.size();i++){
|
||||
DirectiveOrderSub ordersSub = packageSubList.get(i);
|
||||
getSubNetImages(ordersSub);
|
||||
ordersSub.setOrderNo(getOrderSubNo(orderNo));
|
||||
ordersSub.setOrderType(orderType);
|
||||
ordersSub.setMainId(orders.getId());
|
||||
ordersSub.setNuId(orders.getNuId());
|
||||
ordersSub.setNuName(orders.getNuName());
|
||||
ordersSub.setElderId(orders.getElderId());
|
||||
ordersSub.setElderName(orders.getElderName());
|
||||
ordersSub.setEmployeeId(employeeId);
|
||||
ordersSub.setEmployeeName(employeeName);
|
||||
ordersSub.setIzPackage(orders.getIzPackage());
|
||||
if(!orders.getIzPackage().equals("N")){
|
||||
ordersSub.setPackageId(orders.getPackageId());
|
||||
ordersSub.setPackageName(orders.getPackageName());
|
||||
}
|
||||
ordersSub.setStartTime(startTime);
|
||||
ordersSub.setEndTime(endTime);
|
||||
ordersSub.setIzStart("N");
|
||||
ordersSub.setIzFinish("N");
|
||||
ordersSub.setOptType("1");
|
||||
ordersSub.setIzTimeout("N");
|
||||
ordersSub.setOptIds(employeeId);
|
||||
ordersSub.setOptNames(employeeName);
|
||||
ordersSub.setServiceAllowedTimeout(allowedTimeout);
|
||||
ordersSub.setDelFlag("0");
|
||||
ordersSubService.save(ordersSub);//生成工单子表
|
||||
}
|
||||
}
|
||||
//todo
|
||||
return map;
|
||||
}
|
||||
|
||||
private DirectiveOrder getNetImages(DirectiveOrder par) {
|
||||
if (par.getPreviewFile() != null && !par.getPreviewFile().equals("")) {
|
||||
String previewFile = getImageNetUrl(par.getPreviewFile());
|
||||
par.setNetPreviewFile(previewFile);
|
||||
} else {
|
||||
par.setPreviewFile("");
|
||||
par.setNetPreviewFile("");
|
||||
}
|
||||
if (par.getPreviewFileSmall() != null && !par.getPreviewFileSmall().equals("")) {
|
||||
String previewFileSmall = getImageNetUrl(par.getPreviewFileSmall());
|
||||
par.setNetPreviewFileSmall(previewFileSmall);
|
||||
} else {
|
||||
par.setPreviewFileSmall("");
|
||||
par.setNetPreviewFileSmall("");
|
||||
}
|
||||
if (par.getMp3File() != null && !par.getMp3File().equals("")) {
|
||||
String netMp3File = getImageNetUrl(par.getMp3File());
|
||||
par.setNetMp3File(netMp3File);
|
||||
} else {
|
||||
par.setMp3File("");
|
||||
par.setNetMp3File("");
|
||||
}
|
||||
if (par.getMp4File() != null && !par.getMp4File().equals("")) {
|
||||
String netMp4File = getImageNetUrl(par.getMp4File());
|
||||
par.setNetMp4File(netMp4File);
|
||||
} else {
|
||||
par.setMp4File("");
|
||||
par.setNetMp4File("");
|
||||
}
|
||||
return par;
|
||||
}
|
||||
|
||||
private DirectiveOrderSub getSubNetImages(DirectiveOrderSub par) {
|
||||
if (par.getPreviewFile() != null && !par.getPreviewFile().equals("")) {
|
||||
String previewFile = getImageNetUrl(par.getPreviewFile());
|
||||
par.setNetPreviewFile(previewFile);
|
||||
} else {
|
||||
par.setPreviewFile("");
|
||||
par.setNetPreviewFile("");
|
||||
}
|
||||
if (par.getPreviewFileSmall() != null && !par.getPreviewFileSmall().equals("")) {
|
||||
String previewFileSmall = getImageNetUrl(par.getPreviewFileSmall());
|
||||
par.setNetPreviewFileSmall(previewFileSmall);
|
||||
} else {
|
||||
par.setPreviewFileSmall("");
|
||||
par.setNetPreviewFileSmall("");
|
||||
}
|
||||
if (par.getMp3File() != null && !par.getMp3File().equals("")) {
|
||||
String netMp3File = getImageNetUrl(par.getMp3File());
|
||||
par.setNetMp3File(netMp3File);
|
||||
} else {
|
||||
par.setMp3File("");
|
||||
par.setNetMp3File("");
|
||||
}
|
||||
if (par.getMp4File() != null && !par.getMp4File().equals("")) {
|
||||
String netMp4File = getImageNetUrl(par.getMp4File());
|
||||
par.setNetMp4File(netMp4File);
|
||||
} else {
|
||||
par.setMp4File("");
|
||||
par.setNetMp4File("");
|
||||
}
|
||||
return par;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取管理平台静态资源路径
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取员工姓名
|
||||
* @param employeeId
|
||||
*/
|
||||
private String getEmployeeName(String employeeId){
|
||||
String employeeName = "";
|
||||
if(employeeId!=null&&!employeeId.equals("")){
|
||||
DirectiveOrder employeeInfo = baseMapper.getEmployeeById(employeeId);
|
||||
if(employeeInfo!=null){
|
||||
employeeName = employeeInfo.getEmployeeName();
|
||||
}
|
||||
}
|
||||
return employeeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,14 @@ public class DirectiveOrderSubServiceImpl extends ServiceImpl<DirectiveOrderSubM
|
|||
public List<DirectiveOrderSub> queryDataPoolSubList(DirectiveOrder orders){
|
||||
return baseMapper.queryDataPoolSubList(orders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DirectiveOrderSub> getDirectiveList(String directiveId){
|
||||
return baseMapper.getDirectiveList(directiveId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DirectiveOrderSub> getSubDirectiveList(String packageId){
|
||||
return baseMapper.getSubDirectiveList(packageId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -363,18 +363,6 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
|
|||
bizNuCareDirectivePlanInstantService.save(instant);
|
||||
//TODO 增加日志
|
||||
|
||||
//生成即时指令到数据池,测试
|
||||
// DataPool dataPool = new DataPool();
|
||||
// dataPool.setBizId(customerServerInstant.getId());
|
||||
// dataPool.setNuId(customerServerInstant.getNuId());
|
||||
// dataPool.setNuName(customerServerInstant.getNuName());
|
||||
// dataPool.setCustomerId(customerServerInstant.getCustomerId());
|
||||
// dataPool.setCustomerName(customerServerInstant.getCustomerName());
|
||||
// dataPool.setDirectiveId(customerServerInstant.getDirectiveId());
|
||||
// dataPool.setDirectiveName(customerServerInstant.getDirectiveName());
|
||||
// dataPool.setServiceDuration(customerServerInstant.getServiceDuration());
|
||||
// dataPoolServiceImpl.addInstant(dataPool);
|
||||
|
||||
BeanUtils.copyProperties(instant,careDirectiveInstantEntity);
|
||||
return careDirectiveInstantEntity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,9 +112,25 @@ public class SdWebsocket {
|
|||
* @param message
|
||||
*/
|
||||
public void sendMessage(String userId, String message) {
|
||||
log.info("【系统 SdWebsocket】广播,userId:"+userId+",消息:"+message);
|
||||
log.info("【系统 SdWebsocket】向用户 {} 发送消息: {}", userId, message);
|
||||
|
||||
// 打印所有在线用户
|
||||
StringBuilder userList = new StringBuilder();
|
||||
for (String user : sessionPool.keySet()) {
|
||||
if (userList.length() > 0) {
|
||||
userList.append(", ");
|
||||
}
|
||||
userList.append(user);
|
||||
}
|
||||
log.info("【系统 SdWebsocket】当前在线用户: [{}] 共 {} 人", userList.toString(), sessionPool.size());
|
||||
|
||||
Session session = sessionPool.get(userId);
|
||||
if (session != null && session.isOpen()) {
|
||||
session.getAsyncRemote().sendText(message);
|
||||
log.debug("【系统 SdWebsocket】消息发送成功");
|
||||
} else {
|
||||
log.warn("【系统 SdWebsocket】用户 {} 不在线或连接已关闭,无法发送消息", userId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ public class WebSocketMessageController {
|
|||
|
||||
} catch (Exception e) {
|
||||
log.error("发送消息失败", e);
|
||||
e.printStackTrace();
|
||||
return Result.error("发送失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue