1、生成即时指令工单
2、框架增加线上日志sql打印(logback-spring.xml中 <root标签上 已注释 如需要解开后重新部署)
This commit is contained in:
parent
825c79963c
commit
f6ef60dcec
|
|
@ -49,4 +49,7 @@ public interface DirectiveOrderMapper extends BaseMapper<DirectiveOrder> {
|
||||||
DirectiveOrder getEmployeeById(@Param("employeeId") String employeeId);
|
DirectiveOrder getEmployeeById(@Param("employeeId") String employeeId);
|
||||||
|
|
||||||
List<DirectiveOrderEntity> queryOrderList(@Param("entity") DirectiveOrderEntity entity);
|
List<DirectiveOrderEntity> queryOrderList(@Param("entity") DirectiveOrderEntity entity);
|
||||||
|
|
||||||
|
DirectiveOrderEntity queryOrderNeedDirectiveInfo(@Param("dto") DirectiveOrderEntity entity);
|
||||||
|
DirectiveOrderEntity queryOrderNeedBaseInfo(@Param("dto") DirectiveOrderEntity entity);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -591,70 +591,38 @@
|
||||||
CASE WHEN CAST(t.service_duration AS UNSIGNED) = 0 THEN 999999 ELSE CAST(t.service_duration AS UNSIGNED) END
|
CASE WHEN CAST(t.service_duration AS UNSIGNED) = 0 THEN 999999 ELSE CAST(t.service_duration AS UNSIGNED) END
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryOrderNeedDirectiveInfo" resultMap="DirectiveOrderMap">
|
<select id="queryOrderNeedDirectiveInfo" resultType="com.nu.entity.DirectiveOrderEntity">
|
||||||
SELECT p.id,
|
SELECT directive.instruction_tag_id as instructionId,
|
||||||
p.nu_id,
|
|
||||||
base.nu_name,
|
|
||||||
elder.id as elderId,
|
|
||||||
elder.name as elderName,
|
|
||||||
p.instruction_tag_id,
|
|
||||||
inst.instruction_name,
|
inst.instruction_name,
|
||||||
directive.category_id,
|
directive.category_id,
|
||||||
category.category_name,
|
category.category_name,
|
||||||
directive.type_id,
|
directive.type_id,
|
||||||
stype.type_name,
|
stype.type_name,
|
||||||
p.directive_id,
|
directive.id as directive_id,
|
||||||
directive.directive_name,
|
directive.directive_name,
|
||||||
p.cycle_type_id,
|
|
||||||
p.cycle_value,
|
|
||||||
p.opt_time,
|
|
||||||
p.opt_count,
|
|
||||||
p.iz_multi,
|
|
||||||
directive.immediate_file,
|
directive.immediate_file,
|
||||||
directive.immediate_file_focus,
|
directive.immediate_file_focus,
|
||||||
directive.preview_file,
|
directive.preview_file,
|
||||||
directive.preview_file_small,
|
directive.preview_file_small,
|
||||||
directive.mp3_file,
|
directive.mp3_file,
|
||||||
directive.mp4_file,
|
directive.mp4_file,
|
||||||
|
directive.service_attribute,
|
||||||
directive.service_duration,
|
directive.service_duration,
|
||||||
directive.service_content,
|
directive.service_content,
|
||||||
p.positioning,
|
|
||||||
p.positioning_long,
|
|
||||||
p.tag_name,
|
|
||||||
CONCAT(
|
|
||||||
DATE_FORMAT(now(), '%Y-%m-%d'), ' ',
|
|
||||||
p.start_time, ':00'
|
|
||||||
) as start_time,
|
|
||||||
CASE
|
|
||||||
WHEN directive.service_duration IS NOT NULL
|
|
||||||
THEN DATE_FORMAT(
|
|
||||||
DATE_ADD(
|
|
||||||
STR_TO_DATE(CONCAT(DATE_FORMAT(now(), '%Y-%m-%d'), ' ', p.start_time, ':00'),
|
|
||||||
'%Y-%m-%d %H:%i:%s'),
|
|
||||||
INTERVAL directive.service_duration MINUTE
|
|
||||||
),
|
|
||||||
'%Y-%m-%d %H:%i:%s'
|
|
||||||
)
|
|
||||||
ELSE NULL
|
|
||||||
END as end_time,
|
|
||||||
p.create_by,
|
|
||||||
p.create_time,
|
|
||||||
p.update_by,
|
|
||||||
p.update_time,
|
|
||||||
p.sys_org_code
|
p.sys_org_code
|
||||||
FROM (
|
FROM nu_config_service_directive directive
|
||||||
SELECT base.*, elder.*
|
LEFT JOIN nu_config_service_instruction_tag inst ON directive.instruction_tag_id = inst.id
|
||||||
|
LEFT JOIN nu_config_service_category category ON directive.category_id = category.id
|
||||||
|
LEFT JOIN nu_config_service_type stype ON directive.type_id = stype.id
|
||||||
|
WHERE directive.id = #{dto.directiveId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="queryOrderNeedBaseInfo" resultType="com.nu.entity.DirectiveOrderEntity">
|
||||||
|
SELECT base.nu_name,
|
||||||
|
elder.id as elderId,
|
||||||
|
elder.name as elderName
|
||||||
FROM nu_base_info base
|
FROM nu_base_info base
|
||||||
LEFT JOIN nu_biz_elder_info elder ON base.elder_id = elder.id
|
LEFT JOIN nu_biz_elder_info elder ON elder.id = base.elder_id
|
||||||
) base_elder
|
WHERE base.nu_id = #{dto.nuId}
|
||||||
CROSS JOIN (
|
|
||||||
SELECT inst.*, category.*, stype.*
|
|
||||||
FROM nu_config_service_instruction_tag inst
|
|
||||||
LEFT JOIN nu_config_service_category category ON inst.category_id = category.id
|
|
||||||
LEFT JOIN nu_config_service_type stype ON inst.type_id = stype.id
|
|
||||||
) config
|
|
||||||
WHERE p.nu_id = #{dto.nuId}
|
|
||||||
AND p.instruction_tag_id = #{dto.instructionTagId}
|
|
||||||
AND directive.id = #{dto.directiveId}
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.nu.modules.biz.order.service.impl;
|
package com.nu.modules.biz.order.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
|
@ -16,8 +17,10 @@ import com.nu.modules.biz.order.mapper.DirectiveOrderInfoMapper;
|
||||||
import com.nu.modules.biz.order.mapper.DirectiveOrderMapper;
|
import com.nu.modules.biz.order.mapper.DirectiveOrderMapper;
|
||||||
import com.nu.modules.biz.order.service.IDirectiveOrderInfoService;
|
import com.nu.modules.biz.order.service.IDirectiveOrderInfoService;
|
||||||
import com.nu.modules.biz.order.service.IDirectiveOrderService;
|
import com.nu.modules.biz.order.service.IDirectiveOrderService;
|
||||||
|
import com.nu.modules.biz.plan.care.entity.DirectivePlanDate;
|
||||||
import com.nu.modules.directiveorder.api.IDirectiveOrderLogApi;
|
import com.nu.modules.directiveorder.api.IDirectiveOrderLogApi;
|
||||||
import com.nu.modules.order.api.IDirectiveOrderApi;
|
import com.nu.modules.order.api.IDirectiveOrderApi;
|
||||||
|
import com.nu.websocket.SdWebsocket;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
|
|
@ -51,6 +54,8 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
||||||
private IDirectiveOrderLogApi directiveOrderLogApi;
|
private IDirectiveOrderLogApi directiveOrderLogApi;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDirectiveOrderInfoService directiveOrderInfoService;
|
private IDirectiveOrderInfoService directiveOrderInfoService;
|
||||||
|
@Autowired
|
||||||
|
private SdWebsocket sdWebsocket;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DirectiveOrderInfoEntity> queryList(DirectiveOrderInfoEntity dto) {
|
public List<DirectiveOrderInfoEntity> queryList(DirectiveOrderInfoEntity dto) {
|
||||||
|
|
@ -412,15 +417,71 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result<String> generateOrdersInstant(DirectiveOrderEntity directiveOrderEntity) {
|
public Result<String> generateOrdersInstant(DirectiveOrderEntity directiveOrderEntity) {
|
||||||
|
String empId = "2028395421069524993";//王伟东
|
||||||
|
|
||||||
|
Date startTime = new Date();
|
||||||
String nuId = directiveOrderEntity.getNuId();
|
String nuId = directiveOrderEntity.getNuId();
|
||||||
String instructionId = directiveOrderEntity.getInstructionId();
|
String instructionId = directiveOrderEntity.getInstructionId();
|
||||||
String directiveId = directiveOrderEntity.getDirectiveId();
|
String directiveId = directiveOrderEntity.getDirectiveId();
|
||||||
|
|
||||||
|
DirectiveOrderEntity directiveInfo = baseMapper.queryOrderNeedDirectiveInfo(directiveOrderEntity);
|
||||||
|
DirectiveOrderEntity baseInfo = baseMapper.queryOrderNeedBaseInfo(directiveOrderEntity);
|
||||||
|
|
||||||
return Result.OK("派发成功,执行员工:");
|
|
||||||
// DirectiveOrder directiveOrder = new DirectiveOrder();
|
DirectiveOrder newOrder = new DirectiveOrder();
|
||||||
// BeanUtils.copyProperties(directiveOrderEntity, directiveOrder);
|
newOrder.setId(null);
|
||||||
// return directiveOrderService.generateOrdersInstant(directiveOrder);
|
|
||||||
|
newOrder.setNuId(directiveOrderEntity.getNuId());
|
||||||
|
newOrder.setNuName(baseInfo.getNuName());
|
||||||
|
newOrder.setElderId(baseInfo.getElderId());
|
||||||
|
newOrder.setElderName(baseInfo.getElderName());
|
||||||
|
|
||||||
|
newOrder.setEmployeeId(empId);
|
||||||
|
newOrder.setEmployeeName("王伟东");
|
||||||
|
newOrder.setOptType("1");//单人执行
|
||||||
|
newOrder.setServStartTime(startTime);//服务开始时间
|
||||||
|
newOrder.setServEndTime(new Date(startTime.getTime() + Integer.parseInt(directiveInfo.getServiceDuration()) * 60 * 1000L));//服务结束时间
|
||||||
|
newOrder.setOrderStartTime(new Date());//工单开始时间
|
||||||
|
newOrder.setCreateBy("即时指令派单");
|
||||||
|
|
||||||
|
newOrder.setInstructionId(directiveInfo.getInstructionId());
|
||||||
|
newOrder.setInstructionName(directiveInfo.getInstructionName());
|
||||||
|
newOrder.setCategoryId(directiveInfo.getCategoryId());
|
||||||
|
newOrder.setCategoryName(directiveInfo.getCategoryName());
|
||||||
|
newOrder.setTypeId(directiveInfo.getTypeId());
|
||||||
|
newOrder.setTypeName(directiveInfo.getTypeName());
|
||||||
|
newOrder.setDirectiveId(directiveInfo.getDirectiveId());
|
||||||
|
newOrder.setDirectiveName(directiveInfo.getDirectiveName());
|
||||||
|
newOrder.setImmediateFile(directiveInfo.getImmediateFile());
|
||||||
|
newOrder.setImmediateFileFocus(directiveInfo.getImmediateFileFocus());
|
||||||
|
newOrder.setPreviewFile(directiveInfo.getPreviewFile());
|
||||||
|
newOrder.setPreviewFileSmall(directiveInfo.getPreviewFileSmall());
|
||||||
|
newOrder.setMp3File(directiveInfo.getMp3File());
|
||||||
|
newOrder.setMp4File(directiveInfo.getMp4File());
|
||||||
|
newOrder.setServiceAttribute(directiveInfo.getServiceAttribute());
|
||||||
|
newOrder.setServiceDuration(directiveInfo.getServiceDuration());
|
||||||
|
newOrder.setServiceContent(directiveInfo.getServiceContent());
|
||||||
|
|
||||||
|
baseMapper.insert(newOrder);
|
||||||
|
|
||||||
|
//发送websocket消息
|
||||||
|
try {
|
||||||
|
// 发送数据
|
||||||
|
JSONObject message = new JSONObject();
|
||||||
|
message.put("type", "directiveOrder");//消息类型
|
||||||
|
message.put("timestamp", System.currentTimeMillis());
|
||||||
|
message.put("from", "system");//发送者
|
||||||
|
message.put("to", empId);//先固定都发给伟东
|
||||||
|
message.put("data", newOrder);//业务数据
|
||||||
|
String messageJson = message.toJSONString();
|
||||||
|
//发送给单个用户
|
||||||
|
sdWebsocket.sendMessage(empId, messageJson);
|
||||||
|
log.info("【ws消息推送】发送给用户 {}: {}", empId, messageJson);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("ws发送消息失败", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.OK("派发成功,执行员工:" + "王伟东");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,14 @@
|
||||||
<logger name="java.sql.Statement" level="DEBUG" />
|
<logger name="java.sql.Statement" level="DEBUG" />
|
||||||
<logger name="java.sql.PreparedStatement" level="DEBUG" />
|
<logger name="java.sql.PreparedStatement" level="DEBUG" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 打印日志 -->
|
||||||
|
<!-- <logger name="org.apache.ibatis" level="DEBUG" />-->
|
||||||
|
<!-- <logger name="java.sql" level="DEBUG" />-->
|
||||||
|
<!-- <logger name="org.jeecg.modules.system.mapper" level="DEBUG" />-->
|
||||||
|
<!-- <logger name="org.jeecg" level="DEBUG" />-->
|
||||||
|
<!-- <logger name="com.nu" level="DEBUG" />-->
|
||||||
|
|
||||||
<!-- 日志输出级别 -->
|
<!-- 日志输出级别 -->
|
||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue