服务指令-数据池缩减无用冗余字段

This commit is contained in:
曹磊 2026-01-16 16:36:41 +08:00
parent 599f3d867f
commit 9c96c55158
17 changed files with 172 additions and 1167 deletions

View File

@ -1,109 +0,0 @@
package com.nu.modules.biz.datapool.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description: 服务指令数据池子表
* @Author: caolei
* @Date: 2026-1-6
* @Version: V1.0
*/
@Data
@TableName("nu_biz_nu_directive_data_pool_sub")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="nu_biz_nu_directive_data_pool对象", description="服务指令数据池子表")
public class DirectiveDataPoolSub implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**数据池类型 1护理;2医疗:3仓库;4行政*/
private String poolType;
/**主表id*/
private String mainId;
/**护理单元id*/
private String nuId;
/**护理单元名称*/
private String nuName;
/**长者id*/
private String elderId;
/**长者姓名*/
private String elderName;
/**分类标签id*/
private String instructionTagId;
/**分类标签*/
private String instructionTagName;
/**服务类别id*/
private String categoryId;
/**服务类别名称*/
private String categoryName;
/**服务类型id*/
private String typeId;
/**服务类型名称*/
private String typeName;
/**服务指令id*/
private String directiveId;
/**服务指令名称*/
private String directiveName;
/**指令类型ID*/
private String cycleTypeId;
/**指令类型*/
private String cycleType;
/**周期值*/
private String cycleValue;
/**服务指令图片大图*/
private String previewFile;
private String netPreviewFile;
/**服务指令图片小图*/
private String previewFileSmall;
private String netPreviewFileSmall;
/**指令音频文件*/
private String mp3File;
private String netMp3File;
/**指令视频文件*/
private String mp4File;
private String netMp4File;
/**服务时长(分钟)*/
private String serviceDuration;
/**服务描述*/
private String serviceContent;
/**指令包id*/
private String packageId;
/**指令包名称*/
private String packageName;
/**是否是服务指令包 Y是 N否*/
private String izPackage;
/**开始时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date startTime;
/**结束时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date endTime;
/**创建人*/
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**更新人*/
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**是否删除 0未删除 1删除*/
private String delFlag;
}

View File

@ -17,19 +17,14 @@ public interface DirectiveDataPoolMapper extends BaseMapper<DirectiveDataPool> {
DirectiveDataPool queryPoolOne(DirectiveDataPool dataPool);
void createDataPoolLog(DirectiveDataPool dataPool);
void createDataPoolLogSub(DirectiveDataPool dataPool);
void addDataPoolLog(DirectiveDataPool dataPool);
void addDataPoolSubLog(DirectiveDataPool dataPool);
void deleteDataPool(DirectiveDataPool dataPool);
void deleteDataPoolSub(DirectiveDataPool dataPool);
void createOrdersLog(DirectiveDataPool dataPool);
void createOrdersLogSub(DirectiveDataPool dataPool);
void addOrdersLog(DirectiveDataPool dataPool);
void addOrdersSubLog(DirectiveDataPool dataPool);
DirectiveDataPool queryOrdersOne(DirectiveDataPool dataPool);
void deleteOrders(DirectiveDataPool dataPool);

View File

@ -1,16 +0,0 @@
package com.nu.modules.biz.datapool.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nu.modules.biz.datapool.entity.DirectiveDataPoolSub;
import java.util.List;
/**
* @Description: 服务指令数据池管理子表
* @Author: caolei
* @Date: 2026-1-6
* @Version: V1.0
*/
public interface DirectiveDataPoolSubMapper extends BaseMapper<DirectiveDataPoolSub> {
DirectiveDataPoolSub queryDirectiveOne(DirectiveDataPoolSub dataPoolSub);
List<DirectiveDataPoolSub> queryDirectiveList(DirectiveDataPoolSub dataPoolSub);
}

View File

@ -15,4 +15,5 @@ import java.util.List;
public interface InvoicingDataPoolMapper extends BaseMapper<DirectiveDataPool> {
List<DirectiveDataPool> queryPlanList(DirectiveDataPool dataPool);
DirectiveDataPool queryPlanById(@Param("id") String id);
int getOrderOptCount(DirectiveDataPool dataPool);
}

View File

@ -15,4 +15,5 @@ import java.util.List;
public interface LogisticsDataPoolMapper extends BaseMapper<DirectiveDataPool> {
List<DirectiveDataPool> queryPlanList(DirectiveDataPool dataPool);
DirectiveDataPool queryPlanById(@Param("id") String id);
int getOrderOptCount(DirectiveDataPool dataPool);
}

View File

@ -4,13 +4,14 @@
<select id="queryPlanList" resultType="com.nu.modules.biz.datapool.entity.DirectiveDataPool">
select
'1' as poolType,
a.id as bizId,
a.nu_id as nuId,
a.directive_id as directiveId,
a.iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(a.start_time, '%H:%i')) as startTime,
a.cycle_type_id as cycleTypeId,
a.cycle_value as cycleValue,
a.iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(a.start_time, '%H:%i')) as startTime,
a.opt_time as optTime,
a.opt_count as optCount
from nu_biz_nu_care_directive_plan a
@ -32,13 +33,14 @@
<select id="queryPlanById" resultType="com.nu.modules.biz.datapool.entity.DirectiveDataPool">
select
'1' as poolType,
a.id as bizId,
a.nu_id as nuId,
a.directive_id as directiveId,
a.iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(a.start_time, '%H:%i')) as startTime,
a.cycle_type_id as cycleTypeId,
a.cycle_value as cycleValue,
a.iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(a.start_time, '%H:%i')) as startTime,
a.opt_time as optTime,
a.opt_count as optCount
from nu_biz_nu_care_directive_plan a

View File

@ -44,29 +44,11 @@
pool_type varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据池类型 1护理;2医疗:3仓库;4行政',
biz_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令计划ID,nu_biz_nu_care_directive_plan.id;即时指令计划ID,nu_biz_nu_care_directive_plan_instant.id',
nu_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '护理单元IDnu_base_info.id',
nu_name varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '护理单元名称',
elder_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '长者IDnu_biz_elder_info.id',
elder_name varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '长者名称',
directive_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令IDnu_config_service_directive.id',
directive_name varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令名称',
cycle_type_id varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '指令类型ID',
cycle_type varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '指令类型',
cycle_value varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '周期值',
preview_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令图片大图',
net_preview_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令图片大图-网络地址',
preview_file_small varchar(300) CHARACTER SET utf32 COLLATE utf32_general_ci NULL DEFAULT NULL COMMENT '服务指令图片小图',
net_preview_file_small varchar(300) CHARACTER SET utf32 COLLATE utf32_general_ci NULL DEFAULT NULL COMMENT '服务指令图片小图-网络地址',
mp3_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '语音文件',
net_mp3_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '语音文件-网络地址',
mp4_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频文件',
net_mp4_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频文件-网络地址',
service_duration varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务时长(分钟)',
service_content varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务说明',
package_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令包ID',
package_name varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令包名称',
iz_package varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '是否是服务指令包 Y是 N否',
start_time datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
end_time datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
iz_orders varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '是否生成工单 Y是 N否',
iz_start varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '是否开始 Y是 N否',
create_by varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
@ -79,51 +61,6 @@
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '护理单元-服务指令-数据池日志主表' ROW_FORMAT = Dynamic;
</update>
<update id="createDataPoolLogSub">
CREATE TABLE IF NOT EXISTS ${tableName} (
id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID',
pool_type varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据池类型 1护理;2医疗:3仓库;4行政',
main_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主表IDnu_biz_nu_directive_data_pool.id',
nu_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '护理单元IDnu_base_info.id',
nu_name varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '护理单元名称',
elder_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '长者IDnu_biz_elder_info.id',
elder_name varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '长者名称',
instruction_tag_id varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类标签',
instruction_tag_name varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类标签名称',
category_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务类别IDnu_config_service_category.id',
category_name varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务类别名称',
type_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务类型IDnu_config_service_type.id',
type_name varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务类型名称',
directive_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令IDnu_config_service_directive.id',
directive_name varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令名称',
cycle_type_id varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '指令类型ID',
cycle_type varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '指令类型',
cycle_value varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '周期值',
preview_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令图片大图',
net_preview_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令图片大图-网络地址',
preview_file_small varchar(300) CHARACTER SET utf32 COLLATE utf32_general_ci NULL DEFAULT NULL COMMENT '服务指令图片小图',
net_preview_file_small varchar(300) CHARACTER SET utf32 COLLATE utf32_general_ci NULL DEFAULT NULL COMMENT '服务指令图片小图-网络地址',
mp3_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '语音文件',
net_mp3_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '语音文件-网络地址',
mp4_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频文件',
net_mp4_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频文件-网络地址',
service_duration varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务时长(分钟)',
service_content varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务说明',
package_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令包ID',
package_name varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令包名称',
iz_package varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '是否是服务指令包 Y是 N否',
start_time datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
end_time datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
create_by varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
create_time datetime(0) NULL DEFAULT NULL COMMENT '创建日期',
update_by varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
update_time datetime(0) NULL DEFAULT NULL COMMENT '更新日期',
del_flag varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '是否删除 0未删除 1删除',
operation_flag varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作标记 1正常删除入库 2撤回删除入库',
PRIMARY KEY (id) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '护理单元-服务指令-数据池日志子表' ROW_FORMAT = Dynamic;
</update>
<update id="addDataPoolLog">
insert into ${tableName}
select a.*,#{operationFlag}
@ -138,20 +75,6 @@
</where>
</update>
<update id="addDataPoolSubLog">
insert into ${tableName}
select a.*,#{operationFlag}
from nu_biz_nu_directive_data_pool_sub a
<where>
<if test="id != null and id != ''">
AND main_id = #{id}
</if>
<if test="endTime != null">
AND a.create_time &lt;= #{endTime}
</if>
</where>
</update>
<update id="deleteDataPool">
delete from nu_biz_nu_directive_data_pool a
<where>
@ -164,18 +87,6 @@
</where>
</update>
<update id="deleteDataPoolSub">
delete from nu_biz_nu_directive_data_pool_sub a
<where>
<if test="id != null and id != ''">
AND main_id = #{id}
</if>
<if test="endTime != null">
AND a.create_time &lt;= #{endTime}
</if>
</where>
</update>
<update id="createOrdersLog">
CREATE TABLE IF NOT EXISTS ${tableName} (
id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID',
@ -234,65 +145,6 @@
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '护理单元-服务指令-工单日志主表' ROW_FORMAT = Dynamic;
</update>
<update id="createOrdersLogSub">
CREATE TABLE IF NOT EXISTS ${tableName} (
id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID',
order_no varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号',
order_type varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '工单类型 1护理;2医疗:3仓库;4行政',
main_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主表IDnu_biz_nu_directive_data_pool.id',
pool_sub_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据池子表IDnu_biz_nu_directive_data_pool_sub.id',
nu_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '护理单元IDnu_base_info.id',
nu_name varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '护理单元名称',
elder_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '长者IDnu_biz_elder_info.id',
elder_name varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '长者名称',
employee_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '员工ID',
employee_name varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '员工姓名',
instruction_tag_id varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类标签',
instruction_tag_name varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类标签名称',
category_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务类别IDnu_config_service_category.id',
category_name varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务类别名称',
type_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务类型IDnu_config_service_type.id',
type_name varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务类型名称',
directive_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令IDnu_config_service_directive.id',
directive_name varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令名称',
cycle_type_id varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '指令类型ID',
cycle_type varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '指令类型',
cycle_value varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '周期值',
preview_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令图片大图',
net_preview_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令图片大图-网络地址',
preview_file_small varchar(300) CHARACTER SET utf32 COLLATE utf32_general_ci NULL DEFAULT NULL COMMENT '服务指令图片小图',
net_preview_file_small varchar(300) CHARACTER SET utf32 COLLATE utf32_general_ci NULL DEFAULT NULL COMMENT '服务指令图片小图-网络地址',
mp3_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '语音文件',
net_mp3_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '语音文件-网络地址',
mp4_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频文件',
net_mp4_file varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频文件-网络地址',
service_duration varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务时长(分钟)',
service_content varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务说明',
toll_price decimal(12, 4) NULL DEFAULT NULL COMMENT '收费价格',
com_price decimal(12, 4) NULL DEFAULT NULL COMMENT '收费价格',
real_com_price decimal(12, 4) NULL DEFAULT NULL COMMENT '收费价格',
package_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令包ID',
package_name varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令包名称',
iz_package varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '是否是服务指令包 Y是 N否',
start_time datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
end_time datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
begin_time datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
finish_time datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
iz_start varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '是否开始 Y是 N否',
iz_finish varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '是否开始 Y是 N否',
create_by varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
create_time datetime(0) NULL DEFAULT NULL COMMENT '创建日期',
update_by varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
update_time datetime(0) NULL DEFAULT NULL COMMENT '更新日期',
del_flag varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '是否删除 0未删除 1删除',
tplink_path varchar(600) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'tplink下载地址',
manually_pic_path text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手动拍照',
manually_mp4_path text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手动录制',
remarks varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
PRIMARY KEY (id) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '护理单元-服务指令-工单日志子表' ROW_FORMAT = Dynamic;
</update>
<select id="queryOrdersOne" resultType="com.nu.modules.biz.datapool.entity.DirectiveDataPool">
select
id,
@ -335,13 +187,6 @@
where id = #{id}
</update>
<update id="addOrdersSubLog">
insert into ${tableName}
select a.*,#{remarks}
from nu_biz_nu_directive_order_sub a
where main_id = #{id}
</update>
<update id="deleteOrders">
delete from nu_biz_nu_directive_order
where id = #{id}

View File

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nu.modules.biz.datapool.mapper.DirectiveDataPoolSubMapper">
<select id="queryDirectiveOne" resultType="com.nu.modules.biz.datapool.entity.DirectiveDataPoolSub">
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="queryDirectiveList" resultType="com.nu.modules.biz.datapool.entity.DirectiveDataPoolSub">
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,
a.cycle_value AS cycleValue,
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>

View File

@ -4,29 +4,16 @@
<select id="queryPlanList" resultType="com.nu.modules.biz.datapool.entity.DirectiveDataPool">
select
id as bizId,
nu_id as nuId,
nu_name as nuName,
(case when iz_package = 'Y' then '' else directive_id end) as directiveId,
(case when iz_package = 'Y' then '' else directive_name end) as directiveName,
(case when iz_package = 'Y' then directive_id else '' end) as packageId,
(case when iz_package = 'Y' then directive_name else '' end) as packageName,
iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(start_time, '%H:%i')) as startTime,
CONCAT(CURDATE(), ' ',STR_TO_DATE(end_time, '%H:%i')) as endTime,
cycle_type_id as cycleTypeId,
cycle_type as cycleType,
cycle_value as cycleValue,
preview_file as previewFile,
net_preview_file as netPreviewFile,
preview_file_small as previewFileSmall,
net_preview_file_small as netPreviewFileSmall,
mp3_file as mp3File,
net_mp3_file as netMp3File,
mp4_file as mp4File,
net_mp4_file as netMp4File,
service_duration as serviceDuration,
service_content as serviceContent
'3' as poolType,
a.id as bizId,
a.nu_id as nuId,
a.directive_id as directiveId,
a.cycle_type_id as cycleTypeId,
a.cycle_value as cycleValue,
a.iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(a.start_time, '%H:%i')) as startTime,
a.opt_time as optTime,
a.opt_count as optCount
from nu_biz_nu_invoicing_directive_plan
<where>
<if test="nuId != null and nuId != ''">
@ -35,9 +22,6 @@
<if test="directiveId != null and directiveId != ''">
AND directive_id = #{directiveId}
</if>
<if test="packageId != null and packageId != ''">
AND package_id = #{packageId}
</if>
<if test="startTime != null">
AND CONCAT(CURDATE(), ' ',STR_TO_DATE(start_time, '%H:%i')) >= #{startTime}
</if>
@ -49,31 +33,31 @@
<select id="queryPlanById" resultType="com.nu.modules.biz.datapool.entity.DirectiveDataPool">
select
id as bizId,
nu_id as nuId,
nu_name as nuName,
(case when iz_package = 'Y' then '' else directive_id end) as directiveId,
(case when iz_package = 'Y' then '' else directive_name end) as directiveName,
(case when iz_package = 'Y' then directive_id else '' end) as packageId,
(case when iz_package = 'Y' then directive_name else '' end) as packageName,
iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(start_time, '%H:%i')) as startTime,
CONCAT(CURDATE(), ' ',STR_TO_DATE(end_time, '%H:%i')) as endTime,
cycle_type_id as cycleTypeId,
cycle_type as cycleType,
cycle_value as cycleValue,
preview_file as previewFile,
net_preview_file as netPreviewFile,
preview_file_small as previewFileSmall,
net_preview_file_small as netPreviewFileSmall,
mp3_file as mp3File,
net_mp3_file as netMp3File,
mp4_file as mp4File,
net_mp4_file as netMp4File,
service_duration as serviceDuration,
service_content as serviceContent
'3' as poolType,
a.id as bizId,
a.nu_id as nuId,
a.directive_id as directiveId,
a.cycle_type_id as cycleTypeId,
a.cycle_value as cycleValue,
a.iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(a.start_time, '%H:%i')) as startTime,
a.opt_time as optTime,
a.opt_count as optCount
from nu_biz_nu_invoicing_directive_plan
where id = #{id}
</select>
<select id="getOrderOptCount" resultType="int">
select count(*)
from nu_biz_nu_directive_order
where nu_id = #{nuId}
and start_time >= #{optTime}
<if test="izPackage != null and izPackage != 'N'">
AND directive_id = #{directiveId}
</if>
<if test="izPackage != null and izPackage != 'Y'">
AND package_id = #{directiveId}
</if>
</select>
</mapper>

View File

@ -4,31 +4,16 @@
<select id="queryPlanList" resultType="com.nu.modules.biz.datapool.entity.DirectiveDataPool">
select
id as bizId,
nu_id as nuId,
nu_name as nuName,
elder_id as elderId,
elder_name as elderName,
(case when iz_package = 'Y' then '' else directive_id end) as directiveId,
(case when iz_package = 'Y' then '' else directive_name end) as directiveName,
(case when iz_package = 'Y' then directive_id else '' end) as packageId,
(case when iz_package = 'Y' then directive_name else '' end) as packageName,
iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(start_time, '%H:%i')) as startTime,
CONCAT(CURDATE(), ' ',STR_TO_DATE(end_time, '%H:%i')) as endTime,
cycle_type_id as cycleTypeId,
cycle_type as cycleType,
cycle_value as cycleValue,
preview_file as previewFile,
net_preview_file as netPreviewFile,
preview_file_small as previewFileSmall,
net_preview_file_small as netPreviewFileSmall,
mp3_file as mp3File,
net_mp3_file as netMp3File,
mp4_file as mp4File,
net_mp4_file as netMp4File,
service_duration as serviceDuration,
service_content as serviceContent
'4' as poolType,
a.id as bizId,
a.nu_id as nuId,
a.directive_id as directiveId,
a.cycle_type_id as cycleTypeId,
a.cycle_value as cycleValue,
a.iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(a.start_time, '%H:%i')) as startTime,
a.opt_time as optTime,
a.opt_count as optCount
from nu_biz_nu_logistics_directive_plan
<where>
<if test="nuId != null and nuId != ''">
@ -40,9 +25,6 @@
<if test="directiveId != null and directiveId != ''">
AND directive_id = #{directiveId}
</if>
<if test="packageId != null and packageId != ''">
AND package_id = #{packageId}
</if>
<if test="startTime != null">
AND CONCAT(CURDATE(), ' ',STR_TO_DATE(start_time, '%H:%i')) >= #{startTime}
</if>
@ -54,33 +36,31 @@
<select id="queryPlanById" resultType="com.nu.modules.biz.datapool.entity.DirectiveDataPool">
select
id as bizId,
nu_id as nuId,
nu_name as nuName,
elder_id as elderId,
elder_name as elderName,
(case when iz_package = 'Y' then '' else directive_id end) as directiveId,
(case when iz_package = 'Y' then '' else directive_name end) as directiveName,
(case when iz_package = 'Y' then directive_id else '' end) as packageId,
(case when iz_package = 'Y' then directive_name else '' end) as packageName,
iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(start_time, '%H:%i')) as startTime,
CONCAT(CURDATE(), ' ',STR_TO_DATE(end_time, '%H:%i')) as endTime,
cycle_type_id as cycleTypeId,
cycle_type as cycleType,
cycle_value as cycleValue,
preview_file as previewFile,
net_preview_file as netPreviewFile,
preview_file_small as previewFileSmall,
net_preview_file_small as netPreviewFileSmall,
mp3_file as mp3File,
net_mp3_file as netMp3File,
mp4_file as mp4File,
net_mp4_file as netMp4File,
service_duration as serviceDuration,
service_content as serviceContent
'4' as poolType,
a.id as bizId,
a.nu_id as nuId,
a.directive_id as directiveId,
a.cycle_type_id as cycleTypeId,
a.cycle_value as cycleValue,
a.iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(a.start_time, '%H:%i')) as startTime,
a.opt_time as optTime,
a.opt_count as optCount
from nu_biz_nu_logistics_directive_plan
where id = #{id}
</select>
<select id="getOrderOptCount" resultType="int">
select count(*)
from nu_biz_nu_directive_order
where nu_id = #{nuId}
and start_time >= #{optTime}
<if test="izPackage != null and izPackage != 'N'">
AND directive_id = #{directiveId}
</if>
<if test="izPackage != null and izPackage != 'Y'">
AND package_id = #{directiveId}
</if>
</select>
</mapper>

View File

@ -19,8 +19,6 @@ public interface IDirectiveDataPoolService extends IService<DirectiveDataPool> {
void addDataPoolLog(String dateStr,String id);
void addDataPoolSubLog(String dateStr,String id);
/**
* 清理
*/

View File

@ -1,16 +0,0 @@
package com.nu.modules.biz.datapool.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nu.modules.biz.datapool.entity.DirectiveDataPoolSub;
import java.util.List;
/**
* @Description: 服务指令数据池管理子表
* @Author: caolei
* @Date: 2026-1-6
* @Version: V1.0
*/
public interface IDirectiveDataPoolSubService extends IService<DirectiveDataPoolSub> {
DirectiveDataPoolSub queryDirectiveOne(DirectiveDataPoolSub dataPoolSub);
List<DirectiveDataPoolSub> queryDirectiveList(DirectiveDataPoolSub dataPoolSub);
}

View File

@ -1,23 +1,16 @@
package com.nu.modules.biz.datapool.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nu.modules.biz.datapool.entity.DirectiveDataPool;
import com.nu.modules.biz.datapool.entity.DirectiveDataPoolSub;
import com.nu.modules.biz.datapool.mapper.CareDataPoolMapper;
import com.nu.modules.biz.datapool.mapper.DirectiveDataPoolMapper;
import com.nu.modules.biz.datapool.service.ICareDataPoolService;
import com.nu.modules.biz.datapool.service.IDirectiveDataPoolService;
import com.nu.modules.biz.datapool.service.IDirectiveDataPoolSubService;
import com.nu.modules.biz.plan.care.entity.CareDirectivePlan;
import com.nu.modules.sysconfig.ISysConfigApi;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@ -35,11 +28,6 @@ public class CareDataPoolServiceImpl extends ServiceImpl<CareDataPoolMapper, Dir
@Autowired
IDirectiveDataPoolService dataPoolService;
@Autowired
IDirectiveDataPoolSubService dataPoolSubService;
@Autowired
private ISysConfigApi sysConfigApi;
private String serverNetUrl;
/**
* 批量生成数据池
@ -57,7 +45,6 @@ public class CareDataPoolServiceImpl extends ServiceImpl<CareDataPoolMapper, Dir
List<DirectiveDataPool> planList = baseMapper.queryPlanList(entity);//获取计划
if(planList.size()>0){
for(DirectiveDataPool plan : planList){
plan.setPoolType("1");
DirectiveDataPool pool = dataPoolService.queryPoolOne(plan);
if(pool!=null){
continue;
@ -115,16 +102,8 @@ public class CareDataPoolServiceImpl extends ServiceImpl<CareDataPoolMapper, Dir
* 日常指令生成数据池子表
*/
private void addDaily(DirectiveDataPool dataPool){
String izPackage = dataPool.getIzPackage();
//入指令池主表
this.save(dataPool);
if(izPackage!=null&&izPackage.equals("Y")){
//入指令池子表
addPackageSubs(dataPool);
}else{
//入指令池子表
addSub(dataPool);
}
}
/**
@ -190,58 +169,6 @@ public class CareDataPoolServiceImpl extends ServiceImpl<CareDataPoolMapper, Dir
}
}
/**
* 指令生成数据池子表非包
*/
private void addSub(DirectiveDataPool dataPool){
DirectiveDataPoolSub entity = new DirectiveDataPoolSub();
entity.setDirectiveId(dataPool.getDirectiveId());
DirectiveDataPoolSub dataPoolSub = dataPoolSubService.queryDirectiveOne(entity);
getNetImagesSub(dataPoolSub);//获取网络地址
dataPoolSub.setCycleValue(dataPool.getCycleValue());
dataPoolSub.setNuId(dataPool.getNuId());
dataPoolSub.setStartTime(dataPool.getStartTime());
dataPoolSub.setEndTime(dataPool.getEndTime());
dataPoolSub.setIzPackage("N");
dataPoolSub.setDelFlag(dataPool.getDelFlag());
dataPoolSub.setMainId(dataPool.getId());
dataPoolSub.setPoolType("1");
dataPoolSubService.save(dataPoolSub);
}
/**
* 指令包中指令进行规则判断并生成到数据池子表
*/
private void addPackageSubs(DirectiveDataPool dataPool){
DirectiveDataPoolSub entity = new DirectiveDataPoolSub();
// entity.setPackageId(dataPool.getPackageId());
List<DirectiveDataPoolSub> subList = dataPoolSubService.queryDirectiveList(entity);
for(int i=0;i<subList.size();i++){
DirectiveDataPoolSub dataPoolSub = subList.get(i);
getNetImagesSub(dataPoolSub);//获取网络地址
addPackageSub(dataPool,dataPoolSub);
}
}
/**
* 指令生成到数据池子表
*/
private void addPackageSub(DirectiveDataPool dataPool, DirectiveDataPoolSub dataPoolSub){
dataPoolSub.setNuId(dataPool.getNuId());
// dataPoolSub.setNuName(dataPool.getNuName());
// dataPoolSub.setElderId(dataPool.getElderId());
// dataPoolSub.setElderName(dataPool.getElderName());
dataPoolSub.setStartTime(dataPool.getStartTime());
dataPoolSub.setEndTime(dataPool.getEndTime());
dataPoolSub.setIzPackage("Y");
// dataPoolSub.setPackageId(dataPool.getPackageId());
// dataPoolSub.setPackageName(dataPool.getPackageName());
dataPoolSub.setDelFlag(dataPool.getDelFlag());
dataPoolSub.setMainId(dataPool.getId());
dataPoolSub.setPoolType("1");
dataPoolSubService.save(dataPoolSub);
}
/**
* 单一指令生成到数据池
* @param careDirectivePlan
@ -249,32 +176,13 @@ public class CareDataPoolServiceImpl extends ServiceImpl<CareDataPoolMapper, Dir
@Override
public void generateDataPool(CareDirectivePlan careDirectivePlan){
DirectiveDataPool dataPool = new DirectiveDataPool();
dataPool.setPoolType("1");
dataPool.setBizId(careDirectivePlan.getId());
dataPool.setNuId(careDirectivePlan.getNuId());
// dataPool.setNuName(careDirectivePlan.getNuName());
// dataPool.setElderId(careDirectivePlan.getElderId());
// dataPool.setElderName(careDirectivePlan.getElderName());
if(careDirectivePlan.getIzPackage().equals("Y")){
// dataPool.setPackageId(careDirectivePlan.getDirectiveId());
// dataPool.setPackageName(careDirectivePlan.getDirectiveName());
}else{
dataPool.setDirectiveId(careDirectivePlan.getDirectiveId());
// dataPool.setDirectiveName(careDirectivePlan.getDirectiveName());
}
dataPool.setDirectiveId(careDirectivePlan.getDirectiveId());
dataPool.setCycleTypeId(careDirectivePlan.getCycleTypeId());
// dataPool.setCycleType(careDirectivePlan.getCycleType());
dataPool.setCycleValue(careDirectivePlan.getCycleValue());
// dataPool.setPreviewFile(careDirectivePlan.getPreviewFile());
// dataPool.setNetPreviewFile(careDirectivePlan.getNetPreviewFile());
// dataPool.setPreviewFileSmall(careDirectivePlan.getPreviewFileSmall());
// dataPool.setNetPreviewFileSmall(careDirectivePlan.getNetPreviewFileSmall());
// dataPool.setMp3File(careDirectivePlan.getMp3File());
// dataPool.setNetMp3File(careDirectivePlan.getNetMp3File());
// dataPool.setMp4File(careDirectivePlan.getMp4File());
// dataPool.setNetMp4File(careDirectivePlan.getNetMp4File());
dataPool.setIzPackage(careDirectivePlan.getIzPackage());
// dataPool.setServiceDuration(careDirectivePlan.getServiceDuration());
// dataPool.setServiceContent(careDirectivePlan.getServiceContent());
String startTime = careDirectivePlan.getStartTime();
String[] starts = startTime.split(":");
String hour = starts[0];
@ -285,15 +193,8 @@ public class CareDataPoolServiceImpl extends ServiceImpl<CareDataPoolMapper, Dir
c.set(Calendar.SECOND,0);
c.set(Calendar.MILLISECOND,0);
dataPool.setStartTime(c.getTime());
String endTime = careDirectivePlan.getEndTime();
String[] ends = endTime.split(":");
hour = ends[0];
minute = ends[1];
c.set(Calendar.HOUR_OF_DAY,Integer.valueOf(hour));
c.set(Calendar.MINUTE,Integer.valueOf(minute));
c.set(Calendar.SECOND,0);
c.set(Calendar.MILLISECOND,0);
dataPool.setEndTime(c.getTime());
dataPool.setOptTime(careDirectivePlan.getOptTime());
dataPool.setOptCount(careDirectivePlan.getOptCount());
addDataPool(dataPool);
}
@ -313,18 +214,12 @@ public class CareDataPoolServiceImpl extends ServiceImpl<CareDataPoolMapper, Dir
c.set(Calendar.SECOND,0);
c.set(Calendar.MILLISECOND,0);
DirectiveDataPool dataPool = new DirectiveDataPool();
dataPool.setPoolType("1");
dataPool.setBizId(careDirectivePlan.getId());
dataPool.setNuId(careDirectivePlan.getNuId());
// dataPool.setElderId(careDirectivePlan.getElderId());
dataPool.setDirectiveId(careDirectivePlan.getDirectiveId());
dataPool.setStartTime(c.getTime());
// dataPool.setIzOrders("N");
dataPool.setIzStart("N");
String izPackage = careDirectivePlan.getIzPackage();
if(izPackage.equals("Y")){
// dataPool.setPackageId(careDirectivePlan.getDirectiveId());
}else{
dataPool.setDirectiveId(careDirectivePlan.getDirectiveId());
}
DirectiveDataPool pool = dataPoolService.queryPoolOne(dataPool);
if(pool!=null){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -334,7 +229,6 @@ public class CareDataPoolServiceImpl extends ServiceImpl<CareDataPoolMapper, Dir
dataPoolService.deleteOrders(dateStr,pool);
}
dataPoolService.addDataPoolLog(dateStr,pool.getId());
dataPoolService.addDataPoolSubLog(dateStr,pool.getId());
}
}
@ -352,59 +246,4 @@ public class CareDataPoolServiceImpl extends ServiceImpl<CareDataPoolMapper, Dir
}
}
/**
* 获取管理平台静态资源路径
*
* @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 DirectiveDataPoolSub getNetImagesSub(DirectiveDataPoolSub par) {
if (par.getPreviewFile() != null && !par.getPreviewFile().equals("")) {
String netPreviewFile = getImageNetUrl(par.getPreviewFile());
par.setNetPreviewFile(netPreviewFile);
} else {
par.setPreviewFile("");
par.setNetPreviewFile("");
}
if (par.getPreviewFileSmall() != null && !par.getPreviewFileSmall().equals("")) {
String netPreviewFileSmall = getImageNetUrl(par.getPreviewFileSmall());
par.setNetPreviewFileSmall(netPreviewFileSmall);
} 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;
}
}

View File

@ -1,25 +1,16 @@
package com.nu.modules.biz.datapool.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nu.modules.biz.datapool.entity.DirectiveDataPool;
import com.nu.modules.biz.datapool.entity.DirectiveDataPoolSub;
import com.nu.modules.biz.datapool.mapper.DirectiveDataPoolMapper;
import com.nu.modules.biz.datapool.service.IDirectiveDataPoolService;
import com.nu.modules.biz.datapool.service.IDirectiveDataPoolSubService;
import com.nu.modules.biz.plan.care.entity.CareDirectivePlan;
import com.nu.modules.sysconfig.ISysConfigApi;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* @Description: 服务指令数据池管理
@ -31,11 +22,6 @@ import java.util.List;
@Slf4j
public class DirectiveDataPoolServiceImpl extends ServiceImpl<DirectiveDataPoolMapper, DirectiveDataPool> implements IDirectiveDataPoolService {
@Autowired
IDirectiveDataPoolSubService dataPoolSubService;
@Autowired
private ISysConfigApi sysConfigApi;
/**
* 创建工单日志表
*/
@ -48,18 +34,6 @@ public class DirectiveDataPoolServiceImpl extends ServiceImpl<DirectiveDataPoolM
baseMapper.deleteOrders(dataPool);//删除昨天及之前的数据
}
/**
* 创建工单日志表
*/
private void addOrdersSubLog(String dateStr, DirectiveDataPool dataPool){
String tableName = "nu_biz_nu_directive_order_sub_log_"+dateStr.substring(2, 4)+dateStr.substring(5, 7);
dataPool.setTableName(tableName);
baseMapper.createOrdersLogSub(dataPool);//创建日志子表
dataPool.setRemarks("计划删除,删除未开始工单");
baseMapper.addOrdersSubLog(dataPool);//保存数据池数据到日志子表
baseMapper.deleteOrdersSub(dataPool);//删除昨天及之前的数据
}
/**
* 查询数据池
* @param directiveDataPool
@ -83,7 +57,6 @@ public class DirectiveDataPoolServiceImpl extends ServiceImpl<DirectiveDataPoolM
if(pool!=null){
//删除工单
addOrdersLog(dateStr,pool);
addOrdersSubLog(dateStr,pool);
//ws发送通知给员工员工端删除次工单待完善
}
}
@ -105,24 +78,6 @@ public class DirectiveDataPoolServiceImpl extends ServiceImpl<DirectiveDataPoolM
baseMapper.deleteDataPool(dataPool);//删除昨天及之前的数据
}
/**
* 创建日志表
* @param dateStr
* @param id
*/
@Override
public void addDataPoolSubLog(String dateStr,String id){
String tableName = "nu_biz_nu_directive_data_pool_sub_log_"+dateStr.substring(2, 4)+dateStr.substring(5, 7);
DirectiveDataPool dataPool = new DirectiveDataPool();
dataPool.setTableName(tableName);
baseMapper.createDataPoolLogSub(dataPool);//创建日志子表
dataPool.setId(id);
dataPool.setOperationFlag("2");
baseMapper.addDataPoolSubLog(dataPool);//保存数据池数据到日志子表
baseMapper.deleteDataPoolSub(dataPool);//删除昨天及之前的数据
}
/**
* 清理数据池数据
*/
@ -135,7 +90,6 @@ public class DirectiveDataPoolServiceImpl extends ServiceImpl<DirectiveDataPoolM
String dateStr = sdf.format(c.getTime());
//创建日志表保存数据池数据到日志表删除昨天及之前的数据
addDataPoolLogByClean(dateStr);
addDataPoolSubLogByClean(dateStr);
}
/**
@ -157,22 +111,4 @@ public class DirectiveDataPoolServiceImpl extends ServiceImpl<DirectiveDataPoolM
baseMapper.deleteDataPool(dataPool);//删除昨天及之前的数据
}
/**
* 创建日志表
*/
private void addDataPoolSubLogByClean(String dateStr){
String tableName = "nu_biz_nu_directive_data_pool_sub_log_"+dateStr.substring(2, 4)+dateStr.substring(5, 7);
DirectiveDataPool dataPool = new DirectiveDataPool();
dataPool.setTableName(tableName);
baseMapper.createDataPoolLogSub(dataPool);//创建日志子表
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY,0);
c.set(Calendar.MINUTE,0);
c.set(Calendar.SECOND,0);
c.set(Calendar.MILLISECOND,0);
dataPool.setEndTime(c.getTime());
dataPool.setOperationFlag("1");
baseMapper.addDataPoolSubLog(dataPool);//保存数据池数据到日志子表
baseMapper.deleteDataPoolSub(dataPool);//删除昨天及之前的数据
}
}

View File

@ -1,30 +0,0 @@
package com.nu.modules.biz.datapool.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nu.modules.biz.datapool.entity.DirectiveDataPoolSub;
import com.nu.modules.biz.datapool.mapper.DirectiveDataPoolSubMapper;
import com.nu.modules.biz.datapool.service.IDirectiveDataPoolSubService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description: 服务指令数据池管理
* @Author: caolei
* @Date: 2025-11-07
* @Version: V1.0
*/
@Service
@Slf4j
public class DirectiveDataPoolSubServiceImpl extends ServiceImpl<DirectiveDataPoolSubMapper, DirectiveDataPoolSub> implements IDirectiveDataPoolSubService {
@Override
public DirectiveDataPoolSub queryDirectiveOne(DirectiveDataPoolSub dataPoolSub){
return baseMapper.queryDirectiveOne(dataPoolSub);
}
@Override
public List<DirectiveDataPoolSub> queryDirectiveList(DirectiveDataPoolSub dataPoolSub){
return baseMapper.queryDirectiveList(dataPoolSub);
}
}

View File

@ -1,22 +1,16 @@
package com.nu.modules.biz.datapool.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nu.modules.biz.datapool.entity.DirectiveDataPool;
import com.nu.modules.biz.datapool.entity.DirectiveDataPoolSub;
import com.nu.modules.biz.datapool.mapper.InvoicingDataPoolMapper;
import com.nu.modules.biz.datapool.service.IDirectiveDataPoolService;
import com.nu.modules.biz.datapool.service.IDirectiveDataPoolSubService;
import com.nu.modules.biz.datapool.service.IInvoicingDataPoolService;
import com.nu.modules.biz.plan.invoicing.entity.InvoicingDirectivePlan;
import com.nu.modules.sysconfig.ISysConfigApi;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@ -34,11 +28,6 @@ public class InvoicingDataPoolServiceImpl extends ServiceImpl<InvoicingDataPoolM
@Autowired
IDirectiveDataPoolService dataPoolService;
@Autowired
IDirectiveDataPoolSubService dataPoolSubService;
@Autowired
private ISysConfigApi sysConfigApi;
private String serverNetUrl;
/**
* 批量生成数据池
@ -86,27 +75,23 @@ public class InvoicingDataPoolServiceImpl extends ServiceImpl<InvoicingDataPoolM
dataPool.setIzOrders("N");
dataPool.setIzStart("N");
dataPool.setDelFlag("0");
dataPool.setPoolType("3");
String izPackage = dataPool.getIzPackage();
if(izPackage!=null&&izPackage.equals("Y")){
addPackage(dataPool);
}else{
String typeId = dataPool.getCycleTypeId();
if(typeId!=null){
if(typeId.equals("1")){
addDaily(dataPool);
}
if(typeId.equals("2")){
//周期先判断是星期还是月份再判断当前时间是否命中周期
String cycleValue = dataPool.getCycleValue();
if(cycleValue.length()>1){
//月周期
addMonthDay(dataPool);
}else{
//星期周期
addWeekDay(dataPool);
}
}
String typeId = dataPool.getCycleTypeId();
if(typeId!=null){
//每天
if(typeId.equals("1")){
addDaily(dataPool);
}
//星期
if(typeId.equals("3")){
addWeekDay(dataPool);
}
//日期
if(typeId.equals("4")){
addMonthDay(dataPool);
}
//频率
if(typeId.equals("5")){
addFrequency(dataPool);
}
}
}
@ -119,8 +104,6 @@ public class InvoicingDataPoolServiceImpl extends ServiceImpl<InvoicingDataPoolM
private void addDaily(DirectiveDataPool dataPool){
//入指令池主表
this.save(dataPool);
//入指令池子表
addSub(dataPool);
}
/**
@ -139,10 +122,7 @@ public class InvoicingDataPoolServiceImpl extends ServiceImpl<InvoicingDataPoolM
}
//计划执行星期几是当天则入指令池
if(dayOfWeek == cv){
//入指令池主表
this.save(dataPool);
//入指令池子表
addSub(dataPool);
addDaily(dataPool);
}
}
@ -156,104 +136,39 @@ public class InvoicingDataPoolServiceImpl extends ServiceImpl<InvoicingDataPoolM
Integer cv = Integer.valueOf(cycleValue);
//计划执行月中的几号是当天则入指令池
if(dayOfMonth == cv){
//入指令池主表
this.save(dataPool);
//入指令池子表
addSub(dataPool);
addDaily(dataPool);
}
}
/**
* 指令生成数据池子表非包
* 频次指令生成数据池子表
*/
private void addSub(DirectiveDataPool dataPool){
DirectiveDataPoolSub entity = new DirectiveDataPoolSub();
entity.setDirectiveId(dataPool.getDirectiveId());
DirectiveDataPoolSub dataPoolSub = dataPoolSubService.queryDirectiveOne(entity);
getNetImagesSub(dataPoolSub);//获取网络地址
dataPoolSub.setCycleValue(dataPool.getCycleValue());
dataPoolSub.setNuId(dataPool.getNuId());
// dataPoolSub.setNuName(dataPool.getNuName());
dataPoolSub.setStartTime(dataPool.getStartTime());
dataPoolSub.setEndTime(dataPool.getEndTime());
dataPoolSub.setIzPackage("N");
dataPoolSub.setDelFlag(dataPool.getDelFlag());
dataPoolSub.setMainId(dataPool.getId());
dataPoolSub.setPoolType("3");
dataPoolSubService.save(dataPoolSub);
}
/**
* 指令包生成数据池
*/
private void addPackage(DirectiveDataPool dataPool){
//入指令池主表
this.save(dataPool);
//入指令池子表
addPackageSubs(dataPool);
}
/**
* 指令包中指令进行规则判断并生成到数据池子表
*/
private void addPackageSubs(DirectiveDataPool dataPool){
DirectiveDataPoolSub entity = new DirectiveDataPoolSub();
// entity.setPackageId(dataPool.getPackageId());
List<DirectiveDataPoolSub> subList = dataPoolSubService.queryDirectiveList(entity);
for(int i=0;i<subList.size();i++){
DirectiveDataPoolSub dataPoolSub = subList.get(i);
getNetImagesSub(dataPoolSub);//获取网络地址
String cycleValue = dataPoolSub.getCycleValue();
if(cycleValue==null || cycleValue.equals("")){
//指令包中日常指令
addPackageSub(dataPool,dataPoolSub);
private void addFrequency(DirectiveDataPool dataPool){
String cycleValue = dataPool.getCycleValue();
Integer cv = Integer.valueOf(cycleValue);
cv = cv + 1;
Date optTime = dataPool.getOptTime();
Calendar calendar = Calendar.getInstance();
int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
//计算间隔执行的日期
calendar.setTime(optTime);
int optDay = calendar.get(Calendar.DAY_OF_MONTH);
int resDay = dayOfMonth - optDay;
int resCv = resDay%cv;
//派单间隔日期否是当前日期
if(resCv == 0){
int optCount = dataPool.getOptCount();
if(optCount == 0){
addDaily(dataPool);
}else{
if(cycleValue.length()>1){
//指令包中月周期指令
Calendar calendar = Calendar.getInstance();
int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
Integer cv = Integer.valueOf(cycleValue);
//计划执行月中的几号是当天则入指令池
if(dayOfMonth == cv){
addPackageSub(dataPool,dataPoolSub);
}
}else{
//指令包中星期周期指令
Calendar calendar = Calendar.getInstance();
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); //1周日 2周一 3周二 4周三 5周四 6周五 7周六
//cycleValue 存js的星期 0周一 1周二 2周三 3周四 4周五 5周六 6周日 js +2 2 3 4 5 6 7 8 /7 %
Integer cv = Integer.valueOf(cycleValue);
//处理js星期使其能和java的星期进行比较
cv = cv + 2;
if(cv-7>0){
cv = cv -7;
}
//计划执行星期几是当天则入指令池
if(dayOfWeek == cv){
addPackageSub(dataPool,dataPoolSub);
}
int orderOptCount = baseMapper.getOrderOptCount(dataPool);
if(orderOptCount<optCount){
addDaily(dataPool);
}
}
}
}
/**
* 指令生成到数据池子表
*/
private void addPackageSub(DirectiveDataPool dataPool, DirectiveDataPoolSub dataPoolSub){
dataPoolSub.setNuId(dataPool.getNuId());
// dataPoolSub.setNuName(dataPool.getNuName());
dataPoolSub.setStartTime(dataPool.getStartTime());
dataPoolSub.setEndTime(dataPool.getEndTime());
dataPoolSub.setIzPackage("Y");
// dataPoolSub.setPackageId(dataPool.getPackageId());
// dataPoolSub.setPackageName(dataPool.getPackageName());
dataPoolSub.setDelFlag(dataPool.getDelFlag());
dataPoolSub.setMainId(dataPool.getId());
dataPoolSub.setPoolType("3");
dataPoolSubService.save(dataPoolSub);
}
/**
* 单一指令生成到数据池
* @param invoicingDirectivePlan
@ -261,30 +176,13 @@ public class InvoicingDataPoolServiceImpl extends ServiceImpl<InvoicingDataPoolM
@Override
public void generateDataPool(InvoicingDirectivePlan invoicingDirectivePlan){
DirectiveDataPool dataPool = new DirectiveDataPool();
dataPool.setPoolType("3");
dataPool.setBizId(invoicingDirectivePlan.getId());
dataPool.setNuId(invoicingDirectivePlan.getNuId());
// dataPool.setNuName(invoicingDirectivePlan.getNuName());
if(invoicingDirectivePlan.getIzPackage().equals("Y")){
// dataPool.setPackageId(invoicingDirectivePlan.getDirectiveId());
// dataPool.setPackageName(invoicingDirectivePlan.getDirectiveName());
}else{
dataPool.setDirectiveId(invoicingDirectivePlan.getDirectiveId());
// dataPool.setDirectiveName(invoicingDirectivePlan.getDirectiveName());
}
dataPool.setDirectiveId(invoicingDirectivePlan.getDirectiveId());
dataPool.setCycleTypeId(invoicingDirectivePlan.getCycleTypeId());
// dataPool.setCycleType(invoicingDirectivePlan.getCycleType());
dataPool.setCycleValue(invoicingDirectivePlan.getCycleValue());
// dataPool.setPreviewFile(invoicingDirectivePlan.getPreviewFile());
// dataPool.setNetPreviewFile(invoicingDirectivePlan.getNetPreviewFile());
// dataPool.setPreviewFileSmall(invoicingDirectivePlan.getPreviewFileSmall());
// dataPool.setNetPreviewFileSmall(invoicingDirectivePlan.getNetPreviewFileSmall());
// dataPool.setMp3File(invoicingDirectivePlan.getMp3File());
// dataPool.setNetMp3File(invoicingDirectivePlan.getNetMp3File());
// dataPool.setMp4File(invoicingDirectivePlan.getMp4File());
// dataPool.setNetMp4File(invoicingDirectivePlan.getNetMp4File());
dataPool.setIzPackage(invoicingDirectivePlan.getIzPackage());
// dataPool.setServiceDuration(invoicingDirectivePlan.getServiceDuration());
// dataPool.setServiceContent(invoicingDirectivePlan.getServiceContent());
String startTime = invoicingDirectivePlan.getStartTime();
String[] starts = startTime.split(":");
String hour = starts[0];
@ -295,15 +193,8 @@ public class InvoicingDataPoolServiceImpl extends ServiceImpl<InvoicingDataPoolM
c.set(Calendar.SECOND,0);
c.set(Calendar.MILLISECOND,0);
dataPool.setStartTime(c.getTime());
// String endTime = invoicingDirectivePlan.getEndTime();
// String[] ends = endTime.split(":");
// hour = ends[0];
// minute = ends[1];
// c.set(Calendar.HOUR_OF_DAY,Integer.valueOf(hour));
c.set(Calendar.MINUTE,Integer.valueOf(minute));
c.set(Calendar.SECOND,0);
c.set(Calendar.MILLISECOND,0);
dataPool.setEndTime(c.getTime());
dataPool.setOptTime(invoicingDirectivePlan.getOptTime());
dataPool.setOptCount(invoicingDirectivePlan.getOptCount());
addDataPool(dataPool);
}
@ -323,17 +214,12 @@ public class InvoicingDataPoolServiceImpl extends ServiceImpl<InvoicingDataPoolM
c.set(Calendar.SECOND,0);
c.set(Calendar.MILLISECOND,0);
DirectiveDataPool dataPool = new DirectiveDataPool();
dataPool.setPoolType("3");
dataPool.setBizId(invoicingDirectivePlan.getId());
dataPool.setNuId(invoicingDirectivePlan.getNuId());
dataPool.setDirectiveId(invoicingDirectivePlan.getDirectiveId());
dataPool.setStartTime(c.getTime());
// dataPool.setIzOrders("N");
dataPool.setIzStart("N");
String izPackage = invoicingDirectivePlan.getIzPackage();
if(izPackage.equals("Y")){
// dataPool.setPackageId(invoicingDirectivePlan.getDirectiveId());
}else{
dataPool.setDirectiveId(invoicingDirectivePlan.getDirectiveId());
}
DirectiveDataPool pool = dataPoolService.queryPoolOne(dataPool);
if(pool!=null){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -343,7 +229,6 @@ public class InvoicingDataPoolServiceImpl extends ServiceImpl<InvoicingDataPoolM
dataPoolService.deleteOrders(dateStr,pool);
}
dataPoolService.addDataPoolLog(dateStr,pool.getId());
dataPoolService.addDataPoolSubLog(dateStr,pool.getId());
}
}
@ -361,59 +246,4 @@ public class InvoicingDataPoolServiceImpl extends ServiceImpl<InvoicingDataPoolM
}
}
/**
* 获取管理平台静态资源路径
*
* @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 DirectiveDataPoolSub getNetImagesSub(DirectiveDataPoolSub par) {
if (par.getPreviewFile() != null && !par.getPreviewFile().equals("")) {
String netPreviewFile = getImageNetUrl(par.getPreviewFile());
par.setNetPreviewFile(netPreviewFile);
} else {
par.setPreviewFile("");
par.setNetPreviewFile("");
}
if (par.getPreviewFileSmall() != null && !par.getPreviewFileSmall().equals("")) {
String netPreviewFileSmall = getImageNetUrl(par.getPreviewFileSmall());
par.setNetPreviewFileSmall(netPreviewFileSmall);
} 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;
}
}

View File

@ -1,21 +1,16 @@
package com.nu.modules.biz.datapool.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nu.modules.biz.datapool.entity.DirectiveDataPool;
import com.nu.modules.biz.datapool.entity.DirectiveDataPoolSub;
import com.nu.modules.biz.datapool.mapper.LogisticsDataPoolMapper;
import com.nu.modules.biz.datapool.service.IDirectiveDataPoolService;
import com.nu.modules.biz.datapool.service.IDirectiveDataPoolSubService;
import com.nu.modules.biz.datapool.service.ILogisticsDataPoolService;
import com.nu.modules.biz.plan.logistics.entity.LogisticsDirectivePlan;
import com.nu.modules.sysconfig.ISysConfigApi;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@ -33,11 +28,6 @@ public class LogisticsDataPoolServiceImpl extends ServiceImpl<LogisticsDataPoolM
@Autowired
IDirectiveDataPoolService dataPoolService;
@Autowired
IDirectiveDataPoolSubService dataPoolSubService;
@Autowired
private ISysConfigApi sysConfigApi;
private String serverNetUrl;
/**
* 批量生成数据池
@ -85,27 +75,23 @@ public class LogisticsDataPoolServiceImpl extends ServiceImpl<LogisticsDataPoolM
dataPool.setIzOrders("N");
dataPool.setIzStart("N");
dataPool.setDelFlag("0");
dataPool.setPoolType("4");
String izPackage = dataPool.getIzPackage();
if(izPackage!=null&&izPackage.equals("Y")){
addPackage(dataPool);
}else{
String typeId = dataPool.getCycleTypeId();
if(typeId!=null){
if(typeId.equals("1")){
addDaily(dataPool);
}
if(typeId.equals("2")){
//周期先判断是星期还是月份再判断当前时间是否命中周期
String cycleValue = dataPool.getCycleValue();
if(cycleValue.length()>1){
//月周期
addMonthDay(dataPool);
}else{
//星期周期
addWeekDay(dataPool);
}
}
String typeId = dataPool.getCycleTypeId();
if(typeId!=null){
//每天
if(typeId.equals("1")){
addDaily(dataPool);
}
//星期
if(typeId.equals("3")){
addWeekDay(dataPool);
}
//日期
if(typeId.equals("4")){
addMonthDay(dataPool);
}
//频率
if(typeId.equals("5")){
addFrequency(dataPool);
}
}
}
@ -118,8 +104,6 @@ public class LogisticsDataPoolServiceImpl extends ServiceImpl<LogisticsDataPoolM
private void addDaily(DirectiveDataPool dataPool){
//入指令池主表
this.save(dataPool);
//入指令池子表
addSub(dataPool);
}
/**
@ -138,10 +122,7 @@ public class LogisticsDataPoolServiceImpl extends ServiceImpl<LogisticsDataPoolM
}
//计划执行星期几是当天则入指令池
if(dayOfWeek == cv){
//入指令池主表
this.save(dataPool);
//入指令池子表
addSub(dataPool);
addDaily(dataPool);
}
}
@ -155,108 +136,39 @@ public class LogisticsDataPoolServiceImpl extends ServiceImpl<LogisticsDataPoolM
Integer cv = Integer.valueOf(cycleValue);
//计划执行月中的几号是当天则入指令池
if(dayOfMonth == cv){
//入指令池主表
this.save(dataPool);
//入指令池子表
addSub(dataPool);
addDaily(dataPool);
}
}
/**
* 指令生成数据池子表非包
* 频次指令生成数据池子表
*/
private void addSub(DirectiveDataPool dataPool){
DirectiveDataPoolSub entity = new DirectiveDataPoolSub();
entity.setDirectiveId(dataPool.getDirectiveId());
DirectiveDataPoolSub dataPoolSub = dataPoolSubService.queryDirectiveOne(entity);
getNetImagesSub(dataPoolSub);//获取网络地址
dataPoolSub.setCycleValue(dataPool.getCycleValue());
dataPoolSub.setNuId(dataPool.getNuId());
// dataPoolSub.setNuName(dataPool.getNuName());
// dataPoolSub.setElderId(dataPool.getElderId());
// dataPoolSub.setElderName(dataPool.getElderName());
dataPoolSub.setStartTime(dataPool.getStartTime());
dataPoolSub.setEndTime(dataPool.getEndTime());
dataPoolSub.setIzPackage("N");
dataPoolSub.setDelFlag(dataPool.getDelFlag());
dataPoolSub.setMainId(dataPool.getId());
dataPoolSub.setPoolType("4");
dataPoolSubService.save(dataPoolSub);
}
/**
* 指令包生成数据池
*/
private void addPackage(DirectiveDataPool dataPool){
//入指令池主表
this.save(dataPool);
//入指令池子表
addPackageSubs(dataPool);
}
/**
* 指令包中指令进行规则判断并生成到数据池子表
*/
private void addPackageSubs(DirectiveDataPool dataPool){
DirectiveDataPoolSub entity = new DirectiveDataPoolSub();
// entity.setPackageId(dataPool.getPackageId());
List<DirectiveDataPoolSub> subList = dataPoolSubService.queryDirectiveList(entity);
for(int i=0;i<subList.size();i++){
DirectiveDataPoolSub dataPoolSub = subList.get(i);
getNetImagesSub(dataPoolSub);//获取网络地址
String cycleValue = dataPoolSub.getCycleValue();
if(cycleValue==null || cycleValue.equals("")){
//指令包中日常指令
addPackageSub(dataPool,dataPoolSub);
private void addFrequency(DirectiveDataPool dataPool){
String cycleValue = dataPool.getCycleValue();
Integer cv = Integer.valueOf(cycleValue);
cv = cv + 1;
Date optTime = dataPool.getOptTime();
Calendar calendar = Calendar.getInstance();
int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
//计算间隔执行的日期
calendar.setTime(optTime);
int optDay = calendar.get(Calendar.DAY_OF_MONTH);
int resDay = dayOfMonth - optDay;
int resCv = resDay%cv;
//派单间隔日期否是当前日期
if(resCv == 0){
int optCount = dataPool.getOptCount();
if(optCount == 0){
addDaily(dataPool);
}else{
if(cycleValue.length()>1){
//指令包中月周期指令
Calendar calendar = Calendar.getInstance();
int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
Integer cv = Integer.valueOf(cycleValue);
//计划执行月中的几号是当天则入指令池
if(dayOfMonth == cv){
addPackageSub(dataPool,dataPoolSub);
}
}else{
//指令包中星期周期指令
Calendar calendar = Calendar.getInstance();
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); //1周日 2周一 3周二 4周三 5周四 6周五 7周六
//cycleValue 存js的星期 0周一 1周二 2周三 3周四 4周五 5周六 6周日 js +2 2 3 4 5 6 7 8 /7 %
Integer cv = Integer.valueOf(cycleValue);
//处理js星期使其能和java的星期进行比较
cv = cv + 2;
if(cv-7>0){
cv = cv -7;
}
//计划执行星期几是当天则入指令池
if(dayOfWeek == cv){
addPackageSub(dataPool,dataPoolSub);
}
int orderOptCount = baseMapper.getOrderOptCount(dataPool);
if(orderOptCount<optCount){
addDaily(dataPool);
}
}
}
}
/**
* 指令生成到数据池子表
*/
private void addPackageSub(DirectiveDataPool dataPool, DirectiveDataPoolSub dataPoolSub){
dataPoolSub.setNuId(dataPool.getNuId());
// dataPoolSub.setNuName(dataPool.getNuName());
// dataPoolSub.setElderId(dataPool.getElderId());
// dataPoolSub.setElderName(dataPool.getElderName());
dataPoolSub.setStartTime(dataPool.getStartTime());
dataPoolSub.setEndTime(dataPool.getEndTime());
dataPoolSub.setIzPackage("Y");
// dataPoolSub.setPackageId(dataPool.getPackageId());
// dataPoolSub.setPackageName(dataPool.getPackageName());
dataPoolSub.setDelFlag(dataPool.getDelFlag());
dataPoolSub.setMainId(dataPool.getId());
dataPoolSub.setPoolType("4");
dataPoolSubService.save(dataPoolSub);
}
/**
* 单一指令生成到数据池
* @param logisticsDirectivePlan
@ -264,32 +176,13 @@ public class LogisticsDataPoolServiceImpl extends ServiceImpl<LogisticsDataPoolM
@Override
public void generateDataPool(LogisticsDirectivePlan logisticsDirectivePlan){
DirectiveDataPool dataPool = new DirectiveDataPool();
dataPool.setPoolType("4");
dataPool.setBizId(logisticsDirectivePlan.getId());
dataPool.setNuId(logisticsDirectivePlan.getNuId());
// dataPool.setNuName(logisticsDirectivePlan.getNuName());
// dataPool.setElderId(logisticsDirectivePlan.getElderId());
// dataPool.setElderName(logisticsDirectivePlan.getElderName());
if(logisticsDirectivePlan.getIzPackage().equals("Y")){
// dataPool.setPackageId(logisticsDirectivePlan.getDirectiveId());
// dataPool.setPackageName(logisticsDirectivePlan.getDirectiveName());
}else{
dataPool.setDirectiveId(logisticsDirectivePlan.getDirectiveId());
// dataPool.setDirectiveName(logisticsDirectivePlan.getDirectiveName());
}
dataPool.setDirectiveId(logisticsDirectivePlan.getDirectiveId());
dataPool.setCycleTypeId(logisticsDirectivePlan.getCycleTypeId());
// dataPool.setCycleType(logisticsDirectivePlan.getCycleType());
dataPool.setCycleValue(logisticsDirectivePlan.getCycleValue());
// dataPool.setPreviewFile(logisticsDirectivePlan.getPreviewFile());
// dataPool.setNetPreviewFile(logisticsDirectivePlan.getNetPreviewFile());
// dataPool.setPreviewFileSmall(logisticsDirectivePlan.getPreviewFileSmall());
// dataPool.setNetPreviewFileSmall(logisticsDirectivePlan.getNetPreviewFileSmall());
// dataPool.setMp3File(logisticsDirectivePlan.getMp3File());
// dataPool.setNetMp3File(logisticsDirectivePlan.getNetMp3File());
// dataPool.setMp4File(logisticsDirectivePlan.getMp4File());
// dataPool.setNetMp4File(logisticsDirectivePlan.getNetMp4File());
dataPool.setIzPackage(logisticsDirectivePlan.getIzPackage());
// dataPool.setServiceDuration(logisticsDirectivePlan.getServiceDuration());
// dataPool.setServiceContent(logisticsDirectivePlan.getServiceContent());
String startTime = logisticsDirectivePlan.getStartTime();
String[] starts = startTime.split(":");
String hour = starts[0];
@ -300,15 +193,8 @@ public class LogisticsDataPoolServiceImpl extends ServiceImpl<LogisticsDataPoolM
c.set(Calendar.SECOND,0);
c.set(Calendar.MILLISECOND,0);
dataPool.setStartTime(c.getTime());
String endTime = logisticsDirectivePlan.getEndTime();
String[] ends = endTime.split(":");
hour = ends[0];
minute = ends[1];
c.set(Calendar.HOUR_OF_DAY,Integer.valueOf(hour));
c.set(Calendar.MINUTE,Integer.valueOf(minute));
c.set(Calendar.SECOND,0);
c.set(Calendar.MILLISECOND,0);
dataPool.setEndTime(c.getTime());
dataPool.setOptTime(logisticsDirectivePlan.getOptTime());
dataPool.setOptCount(logisticsDirectivePlan.getOptCount());
addDataPool(dataPool);
}
@ -328,18 +214,12 @@ public class LogisticsDataPoolServiceImpl extends ServiceImpl<LogisticsDataPoolM
c.set(Calendar.SECOND,0);
c.set(Calendar.MILLISECOND,0);
DirectiveDataPool dataPool = new DirectiveDataPool();
dataPool.setPoolType("4");
dataPool.setBizId(logisticsDirectivePlan.getId());
dataPool.setNuId(logisticsDirectivePlan.getNuId());
// dataPool.setElderId(logisticsDirectivePlan.getElderId());
dataPool.setDirectiveId(logisticsDirectivePlan.getDirectiveId());
dataPool.setStartTime(c.getTime());
// dataPool.setIzOrders("N");
dataPool.setIzStart("N");
String izPackage = logisticsDirectivePlan.getIzPackage();
if(izPackage.equals("Y")){
// dataPool.setPackageId(logisticsDirectivePlan.getDirectiveId());
}else{
dataPool.setDirectiveId(logisticsDirectivePlan.getDirectiveId());
}
DirectiveDataPool pool = dataPoolService.queryPoolOne(dataPool);
if(pool!=null){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -349,7 +229,6 @@ public class LogisticsDataPoolServiceImpl extends ServiceImpl<LogisticsDataPoolM
dataPoolService.deleteOrders(dateStr,pool);
}
dataPoolService.addDataPoolLog(dateStr,pool.getId());
dataPoolService.addDataPoolSubLog(dateStr,pool.getId());
}
}
@ -367,59 +246,4 @@ public class LogisticsDataPoolServiceImpl extends ServiceImpl<LogisticsDataPoolM
}
}
/**
* 获取管理平台静态资源路径
*
* @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 DirectiveDataPoolSub getNetImagesSub(DirectiveDataPoolSub par) {
if (par.getPreviewFile() != null && !par.getPreviewFile().equals("")) {
String netPreviewFile = getImageNetUrl(par.getPreviewFile());
par.setNetPreviewFile(netPreviewFile);
} else {
par.setPreviewFile("");
par.setNetPreviewFile("");
}
if (par.getPreviewFileSmall() != null && !par.getPreviewFileSmall().equals("")) {
String netPreviewFileSmall = getImageNetUrl(par.getPreviewFileSmall());
par.setNetPreviewFileSmall(netPreviewFileSmall);
} 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;
}
}