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);
|
||||
|
||||
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
|
||||
</select>
|
||||
|
||||
<select id="queryOrderNeedDirectiveInfo" resultMap="DirectiveOrderMap">
|
||||
SELECT p.id,
|
||||
p.nu_id,
|
||||
base.nu_name,
|
||||
elder.id as elderId,
|
||||
elder.name as elderName,
|
||||
p.instruction_tag_id,
|
||||
<select id="queryOrderNeedDirectiveInfo" resultType="com.nu.entity.DirectiveOrderEntity">
|
||||
SELECT directive.instruction_tag_id as instructionId,
|
||||
inst.instruction_name,
|
||||
directive.category_id,
|
||||
category.category_name,
|
||||
directive.type_id,
|
||||
stype.type_name,
|
||||
p.directive_id,
|
||||
directive.id as directive_id,
|
||||
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_focus,
|
||||
directive.preview_file,
|
||||
directive.preview_file_small,
|
||||
directive.mp3_file,
|
||||
directive.mp4_file,
|
||||
directive.service_attribute,
|
||||
directive.service_duration,
|
||||
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
|
||||
FROM (
|
||||
SELECT base.*, elder.*
|
||||
FROM nu_base_info base
|
||||
LEFT JOIN nu_biz_elder_info elder ON base.elder_id = elder.id
|
||||
) base_elder
|
||||
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}
|
||||
FROM nu_config_service_directive directive
|
||||
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
|
||||
LEFT JOIN nu_biz_elder_info elder ON elder.id = base.elder_id
|
||||
WHERE base.nu_id = #{dto.nuId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nu.modules.biz.order.service.impl;
|
||||
|
||||
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.QueryWrapper;
|
||||
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.service.IDirectiveOrderInfoService;
|
||||
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.order.api.IDirectiveOrderApi;
|
||||
import com.nu.websocket.SdWebsocket;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
|
|
@ -51,6 +54,8 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
|||
private IDirectiveOrderLogApi directiveOrderLogApi;
|
||||
@Autowired
|
||||
private IDirectiveOrderInfoService directiveOrderInfoService;
|
||||
@Autowired
|
||||
private SdWebsocket sdWebsocket;
|
||||
|
||||
@Override
|
||||
public List<DirectiveOrderInfoEntity> queryList(DirectiveOrderInfoEntity dto) {
|
||||
|
|
@ -412,15 +417,71 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
|||
*/
|
||||
@Override
|
||||
public Result<String> generateOrdersInstant(DirectiveOrderEntity directiveOrderEntity) {
|
||||
String empId = "2028395421069524993";//王伟东
|
||||
|
||||
Date startTime = new Date();
|
||||
String nuId = directiveOrderEntity.getNuId();
|
||||
String instructionId = directiveOrderEntity.getInstructionId();
|
||||
String directiveId = directiveOrderEntity.getDirectiveId();
|
||||
|
||||
DirectiveOrderEntity directiveInfo = baseMapper.queryOrderNeedDirectiveInfo(directiveOrderEntity);
|
||||
DirectiveOrderEntity baseInfo = baseMapper.queryOrderNeedBaseInfo(directiveOrderEntity);
|
||||
|
||||
return Result.OK("派发成功,执行员工:");
|
||||
// DirectiveOrder directiveOrder = new DirectiveOrder();
|
||||
// BeanUtils.copyProperties(directiveOrderEntity, directiveOrder);
|
||||
// return directiveOrderService.generateOrdersInstant(directiveOrder);
|
||||
|
||||
DirectiveOrder newOrder = new DirectiveOrder();
|
||||
newOrder.setId(null);
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -66,6 +66,14 @@
|
|||
<logger name="java.sql.Statement" 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">
|
||||
<appender-ref ref="STDOUT" />
|
||||
|
|
@ -74,4 +82,4 @@
|
|||
<appender-ref ref="FILE_HTML" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
|
|
|||
Loading…
Reference in New Issue