删除服务指令多余代码

This commit is contained in:
1378012178@qq.com 2026-05-06 15:29:17 +08:00
parent 422a57efd0
commit d002314fca
43 changed files with 60 additions and 3103 deletions

View File

@ -1,41 +0,0 @@
package com.nu.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Description: 体型标签
* @Author: 张明远
* @Date: 2025-07-25
* @Version: V1.0
*/
@Data
public class BodyTagMQDto implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 标签名称
*/
private String tagName;
/**
* 排序
*/
private Integer sort;
/**
* 状态 0已授权 1未授权
*/
private String status;
/**
* 是否启用 Y启用 N未启用
*/
private String izEnabled;
/**
* 是否删除 0未删除 1删除
*/
private String delFlag;
}

View File

@ -1,9 +1,6 @@
package com.nu.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
@ -43,18 +40,6 @@ public class DirectiveAsyncMQDto implements Serializable {
* 提成价格
*/
private java.math.BigDecimal comPrice;
/**
* 是否参与医保报销 0不报销 1报销
*/
private String izReimbursement;
/**
* 是否参与机构优惠 0不参与 1参与
*/
private String izPreferential;
/**
* 收费频次 1按次收费 2按天收费
*/
private String chargingFrequency;
/**
* 指令类型 1日常护理 2周期护理 3即时护理
*/
@ -63,10 +48,6 @@ public class DirectiveAsyncMQDto implements Serializable {
* 服务属性 ds定时 js计时
*/
private String serviceAttribute;
/**
* 排序
*/
private Integer sort;
/**
* 服务描述
*/
@ -75,10 +56,6 @@ public class DirectiveAsyncMQDto implements Serializable {
* 服务时长分钟
*/
private String serviceDuration;
/**
* 超时时长分钟
*/
private String timeoutDuration;
/**
* 指令状态
*/
@ -168,14 +145,6 @@ public class DirectiveAsyncMQDto implements Serializable {
private String typeName;
//指令类型中文名称
private String cycleTypeName;
//体型标签id,id,id
private String bodyTags;
//情绪标签id,id,id
private String emotionTags;
//体型标签json字符串有idlabel
private String bodyTagsObj;
//情绪标签json字符串有idlabel
private String emotionTagsObj;
//资源请求接口域名+项目上下文路径
private String api;
}

View File

@ -28,10 +28,6 @@ public class DirectiveMQDto {
private List<CategoryMQDto> categoryList;
//服务类型字典项
private List<DirectiveTypeMQDto> typeList;
//体型标签字典项
private List<BodyTagMQDto> bodyTagList;
//情绪标签字典项
private List<EmotionTagMQDto> emotionTagList;
//是否同步指令资源
private boolean izSyncMedia;
}

View File

@ -1,41 +0,0 @@
package com.nu.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Description: 情绪标签
* @Author: 张明远
* @Date: 2025-07-25
* @Version: V1.0
*/
@Data
public class EmotionTagMQDto implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 标签名称
*/
private String tagName;
/**
* 排序
*/
private Integer sort;
/**
* 状态 0已授权 1未授权
*/
private String status;
/**
* 是否启用 Y启用 N未启用
*/
private String izEnabled;
/**
* 是否删除 0未删除 1删除
*/
private String delFlag;
}

View File

@ -44,26 +44,10 @@ public class DirectiveEntity implements Serializable {
* 提成价格
*/
private java.math.BigDecimal comPrice;
/**
* 是否参与医保报销 0不报销 1报销
*/
private String izReimbursement;
/**
* 是否参与机构优惠 0不参与 1参与
*/
private String izPreferential;
/**
* 收费频次 1按次收费 2按天收费
*/
private String chargingFrequency;
/**
* 服务属性 ds定时 js计时
*/
private String serviceAttribute;
/**
* 排序
*/
private Integer sort;
/**
* 服务描述
*/
@ -72,11 +56,6 @@ public class DirectiveEntity implements Serializable {
* 服务时长分钟
*/
private String serviceDuration;
/**
* 超时时长分钟
*/
private String timeoutDuration;
/**
* 指令状态
*/
@ -167,10 +146,6 @@ public class DirectiveEntity implements Serializable {
* 即时指令图标md5
*/
private String immediateFileFocusMd5;
/**
* 是否下载tplink视频 Y下载 N不下载
*/
private String izDownTplink;
//即时指令图标是否变更
private boolean immediateFileChanged;
@ -184,10 +159,6 @@ public class DirectiveEntity implements Serializable {
private Integer typeRowSpan;
//合并单元格用分类标签合并的行数
private Integer instructionRowSpan;
//体型标签id,id,id
private String bodyTags;
//情绪标签id,id,id
private String emotionTags;
//分类标签中文名称
private String instructionName;
@ -197,10 +168,6 @@ public class DirectiveEntity implements Serializable {
private String typeName;
//媒体资源存储路径名
private String mediaFileSavePath;
//体型标签json字符串前台封装好的 有idlabel
private String bodyTagsObj;
//情绪标签json字符串前台封装好的 有idlabel
private String emotionTagsObj;
//护理分类名称
private String instructionTagName;
private String syncIds;

View File

@ -2,23 +2,14 @@ package com.nu.modules.biz.appraisal.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nu.entity.EmployeesSalaryInfoEntity;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nu.modules.IEmployeesSalaryApi;
import com.nu.modules.biz.appraisal.entity.DirectiveAppraisal;
import com.nu.modules.biz.appraisal.mapper.DirectiveAppraisalMapper;
import com.nu.modules.biz.appraisal.service.IDirectiveAppraisalService;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.List;
/**
* @Description: 护理单元-服务指令-工单
* @Author: jeecg-boot
@ -45,150 +36,4 @@ public class DirectiveAppraisalServiceImpl extends ServiceImpl<DirectiveAppraisa
return baseMapper.queryPageList(page, directiveAppraisal);
}
// public void audit(DirectiveAppraisal directiveAppraisal) {
// // 最终的提成
// BigDecimal tiCheng = new BigDecimal(0);
// // 每人提成
// BigDecimal meiRenTiCheng = new BigDecimal(0);
// //员工ids
// List<String> optIds = Arrays.asList(directiveAppraisal.getOptIds().split(","));
// //员工姓名
// List<String> optNames = Arrays.asList(directiveAppraisal.getOptNames().split(","));
//
// if ("2".equals(directiveAppraisal.getStatus())) {
// // 考核通过 - 一个人执行的直接就是之前算好的提成 多人的话平均 例如3人执行 提成是1元的话 每人3毛3分
// tiCheng = directiveAppraisal.getYsComPrice();
//
// // 总共几个人执行的
// int renShu = optIds.size();
//
// if (renShu > 0) {
// // 计算每人提成精确到2位小数向下取整 比如 1元 3人分 1÷3约等于0.33333 保留2位 第三位是向下取整 结果0.33
// // 验证4.01提成 3人分 4.01÷3约等于1.336666 保留2位1.33 第三位6向下取整0 结果 1.33 总共给3人3.99 < 4.01 差2分
// meiRenTiCheng = tiCheng.divide(new BigDecimal(renShu), 2, RoundingMode.DOWN);
// }
//
// }
// if ("3".equals(directiveAppraisal.getStatus())) {
// //考核不通过 - 员工提成0 长者收费0
// tiCheng = new BigDecimal(0);
// meiRenTiCheng = new BigDecimal(0);
// }
//
// //首次考核就是向员工薪资明显表插入数据 因为有撤回功能 所以可能出现二次及以上考核 此时就是更新了 所以需要先用id查询 有则更新否则新增
// //如果是多人执行 需要给多人插入数据 - 新增时把员工id/姓名拆分成对应的人orderNo单号是一样的 一个单号对应一个具体的指令 修改时根据单号一样的一条/多条数据的值状态
// List<EmployeesSalaryInfoEntity> handleData = Lists.newArrayList();
// for (int i = 0; i < optIds.size(); i++) {
// EmployeesSalaryInfoEntity empSalary = new EmployeesSalaryInfoEntity();
// //员工信息
// empSalary.setEmployeeId(optIds.get(i));
// empSalary.setEmployeeName(optNames.get(i));
// //员工提成
// empSalary.setRealComPrice(meiRenTiCheng);
// //工单单号 - 用于关联原始工单
// empSalary.setOrderNo(directiveAppraisal.getOrderNo());
// //工单类型 - 1护理2医疗3库房4行政
// empSalary.setOrderType(directiveAppraisal.getOrderType());
// //护理单元ID - 关联nu_base_info表
// empSalary.setNuId(directiveAppraisal.getNuId());
// //护理单元名称
// empSalary.setNuName(directiveAppraisal.getNuName());
// //长者ID - 关联nu_biz_elder_info表
// empSalary.setElderId(directiveAppraisal.getElderId());
// //长者名称
// empSalary.setElderName(directiveAppraisal.getElderName());
// //分类标签ID - 关联nu_config_service_instruction_tag表
// empSalary.setInstructionTagId(directiveAppraisal.getInstructionTagId());
// //分类标签名称
// empSalary.setInstructionTagName(directiveAppraisal.getInstructionTagName());
// //服务类别ID - 关联nu_config_service_category表
// empSalary.setCategoryId(directiveAppraisal.getCategoryId());
// //服务类别名称
// empSalary.setCategoryName(directiveAppraisal.getCategoryName());
// //服务类型ID - 关联nu_config_service_type表
// empSalary.setTypeId(directiveAppraisal.getTypeId());
// //服务属性 - ds定时/js计时
// empSalary.setServiceAttribute(directiveAppraisal.getServiceAttribute());
// //服务类型名称
// empSalary.setTypeName(directiveAppraisal.getTypeName());
// //服务指令ID - 关联nu_config_service_directive表
// empSalary.setDirectiveId(directiveAppraisal.getDirectiveId());
// //服务指令名称
// empSalary.setDirectiveName(directiveAppraisal.getDirectiveName());
// //周期类型ID
// empSalary.setCycleTypeId(directiveAppraisal.getCycleTypeId());
// //周期类型
// empSalary.setCycleType(directiveAppraisal.getCycleType());
// //周期值
// empSalary.setCycleValue(directiveAppraisal.getCycleValue());
// //服务时长分钟
// empSalary.setServiceDuration(directiveAppraisal.getServiceDuration());
// //服务说明
// empSalary.setServiceContent(directiveAppraisal.getServiceContent());
// //基础价格
// empSalary.setTollPrice(directiveAppraisal.getTollPrice());
// //提成价格
// empSalary.setComPrice(directiveAppraisal.getComPrice());
// //标签总价格
// empSalary.setTagTotalPrice(directiveAppraisal.getTagTotalPrice());
// //应收提成价格
// empSalary.setYsComPrice(directiveAppraisal.getYsComPrice());
// //服务指令包ID
// empSalary.setPackageId(directiveAppraisal.getPackageId());
// //服务指令包名称
// empSalary.setPackageName(directiveAppraisal.getPackageName());
// //是否为服务指令包 - Y是/N否
// empSalary.setIzPackage(directiveAppraisal.getIzPackage());
// //计划开始时间
// empSalary.setStartTime(directiveAppraisal.getStartTime());
// //计划结束时间
// empSalary.setEndTime(directiveAppraisal.getEndTime());
// //实际开始时间
// empSalary.setBeginTime(directiveAppraisal.getBeginTime());
// //实际结束时间
// empSalary.setFinishTime(directiveAppraisal.getFinishTime());
// //是否开始 - Y是/N否
// empSalary.setIzStart(directiveAppraisal.getIzStart());
// //是否完成 - Y是/N否
// empSalary.setIzFinish(directiveAppraisal.getIzFinish());
// //创建人
// empSalary.setCreateBy(directiveAppraisal.getCreateBy());
// //创建日期
// empSalary.setCreateTime(directiveAppraisal.getCreateTime());
// //更新人
// empSalary.setUpdateBy(directiveAppraisal.getUpdateBy());
// //更新日期
// empSalary.setUpdateTime(directiveAppraisal.getUpdateTime());
// //tplink下载地址
// empSalary.setTplinkPath(directiveAppraisal.getTplinkPath());
// //手动拍照路径
// empSalary.setManuallyPicPath(directiveAppraisal.getManuallyPicPath());
// //手动录制视频路径
// empSalary.setManuallyMp4Path(directiveAppraisal.getManuallyMp4Path());
// //执行类型 - 1单人/2协助/3转单
// empSalary.setOptType(directiveAppraisal.getOptType());
// //执行状态 - 1正常/2未执行/3超时
// empSalary.setOptStatus(directiveAppraisal.getOptStatus());
// //实际执行人ID多个逗号分隔
// empSalary.setOptIds(directiveAppraisal.getOptIds());
// //实际执行人名称多个逗号分隔
// empSalary.setOptNames(directiveAppraisal.getOptNames());
// //审核状态 - 0待审核/1通过/2未通过
// empSalary.setStatus(directiveAppraisal.getStatus());
// //驳回原因
// empSalary.setContent(directiveAppraisal.getContent());
// //撤回人
// empSalary.setRevocation(directiveAppraisal.getRevocation());
// //撤回时间
// empSalary.setRevocationTime(directiveAppraisal.getRevocationTime());
//
// handleData.add(empSalary);
// }
// //存储数据
// //考核信息
// directiveAppraisal.setRealComPrice(tiCheng);
// //薪资
// employeesSalaryApi.auditFinish(handleData);
// baseMapper.updateById(directiveAppraisal);
// }
}

View File

@ -40,15 +40,6 @@ public class BizConfigInstructionTag implements Serializable {
@Excel(name = "分类标签类型", width = 15)
@ApiModelProperty(value = "分类标签类型")
private String instructionType;
/**排序*/
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private Integer sort;
/**状态 0已授权 1未授权*/
@Excel(name = "状态 0已授权 1未授权", width = 15)
@ApiModelProperty(value = "状态 0已授权 1未授权")
@Dict(dicCode = "status")
private String status;
/**是否启用 Y启用 N未启用*/
@Excel(name = "是否启用", width = 15)
@ApiModelProperty(value = "是否启用")

View File

@ -64,22 +64,6 @@ public class BizConfigServiceDirective implements Serializable {
@Excel(name = "提成价格", width = 15)
@ApiModelProperty(value = "提成价格")
private BigDecimal comPrice;
/**是否参与医保报销 0不报销 1报销*/
@Excel(name = "是否参与医保报销 0不报销 1报销", width = 15)
@ApiModelProperty(value = "是否参与医保报销 0不报销 1报销")
private String izReimbursement;
/**是否参与机构优惠 0不参与 1参与*/
@Excel(name = "是否参与机构优惠 0不参与 1参与", width = 15)
@ApiModelProperty(value = "是否参与机构优惠 0不参与 1参与")
private String izPreferential;
/**收费频次 1按次收费 2按天收费*/
@Excel(name = "收费频次 1按次收费 2按天收费", width = 15)
@ApiModelProperty(value = "收费频次 1按次收费 2按天收费")
private String chargingFrequency;
/**排序*/
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private Integer sort;
/**服务说明*/
@Excel(name = "服务说明", width = 15)
@ApiModelProperty(value = "服务说明")
@ -88,10 +72,6 @@ public class BizConfigServiceDirective implements Serializable {
@Excel(name = "服务时长(分钟)", width = 15)
@ApiModelProperty(value = "服务时长(分钟)")
private String serviceDuration;
/**超时时长(分钟)*/
@Excel(name = "超时时长(分钟)", width = 15)
@ApiModelProperty(value = "超时时长(分钟)")
private String timeoutDuration;
/**是否启用 Y启用 N未启用*/
@Excel(name = "是否启用 Y启用 N未启用", width = 15)
@ApiModelProperty(value = "是否启用 Y启用 N未启用")
@ -148,10 +128,4 @@ public class BizConfigServiceDirective implements Serializable {
*/
@ApiModelProperty(value = "服务指令图片小图")
private String previewFileSmall;
//体型标签
@TableField(exist = false)
private String bodyTagName;
//情绪标签
@TableField(exist = false)
private String emotionTagName;
}

View File

@ -13,9 +13,6 @@
cst.type_name as typeName,
csd.toll_price,
csd.com_price,
csd.iz_reimbursement,
csd.iz_preferential,
csd.charging_frequency,
csd.service_content,
csd.service_duration,
csd.iz_enabled,

View File

@ -40,6 +40,7 @@ public class DirectiveGenerateOrderJob implements Job {
//2026-03-24 10:10:00 -> 2026-03-24 10:15:00
//2026-03-24 23:58:20 -> 2026-03-25 00:00:00
//2026-03-24 23:59:59 -> 2026-03-25 00:00:00
//测试
Date targetTime = getNextFiveMinuteTime();
DirectivePlanDateEntity queryParam = new DirectivePlanDateEntity();

View File

@ -50,7 +50,6 @@ public class DirectiveMedia implements Serializable {
@ApiModelProperty(value = "分类标签id")
//数据源从配置文件读取 - 实验基地机构编码
@Dict(dicCode = "id", dictTable = "nu_config_service_instruction_tag", dicText = "instruction_name", ds = "${nu.org.master.code}")
private java.lang.String instructionTagId;
/**
* 服务类别id

View File

@ -29,12 +29,8 @@
<result property="instructionTagName" column="instruction_name"/>
<result property="tollPrice" column="toll_price"/>
<result property="comPrice" column="com_price"/>
<result property="izReimbursement" column="iz_reimbursement"/>
<result property="izPreferential" column="iz_preferential"/>
<result property="chargingFrequency" column="charging_frequency"/>
<result property="serviceContent" column="service_content"/>
<result property="serviceDuration" column="service_duration"/>
<result property="timeoutDuration" column="directive_timeout_duration"/>
<result property="izEnabled" column="directive_iz_enabled"/>
<result property="delFlag" column="directive_del_flag"/>
<result property="createBy" column="directive_create_by"/>
@ -48,33 +44,6 @@
<result property="typeName" column="cst_type_name"/>
<result property="previewFile" column="preview_file"/>
<result property="immediateFile" column="immediate_file"/>
<!-- 关联的体型标签列表 -->
<collection property="bodyTagList" ofType="com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag">
<id property="id" column="tag_id"/>
<result property="tagName" column="bodytag_name"/>
<result property="sort" column="bodytag_sort"/>
<result property="izEnabled" column="bodytag_iz_enabled"/>
<result property="delFlag" column="bodytag_del_flag"/>
<result property="createBy" column="bodytag_create_by"/>
<result property="createTime" column="bodytag_create_time"/>
<result property="updateBy" column="bodytag_update_by"/>
<result property="updateTime" column="bodytag_update_time"/>
<result property="sysOrgCode" column="bodytag_sys_org_code"/>
</collection>
<!-- 关联的情绪标签列表 -->
<collection property="emotionTagList"
ofType="com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag">
<id property="id" column="emotag_id"/>
<result property="tagName" column="emotag_name"/>
<result property="sort" column="emotag_sort"/>
<result property="izEnabled" column="emotag_iz_enabled"/>
<result property="delFlag" column="emotag_del_flag"/>
<result property="createBy" column="emotag_create_by"/>
<result property="createTime" column="emotag_create_time"/>
<result property="updateBy" column="emotag_update_by"/>
<result property="updateTime" column="emotag_update_time"/>
<result property="sysOrgCode" column="emotag_sys_org_code"/>
</collection>
</collection>
</resultMap>
<update id="updateTotalDurationInt">
@ -108,9 +77,6 @@
csd.instruction_tag_id,
csd.toll_price,
csd.com_price,
csd.iz_reimbursement,
csd.iz_preferential,
csd.charging_frequency,
csd.service_content,
csd.service_duration,
csd.timeout_duration as directive_timeout_duration,
@ -126,26 +92,6 @@
csd.preview_file,
csd.immediate_file,
csd.immediate_file_focus,
cdbt.id AS bodytag_id,
cdbt.tag_name AS bodytag_name,
cdbt.sort AS bodytag_sort,
cdbt.iz_enabled AS bodytag_iz_enabled,
cdbt.del_flag AS bodytag_del_flag,
cdbt.create_by AS bodytag_create_by,
cdbt.create_time AS bodytag_create_time,
cdbt.update_by AS bodytag_update_by,
cdbt.update_time AS bodytag_update_time,
cdbt.sys_org_code AS bodytag_sys_org_code,
cdet.id AS emotag_id,
cdet.tag_name AS emotag_name,
cdet.sort AS emotag_sort,
cdet.iz_enabled AS emotag_iz_enabled,
cdet.del_flag AS emotag_del_flag,
cdet.create_by AS emotag_create_by,
cdet.create_time AS emotag_create_time,
cdet.update_by AS emotag_update_by,
cdet.update_time AS emotag_update_time,
cdet.sys_org_code AS emotag_sys_org_code,
csc.category_name AS csc_category_name,
cst.type_name AS cst_type_name,
insTag.instruction_name AS instruction_name
@ -166,10 +112,6 @@
) dp
LEFT JOIN nu_config_directive_package_item pd ON dp.id = pd.package_id
LEFT JOIN nu_config_service_directive csd ON pd.directive_id = csd.id
LEFT JOIN nu_directive_body_tag bdt ON csd.id = bdt.directive_id
LEFT JOIN nu_config_body_tag cdbt ON bdt.tag_id = cdbt.id
LEFT JOIN nu_directive_emotion_tag edt ON csd.id = edt.directive_id
LEFT JOIN nu_config_emotion_tag cdet ON edt.tag_id = cdet.id
LEFT JOIN nu_config_service_category csc ON csd.category_id = csc.id
LEFT JOIN nu_config_service_type cst ON csd.type_id = cst.id
left join nu_config_service_instruction_tag insTag on csd.instruction_tag_id = insTag.id

View File

@ -1,176 +0,0 @@
package com.nu.modules.config.directivetag.body.controller;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag;
import com.nu.modules.config.directivetag.body.service.IDirectiveBodyTagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* @Description: 体型标签
* @Author: 张明远
* @Date: 2025-03-17
* @Version: V1.0
*/
@Api(tags = "体型标签")
@RestController
@RequestMapping("/services/directiveTag/bodyTag")
@Slf4j
public class DirectiveBodyTagController extends JeecgController<DirectiveBodyTag, IDirectiveBodyTagService> {
@Autowired
private IDirectiveBodyTagService directiveTagService;
@Autowired
private ISysBaseAPI sysBaseAPI;
/**
* 分页列表查询
*
* @param directiveTag
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "体型标签-分页列表查询")
@ApiOperation(value = "体型标签-分页列表查询", notes = "体型标签-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<DirectiveBodyTag>> queryPageList(DirectiveBodyTag directiveTag,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
// 自定义多选的查询规则为LIKE_WITH_OR
customeRuleMap.put("izEnabled", QueryRuleEnum.LIKE_WITH_OR);
QueryWrapper<DirectiveBodyTag> queryWrapper = QueryGenerator.initQueryWrapper(directiveTag, req.getParameterMap(), customeRuleMap);
Page<DirectiveBodyTag> page = new Page<DirectiveBodyTag>(pageNo, pageSize);
IPage<DirectiveBodyTag> pageList = directiveTagService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param directiveTag
* @return
*/
@AutoLog(value = "体型标签-添加")
@ApiOperation(value = "体型标签-添加", notes = "体型标签-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody DirectiveBodyTag directiveTag) {
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
directiveTag.setId(deptInfo.getString("code") + IdUtil.simpleUUID());
directiveTag.setSysOrgCode(deptInfo.getString("code"));
directiveTagService.save(directiveTag);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param directiveTag
* @return
*/
@AutoLog(value = "体型标签-编辑")
@ApiOperation(value = "体型标签-编辑", notes = "体型标签-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody DirectiveBodyTag directiveTag) {
directiveTagService.updateById(directiveTag);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "体型标签-通过id删除")
@ApiOperation(value = "体型标签-通过id删除", notes = "体型标签-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
if (directiveTagService.isUsed(id)) {
return Result.error("已被使用,无法删除!");
}
directiveTagService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "体型标签-批量删除")
@ApiOperation(value = "体型标签-批量删除", notes = "体型标签-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
if (directiveTagService.isUsed(ids)) {
return Result.error("已被使用,无法删除!");
}
this.directiveTagService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "体型标签-通过id查询")
@ApiOperation(value = "体型标签-通过id查询", notes = "体型标签-通过id查询")
@GetMapping(value = "/queryById")
public Result<DirectiveBodyTag> queryById(@RequestParam(name = "id", required = true) String id) {
DirectiveBodyTag directiveTag = directiveTagService.getById(id);
if (directiveTag == null) {
return Result.error("未找到对应数据");
}
return Result.OK(directiveTag);
}
/**
* 导出excel
*
* @param request
* @param directiveTag
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, DirectiveBodyTag directiveTag) {
return super.exportXls(request, directiveTag, DirectiveBodyTag.class, "体型标签");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, DirectiveBodyTag.class);
}
}

View File

@ -1,79 +0,0 @@
package com.nu.modules.config.directivetag.body.entity;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 体型标签
* @Author: 张明远
* @Date: 2025-03-17
* @Version: V1.0
*/
@Data
@TableName("nu_config_body_tag")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="nu_config_body_tag对象", description="体型标签")
public class DirectiveBodyTag implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private String id;
/**标签名称*/
@Excel(name = "标签名称", width = 15)
@ApiModelProperty(value = "标签名称")
private String tagName;
/**排序*/
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private Integer sort;
/**状态 0已授权 1未授权*/
@Excel(name = "状态 0已授权 1未授权", width = 15)
@ApiModelProperty(value = "状态 0已授权 1未授权")
@Dict(dicCode = "status")
private java.lang.String status;
/**是否启用 Y启用 N未启用*/
@Excel(name = "是否启用", width = 15, dicCode = "iz_enabled")
@Dict(dicCode = "iz_enabled")
@ApiModelProperty(value = "是否启用")
private String izEnabled;
/**是否删除 0未删除 1删除*/
@Excel(name = "是否删除", width = 15)
@ApiModelProperty(value = "是否删除")
@TableLogic
private String delFlag;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
}

View File

@ -1,28 +0,0 @@
package com.nu.modules.config.directivetag.body.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @Description: 服务指令-体型标签中间表
* @Author: 张明远
* @Date: 2025-4-23 09:26:04
* @Version: V1.0
*/
@Data
@TableName("nu_directive_body_tag")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="nu_directive_body_tag对象", description="服务指令-体型标签中间表")
public class DirectiveBodyTagRelation implements Serializable {
private static final long serialVersionUID = 1L;
private String directiveId;
private String tagId;
}

View File

@ -1,19 +0,0 @@
package com.nu.modules.config.directivetag.body.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 体型标签
* @Author: 张明远
* @Date: 2025-03-17
* @Version: V1.0
*/
public interface DirectiveBodyTagMapper extends BaseMapper<DirectiveBodyTag> {
List<DirectiveBodyTag> selectAll(@Param("ids") List<String> ids,@Param("excludeIds") List<String> excludeIds);
}

View File

@ -1,21 +0,0 @@
package com.nu.modules.config.directivetag.body.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nu.modules.config.directivetag.body.entity.DirectiveBodyTagRelation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 体型标签
* @Author: 张明远
* @Date: 2025-03-17
* @Version: V1.0
*/
public interface DirectiveBodyTagRelationMapper extends BaseMapper<DirectiveBodyTagRelation> {
void removeAll();
void removeAllRelation();
List<DirectiveBodyTagRelation> selectAllRelation(@Param("ids") List<String> ids,@Param("excludeIds") List<String> excludeIds);
}

View File

@ -1,20 +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.config.directivetag.body.mapper.DirectiveBodyTagMapper">
<select id="selectAll" resultType="com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag">
select distinct b.* from nu_config_body_tag b left join nu_directive_body_tag d on b.id = d.tag_id
<where>
d.directive_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
<if test="excludeIds != null and excludeIds.size() > 0">
AND b.id not in
<foreach collection="excludeIds" item="excludeId" open="(" separator="," close=")">
#{excludeId}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@ -1,27 +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.config.directivetag.body.mapper.DirectiveBodyTagRelationMapper">
<delete id="removeAll">
delete from nu_config_body_tag
</delete>
<delete id="removeAllRelation">
delete from nu_directive_body_tag
</delete>
<select id="selectAllRelation" resultType="com.nu.modules.config.directivetag.body.entity.DirectiveBodyTagRelation">
select * from nu_directive_body_tag
<where>
directive_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
<if test="excludeIds != null and excludeIds.size() > 0">
AND tag_id not in
<foreach collection="excludeIds" item="excludeId" open="(" separator="," close=")">
#{excludeId}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@ -1,35 +0,0 @@
package com.nu.modules.config.directivetag.body.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag;
import com.nu.modules.config.directivetag.body.entity.DirectiveBodyTagRelation;
import java.util.List;
/**
* @Description: 体型标签
* @Author: 张明远
* @Date: 2025-03-17
* @Version: V1.0
*/
public interface IDirectiveBodyTagService extends IService<DirectiveBodyTag> {
/**
* 查询数据是否已被使用
* @param ids
* @return
*/
boolean isUsed(String id);
public void removeAllRelation();
public List<DirectiveBodyTagRelation> selectAllRelation(String dataSourceCode, List<String> ids,List<String> excludeIds);
void insertAllRelation(List<DirectiveBodyTagRelation> relations);
List<DirectiveBodyTag> selectAll(String dataSourceCode, List<String> ids,List<String> excludeIds);
List<DirectiveBodyTag> selectAll(List<String> ids, List<String> excludeIds);
void insertAll(List<DirectiveBodyTag> bodyAll);
}

View File

@ -1,81 +0,0 @@
package com.nu.modules.config.directivetag.body.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag;
import com.nu.modules.config.directivetag.body.entity.DirectiveBodyTagRelation;
import com.nu.modules.config.directivetag.body.mapper.DirectiveBodyTagMapper;
import com.nu.modules.config.directivetag.body.mapper.DirectiveBodyTagRelationMapper;
import com.nu.modules.config.directivetag.body.service.IDirectiveBodyTagService;
import com.nu.modules.config.servicedirective.mapper.ConfigServiceDirectiveMapper;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
/**
* @Description: 体型标签
* @Author: 张明远
* @Date: 2025-03-17
* @Version: V1.0
*/
@Service
public class DirectiveBodyTagServiceImpl extends ServiceImpl<DirectiveBodyTagMapper, DirectiveBodyTag> implements IDirectiveBodyTagService {
@Autowired
private ConfigServiceDirectiveMapper serviceDirectiveMapper;
@Autowired
private DirectiveBodyTagRelationMapper tagRelationMapper;
@Override
public boolean isUsed(String ids) {
if (StringUtils.isBlank(ids)) {
return false;
}
boolean result = false;
//是否已被服务指令使用
int i = serviceDirectiveMapper.queryCountByBodyTagIds(Arrays.asList(ids.split(",")));
if (i > 0) {
result = true;
}
return result;
}
@Override
public void removeAllRelation() {
tagRelationMapper.removeAll();
tagRelationMapper.removeAllRelation();
}
@Override
@DS("#dataSourceCode")
public List<DirectiveBodyTagRelation> selectAllRelation(String dataSourceCode, List<String> ids,List<String> excludeIds) {
return tagRelationMapper.selectAllRelation(ids,excludeIds);
}
@Override
public void insertAllRelation(List<DirectiveBodyTagRelation> idRelations) {
idRelations.forEach(ir -> {
tagRelationMapper.insert(ir);
});
}
@Override
@DS("#dataSourceCode")
public List<DirectiveBodyTag> selectAll(String dataSourceCode, List<String> ids,List<String> excludeIds) {
return baseMapper.selectAll(ids,excludeIds);
}
@Override
public List<DirectiveBodyTag> selectAll(List<String> ids, List<String> excludeIds) {
return baseMapper.selectAll(ids, excludeIds);
}
@Override
public void insertAll(List<DirectiveBodyTag> bodyAll) {
bodyAll.forEach(b -> {
baseMapper.insert(b);
});
}
}

View File

@ -1,176 +0,0 @@
package com.nu.modules.config.directivetag.emotion.controller;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag;
import com.nu.modules.config.directivetag.emotion.service.IDirectiveEmotionTagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* @Description: 情绪标签
* @Author: 张明远
* @Date: 2025-03-17
* @Version: V1.0
*/
@Api(tags = "情绪标签")
@RestController
@RequestMapping("/services/directiveTag/emotionTag")
@Slf4j
public class DirectiveEmotionTagController extends JeecgController<DirectiveEmotionTag, IDirectiveEmotionTagService> {
@Autowired
private IDirectiveEmotionTagService directiveTagService;
@Autowired
private ISysBaseAPI sysBaseAPI;
/**
* 分页列表查询
*
* @param directiveTag
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "情绪标签-分页列表查询")
@ApiOperation(value = "情绪标签-分页列表查询", notes = "情绪标签-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<DirectiveEmotionTag>> queryPageList(DirectiveEmotionTag directiveTag,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
// 自定义多选的查询规则为LIKE_WITH_OR
customeRuleMap.put("izEnabled", QueryRuleEnum.LIKE_WITH_OR);
QueryWrapper<DirectiveEmotionTag> queryWrapper = QueryGenerator.initQueryWrapper(directiveTag, req.getParameterMap(), customeRuleMap);
Page<DirectiveEmotionTag> page = new Page<DirectiveEmotionTag>(pageNo, pageSize);
IPage<DirectiveEmotionTag> pageList = directiveTagService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param directiveTag
* @return
*/
@AutoLog(value = "情绪标签-添加")
@ApiOperation(value = "情绪标签-添加", notes = "情绪标签-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody DirectiveEmotionTag directiveTag) {
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
directiveTag.setId(deptInfo.getString("code") + IdUtil.simpleUUID());
directiveTag.setSysOrgCode(deptInfo.getString("code"));
directiveTagService.save(directiveTag);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param directiveTag
* @return
*/
@AutoLog(value = "情绪标签-编辑")
@ApiOperation(value = "情绪标签-编辑", notes = "情绪标签-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody DirectiveEmotionTag directiveTag) {
directiveTagService.updateById(directiveTag);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "情绪标签-通过id删除")
@ApiOperation(value = "情绪标签-通过id删除", notes = "情绪标签-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
if (directiveTagService.isUsed(id)) {
return Result.error("已被使用,无法删除!");
}
directiveTagService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "情绪标签-批量删除")
@ApiOperation(value = "情绪标签-批量删除", notes = "情绪标签-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
if (directiveTagService.isUsed(ids)) {
return Result.error("已被使用,无法删除!");
}
this.directiveTagService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "情绪标签-通过id查询")
@ApiOperation(value = "情绪标签-通过id查询", notes = "情绪标签-通过id查询")
@GetMapping(value = "/queryById")
public Result<DirectiveEmotionTag> queryById(@RequestParam(name = "id", required = true) String id) {
DirectiveEmotionTag directiveTag = directiveTagService.getById(id);
if (directiveTag == null) {
return Result.error("未找到对应数据");
}
return Result.OK(directiveTag);
}
/**
* 导出excel
*
* @param request
* @param directiveTag
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, DirectiveEmotionTag directiveTag) {
return super.exportXls(request, directiveTag, DirectiveEmotionTag.class, "情绪标签");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, DirectiveEmotionTag.class);
}
}

View File

@ -1,79 +0,0 @@
package com.nu.modules.config.directivetag.emotion.entity;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 情绪标签
* @Author: 张明远
* @Date: 2025-03-17
* @Version: V1.0
*/
@Data
@TableName("nu_config_emotion_tag")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="nu_config_emotion_tag对象", description="情绪标签")
public class DirectiveEmotionTag implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**标签名称*/
@Excel(name = "标签名称", width = 15)
@ApiModelProperty(value = "标签名称")
private java.lang.String tagName;
/**排序*/
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private java.lang.Integer sort;
/**状态 0已授权 1未授权*/
@Excel(name = "状态 0已授权 1未授权", width = 15)
@ApiModelProperty(value = "状态 0已授权 1未授权")
@Dict(dicCode = "status")
private java.lang.String status;
/**是否启用 Y启用 N未启用*/
@Excel(name = "是否启用", width = 15, dicCode = "iz_enabled")
@Dict(dicCode = "iz_enabled")
@ApiModelProperty(value = "是否启用")
private java.lang.String izEnabled;
/**是否删除 0未删除 1删除*/
@Excel(name = "是否删除", width = 15)
@ApiModelProperty(value = "是否删除")
@TableLogic
private java.lang.String delFlag;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
}

View File

@ -1,28 +0,0 @@
package com.nu.modules.config.directivetag.emotion.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @Description: 服务指令-情绪标签中间表
* @Author: 张明远
* @Date: 2025-4-23 09:26:04
* @Version: V1.0
*/
@Data
@TableName("nu_directive_emotion_tag")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="nu_directive_emotion_tag对象", description="服务指令-情绪标签中间表")
public class DirectiveEmotionTagRelation implements Serializable {
private static final long serialVersionUID = 1L;
private String directiveId;
private String tagId;
}

View File

@ -1,19 +0,0 @@
package com.nu.modules.config.directivetag.emotion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 情绪标签
* @Author: 张明远
* @Date: 2025-03-17
* @Version: V1.0
*/
public interface DirectiveEmotionTagMapper extends BaseMapper<DirectiveEmotionTag> {
List<DirectiveEmotionTag> selectAll(@Param("ids") List<String> ids, @Param("excludeIds") List<String> excludeIds);
}

View File

@ -1,22 +0,0 @@
package com.nu.modules.config.directivetag.emotion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTagRelation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 情绪标签
* @Author: 张明远
* @Date: 2025-03-17
* @Version: V1.0
*/
public interface DirectiveEmotionTagRelationMapper extends BaseMapper<DirectiveEmotionTagRelation> {
void removeAll();
void removeAllRelation();
List<DirectiveEmotionTagRelation> selectAllRelation(@Param("ids") List<String> ids, @Param("excludeIds") List<String> excludeIds);
}

View File

@ -1,19 +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.config.directivetag.emotion.mapper.DirectiveEmotionTagMapper">
<select id="selectAll" resultType="com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag">
select distinct e.* from nu_config_emotion_tag e left join nu_directive_emotion_tag d on e.id = d.tag_id
<where>
directive_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
<if test="excludeIds != null and excludeIds.size() > 0">
AND e.id not in
<foreach collection="excludeIds" item="excludeId" open="(" separator="," close=")">
#{excludeId}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@ -1,27 +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.config.directivetag.emotion.mapper.DirectiveEmotionTagRelationMapper">
<delete id="removeAll">
delete
from nu_config_emotion_tag
</delete>
<delete id="removeAllRelation">
delete
from nu_directive_emotion_tag
</delete>
<select id="selectAllRelation" resultType="com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTagRelation">
select * from nu_directive_emotion_tag
<where>
directive_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
<if test="excludeIds != null and excludeIds.size() > 0">
AND tag_id not in
<foreach collection="excludeIds" item="excludeId" open="(" separator="," close=")">
#{excludeId}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@ -1,35 +0,0 @@
package com.nu.modules.config.directivetag.emotion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag;
import com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTagRelation;
import java.util.List;
/**
* @Description: 情绪标签
* @Author: 张明远
* @Date: 2025-03-17
* @Version: V1.0
*/
public interface IDirectiveEmotionTagService extends IService<DirectiveEmotionTag> {
/**
* 查询数据是否已被使用
* @param ids
* @return
*/
boolean isUsed(String id);
public void removeAllRelation();
public List<DirectiveEmotionTagRelation> selectAllRelation(String dataSourceCode, List<String> ids,List<String> excludeIds);
void insertAllRelation(List<DirectiveEmotionTagRelation> relations);
List<DirectiveEmotionTag> selectAll(String dataSourceCode, List<String> ids,List<String> excludeIds);
List<DirectiveEmotionTag> selectAll(List<String> ids, List<String> excludeIds);
void insertAll(List<DirectiveEmotionTag> emoRelations);
}

View File

@ -1,81 +0,0 @@
package com.nu.modules.config.directivetag.emotion.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag;
import com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTagRelation;
import com.nu.modules.config.directivetag.emotion.mapper.DirectiveEmotionTagMapper;
import com.nu.modules.config.directivetag.emotion.mapper.DirectiveEmotionTagRelationMapper;
import com.nu.modules.config.directivetag.emotion.service.IDirectiveEmotionTagService;
import com.nu.modules.config.servicedirective.mapper.ConfigServiceDirectiveMapper;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
/**
* @Description: 情绪标签
* @Author: 张明远
* @Date: 2025-03-17
* @Version: V1.0
*/
@Service
public class DirectiveEmotionTagServiceImpl extends ServiceImpl<DirectiveEmotionTagMapper, DirectiveEmotionTag> implements IDirectiveEmotionTagService {
@Autowired
private ConfigServiceDirectiveMapper serviceDirectiveMapper;
@Autowired
private DirectiveEmotionTagRelationMapper tagRelationMapper;
@Override
public boolean isUsed(String ids) {
if (StringUtils.isBlank(ids)) {
return false;
}
boolean result = false;
//是否已被服务指令使用
int i = serviceDirectiveMapper.queryCountByEmotionTagIds(Arrays.asList(ids.split(",")));
if (i > 0) {
result = true;
}
return result;
}
@Override
public void removeAllRelation() {
tagRelationMapper.removeAll();
tagRelationMapper.removeAllRelation();
}
@Override
@DS("#dataSourceCode")
public List<DirectiveEmotionTagRelation> selectAllRelation(String dataSourceCode, List<String> ids, List<String> excludeIds) {
return tagRelationMapper.selectAllRelation(ids, excludeIds);
}
@Override
public void insertAllRelation(List<DirectiveEmotionTagRelation> idRelations) {
idRelations.forEach(ir -> {
tagRelationMapper.insert(ir);
});
}
@Override
@DS("#dataSourceCode")
public List<DirectiveEmotionTag> selectAll(String dataSourceCode, List<String> ids, List<String> excludeIds) {
return baseMapper.selectAll(ids, excludeIds);
}
@Override
public List<DirectiveEmotionTag> selectAll(List<String> ids, List<String> excludeIds) {
return baseMapper.selectAll(ids, excludeIds);
}
@Override
public void insertAll(List<DirectiveEmotionTag> emoRelations) {
emoRelations.forEach(e -> {
baseMapper.insert(e);
});
}
}

View File

@ -42,14 +42,6 @@ public class InstructionTag implements Serializable {
@ApiModelProperty(value = "分类标签类型")
@Dict(dicCode = "service_instruction_tag")
private java.lang.String instructionType;
/**排序*/
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private java.lang.Integer sort;
/**状态 0已授权 1未授权*/
@Excel(name = "状态 0已授权 1未授权", width = 15)
@ApiModelProperty(value = "状态 0已授权 1未授权")
@Dict(dicCode = "status")
private java.lang.String status;
/**是否启用 Y启用 N未启用*/
@Excel(name = "是否启用", width = 15)

View File

@ -47,11 +47,6 @@ public class ConfigServiceCategory implements Serializable {
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private java.lang.Integer sort;
/**状态 0已授权 1未授权*/
@Excel(name = "状态 0已授权 1未授权", width = 15)
@ApiModelProperty(value = "状态 0已授权 1未授权")
@Dict(dicCode = "status")
private java.lang.String status;
/**是否启用 Y启用 N未启用*/
@Excel(name = "是否启用", width = 15)
@ApiModelProperty(value = "是否启用")

View File

@ -57,8 +57,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
private ISysBaseAPI sysBaseAPI;
@Value("${nu.org.master.code}")
private String masterCode;
// @Autowired
// private ICanAddDirectiveService canAddDirectiveService;
@PostMapping("/tree")
public Result<List<TreeNode>> getTree(@RequestBody ConfigServiceDirective dto) {
@ -87,9 +85,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
customeRuleMap.put("categoryId", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("typeId", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("instructionTagId", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("izReimbursement", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("izPreferential", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("chargingFrequency", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("izEnabled", QueryRuleEnum.EQ);
QueryWrapper<ConfigServiceDirective> queryWrapper = QueryGenerator.initQueryWrapper(configServiceDirective, req.getParameterMap(), customeRuleMap);
queryWrapper.select("id");
@ -97,31 +92,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
if(StringUtils.isNotBlank(configServiceDirective.getNotId())){
queryWrapper.notIn("id", configServiceDirective.getNotId().split(","));
}
//如果有服务指令需要提前查询下对应的服务指令id
// List<ConfigServiceDirective> directiveIds = null;
// if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
// directiveIds = configServiceDirectiveService.queryDirectiveIdByBodyTagIds(configServiceDirective.getBodyTags());
// if (directiveIds != null && !directiveIds.isEmpty()) {
// queryWrapper.in("id", directiveIds.stream().map(ConfigServiceDirective::getId).collect(Collectors.toList()));
// } else {
// //体重标签下没有数据
// queryWrapper.eq("id", "null");
// }
// }
// if (StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
// directiveIds = configServiceDirectiveService.queryDirectiveIdByEmotionTagIds(configServiceDirective.getEmotionTags());
// if (directiveIds != null && !directiveIds.isEmpty() && StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
// queryWrapper.in("id", directiveIds.stream().map(ConfigServiceDirective::getId).collect(Collectors.toList()));
// } else {
// //情绪标签下没有数据
// queryWrapper.eq("id", "null");
// }
// }
if (configServiceDirective.isIzAbnormal()) {
queryWrapper.eq("toll_price", new BigDecimal("0"));
queryWrapper.eq("com_price", new BigDecimal("0"));
queryWrapper.eq("service_duration", "0");
}
Page<ConfigServiceDirective> page = new Page<ConfigServiceDirective>(pageNo, pageSize);
IPage<ConfigServiceDirective> list = configServiceDirectiveService.page(page, queryWrapper);
List<ConfigServiceDirective> pageList = service.pageList(configServiceDirective, list);
@ -151,38 +121,11 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
customeRuleMap.put("categoryId", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("typeId", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("instructionTagId", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("izReimbursement", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("izPreferential", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("chargingFrequency", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("izEnabled", QueryRuleEnum.LIKE_WITH_OR);
QueryWrapper<ConfigServiceDirective> queryWrapper = QueryGenerator.initQueryWrapper(configServiceDirective, req.getParameterMap(), customeRuleMap);
queryWrapper.select("id");
//如果有服务指令需要提前查询下对应的服务指令id
List<ConfigServiceDirective> directiveIds = null;
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
directiveIds = configServiceDirectiveService.queryDirectiveIdByBodyTagIds(configServiceDirective.getBodyTags());
if (directiveIds != null && !directiveIds.isEmpty()) {
queryWrapper.in("id", directiveIds.stream().map(ConfigServiceDirective::getId).collect(Collectors.toList()));
} else {
//体重标签下没有数据
queryWrapper.eq("id", "null");
}
}
if (StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
directiveIds = configServiceDirectiveService.queryDirectiveIdByEmotionTagIds(configServiceDirective.getEmotionTags());
if (directiveIds != null && !directiveIds.isEmpty() && StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
queryWrapper.in("id", directiveIds.stream().map(ConfigServiceDirective::getId).collect(Collectors.toList()));
} else {
//情绪标签下没有数据
queryWrapper.eq("id", "null");
}
}
//只查询已授权status = 0)
// if (StringUtils.isNotBlank(configServiceDirective.getStatus())) {
// queryWrapper.in("status", configServiceDirective.getStatus().split(","));
// } else {
// queryWrapper.in("status", new String[]{"0", "2"});
// }
if (StringUtils.isNotBlank(configServiceDirective.getExcludeIds())) {
queryWrapper.notIn("id", configServiceDirective.getExcludeIds().split(","));
}
@ -237,59 +180,13 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
return Result.error("服务指令已存在!");
}
//临时切换至管理平台
// DynamicDataSourceContextHolder.push("ope");
// List<CanAddDirective> canAddList;
// try {
// canAddList = canAddDirectiveService.list();
// } finally {
// //恢复数据源
// DynamicDataSourceContextHolder.clear();
// }
// boolean needSetId = true;
// for (int i = 0; i < canAddList.size(); i++) {
// CanAddDirective canAddDirective = canAddList.get(i);
// if (
// canAddDirective.getInstructionTag().equals(configServiceDirective.getInstructionName()) &&
// canAddDirective.getCategory().equals(configServiceDirective.getCategoryName()) &&
// canAddDirective.getType().equals(configServiceDirective.getTypeName()) &&
// canAddDirective.getDirectiveName().equals(configServiceDirective.getDirectiveName())
// ) {
// needSetId = false;
// configServiceDirective.setId(canAddDirective.getDirectiveId());
// }
// }
//存储机构编码
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
// if (needSetId) {
configServiceDirective.setId(deptInfo.getString("code") + IdUtil.simpleUUID());
// }
configServiceDirective.setSysOrgCode(deptInfo.getString("code"));
//设置为未授权
configServiceDirective.setStatus("1");
//处理媒体资源放在保存方法之前
// configServiceDirectiveService.handleMediaFile(configServiceDirective);
configServiceDirectiveService.save(configServiceDirective);
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
configServiceDirectiveService.saveBodyTags(configServiceDirective);
} else {
configServiceDirectiveService.removeBodyTags(configServiceDirective);
}
if (StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
configServiceDirectiveService.saveEmotionTags(configServiceDirective);
} else {
configServiceDirectiveService.removeEmotionTags(configServiceDirective);
}
//同步给管理平台 - 操作日志
{
DirectiveAsyncMQDto directiveAsyncMQDto = new DirectiveAsyncMQDto();
BeanUtils.copyProperties(configServiceDirective, directiveAsyncMQDto);
rabbitMQUtil.sendToExchange("hldy.directive", "hldy.directive.newadd", directiveAsyncMQDto);
}
//操作日志
{
@ -322,7 +219,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
info.setComPrice(configServiceDirective.getComPrice());//提成价格
info.setServiceContent(configServiceDirective.getServiceContent());//服务说明
info.setServiceDuration(configServiceDirective.getServiceDuration());//服务时长
info.setTimeoutDuration(configServiceDirective.getTimeoutDuration());//超时时长
info.setSysOrgCode(configServiceDirective.getSysOrgCode());//所属部门
info.setMp3File(configServiceDirective.getMp3File());//语音文件
info.setMp4File(configServiceDirective.getMp4File());//视频文件
@ -339,53 +235,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
return Result.OK("添加成功!");
}
/**
* 批量新增
*
* @param list
* @return
*/
@AutoLog(value = "服务指令-批量新增")
@ApiOperation(value = "服务指令-批量新增", notes = "服务指令-批量新增")
@PostMapping(value = "/batchAdd")
public Result<String> batchAdd(@RequestBody List<ConfigServiceDirective> list) {
//设置
Set<String> existIds = configServiceDirectiveService.lambdaQuery()
.select(ConfigServiceDirective::getId)
.list()
.stream()
.map(ConfigServiceDirective::getId)
.collect(Collectors.toSet());
// 2. 过滤出需要新增的数据
List<ConfigServiceDirective> addList = list.stream()
.filter(item -> !existIds.contains(item.getDirectiveId()))
.collect(Collectors.toList());
addList.stream().forEach(d -> {
d.setId(d.getDirectiveId());
d.setTollPrice(new BigDecimal("0"));
d.setComPrice(new BigDecimal("0"));
d.setIzEnabled("1");
d.setServiceDuration("0");
d.setDelFlag("0");
d.setSysOrgCode(masterCode);
d.setStatus("0");
});
configServiceDirectiveService.saveBatch(list);
//同步给管理平台
{
addList.stream().forEach(configServiceDirective -> {
DirectiveAsyncMQDto directiveAsyncMQDto = new DirectiveAsyncMQDto();
BeanUtils.copyProperties(configServiceDirective, directiveAsyncMQDto);
rabbitMQUtil.sendToExchange("hldy.directive", "hldy.directive.newadd", directiveAsyncMQDto);
});
}
return Result.OK("添加成功!");
}
/**
* 编辑
*
@ -401,24 +250,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
//处理媒体资源放在保存方法之前
// configServiceDirectiveService.handleMediaFile(configServiceDirective);
configServiceDirectiveService.updateById(configServiceDirective);
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
configServiceDirectiveService.saveBodyTags(configServiceDirective);
} else {
configServiceDirectiveService.removeBodyTags(configServiceDirective);
}
if (StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
configServiceDirectiveService.saveEmotionTags(configServiceDirective);
} else {
configServiceDirectiveService.removeEmotionTags(configServiceDirective);
}
//管理平台不存数据了这个需求不要了 如果是未授权 则同步给管理平台进行更新
// if ("1".equals(configServiceDirective.getStatus())) {
// DirectiveAsyncMQDto directiveAsyncMQDto = new DirectiveAsyncMQDto();
// BeanUtils.copyProperties(configServiceDirective, directiveAsyncMQDto);
// rabbitMQUtil.sendToExchange("hldy.directive", "hldy.directive.newadd", directiveAsyncMQDto);
// }
//操作日志
{
@ -454,7 +285,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
info.setComPrice(his.getComPrice());//提成价格
info.setServiceContent(his.getServiceContent());//服务说明
info.setServiceDuration(his.getServiceDuration());//服务时长
info.setTimeoutDuration(his.getTimeoutDuration());//超时时长
info.setSysOrgCode(his.getSysOrgCode());//所属部门
info.setMp3File(his.getMp3File());//语音文件
info.setMp4File(his.getMp4File());//视频文件
@ -483,7 +313,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
info.setComPrice(configServiceDirective.getComPrice());//提成价格
info.setServiceContent(configServiceDirective.getServiceContent());//服务说明
info.setServiceDuration(configServiceDirective.getServiceDuration());//服务时长
info.setTimeoutDuration(configServiceDirective.getTimeoutDuration());//超时时长
info.setSysOrgCode(his.getSysOrgCode());//所属部门
info.setMp3File(configServiceDirective.getMp3File());//语音文件
info.setMp4File(configServiceDirective.getMp4File());//视频文件
@ -508,7 +337,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|| !Objects.equals(his.getComPrice(), configServiceDirective.getComPrice())
|| !Objects.equals(his.getServiceContent(), configServiceDirective.getServiceContent())
|| !Objects.equals(his.getServiceDuration(), configServiceDirective.getServiceDuration())
|| !Objects.equals(his.getTimeoutDuration(), configServiceDirective.getTimeoutDuration())
|| !Objects.equals(his.getMp3File(), configServiceDirective.getMp3File())
|| !Objects.equals(his.getMp4File(), configServiceDirective.getMp4File())
|| !Objects.equals(his.getPreviewFile(), configServiceDirective.getPreviewFile())

View File

@ -2,8 +2,6 @@ package com.nu.modules.config.servicedirective.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag;
import com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -14,7 +12,6 @@ import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.List;
/**
* @Description: 服务指令
@ -36,6 +33,13 @@ public class ConfigServiceDirective implements Serializable {
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**
* 分类标签
*/
@Excel(name = "分类标签", width = 15, dicCode = "item_value", dictTable = "view_instruction_tag", dicText = "item_text")
@ApiModelProperty(value = "分类标签")
@Dict(dicCode = "item_value", dictTable = "view_instruction_tag", dicText = "item_text")
private java.lang.String instructionTagId;
/**
* 服务类别id
*/
@ -50,19 +54,19 @@ public class ConfigServiceDirective implements Serializable {
@ApiModelProperty(value = "服务类型")
@Dict(dicCode = "id", dictTable = "nu_config_service_type", dicText = "type_name")
private java.lang.String typeId;
/**
* 分类标签
*/
@Excel(name = "分类标签", width = 15, dicCode = "item_value", dictTable = "view_instruction_tag", dicText = "item_text")
@ApiModelProperty(value = "分类标签")
@Dict(dicCode = "item_value", dictTable = "view_instruction_tag", dicText = "item_text")
private java.lang.String instructionTagId;
/**
* 服务指令名称
*/
@Excel(name = "服务指令名称", width = 15)
@Excel(name = "服务指令名称", width = 30)
@ApiModelProperty(value = "服务指令名称")
private java.lang.String directiveName;
/**
* 服务属性 ds定时 js计时
*/
@Excel(name = "服务属性", width = 15, dicCode = "service_attribute")
@ApiModelProperty(value = "服务属性")
@Dict(dicCode = "service_attribute")
private java.lang.String serviceAttribute;
/**
* 基础价格
*/
@ -75,64 +79,13 @@ public class ConfigServiceDirective implements Serializable {
@Excel(name = "提成价格", width = 15)
@ApiModelProperty(value = "提成价格")
private java.math.BigDecimal comPrice;
/**
* 是否参与医保报销 0不报销 1报销
*/
@Excel(name = "医保报销", width = 15, dicCode = "med_ins_reimb")
@ApiModelProperty(value = "医保报销")
@Dict(dicCode = "med_ins_reimb")
private java.lang.String izReimbursement;
/**
* 是否参与机构优惠 0不参与 1参与
*/
@Excel(name = "机构优惠", width = 15, dicCode = "institutional_discount")
@ApiModelProperty(value = "机构优惠")
@Dict(dicCode = "institutional_discount")
private java.lang.String izPreferential;
/**
* 收费频次 1按次收费 2按天收费
*/
@ApiModelProperty(value = "收费频次")
@Dict(dicCode = "billing_frequency")
private java.lang.String chargingFrequency;
/**
* 服务属性 ds定时 js计时
*/
@Excel(name = "服务属性 ds定时 js计时", width = 15)
@ApiModelProperty(value = "服务属性 ds定时 js计时")
@Dict(dicCode = "service_attribute")
private java.lang.String serviceAttribute;
/**
* 排序
*/
@ApiModelProperty(value = "排序")
private java.lang.Integer sort;
/**
* 服务描述
*/
@Excel(name = "服务描述", width = 15)
@ApiModelProperty(value = "服务描述")
private java.lang.String serviceContent;
/**
* 服务时长分钟
*/
@Excel(name = "服务时长(分钟)", width = 15)
@Excel(name = "服务时长(分钟)", width = 20)
@ApiModelProperty(value = "服务时长(分钟)")
private java.lang.String serviceDuration;
/**
* 超时时长分钟
*/
@Excel(name = "超时时长(分钟)", width = 15)
@ApiModelProperty(value = "超时时长(分钟)")
private String timeoutDuration;
/**
* 指令状态
*/
@Excel(name = "指令状态", width = 15, dicCode = "directive_status")
@ApiModelProperty(value = "指令状态")
@Dict(dicCode = "directive_status")
private java.lang.String status;
/**
* 是否启用 Y启用 N未启用
*/
@ -140,10 +93,15 @@ public class ConfigServiceDirective implements Serializable {
@ApiModelProperty(value = "是否启用")
@Dict(dicCode = "iz_enabled")
private java.lang.String izEnabled;
/**
* 服务描述
*/
@Excel(name = "服务指令描述", width = 50)
@ApiModelProperty(value = "服务指令描述")
private java.lang.String serviceContent;
/**
* 是否删除
*/
@Excel(name = "是否删除", width = 15)
@ApiModelProperty(value = "是否删除")
@TableLogic
private java.lang.String delFlag;
@ -245,11 +203,6 @@ public class ConfigServiceDirective implements Serializable {
*/
@ApiModelProperty(value = "即时指令图标md5")
private java.lang.String immediateFileFocusMd5;
/**
* 是否下载tplink视频 Y下载 N不下载
*/
@ApiModelProperty(value = "是否下载tplink视频 Y下载 N不下载")
private java.lang.String izDownTplink;
//即时指令图标是否变更
@TableField(exist = false)
@ -268,27 +221,6 @@ public class ConfigServiceDirective implements Serializable {
//合并单元格用分类标签合并的行数
@TableField(exist = false)
private Integer instructionRowSpan;
//体型标签id,id,id
@TableField(exist = false)
private String bodyTags;
//情绪标签id,id,id
@TableField(exist = false)
private String emotionTags;
//体型标签
@TableField(exist = false)
List<DirectiveBodyTag> bodyTagList;
//体型标签字符串
@TableField(exist = false)
private String bodyTagsName;
//情绪标签
@TableField(exist = false)
List<DirectiveEmotionTag> emotionTagList;
//情绪标签字符串
@TableField(exist = false)
private String emotionTagsName;
//分类标签中文名称
@TableField(exist = false)
@ -302,12 +234,6 @@ public class ConfigServiceDirective implements Serializable {
//媒体资源存储路径名
@TableField(exist = false)
private String mediaFileSavePath;
//体型标签json字符串前台封装好的 有idlabel
@TableField(exist = false)
private String bodyTagsObj;
//情绪标签json字符串前台封装好的 有idlabel
@TableField(exist = false)
private String emotionTagsObj;
//护理分类名称
@TableField(exist = false)
private String instructionTagName;
@ -320,28 +246,15 @@ public class ConfigServiceDirective implements Serializable {
@TableField(exist = false)
private String directiveId;
@TableField(exist = false)
private boolean izAbnormal;//查询服务时长基础价格提成价格 都等于 0的数据
@TableField(exist = false)
private String compareOrgCode;//对比的机构编码
@TableField(exist = false)
private boolean ownExist;//本平台是否存在该指令
@TableField(exist = false)
private boolean targetExist;//目标平台是否存在该指令
// @TableField(exist = false)
// private String cycleTypeShow;
// @TableField(exist = false)
// private String cycleTypeValue;
@TableField(exist = false)
private String syncCode;
@TableField(exist = false)
private String notId;
@TableField(exist = false)
private String serviceAttributeName;
// /**
// * 指令类型 1日常护理 2周期护理 3即时护理
// */
// @Excel(name = "指令类型", width = 15)
// @ApiModelProperty(value = "指令类型")
// @Dict(dicCode = "period_type")
// private java.lang.String cycleType;
}

View File

@ -1,7 +1,5 @@
package com.nu.modules.config.servicedirective.entity;
import com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag;
import com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag;
import lombok.Data;
import java.util.ArrayList;
@ -23,8 +21,6 @@ public class TreeNode {
private boolean canAdd;
private boolean showContent;
private List<TreeNode> children = new ArrayList<>();
private List<DirectiveBodyTag> bodyTagList;
private List<DirectiveEmotionTag> emotionTagList;
private boolean parentLevelEnabled;//父级及往上是否启用
public TreeNode(String instructionId,String categoryId,String typeId,String key, String title,int level,String cycleTypeName,String izEnabled,Integer sort,boolean canAdd,boolean parentLevelEnabled,String icon) {

View File

@ -1,15 +1,13 @@
package com.nu.modules.config.servicedirective.mapper;
import java.util.List;
import com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag;
import com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nu.modules.config.instructiontag.entity.InstructionTag;
import com.nu.modules.config.servicecategory.entity.ConfigServiceCategory;
import com.nu.modules.config.servicedirective.entity.ConfigServiceDirective;
import com.nu.modules.config.servicetype.entity.ConfigServiceType;
import org.apache.ibatis.annotations.Param;
import com.nu.modules.config.servicedirective.entity.ConfigServiceDirective;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* @Description: 服务指令
@ -21,7 +19,6 @@ public interface ConfigServiceDirectiveMapper extends BaseMapper<ConfigServiceDi
/**
* 自定义分页查询方法
*
* @param page 分页参数
* @param directive 主查询对象包含搜索条件
* @return 分页结果
*/
@ -29,42 +26,6 @@ public interface ConfigServiceDirectiveMapper extends BaseMapper<ConfigServiceDi
@Param("directive") ConfigServiceDirective directive,
@Param("ids") List<ConfigServiceDirective> records
);
// IPage<ConfigServiceDirective> pageList(
// @Param("page") Page<ConfigServiceDirective> page,
// @Param("directive") ConfigServiceDirective directive
// );
int deleteBodyTags(@Param("directive") ConfigServiceDirective configServiceDirective);
int saveBodyTags(@Param("directive") ConfigServiceDirective configServiceDirective);
int deleteEmotionTags(@Param("directive") ConfigServiceDirective configServiceDirective);
int saveEmotionTags(@Param("directive") ConfigServiceDirective configServiceDirective);
/**
* 根据体型标签查询对应的服务指令id
* @return
*/
List<ConfigServiceDirective> queryDirectiveIdByBodyTagIds(@Param("tagIds") String tagIds);
/**
* 根据情绪标签查询对应的服务指令id
* @return
*/
List<ConfigServiceDirective> queryDirectiveIdByEmotionTagIds(@Param("tagIds") String tagIds);
/**
* 查询体型标签是否被使用
* @return
*/
int queryCountByBodyTagIds(@Param("tagIds") List<String> tagIds);
/**
* 查询情绪标签是否被使用
* @return
*/
int queryCountByEmotionTagIds(@Param("tagIds") List<String> tagIds);
int removeAll();
@ -73,8 +34,6 @@ public interface ConfigServiceDirectiveMapper extends BaseMapper<ConfigServiceDi
List<InstructionTag> getUsedInstructionTags();
List<ConfigServiceCategory> getUsedCategories();
List<ConfigServiceType> getUsedTypes();
List<DirectiveBodyTag> getBodyTagsByDirective(@Param("id") String directiveId);
List<DirectiveEmotionTag> getEmotionTagsByDirective(@Param("id") String directiveId);
List<ConfigServiceDirective> allData();

View File

@ -12,15 +12,9 @@
<result property="directiveName" column="directive_name"/>
<result property="tollPrice" column="toll_price"/>
<result property="comPrice" column="com_price"/>
<result property="izReimbursement" column="iz_reimbursement"/>
<result property="izPreferential" column="iz_preferential"/>
<result property="chargingFrequency" column="charging_frequency"/>
<result property="serviceAttribute" column="service_attribute"/>
<result property="sort" column="sort"/>
<result property="serviceContent" column="service_content"/>
<result property="serviceDuration" column="service_duration"/>
<result property="timeoutDuration" column="timeout_duration"/>
<result property="status" column="status"/>
<result property="izEnabled" column="iz_enabled"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
@ -40,17 +34,6 @@
<result property="previewFileSmallMd5" column="preview_file_small_md5"/>
<result property="immediateFileMd5" column="immediate_file_md5"/>
<result property="immediateFileFocusMd5" column="immediate_file_focus_md5"/>
<collection property="bodyTagList" ofType="com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag">
<id property="id" column="bodyTagId"/>
<result property="tagName" column="bodyTagName"/>
</collection>
<collection property="emotionTagList"
ofType="com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag">
<id property="id" column="emotionTagId"/>
<result property="tagName" column="emotionTagName"/>
</collection>
</resultMap>
<select id="pageList" resultType="com.nu.modules.config.servicedirective.entity.ConfigServiceDirective" parameterType="map">
@ -62,16 +45,10 @@
c.directive_name,
c.toll_price,
c.com_price,
c.iz_reimbursement,
c.iz_preferential,
c.charging_frequency,
c.sort,
c.service_content,
c.service_attribute,
case c.service_attribute when 'ds' then '定时' when 'js' then '计时' else null end as serviceAttributeName,
c.service_duration,
c.timeout_duration,
c.status,
c.iz_enabled,
c.del_flag,
c.create_by,
@ -126,62 +103,6 @@
ORDER BY c.category_id ASC, c.create_time desc
</select>
<select id="queryDirectiveIdByBodyTagIds"
resultType="com.nu.modules.config.servicedirective.entity.ConfigServiceDirective">
SELECT distinct directive_id as id FROM nu_directive_body_tag WHERE tag_id IN
<foreach collection="tagIds.split(',')" item="tagId" open="(" separator="," close=")">
#{tagId}
</foreach>
</select>
<select id="queryDirectiveIdByEmotionTagIds"
resultType="com.nu.modules.config.servicedirective.entity.ConfigServiceDirective">
SELECT distinct directive_id as id FROM nu_directive_emotion_tag WHERE tag_id IN
<foreach collection="tagIds.split(',')" item="tagId" open="(" separator="," close=")">
#{tagId}
</foreach>
</select>
<select id="queryCountByBodyTagIds" resultType="java.lang.Integer">
SELECT COUNT(*) FROM nu_directive_body_tag WHERE tag_id IN
<foreach collection="tagIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="queryCountByEmotionTagIds" resultType="java.lang.Integer">
SELECT COUNT(*) FROM nu_directive_emotion_tag WHERE tag_id IN
<foreach collection="tagIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<delete id="deleteBodyTags">
delete
from nu_directive_body_tag
where directive_id = #{directive.id}
</delete>
<insert id="saveBodyTags">
insert into nu_directive_body_tag (directive_id,tag_id) values
<foreach collection="directive.bodyTags.split(',')" item="tagId" separator=",">
(#{directive.id}, #{tagId})
</foreach>
</insert>
<delete id="deleteEmotionTags">
delete
from nu_directive_emotion_tag
where directive_id = #{directive.id}
</delete>
<insert id="saveEmotionTags">
insert into nu_directive_emotion_tag (directive_id,tag_id) values
<foreach collection="directive.emotionTags.split(',')" item="tagId" separator=",">
(#{directive.id}, #{tagId})
</foreach>
</insert>
<delete id="removeAll">
delete
from nu_config_service_directive
@ -194,12 +115,6 @@
<result column="directive_name" property="directiveName"/>
<result column="category_id" property="categoryId"/>
<result column="type_id" property="typeId"/>
<!-- 一级、二级、三级 ID 可根据需要添加 -->
<collection property="bodyTagList" ofType="com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag"
select="getBodyTagsByDirective" column="id"/>
<collection property="emotionTagList"
ofType="com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag"
select="getEmotionTagsByDirective" column="id"/>
</resultMap>
<!-- 查询未删除的服务指令,并映射标签 -->
@ -218,10 +133,10 @@
<!-- 查询被使用的一、二、三级分类(包含已删除,只要存在未删指令引用) -->
<select id="getUsedInstructionTags" resultType="com.nu.modules.config.instructiontag.entity.InstructionTag">
SELECT id, instruction_name, sort, iz_enabled, icon
SELECT id, instruction_name, iz_enabled, icon
FROM nu_config_service_instruction_tag
WHERE del_flag = '0'
ORDER BY sort ASC
ORDER BY create_time desc
</select>
<select id="getUsedCategories" resultType="com.nu.modules.config.servicecategory.entity.ConfigServiceCategory">
@ -238,21 +153,6 @@
ORDER BY sort ASC
</select>
<!-- 查询标签中间表方法 -->
<select id="getBodyTagsByDirective" resultType="com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag">
SELECT bt.id, bt.tag_name, bt.sort, bt.iz_enabled
FROM nu_config_body_tag bt
INNER JOIN nu_directive_body_tag dbt ON bt.id = dbt.tag_id
WHERE dbt.directive_id = #{directiveId}
</select>
<select id="getEmotionTagsByDirective"
resultType="com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag">
SELECT et.id, et.tag_name, et.sort, et.iz_enabled
FROM nu_config_emotion_tag et
INNER JOIN nu_directive_emotion_tag det ON et.id = det.tag_id
WHERE det.directive_id = #{directiveId}
</select>
<select id="allData" resultType="com.nu.modules.config.servicedirective.entity.ConfigServiceDirective">
select id
from nu_config_service_directive

View File

@ -2,7 +2,6 @@ package com.nu.modules.config.servicedirective.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nu.dto.DirectiveAsyncMQDto;
import com.nu.dto.DirectiveMQDto;
import com.nu.modules.config.servicedirective.entity.ConfigServiceDirective;
import com.nu.modules.config.servicedirective.entity.TreeNode;
@ -17,52 +16,13 @@ import java.util.List;
*/
public interface IConfigServiceDirectiveService extends IService<ConfigServiceDirective> {
void merge(List<ConfigServiceDirective> records);
List<ConfigServiceDirective> pageList(ConfigServiceDirective configServiceDirective, IPage<ConfigServiceDirective> list);
/**
* 存储体型标签数据
*
* @param configServiceDirective
*/
void saveBodyTags(ConfigServiceDirective configServiceDirective);
/**
* 存储情绪标签数据
*
* @param configServiceDirective
*/
void saveEmotionTags(ConfigServiceDirective configServiceDirective);
/**
* 移除改服务指令下体型标签
*
* @param configServiceDirective
*/
void removeBodyTags(ConfigServiceDirective configServiceDirective);
/**
* 移除改服务指令下情绪标签
*
* @param configServiceDirective
*/
void removeEmotionTags(ConfigServiceDirective configServiceDirective);
List<ConfigServiceDirective> queryDirectiveIdByBodyTagIds(String tags);
List<ConfigServiceDirective> queryDirectiveIdByEmotionTagIds(String tags);
void removeAll();
List<ConfigServiceDirective> selectAllByIds(String dataSourceCode, List<String> idList);
void insertAllDirectives(List<ConfigServiceDirective> directives);
void handleMediaFile(ConfigServiceDirective configServiceDirective);
void auditPass(DirectiveAsyncMQDto dto);
List<TreeNode> getTreeData(String filterIzEnabled);
List<ConfigServiceDirective> allData();

View File

@ -7,15 +7,10 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
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.service.impl.ServiceImpl;
import com.google.common.collect.Maps;
import com.nu.dto.*;
import com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag;
import com.nu.modules.config.directivetag.body.service.IDirectiveBodyTagService;
import com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag;
import com.nu.modules.config.directivetag.emotion.service.IDirectiveEmotionTagService;
import com.nu.modules.config.instructiontag.entity.InstructionTag;
import com.nu.modules.config.instructiontag.service.IInstructionTagService;
import com.nu.modules.config.servicecategory.entity.ConfigServiceCategory;
@ -29,7 +24,6 @@ import com.nu.modules.config.servicetype.service.IConfigServiceTypeService;
import com.nu.modules.sysconfig.ISysConfigApi;
import com.nu.mq.directive.listener.DirectiveMQListener;
import com.nu.utils.HttpRequestUtil;
import com.nu.utils.NuFileUtils;
import com.nu.utils.RabbitMQUtil;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang.StringUtils;
@ -71,12 +65,6 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
private IConfigServiceTypeService typeService;
@Lazy
@Autowired
private IDirectiveBodyTagService bodyTagService;
@Lazy
@Autowired
private IDirectiveEmotionTagService emotionTagService;
@Lazy
@Autowired
private DirectiveMQListener directiveMQListener;
@Override
@ -84,178 +72,17 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
if (list_.getRecords() == null || list_.getRecords().isEmpty()) {
return list_.getRecords();
}
// configServiceDirective.setIzEnabled("Y");
List<ConfigServiceDirective> list = baseMapper.pageList(configServiceDirective, list_.getRecords());
// //处理服务标签字段
// if (list != null && !list.isEmpty()) {
// list.stream().forEach(record -> {
// List<DirectiveBodyTag> bodyTagList = record.getBodyTagList();
// record.setBodyTags(bodyTagList.stream().map(DirectiveBodyTag::getId).collect(Collectors.joining(",")));
//
// List<DirectiveEmotionTag> emotionTagList = record.getEmotionTagList();
// record.setEmotionTags(emotionTagList.stream().map(DirectiveEmotionTag::getId).collect(Collectors.joining(",")));
// });
// }
//处理单元格合并所需数据
// merge(list);
return list;
}
/**
* 主合并方法
*
* @param records 已排序的记录列表需先按categoryIdtypeIdinstructionTagId排序
*/
@Override
public void merge(List<ConfigServiceDirective> records) {
if (records == null || records.isEmpty()) return;
int outerStart = 0; // 新一级分组原三级起始索引
String currentInstructionId = records.get(0).getInstructionTagId();
// 新一级循环遍历所有记录处理instructionTagId分组
for (int i = 1; i < records.size(); i++) {
if (!records.get(i).getInstructionTagId().equals(currentInstructionId)) {
processAllGroups(records, outerStart, i - 1); // 处理完整个新一级分组
outerStart = i;
currentInstructionId = records.get(i).getInstructionTagId();
}
}
processAllGroups(records, outerStart, records.size() - 1); // 处理最后一组
}
private void processAllGroups(List<ConfigServiceDirective> records, int start, int end) {
processOuterGroup(records, start, end); // 处理新一级instructionRowSpan
int middleStart = start; // 新二级分组起始索引
String currentCategoryId = records.get(middleStart).getCategoryId();
// 新二级循环处理当前新一级分组内的categoryId分组
for (int j = middleStart + 1; j <= end; j++) {
if (!records.get(j).getCategoryId().equals(currentCategoryId)) {
processMiddleGroup(records, middleStart, j - 1); // 处理完整个新二级分组
middleStart = j;
currentCategoryId = records.get(j).getCategoryId();
}
}
processMiddleGroup(records, middleStart, end); // 处理最后一组新二级数据
}
private void processMiddleGroup(List<ConfigServiceDirective> records, int start, int end) {
processTypeRowSpan(records, start, end); // 设置新二级categoryRowSpan
int innerStart = start; // 新三级分组起始索引
String currentTypeId = records.get(innerStart).getTypeId();
// 新三级循环处理当前新二级分组内的typeId分组
for (int k = innerStart + 1; k <= end; k++) {
if (!records.get(k).getTypeId().equals(currentTypeId)) {
processInnerGroup(records, innerStart, k - 1); // 处理完整个新三级分组
innerStart = k;
currentTypeId = records.get(k).getTypeId();
}
}
processInnerGroup(records, innerStart, end); // 处理最后一组新三级数据
}
private void processInnerGroup(List<ConfigServiceDirective> records, int start, int end) {
int count = end - start + 1;
if (count > 1) {
records.get(start).setTypeRowSpan(count);
for (int i = start + 1; i <= end; i++) {
records.get(i).setTypeRowSpan(0);
}
}
}
// 处理新一级instructionRowSpan
private void processOuterGroup(List<ConfigServiceDirective> records, int start, int end) {
int count = end - start + 1;
if (count > 1) {
records.get(start).setInstructionRowSpan(count);
for (int i = start + 1; i <= end; i++) {
records.get(i).setInstructionRowSpan(0);
}
}
}
// 处理新二级categoryRowSpan
private void processTypeRowSpan(List<ConfigServiceDirective> records, int start, int end) {
int count = end - start + 1;
if (count > 1) {
records.get(start).setCategoryRowSpan(count);
for (int i = start + 1; i <= end; i++) {
records.get(i).setCategoryRowSpan(0);
}
}
}
/**
* 存储体型标签数据
*
* @param configServiceDirective
*/
@Override
public void saveBodyTags(ConfigServiceDirective configServiceDirective) {
baseMapper.deleteBodyTags(configServiceDirective);
baseMapper.saveBodyTags(configServiceDirective);
}
/**
* 存储情绪标签数据
*
* @param configServiceDirective
*/
@Override
public void saveEmotionTags(ConfigServiceDirective configServiceDirective) {
baseMapper.deleteEmotionTags(configServiceDirective);
baseMapper.saveEmotionTags(configServiceDirective);
}
/**
* 移除改服务指令下体型标签
*
* @param configServiceDirective
*/
@Override
public void removeBodyTags(ConfigServiceDirective configServiceDirective) {
baseMapper.deleteBodyTags(configServiceDirective);
}
/**
* 移除改服务指令下情绪标签
*
* @param configServiceDirective
*/
@Override
public void removeEmotionTags(ConfigServiceDirective configServiceDirective) {
baseMapper.deleteEmotionTags(configServiceDirective);
}
@Override
public List<ConfigServiceDirective> queryDirectiveIdByBodyTagIds(String tags) {
return baseMapper.queryDirectiveIdByBodyTagIds(tags);
}
@Override
public List<ConfigServiceDirective> queryDirectiveIdByEmotionTagIds(String tags) {
return baseMapper.queryDirectiveIdByEmotionTagIds(tags);
}
@Override
public void removeAll() {
baseMapper.removeAll();
}
@Override
@DS("#dataSourceCode")
public List<ConfigServiceDirective> selectAllByIds(String dataSourceCode, List<String> idList) {
QueryWrapper<ConfigServiceDirective> qw = new QueryWrapper<>();
qw.in("id", idList);
return baseMapper.selectList(qw);
}
@Override
public void insertAllDirectives(List<ConfigServiceDirective> directives) {
@ -264,113 +91,6 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
});
}
/**
* 处理资源文件
* 1检测各资源文件的存储路径是否跟路径字段的值一致
* 2如果不一致1检测缺少的路径新建目录 2然后把资源挪到新路径中 3修改媒体资源对应字段的值的路径名
*
* @param configServiceDirective
*/
@Override
public void handleMediaFile(ConfigServiceDirective configServiceDirective) {
//需要存储的路径
String mediaFileSavePath = configServiceDirective.getMediaFileSavePath();
//服务指令图片大图
String previewFile = configServiceDirective.getPreviewFile();
//服务指令图片小图
String previewFileSmall = configServiceDirective.getPreviewFileSmall();
//即时指令图标
String immediateFile = configServiceDirective.getImmediateFile();
//即时指令焦点图标
String immediateFileFocus = configServiceDirective.getImmediateFileFocus();
//指令音频文件
String mp3File = configServiceDirective.getMp3File();
//指令视频文件
String mp4File = configServiceDirective.getMp4File();
// 处理每个文件并获取更新后的路径
Map<String, String> newPreviewFileMap = NuFileUtils.processFile(mediaFileSavePath, previewFile);
Map<String, String> newPreviewFileSmallMap = NuFileUtils.processFile(mediaFileSavePath, previewFileSmall);
Map<String, String> newImmediateFileMap = NuFileUtils.processFile(mediaFileSavePath, immediateFile);
Map<String, String> newImmediateFileFocusMap = NuFileUtils.processFile(mediaFileSavePath, immediateFileFocus);
Map<String, String> newMp3FileMap = NuFileUtils.processFile(mediaFileSavePath, mp3File);
Map<String, String> newMp4FileMap = NuFileUtils.processFile(mediaFileSavePath, mp4File);
// 如果有变化更新ConfigServiceDirective对象
if (newPreviewFileMap != null) {
configServiceDirective.setPreviewFile(newPreviewFileMap.get("path"));
configServiceDirective.setPreviewFileMd5(newPreviewFileMap.get("md5"));
}
if (newPreviewFileSmallMap != null) {
configServiceDirective.setPreviewFileSmall(newPreviewFileSmallMap.get("path"));
configServiceDirective.setPreviewFileSmallMd5(newPreviewFileSmallMap.get("md5"));
}
if (newImmediateFileMap != null) {
configServiceDirective.setImmediateFile(newImmediateFileMap.get("path"));
configServiceDirective.setImmediateFileMd5(newImmediateFileMap.get("md5"));
}
if (newImmediateFileFocusMap != null) {
configServiceDirective.setImmediateFileFocus(newImmediateFileFocusMap.get("path"));
configServiceDirective.setImmediateFileFocusMd5(newImmediateFileFocusMap.get("md5"));
}
if (newMp3FileMap != null) {
configServiceDirective.setMp3File(newMp3FileMap.get("path"));
configServiceDirective.setMp3FileMd5(newMp3FileMap.get("md5"));
}
if (newMp4FileMap != null) {
configServiceDirective.setMp4File(newMp4FileMap.get("path"));
configServiceDirective.setMp4FileMd5(newMp4FileMap.get("md5"));
}
}
@Override
public void auditPass(DirectiveAsyncMQDto dto) {
//将相应字典项改为已授权
//分类标签
UpdateWrapper<InstructionTag> instruUW = new UpdateWrapper<>();
instruUW.eq("id", dto.getInstructionTagId());
instruUW.eq("status", "1");
InstructionTag instructionTag = new InstructionTag();
instructionTag.setStatus("0");
instructionTagService.update(instructionTag, instruUW);
//服务类别
UpdateWrapper<ConfigServiceCategory> categoryUW = new UpdateWrapper<>();
categoryUW.eq("id", dto.getCategoryId());
categoryUW.eq("status", "1");
ConfigServiceCategory category = new ConfigServiceCategory();
category.setStatus("0");
categoryService.update(category, categoryUW);
//服务类型
UpdateWrapper<ConfigServiceType> typeUW = new UpdateWrapper<>();
typeUW.eq("id", dto.getTypeId());
typeUW.eq("status", "1");
ConfigServiceType type = new ConfigServiceType();
type.setStatus("0");
typeService.update(type, typeUW);
//体型标签
List<String> bodyTags = Arrays.asList(dto.getBodyTags().split(","));
bodyTags.stream().forEach(b -> {
UpdateWrapper<DirectiveBodyTag> bodyTagUW = new UpdateWrapper<>();
bodyTagUW.eq("id", b);
bodyTagUW.eq("status", "1");
DirectiveBodyTag bodyTag = new DirectiveBodyTag();
bodyTag.setStatus("0");
bodyTagService.update(bodyTag, bodyTagUW);
});
//情绪标签
List<String> emotionTags = Arrays.asList(dto.getEmotionTags().split(","));
emotionTags.stream().forEach(b -> {
UpdateWrapper<DirectiveEmotionTag> emotionTagUW = new UpdateWrapper<>();
emotionTagUW.eq("id", b);
emotionTagUW.eq("status", "1");
DirectiveEmotionTag emotionTag = new DirectiveEmotionTag();
emotionTag.setStatus("0");
emotionTagService.update(emotionTag, emotionTagUW);
});
}
@Override
public List<TreeNode> getTreeData(String filterIzEnabled) {
//查询指令类型字典项备用
@ -380,12 +100,6 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
cycleTypeMap.put(p.getValue(), p.getLabel());
});
// 查询未删除并带标签的所有服务指令
// List<ConfigServiceDirective> directives = baseMapper.getActiveDirectivesWithTags();
// typeId 分组
// Map<String, List<ConfigServiceDirective>> directiveMap = directives.stream()
// .collect(Collectors.groupingBy(ConfigServiceDirective::getTypeId));
// 获取被引用的各级分类
List<InstructionTag> instructions = baseMapper.getUsedInstructionTags();
@ -407,7 +121,7 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
if ("enabled".equals(filterIzEnabled) && !insUsing) {
continue;
}
TreeNode instNode = new TreeNode(inst.getId(), "", "", inst.getId(), inst.getInstructionName(), 1, "", inst.getIzEnabled(), inst.getSort(), insUsing, true, inst.getIcon());
TreeNode instNode = new TreeNode(inst.getId(), "", "", inst.getId(), inst.getInstructionName(), 1, "", inst.getIzEnabled(), 1, insUsing, true, inst.getIcon());
List<ConfigServiceCategory> catList = catMap.get(inst.getId());
if (catList != null) {
catList.sort(Comparator.comparingInt(ConfigServiceCategory::getSort));
@ -426,21 +140,6 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
continue;
}
TreeNode typeNode = new TreeNode(inst.getId(), cat.getId(), tp.getId(), tp.getId(), tp.getTypeName(), 3, "", tp.getIzEnabled(), tp.getSort(), insUsing && catUsing && typUsing, insUsing && catUsing, "");
// List<ConfigServiceDirective> dirList = directiveMap.get(tp.getId());
// if (dirList != null) {
// dirList.sort(Comparator.comparingInt(ConfigServiceDirective::getSort));
// for (ConfigServiceDirective dir : dirList) {
// if ("enabled".equals(filterIzEnabled) && "N".equals(dir.getIzEnabled())) {
// continue;
// }
// TreeNode dirNode = new TreeNode(inst.getId(), cat.getId(), tp.getId(), dir.getId(), dir.getDirectiveName(), 4, cycleTypeMap.get(dir.getCycleType()), dir.getIzEnabled(), dir.getSort(), insUsing && catUsing && typUsing, insUsing && catUsing && typUsing,"");
//// TreeNode tagNode = new TreeNode(inst.getId(), cat.getId(), tp.getId(), IdUtil.simpleUUID(), "标签", 5, cycleTypeMap.get(dir.getCycleType()), dir.getIzEnabled(), dir.getSort(), insUsing && catUsing && typUsing,insUsing && catUsing && typUsing);
//// tagNode.setBodyTagList(dir.getBodyTagList());
//// tagNode.setEmotionTagList(dir.getEmotionTagList());
// typeNode.addChild(dirNode);
//// dirNode.addChild(tagNode);
// }
// }
catNode.addChild(typeNode);
}
}
@ -466,7 +165,6 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
public DirectiveMQDto syncDirective(String sourceOrgCode, String syncIds, String syncCode) {
DirectiveMQDto directiveMQDto = new DirectiveMQDto();
List<ConfigServiceDirective> directives;
List<String> directiveIds = Arrays.asList(syncIds.split(","));
{
List<ConfigServiceDirective> param = Lists.newArrayList();
Arrays.stream(syncIds.split(",")).forEach(id -> {
@ -475,35 +173,7 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
param.add(configServiceDirective);
});
directives = baseMapper.pageList(null, param);
if (directives != null && !directives.isEmpty()) {
directives.stream().forEach(record -> {
//清空指令资源字段的值
// if ("business".equals(syncOption)) {
// record.setPreviewFile(null);
// record.setImmediateFile(null);
// record.setMp3File(null);
// record.setMp4File(null);
// record.setServiceContent(null);
// record.setPreviewFileMd5(null);
// record.setImmediateFileMd5(null);
// record.setMp3FileMd5(null);
// record.setMp4FileMd5(null);
// }
// List<DirectiveBodyTag> bodyTagList = record.getBodyTagList();
// record.setBodyTags(bodyTagList.stream().map(DirectiveBodyTag::getId).collect(Collectors.joining(",")));
//
// List<DirectiveEmotionTag> emotionTagList = record.getEmotionTagList();
// record.setEmotionTags(emotionTagList.stream().map(DirectiveEmotionTag::getId).collect(Collectors.joining(",")));
});
}
directiveMQDto.setDirectiveList(BeanUtil.copyToList(directives, DirectiveAsyncMQDto.class));
// if ("all".equals(syncOption) || "media".equals(syncOption)) {
// directiveMQDto.setIzSyncMedia(true);
// directiveMQDto.getDirectiveList().stream().forEach(d -> {
// d.setApi(fullPath);
// });
// }
}
//分类标签
Map<String, String> instructionTagMap = new HashMap<>();
@ -556,36 +226,9 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
));
}
}
//体型标签
// {
// directiveMQDto.setBodyTagList(BeanUtil.copyToList(bodyTagService.selectAll(directiveIds, null), BodyTagMQDto.class));
// }
//情绪标签
// {
// directiveMQDto.setEmotionTagList(BeanUtil.copyToList(emotionTagService.selectAll(directiveIds, null), EmotionTagMQDto.class));
// }
directiveMQListener.handleIncremental2(directiveMQDto);
String apiAddress = "";
//查询源数据平台的接口api地址
// {
// //各平台api地址都存在管理系统中 管理系统api地址在系统参数配置中 ope_open_url
// JSONObject opeOpenUrl = sysConfigApi.getByKeyByDS("master", "ope_open_url");
// String opeApiAddress = opeOpenUrl.getString("configValue");
// if (opeApiAddress.endsWith("/")) {
// opeApiAddress = opeApiAddress.substring(0, opeApiAddress.length() - 1);
// }
// String bizApiAddress = opeApiAddress + "/api/baseInfo/getOrgApiAddress?orgCode=" + sourceOrgCode;
//
// try {
// String res = HttpRequestUtil.doGet(bizApiAddress, HttpRequestUtil.createDefaultHeaders());
// JSONObject jsonResponse = JSON.parseObject(res);
// JSONObject result = jsonResponse.getJSONObject("result");
// apiAddress = result.getString("url");
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
directiveMQListener.handleCreateMedia2(directiveMQDto, apiAddress);
@ -624,7 +267,6 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
info.setCycleType(item.getCycleType());//指令类型
info.setServiceContent(item.getServiceContent());//服务说明
info.setServiceDuration(item.getServiceDuration());//服务时长
info.setTimeoutDuration(item.getTimeoutDuration());//超时时长
info.setSysOrgCode(item.getSysOrgCode());//所属部门
info.setMp3File(item.getMp3File());//语音文件
info.setMp4File(item.getMp4File());//视频文件

View File

@ -25,12 +25,8 @@
<result property="serviceAttributeName" column="serviceAttributeName"/>
<result property="tollPrice" column="toll_price"/>
<result property="comPrice" column="com_price"/>
<result property="izReimbursement" column="iz_reimbursement"/>
<result property="izPreferential" column="iz_preferential"/>
<result property="chargingFrequency" column="charging_frequency"/>
<result property="serviceContent" column="service_content"/>
<result property="serviceDuration" column="service_duration"/>
<result property="timeoutDuration" column="directive_timeout_duration"/>
<result property="izEnabled" column="directive_iz_enabled"/>
<result property="delFlag" column="directive_del_flag"/>
<result property="createBy" column="directive_create_by"/>
@ -45,33 +41,6 @@
<result property="typeName" column="cst_type_name"/>
<result property="previewFile" column="preview_file"/>
<result property="immediateFile" column="immediate_file"/>
<!-- 关联的体型标签列表 -->
<collection property="bodyTagList" ofType="com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag">
<id property="id" column="bodytag_id"/>
<result property="tagName" column="bodytag_name"/>
<result property="sort" column="bodytag_sort"/>
<result property="izEnabled" column="bodytag_iz_enabled"/>
<result property="delFlag" column="bodytag_del_flag"/>
<result property="createBy" column="bodytag_create_by"/>
<result property="createTime" column="bodytag_create_time"/>
<result property="updateBy" column="bodytag_update_by"/>
<result property="updateTime" column="bodytag_update_time"/>
<result property="sysOrgCode" column="bodytag_sys_org_code"/>
</collection>
<!-- 关联的情绪标签列表 -->
<collection property="emotionTagList"
ofType="com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag">
<id property="id" column="emotag_id"/>
<result property="tagName" column="emotag_name"/>
<result property="sort" column="emotag_sort"/>
<result property="izEnabled" column="emotag_iz_enabled"/>
<result property="delFlag" column="emotag_del_flag"/>
<result property="createBy" column="emotag_create_by"/>
<result property="createTime" column="emotag_create_time"/>
<result property="updateBy" column="emotag_update_by"/>
<result property="updateTime" column="emotag_update_time"/>
<result property="sysOrgCode" column="emotag_sys_org_code"/>
</collection>
</collection>
</resultMap>
@ -97,12 +66,8 @@
case csd.service_attribute when 'ds' then '定时' when 'js' then '计时' else null end as serviceAttributeName,
csd.toll_price,
csd.com_price,
csd.iz_reimbursement,
csd.iz_preferential,
csd.charging_frequency,
csd.service_content,
csd.service_duration,
csd.timeout_duration as directive_timeout_duration,
csd.iz_enabled AS directive_iz_enabled,
csd.del_flag AS directive_del_flag,
csd.create_by AS directive_create_by,
@ -114,26 +79,6 @@
csd.mp4_file,
csd.preview_file,
csd.immediate_file,
cdbt.id AS bodytag_id,
cdbt.tag_name as bodytag_name,
cdbt.sort AS bodytag_sort,
cdbt.iz_enabled AS bodytag_iz_enabled,
cdbt.del_flag AS bodytag_del_flag,
cdbt.create_by AS bodytag_create_by,
cdbt.create_time AS bodytag_create_time,
cdbt.update_by AS bodytag_update_by,
cdbt.update_time AS bodytag_update_time,
cdbt.sys_org_code AS bodytag_sys_org_code,
cdet.id AS emotag_id,
cdet.tag_name as emotag_name,
cdet.sort AS emotag_sort,
cdet.iz_enabled AS emotag_iz_enabled,
cdet.del_flag AS emotag_del_flag,
cdet.create_by AS emotag_create_by,
cdet.create_time AS emotag_create_time,
cdet.update_by AS emotag_update_by,
cdet.update_time AS emotag_update_time,
cdet.sys_org_code AS emotag_sys_org_code,
csi.instruction_name AS csi_instruction_name,
csc.category_name AS csc_category_name,
cst.type_name AS cst_type_name
@ -148,10 +93,6 @@
) dp
LEFT JOIN nu_service_tag_info sd ON dp.id = sd.tag_id
LEFT JOIN nu_config_service_directive csd ON sd.directive_id = csd.id
LEFT JOIN nu_directive_body_tag dbt ON csd.id = dbt.directive_id
LEFT JOIN nu_config_body_tag cdbt ON dbt.tag_id = cdbt.id
LEFT JOIN nu_directive_emotion_tag det ON csd.id = det.directive_id
LEFT JOIN nu_config_emotion_tag cdet ON det.tag_id = cdet.id
LEFT JOIN nu_config_service_instruction_tag csi ON csd.instruction_tag_id = csi.id
LEFT JOIN nu_config_service_category csc ON csd.category_id = csc.id
LEFT JOIN nu_config_service_type cst ON csd.type_id = cst.id

View File

@ -4,16 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag;
import com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag;
import com.nu.modules.config.servicedirective.entity.ConfigServiceDirective;
import com.nu.modules.config.servicetag.entity.ServiceTag;
import com.nu.modules.config.servicetag.mapper.ServiceTagMapper;
import com.nu.modules.config.servicetag.service.IServiceTagService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Description: 服务标签
@ -33,23 +29,6 @@ public class ServiceTagServiceImpl extends ServiceImpl<ServiceTagMapper, Service
@Override
public void queryList(ServiceTag serviceTag, IPage<ServiceTag> pageList) {
List<ServiceTag> record = baseMapper.queryList(serviceTag,pageList.getRecords());
//将指令标签名使用逗号拼接成字符串设置到指令对象的tagsName变量中
if(record != null && !record.isEmpty()){
record.stream().forEach(l -> {
if(l.getDirectives()!=null && !l.getDirectives().isEmpty()){
List<ConfigServiceDirective> sd = l.getDirectives();
for (int i = 0; i < sd.size(); i++) {
List<DirectiveBodyTag> bodyTagList = sd.get(i).getBodyTagList();
List<String> bodyTags = bodyTagList.stream().map(t -> t.getTagName()).collect(Collectors.toList());
sd.get(i).setBodyTagsName(String.join(",",bodyTags));
List<DirectiveEmotionTag> emoTagList = sd.get(i).getEmotionTagList();
List<String> emoTags = emoTagList.stream().map(t -> t.getTagName()).collect(Collectors.toList());
sd.get(i).setEmotionTagsName(String.join(",",emoTags));
}
}
});
}
pageList.setRecords(record);
}

View File

@ -52,11 +52,6 @@ public class ConfigServiceType implements Serializable {
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private java.lang.Integer sort;
/**状态 0已授权 1未授权*/
@Excel(name = "状态 0已授权 1未授权", width = 15)
@ApiModelProperty(value = "状态 0已授权 1未授权")
@Dict(dicCode = "status")
private java.lang.String status;
/**是否启用 Y启用 N未启用*/
@Excel(name = "是否启用", width = 15)
@ApiModelProperty(value = "是否启用")

View File

@ -3,20 +3,17 @@ package com.nu.mq.directive.listener;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.nu.dto.*;
import com.nu.dto.DirectiveMQDto;
import com.nu.dto.StatusMQDto;
import com.nu.enums.MQStatus;
import com.nu.modules.config.directivetag.body.service.IDirectiveBodyTagService;
import com.nu.modules.config.directivetag.emotion.service.IDirectiveEmotionTagService;
import com.nu.modules.config.instructiontag.entity.InstructionTag;
import com.nu.modules.config.instructiontag.service.IInstructionTagService;
import com.nu.modules.mediaasyncerrorlog.service.IMediaAsyncErrorLogService;
import com.nu.modules.config.servicecategory.entity.ConfigServiceCategory;
import com.nu.modules.config.servicecategory.service.IConfigServiceCategoryService;
import com.nu.modules.config.servicedirective.entity.ConfigServiceDirective;
import com.nu.modules.config.servicedirective.service.IConfigServiceDirectiveService;
import com.nu.modules.config.servicetype.entity.ConfigServiceType;
import com.nu.modules.config.servicetype.service.IConfigServiceTypeService;
import com.nu.modules.sysconfig.service.ISysConfigService;
import com.nu.utils.RabbitMQUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
@ -26,7 +23,6 @@ import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -39,21 +35,9 @@ import java.util.stream.Collectors;
@Component
public class DirectiveMQListener {
@Value("${jeecg.path.upload}")
private String upLoadPath;
// @Autowired
// private IMediaManageApi mediaManageApi;
@Autowired
private ISysConfigService sysConfigService;
@Autowired
private IMediaAsyncErrorLogService mediaAsyncErrorLogService;
@Autowired
private IConfigServiceDirectiveService directiveService;
@Autowired
private IDirectiveBodyTagService bodyTagService;
@Autowired
private IDirectiveEmotionTagService emotionTagService;
@Autowired
private IInstructionTagService instructionTagService;
@Autowired
private IConfigServiceCategoryService serviceCategoryService;
@ -70,8 +54,6 @@ public class DirectiveMQListener {
try {
//增量处理数据
handleIncremental(dto);
//数据处理出错的话就不能继续处理指令资源了 所以方法放到这个位置
// handleCreateMedia(dto);
} catch (Exception e) {
e.printStackTrace();
//返回错误日志
@ -125,165 +107,18 @@ public class DirectiveMQListener {
//拉取媒体资源至本地目录
{
// //接口协议域名+上下文访问路径
// String baseUrl = dto.getApi();
//
// //处理服务指令图片大图
// if (StringUtils.isNotBlank(dto.getPreviewFileMd5()) && !dto.getPreviewFileMd5().equals(currentDirective.getPreviewFileMd5())) {
// String previewFile = dto.getPreviewFile();
// if (StringUtils.isNotBlank(previewFile)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(previewFile, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = previewFile.substring(0, previewFile.lastIndexOf("/"));
// String fileName = previewFile.substring(previewFile.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片大图
configServiceDirective.setPreviewFileMd5(dto.getPreviewFileMd5());
// } catch (Exception e) {
// e.printStackTrace();
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(previewFile);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// throw new RuntimeException("服务指令图片大图文件拉取错误,指令id" + dto.getId());
// }
// }
// }
//处理服务指令图片小图
// if (StringUtils.isNotBlank(dto.getPreviewFileSmallMd5()) && !dto.getPreviewFileSmallMd5().equals(currentDirective.getPreviewFileSmallMd5())) {
// String previewFileSmall = dto.getPreviewFileSmall();
// if (StringUtils.isNotBlank(previewFileSmall)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(previewFileSmall, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = previewFileSmall.substring(0, previewFileSmall.lastIndexOf("/"));
// String fileName = previewFileSmall.substring(previewFileSmall.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setPreviewFileSmall(dto.getPreviewFileSmall());//服务指令图片小图
configServiceDirective.setPreviewFileSmallMd5(dto.getPreviewFileSmallMd5());
// } catch (Exception e) {
// e.printStackTrace();
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(previewFileSmall);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// throw new RuntimeException("服务指令图片小图文件拉取错误,指令id" + dto.getId());
// }
// }
// }
//处理即时指令图标
// if (StringUtils.isNotBlank(dto.getImmediateFileMd5()) && !dto.getImmediateFileMd5().equals(currentDirective.getImmediateFileMd5())) {
// String immediateFile = dto.getImmediateFile();
// if (StringUtils.isNotBlank(immediateFile)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(immediateFile, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = immediateFile.substring(0, immediateFile.lastIndexOf("/"));
// String fileName = immediateFile.substring(immediateFile.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setImmediateFile(dto.getImmediateFile());//即时指令图标
configServiceDirective.setImmediateFileMd5(dto.getImmediateFileMd5());
// } catch (Exception e) {
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(immediateFile);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// e.printStackTrace();
// throw new RuntimeException("即时指令图标文件拉取错误,指令id" + dto.getId());
// }
// }
// }
//处理即时指令焦点图标
// if (StringUtils.isNotBlank(dto.getImmediateFileFocusMd5()) && !dto.getImmediateFileFocusMd5().equals(currentDirective.getImmediateFileFocusMd5())) {
// String immediateFileFocus = dto.getImmediateFileFocus();
// if (StringUtils.isNotBlank(immediateFileFocus)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(immediateFileFocus, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = immediateFileFocus.substring(0, immediateFileFocus.lastIndexOf("/"));
// String fileName = immediateFileFocus.substring(immediateFileFocus.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setImmediateFileFocus(dto.getImmediateFileFocus());//即时指令图标
configServiceDirective.setImmediateFileFocusMd5(dto.getImmediateFileFocusMd5());
// } catch (Exception e) {
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(immediateFileFocus);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// e.printStackTrace();
// throw new RuntimeException("即时指令焦点图标文件拉取错误,指令id" + dto.getId());
// }
// }
// }
//处理指令音频文件
// if (StringUtils.isNotBlank(dto.getMp3FileMd5()) && !dto.getMp3FileMd5().equals(currentDirective.getMp3FileMd5())) {
// String mp3File = dto.getMp3File();
// if (StringUtils.isNotBlank(mp3File)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(mp3File, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = mp3File.substring(0, mp3File.lastIndexOf("/"));
// String fileName = mp3File.substring(mp3File.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setMp3File(dto.getMp3File());//指令音频文件
configServiceDirective.setMp3FileMd5(dto.getMp3FileMd5());
// } catch (Exception e) {
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(mp3File);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// e.printStackTrace();
// throw new RuntimeException("指令音频文件拉取错误,指令id" + dto.getId());
// }
// }
// }
//处理指令视频文件
// if (StringUtils.isNotBlank(dto.getMp4FileMd5()) && !dto.getMp4FileMd5().equals(currentDirective.getMp4FileMd5())) {
// String mp4File = dto.getMp4File();
// if (StringUtils.isNotBlank(mp4File)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(mp4File, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = mp4File.substring(0, mp4File.lastIndexOf("/"));
// String fileName = mp4File.substring(mp4File.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setMp4File(dto.getMp4File());//指令视频文件
configServiceDirective.setMp4FileMd5(dto.getMp4FileMd5());
// } catch (Exception e) {
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(mp4File);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// e.printStackTrace();
// throw new RuntimeException("指令视频文件拉取错误,指令id" + dto.getId());
// }
// }
// }
configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片大图
configServiceDirective.setPreviewFileMd5(dto.getPreviewFileMd5());
configServiceDirective.setPreviewFileSmall(dto.getPreviewFileSmall());//服务指令图片小图
configServiceDirective.setPreviewFileSmallMd5(dto.getPreviewFileSmallMd5());
configServiceDirective.setImmediateFile(dto.getImmediateFile());//即时指令图标
configServiceDirective.setImmediateFileMd5(dto.getImmediateFileMd5());
configServiceDirective.setImmediateFileFocus(dto.getImmediateFileFocus());//即时指令图标
configServiceDirective.setImmediateFileFocusMd5(dto.getImmediateFileFocusMd5());
configServiceDirective.setMp3File(dto.getMp3File());//指令音频文件
configServiceDirective.setMp3FileMd5(dto.getMp3FileMd5());
configServiceDirective.setMp4File(dto.getMp4File());//指令视频文件
configServiceDirective.setMp4FileMd5(dto.getMp4FileMd5());
directiveService.updateById(configServiceDirective);
}
});
@ -306,241 +141,6 @@ public class DirectiveMQListener {
}
}
// @RabbitListener(
// bindings = @QueueBinding(
// value = @Queue(name = "#{directiveAsyncDQNP.getAuditResultQueueName()}"),
// exchange = @Exchange(name = "hldy.directive", type = ExchangeTypes.DIRECT),
// key = "#{directiveAsyncDQNP.getAuditResultKeyName()}"
// ),
// errorHandler = "directiveMQErrorHandler"
// )
// public void handleAuditResult(DirectiveAsyncMQDto dto) {
// //将字典项更新为已授权
// directiveService.auditPass(dto);
// //更新服务指令状态
// ConfigServiceDirective configServiceDirective = new ConfigServiceDirective();
// configServiceDirective.setId(dto.getId());
// configServiceDirective.setStatus(dto.getStatus());
// directiveService.updateById(configServiceDirective);
// }
//
// @RabbitListener(
// bindings = @QueueBinding(
// value = @Queue(name = "#{directiveAsyncDQNP.getCreateMediaQueueName()}"),
// exchange = @Exchange(name = "hldy.directive", type = ExchangeTypes.DIRECT),
// key = "#{directiveAsyncDQNP.getCreateMediaKeyName()}"
// ),
// errorHandler = "directiveMQErrorHandler"
// )
// public void handleCreateMedia(DirectiveAsyncMQDto dto) {
// //更新服务指令媒体资源字段
// ConfigServiceDirective configServiceDirective = new ConfigServiceDirective();
// configServiceDirective.setId(dto.getId());
// configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片
// configServiceDirective.setServiceContent(dto.getServiceContent());//服务指令说明
// configServiceDirective.setImmediateFile(dto.getImmediateFile());//即时指令图标
// configServiceDirective.setMp3File(dto.getMp3File());//指令音频文件
// configServiceDirective.setMp4File(dto.getMp4File());//指令视频文件
// directiveService.updateById(configServiceDirective);
//
// //拉取媒体资源至本地目录
// {
// LambdaQueryWrapper<SysConfig> qw = new LambdaQueryWrapper<>();
// qw.eq(SysConfig::getDelFlag, "0");
// qw.eq(SysConfig::getConfigKey, "ope_open_url");
// SysConfig urlObj = sysConfigService.getOne(qw);
// //试验田协议+域名/ip+端口
// String baseUrl = urlObj.getConfigValue();
// if (baseUrl.endsWith("/")) {
// baseUrl = baseUrl.substring(0, baseUrl.length() - 1); // 移除末尾斜杠
// }
//
// //处理服务指令图片
// String previewFile = dto.getPreviewFile();
// if (StringUtils.isNotBlank(previewFile)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(previewFile, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = previewFile.substring(0, previewFile.lastIndexOf("/"));
// String fileName = previewFile.substring(previewFile.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
// } catch (Exception e) {
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(previewFile);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// e.printStackTrace();
// throw new RuntimeException(e);
// }
// }
// //处理即时指令图标
// String immediateFile = dto.getImmediateFile();
// if (StringUtils.isNotBlank(immediateFile)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(immediateFile, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = immediateFile.substring(0, immediateFile.lastIndexOf("/"));
// String fileName = immediateFile.substring(immediateFile.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
// } catch (Exception e) {
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(immediateFile);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// e.printStackTrace();
// throw new RuntimeException(e);
// }
// }
// //处理指令音频文件
// String mp3File = dto.getMp3File();
// if (StringUtils.isNotBlank(mp3File)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(mp3File, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = mp3File.substring(0, mp3File.lastIndexOf("/"));
// String fileName = mp3File.substring(mp3File.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
// } catch (Exception e) {
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(mp3File);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// e.printStackTrace();
// throw new RuntimeException(e);
// }
// }
// //处理指令视频文件
// String mp4File = dto.getMp4File();
// if (StringUtils.isNotBlank(mp4File)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(mp4File, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = mp4File.substring(0, mp4File.lastIndexOf("/"));
// String fileName = mp4File.substring(mp4File.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
// } catch (Exception e) {
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(mp4File);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// e.printStackTrace();
// throw new RuntimeException(e);
// }
// }
// }
// }
// /**
// * if 未到运营开始时间时 全量变更
// * else 增量
// *
// * <p>
// * 具体逻辑说明
// * ->全量同步<-
// * 1未到运营开始时间时dto.isIzInc()为false时
// * 1先将所有相关指令字典表主表关系表数据全部删除后增加
// * 2将指令主表数据增加进去
// * <p>
// * ->增量同步<-
// * 增量时前台操作同步功能 只会在原基础上新增 不存在移除的情况
// * 2已到运营开始时间dto.isIzInc()为true时
// * 1)传过来的id是所有服务指令的id 需要处理只保留新增部分对应的id
// * 2)将新增的指令对应的字典表关系表数据增加进去
// * 3将新增的指令数据增加进去
// *
// * @param dto
// */
// @RabbitListener(
// bindings = @QueueBinding(
// value = @Queue(name = "#{directiveAsyncDQNP.getQueueName()}"),
// exchange = @Exchange(name = "hldy.fwzl", type = ExchangeTypes.DIRECT),
// key = "#{directiveAsyncDQNP.getKeyName()}"
// ),
// errorHandler = "directiveMQErrorHandler"
// )
// @DSTransactional(rollbackFor = {Exception.class})
// public void handleMessage(DirectiveMQDto dto) {
// try {
// if (!dto.isIzInc()) {
// //全量
// handleQuantity(dto);
// } else {
// //增量
// handleIncremental(dto);
// }
// StatusMQDto statusMQDto = new StatusMQDto();
// statusMQDto.setStatus(MQStatus.SUCCESS.getCode());
// statusMQDto.setMessage("数据同步成功!");
// statusMQDto.setAsyncId(dto.getAsyncId());
// statusMQDto.setCode("data");
// rabbitMQUtil.sendToExchange("hldy.fwzl", "fwzl.async.result", statusMQDto);
// } catch (Exception e) {
// StatusMQDto statusMQDto = new StatusMQDto();
// statusMQDto.setStatus(MQStatus.PROCESS_FAILED.getCode());
// statusMQDto.setMessage(e.getMessage());
// statusMQDto.setAsyncId(dto.getAsyncId());
// statusMQDto.setCode("data");
// rabbitMQUtil.sendToExchange("hldy.fwzl", "fwzl.async.result", statusMQDto);
// throw new RuntimeException(e);
// }
// try {
// //处理文件同步
// handleFileAsync(dto);
// StatusMQDto statusMQDto = new StatusMQDto();
// statusMQDto.setStatus(MQStatus.SUCCESS.getCode());
// statusMQDto.setMessage("数据同步成功!");
// statusMQDto.setAsyncId(dto.getAsyncId());
// statusMQDto.setCode("file");
// rabbitMQUtil.sendToExchange("hldy.fwzl", "fwzl.async.result", statusMQDto);
// } catch (Exception e) {
// StatusMQDto statusMQDto = new StatusMQDto();
// statusMQDto.setStatus(MQStatus.PROCESS_FAILED.getCode());
// statusMQDto.setMessage("【文件同步失败请至“服务指令更新功能”重新同步】" + e.getMessage());
// statusMQDto.setAsyncId(dto.getAsyncId());
// statusMQDto.setCode("file");
// rabbitMQUtil.sendToExchange("hldy.fwzl", "fwzl.async.result", statusMQDto);
// throw new RuntimeException(e);
// }
// }
//
// /**
// * 处理全量同步数据
// *
// * @param dto
// */
// private void handleQuantity(DirectiveMQDto dto) {
// //全量移除所有服务指令主表服务指令各字典主表中间关系表数据
// directiveService.removeAll();
// //体型标签
// bodyTagService.removeAllRelation();
// //情绪标签
// emotionTagService.removeAllRelation();
// //服务类别
// serviceCategoryService.removeAll();
// //服务类型
// serviceTypeService.removeAll();
//
// dto.setIdList(Arrays.asList(dto.getIdStr().split(",")));
//
// handleData(dto);
// }
//
/**
* 处理增量同步数据
@ -583,20 +183,6 @@ public class DirectiveMQListener {
//获取到需要新增的指令集合
for (ConfigServiceDirective directive : allData) {
if (needAddIds.contains(directive.getId())) {
//这里都是新增的指令 不存储指令资源字段 在指令资源mq中会存储这个值
// directive.setPreviewFile(null);
// directive.setPreviewFileSmall(null);
// directive.setImmediateFile(null);
// directive.setImmediateFileFocus(null);
// directive.setMp3File(null);
// directive.setMp4File(null);
// directive.setServiceContent(null);
// directive.setPreviewFileMd5(null);
// directive.setPreviewFileSmallMd5(null);
// directive.setImmediateFileMd5(null);
// directive.setImmediateFileFocusMd5(null);
// directive.setMp3FileMd5(null);
// directive.setMp4FileMd5(null);
needAddDirectiveList.add(directive);
}
}
@ -605,88 +191,6 @@ public class DirectiveMQListener {
directiveService.insertAllDirectives(needAddDirectiveList);
}
}
//体型标签
// {
// //处理体型标签字典主表
// if (dto.getBodyTagList() != null) {
// //已经存在的体型标签id
// List<String> existedIds = Lists.newArrayList();
// //获取到已经存在的体型标签数据
// if (dto.isIzInc()) {
// List<DirectiveBodyTag> list = bodyTagService.list();
// existedIds = list.stream().map(DirectiveBodyTag::getId).collect(Collectors.toList());
// }
// //传过来的全部体型标签主表数据
// List<DirectiveBodyTag> allData = BeanUtil.copyToList(dto.getBodyTagList(), DirectiveBodyTag.class);
// //需要新增的体型标签字典表数据
// List<DirectiveBodyTag> needAddBodyList = new ArrayList<>();
// //获取到需要新增的体型标签字典表数据
// for (DirectiveBodyTag body : allData) {
// if (!existedIds.contains(body.getId())) {
// needAddBodyList.add(body);
// }
// }
// if (needAddBodyList != null && !needAddBodyList.isEmpty()) {
// bodyTagService.insertAll(needAddBodyList);
// }
// }
// //中间关系表
// {
// List<DirectiveBodyTagRelation> bodyRelations = Lists.newArrayList();//关系表
// needAddDirectiveList.stream().forEach(d -> {
// String bodyTags = d.getBodyTags();
// if (StringUtils.isNotBlank(bodyTags)) {
// Arrays.stream(bodyTags.split(",")).forEach(bi -> {
// DirectiveBodyTagRelation r = new DirectiveBodyTagRelation();
// r.setDirectiveId(d.getId());
// r.setTagId(bi);
// bodyRelations.add(r);
// });
// }
// });
// bodyTagService.insertAllRelation(bodyRelations);
// }
// }
//情绪标签
// {
// if (dto.getEmotionTagList() != null) {
// //需要排除的情绪标签id
// List<String> existedIds = Lists.newArrayList();
// if (dto.isIzInc()) {
// List<DirectiveEmotionTag> list = emotionTagService.list();
// existedIds = list.stream().map(DirectiveEmotionTag::getId).collect(Collectors.toList());
// }
// //传来的所有数据
// List<DirectiveEmotionTag> allData = BeanUtil.copyToList(dto.getEmotionTagList(), DirectiveEmotionTag.class);
//
// //需要新增的数据
// List<DirectiveEmotionTag> needAddData = new ArrayList<>();//字典表
// for (DirectiveEmotionTag emotion : allData) {
// if (!existedIds.contains(emotion.getId())) {
// needAddData.add(emotion); // 如果不在排除列表里就加入结果
// }
// }
// if (needAddData != null && !needAddData.isEmpty()) {
// emotionTagService.insertAll(needAddData);
// }
// }
// //中间关系表
// {
// List<DirectiveEmotionTagRelation> emotionRelations = Lists.newArrayList();//关系表
// needAddDirectiveList.stream().forEach(d -> {
// String emotionTags = d.getEmotionTags();
// if (StringUtils.isNotBlank(emotionTags)) {
// Arrays.stream(emotionTags.split(",")).forEach(bi -> {
// DirectiveEmotionTagRelation r = new DirectiveEmotionTagRelation();
// r.setDirectiveId(d.getId());
// r.setTagId(bi);
// emotionRelations.add(r);
// });
// }
// });
// emotionTagService.insertAllRelation(emotionRelations);
// }
// }
//分类标签
if (dto.getInstructionList() != null) {
//需要排除的分类标签id
@ -726,7 +230,7 @@ public class DirectiveMQListener {
for (ConfigServiceCategory category : allData) {
if (!existedIds.contains(category.getId())) {
needAddData.add(category);
}else{
} else {
needUpdateData.add(category);
}
}
@ -761,133 +265,6 @@ public class DirectiveMQListener {
}
}
}
//
// /**
// * 处理文件同步
// *
// * @param dto
// */
// private void handleFileAsync(DirectiveMQDto dto) {
// dto.setIdList(Arrays.asList(dto.getIdStr().split(",")));
// if (dto.getIdList() == null || dto.getIdList().isEmpty()) {
// return;
// }
// List<JSONObject> objs = directiveService.selectMediaList("nuro", dto.getIdList());
// if (CollectionUtils.isEmpty(objs)) {
// return;
// }
// //试验田对应服务指令下的媒体资源
// List<MediaManageDto> mediaList = directiveService.selectMediaList("nuro", dto.getIdList())
// .stream()
// .map(json -> JSONUtil.toBean(json, MediaManageDto.class))
// .collect(Collectors.toList());
//
// //获取机构下媒资数据
// List<String> mediaIds = mediaList.stream()
// .map(MediaManageDto::getId)
// .collect(Collectors.toList());
// List<JSONObject> jsonObjects = mediaManageApi.queryByIds(mediaIds);
// Map<String, JSONObject> map = Maps.newHashMap();
// if (jsonObjects != null && !jsonObjects.isEmpty()) {
// jsonObjects.stream().forEach(j -> {
// map.put(j.getStr("id"), j);
// });
// }
//
// //map是运维系统媒体资源数据 m是试验田的媒体资源数据
// mediaList.stream().forEach(m -> {
// if (map.get(m.getId()) != null) {
// //处理同一条数据
// JSONObject enty = map.get(m.getId());
// MediaManage yewu = new MediaManage();//业务
// BeanUtils.copyProperties(m, yewu);
// MediaManage yunwei = new MediaManage();//运维
// yunwei.setId(enty.getStr("id"));
// yunwei.setName(enty.getStr("name"));
// yunwei.setDescr(enty.getStr("descr"));
// yunwei.setFileType(enty.getStr("fileType"));
// yunwei.setSysFunc(enty.getStr("sysFunc"));
// yunwei.setFilePath(enty.getStr("filePath"));
// yunwei.setIzNetUrl(enty.getStr("izNetUrl"));
// yunwei.setDelFlag(enty.getStr("delFlag"));
// yunwei.setCreateBy(enty.getStr("createBy"));
// yunwei.setCreateTime(enty.getDate("createTime"));
// yunwei.setUpdateBy(enty.getStr("updateBy"));
// yunwei.setUpdateTime(enty.getDate("updateTime"));
// //存储数据
// if (!yewu.equals(yunwei)) {
// mediaManageApi.saveOrUpdate(m, false);
// }
// //存储文件
// if (!yunwei.getFilePath().equals(m.getFilePath())) {
// handleSaveFile(m);
// }
// } else {
// //新增数据
// mediaManageApi.saveOrUpdate(m, true);
// handleSaveFile(m);
// }
// });
// }
//
// /**
// * 处理文件存储
// *
// * @param media
// */
// private void handleSaveFile(MediaManageDto media) {
// try {
// LambdaQueryWrapper<SysConfig> qw = new LambdaQueryWrapper<>();
// qw.eq(SysConfig::getDelFlag, "0");
// qw.eq(SysConfig::getConfigKey, "directive_source_url");
// SysConfig urlObj = sysConfigService.getOne(qw);
// //试验田协议+域名/ip+端口
// String baseUrl = urlObj.getConfigValue();
// if (baseUrl.endsWith("/")) {
// baseUrl = baseUrl.substring(0, baseUrl.length() - 1); // 移除末尾斜杠
// }
// //通过系统上传的文件
// if ("local".equals(media.getIzNetUrl())) {
// qw = new LambdaQueryWrapper<>();
// qw.eq(SysConfig::getDelFlag, "0");
// qw.eq(SysConfig::getConfigKey, "directive_source_name");
// SysConfig nameObj = sysConfigService.getOne(qw);
// //获取到对应试验田的服务名 用于通过接口获取对应媒体资源文件
// String servName = nameObj.getConfigValue();
// if (servName.startsWith("/")) {
// servName = servName.substring(1);
// }
// //协议域名服务名
// String url = baseUrl + "/" + servName + "/sys/common/open/static/" + media.getFilePath() + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = media.getFilePath();
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath.substring(0, filePath.lastIndexOf("/")), media.getFilePath().substring(media.getFilePath().lastIndexOf("/") + 1));
// }
// //存储到媒体资源公共目录中的媒体资源 通过nginx可以访问的静态资源
// if ("net".equals(media.getIzNetUrl())) {
// String filePath = media.getFilePath();
// if (filePath.startsWith("/")) {
// filePath = filePath.substring(1);
// }
// String url = baseUrl + "/" + filePath;
// if (directiveUpLoadPath.endsWith("/") || directiveUpLoadPath.endsWith("\\")) {
// directiveUpLoadPath = directiveUpLoadPath.substring(0, directiveUpLoadPath.length() - 1);
// }
// FileDownloader.downloadFile(url, directiveUpLoadPath, media.getFilePath().substring(media.getFilePath().lastIndexOf("/") + 1));
// }
// } catch (Exception e) {
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(media.getId());
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// e.printStackTrace();
// throw new RuntimeException(e);
// }
// }
@DS("master")
public void handleIncremental2(DirectiveMQDto dto) {
@ -919,171 +296,24 @@ public class DirectiveMQListener {
//更新服务指令媒体资源字段
ConfigServiceDirective configServiceDirective = new ConfigServiceDirective();
log.info("======>>{}",dto.getId());
log.info("======>>{}", dto.getId());
configServiceDirective.setId(dto.getId());
configServiceDirective.setServiceContent(dto.getServiceContent());//服务指令说明
//拉取媒体资源至本地目录
{
//接口协议域名+上下文访问路径
String baseUrl = apiAddress;
//处理服务指令图片大图
// if (StringUtils.isNotBlank(dto.getPreviewFileMd5()) && !dto.getPreviewFileMd5().equals(currentDirective.getPreviewFileMd5())) {
// String previewFile = dto.getPreviewFile();
// if (StringUtils.isNotBlank(previewFile)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(previewFile, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = previewFile.substring(0, previewFile.lastIndexOf("/"));
// String fileName = previewFile.substring(previewFile.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片大图
configServiceDirective.setPreviewFileMd5(dto.getPreviewFileMd5());
// } catch (Exception e) {
// e.printStackTrace();
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(previewFile);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// throw new RuntimeException("服务指令图片大图文件拉取错误,指令id" + dto.getId());
// }
// }
// }
//处理服务指令图片小图
// if (StringUtils.isNotBlank(dto.getPreviewFileSmallMd5()) && !dto.getPreviewFileSmallMd5().equals(currentDirective.getPreviewFileSmallMd5())) {
// String previewFileSmall = dto.getPreviewFileSmall();
// if (StringUtils.isNotBlank(previewFileSmall)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(previewFileSmall, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = previewFileSmall.substring(0, previewFileSmall.lastIndexOf("/"));
// String fileName = previewFileSmall.substring(previewFileSmall.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setPreviewFileSmall(dto.getPreviewFileSmall());//服务指令图片小图
configServiceDirective.setPreviewFileSmallMd5(dto.getPreviewFileSmallMd5());
// } catch (Exception e) {
// e.printStackTrace();
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(previewFileSmall);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// throw new RuntimeException("服务指令图片小图文件拉取错误,指令id" + dto.getId());
// }
// }
// }
//处理即时指令图标
// if (StringUtils.isNotBlank(dto.getImmediateFileMd5()) && !dto.getImmediateFileMd5().equals(currentDirective.getImmediateFileMd5())) {
// String immediateFile = dto.getImmediateFile();
// if (StringUtils.isNotBlank(immediateFile)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(immediateFile, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = immediateFile.substring(0, immediateFile.lastIndexOf("/"));
// String fileName = immediateFile.substring(immediateFile.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setImmediateFile(dto.getImmediateFile());//即时指令图标
configServiceDirective.setImmediateFileMd5(dto.getImmediateFileMd5());
// } catch (Exception e) {
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(immediateFile);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// e.printStackTrace();
// throw new RuntimeException("即时指令图标文件拉取错误,指令id" + dto.getId());
// }
// }
// }
//处理即时指令焦点图标
// if (StringUtils.isNotBlank(dto.getImmediateFileFocusMd5()) && !dto.getImmediateFileFocusMd5().equals(currentDirective.getImmediateFileFocusMd5())) {
// String immediateFileFocus = dto.getImmediateFileFocus();
// if (StringUtils.isNotBlank(immediateFileFocus)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(immediateFileFocus, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = immediateFileFocus.substring(0, immediateFileFocus.lastIndexOf("/"));
// String fileName = immediateFileFocus.substring(immediateFileFocus.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setImmediateFileFocus(dto.getImmediateFileFocus());//即时指令图标
configServiceDirective.setImmediateFileFocusMd5(dto.getImmediateFileFocusMd5());
// } catch (Exception e) {
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(immediateFileFocus);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// e.printStackTrace();
// throw new RuntimeException("即时指令图标文件拉取错误,指令id" + dto.getId());
// }
// }
// }
//处理指令音频文件
// if (StringUtils.isNotBlank(dto.getMp3FileMd5()) && !dto.getMp3FileMd5().equals(currentDirective.getMp3FileMd5())) {
// String mp3File = dto.getMp3File();
// if (StringUtils.isNotBlank(mp3File)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(mp3File, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = mp3File.substring(0, mp3File.lastIndexOf("/"));
// String fileName = mp3File.substring(mp3File.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setMp3File(dto.getMp3File());//指令音频文件
configServiceDirective.setMp3FileMd5(dto.getMp3FileMd5());
// } catch (Exception e) {
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(mp3File);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// e.printStackTrace();
// throw new RuntimeException("指令音频文件拉取错误,指令id" + dto.getId());
// }
// }
// }
//处理指令视频文件
// if (StringUtils.isNotBlank(dto.getMp4FileMd5()) && !dto.getMp4FileMd5().equals(currentDirective.getMp4FileMd5())) {
// String mp4File = dto.getMp4File();
// if (StringUtils.isNotBlank(mp4File)) {
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(mp4File, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
// }
// String filePath = mp4File.substring(0, mp4File.lastIndexOf("/"));
// String fileName = mp4File.substring(mp4File.lastIndexOf("/") + 1);
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
// filePath = filePath.substring(1);
// }
// try {
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setMp4File(dto.getMp4File());//指令视频文件
configServiceDirective.setMp4FileMd5(dto.getMp4FileMd5());
// } catch (Exception e) {
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
// mediaAsyncErrorLog.setMediaid(mp4File);
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
// e.printStackTrace();
// throw new RuntimeException("指令视频文件拉取错误,指令id" + dto.getId());
// }
// }
// }
configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片大图
configServiceDirective.setPreviewFileMd5(dto.getPreviewFileMd5());
configServiceDirective.setPreviewFileSmall(dto.getPreviewFileSmall());//服务指令图片小图
configServiceDirective.setPreviewFileSmallMd5(dto.getPreviewFileSmallMd5());
configServiceDirective.setImmediateFile(dto.getImmediateFile());//即时指令图标
configServiceDirective.setImmediateFileMd5(dto.getImmediateFileMd5());
configServiceDirective.setImmediateFileFocus(dto.getImmediateFileFocus());//即时指令图标
configServiceDirective.setImmediateFileFocusMd5(dto.getImmediateFileFocusMd5());
configServiceDirective.setMp3File(dto.getMp3File());//指令音频文件
configServiceDirective.setMp3FileMd5(dto.getMp3FileMd5());
configServiceDirective.setMp4File(dto.getMp4File());//指令视频文件
configServiceDirective.setMp4FileMd5(dto.getMp4FileMd5());
directiveService.updateById(configServiceDirective);
}
});