系统数据字典(临时提交)
This commit is contained in:
parent
d6ba60f650
commit
23664de890
|
@ -1,47 +1,22 @@
|
|||
package com.nu.modules.NuBizNuCustomerServer.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import com.nu.modules.NuBizNuCustomerServer.entity.NuBizNuCustomerServer;
|
||||
import com.nu.modules.NuBizNuCustomerServer.service.INuBizNuCustomerServerService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 护理单元客户配置服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
@ -52,7 +27,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||
public class NuBizNuCustomerServerController extends JeecgController<NuBizNuCustomerServer, INuBizNuCustomerServerService> {
|
||||
@Autowired
|
||||
private INuBizNuCustomerServerService nuBizNuCustomerServerService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
|
@ -66,7 +41,7 @@ public class NuBizNuCustomerServerController extends JeecgController<NuBizNuCust
|
|||
List<Map<String,Object>> pageList = nuBizNuCustomerServerService.getNclist(nuBizNuCustomerServer);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
|
@ -81,7 +56,7 @@ public class NuBizNuCustomerServerController extends JeecgController<NuBizNuCust
|
|||
NuBizNuCustomerServer retText = nuBizNuCustomerServerService.addNuCustomerServer(nuBizNuCustomerServer);
|
||||
return Result.OK(retText);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
|
@ -96,7 +71,7 @@ public class NuBizNuCustomerServerController extends JeecgController<NuBizNuCust
|
|||
NuBizNuCustomerServer retJson = nuBizNuCustomerServerService.editNuCustomerServer(nuBizNuCustomerServer);
|
||||
return Result.OK(retJson);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
|
@ -111,7 +86,7 @@ public class NuBizNuCustomerServerController extends JeecgController<NuBizNuCust
|
|||
nuBizNuCustomerServerService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
|
|
|
@ -22,7 +22,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
/**
|
||||
* @Description: 护理单元客户配置服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
@ -86,6 +86,14 @@ public class NuBizNuCustomerServer implements Serializable {
|
|||
@Excel(name = "服务标签名称", width = 15)
|
||||
@ApiModelProperty(value = "服务标签名称")
|
||||
private java.lang.String tagName;
|
||||
/**体型标签名称*/
|
||||
@Excel(name = "体型标签名称", width = 15)
|
||||
@ApiModelProperty(value = "体型标签名称")
|
||||
private java.lang.String bodyTagName;
|
||||
/**情绪标签名称*/
|
||||
@Excel(name = "情绪标签名称", width = 15)
|
||||
@ApiModelProperty(value = "情绪标签名称")
|
||||
private java.lang.String emotionTagName;
|
||||
/**周期类型*/
|
||||
@Excel(name = "周期类型", width = 15)
|
||||
@ApiModelProperty(value = "周期类型")
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
|
||||
/**
|
||||
* @Description: 护理单元客户配置服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* @Description: 护理单元客户配置服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.*;
|
|||
|
||||
/**
|
||||
* @Description: 护理单元客户配置服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -1,47 +1,21 @@
|
|||
package com.nu.modules.nuApiServiceCategory.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import com.nu.modules.nuApiServiceCategory.entity.NuConfigServiceCategory;
|
||||
import com.nu.modules.nuApiServiceCategory.service.INuConfigServiceCategoryService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
@ -51,7 +25,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||
public class NuConfigServiceCategoryController extends JeecgController<NuConfigServiceCategory, INuConfigServiceCategoryService> {
|
||||
@Autowired
|
||||
private INuConfigServiceCategoryService nuConfigServiceCategoryService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
|
|
|
@ -22,7 +22,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -20,7 +20,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
@ -124,6 +124,10 @@ public class NuConfigServiceDirective implements Serializable {
|
|||
@ApiModelProperty(value = "视频文件")
|
||||
private java.lang.String mp4File;
|
||||
|
||||
//体型标签
|
||||
@TableField(exist = false)
|
||||
private String tagName;
|
||||
private String bodyTagName;
|
||||
//情绪标签
|
||||
@TableField(exist = false)
|
||||
private String emotionTagName;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
package com.nu.modules.nuApiServiceCategory.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.nu.modules.nuApiServiceCategory.entity.NuConfigServiceCategory;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.nuApiServiceCategory.entity.NuConfigServiceCategory;
|
||||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
package com.nu.modules.nuApiServiceCategory.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.nu.modules.nuApiServiceCategory.entity.NuConfigServiceType;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.nuApiServiceCategory.entity.NuConfigServiceType;
|
||||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -3,41 +3,44 @@
|
|||
<mapper namespace="com.nu.modules.nuApiServiceCategory.mapper.NuConfigServiceDirectiveMapper">
|
||||
|
||||
<select id="selectList" resultType="com.nu.modules.nuApiServiceCategory.entity.NuConfigServiceDirective">
|
||||
select * from (
|
||||
SELECT
|
||||
csd.id AS id,
|
||||
csd.directive_name,
|
||||
csd.category_id,
|
||||
csd.type_id,
|
||||
csd.instruction_tag_id,
|
||||
csd.toll_price,
|
||||
csd.com_price,
|
||||
csd.iz_reimbursement,
|
||||
csd.iz_preferential,
|
||||
csd.charging_frequency,
|
||||
dict.item_text AS cycle_type,
|
||||
csd.service_content,
|
||||
csd.service_duration,
|
||||
csd.iz_enabled,
|
||||
csd.del_flag,
|
||||
csd.create_by,
|
||||
csd.create_time,
|
||||
csd.update_by,
|
||||
csd.update_time,
|
||||
csd.sys_org_code,
|
||||
csd.mp3_file,
|
||||
csd.mp4_file,
|
||||
cdt.tag_name
|
||||
FROM nu_config_service_directive csd
|
||||
LEFT JOIN (
|
||||
select GROUP_CONCAT(c.tag_name) tag_name,b.directive_id from nu_directive_body_tag b
|
||||
LEFT JOIN nu_config_body_tag c on b.tag_id = c.id
|
||||
GROUP BY b.directive_id
|
||||
) cdt on csd.id = cdt.directive_id
|
||||
LEFT JOIN nu_config_service_type cst ON csd.type_id = cst.id
|
||||
LEFT JOIN (select * from sys_dict_item where dict_id = '1900374791386140674') dict on csd.cycle_type = dict.item_value
|
||||
) a
|
||||
${ew.customSqlSegment}
|
||||
select *
|
||||
from (SELECT csd.id AS id,
|
||||
csd.directive_name,
|
||||
csd.category_id,
|
||||
csd.type_id,
|
||||
csd.instruction_tag_id,
|
||||
csd.toll_price,
|
||||
csd.com_price,
|
||||
csd.iz_reimbursement,
|
||||
csd.iz_preferential,
|
||||
csd.charging_frequency,
|
||||
dict.item_text AS cycle_type,
|
||||
csd.service_content,
|
||||
csd.service_duration,
|
||||
csd.iz_enabled,
|
||||
csd.del_flag,
|
||||
csd.create_by,
|
||||
csd.create_time,
|
||||
csd.update_by,
|
||||
csd.update_time,
|
||||
csd.sys_org_code,
|
||||
csd.mp3_file,
|
||||
csd.mp4_file,
|
||||
cdt.tag_name as bodyTagName,
|
||||
cet.tag_name AS emotionTagName
|
||||
FROM nu_config_service_directive csd
|
||||
LEFT JOIN (select GROUP_CONCAT(c.tag_name) tag_name, b.directive_id
|
||||
from nu_directive_body_tag b
|
||||
LEFT JOIN nu_config_body_tag c on b.tag_id = c.id
|
||||
GROUP BY b.directive_id) cdt on csd.id = cdt.directive_id
|
||||
LEFT JOIN (select GROUP_CONCAT(c.tag_name) tag_name, b.directive_id
|
||||
from nu_directive_emotion_tag b
|
||||
LEFT JOIN nu_config_emotion_tag c on b.tag_id = c.id
|
||||
GROUP BY b.directive_id) cet on csd.id = cet.directive_id
|
||||
LEFT JOIN nu_config_service_type cst ON csd.type_id = cst.id
|
||||
LEFT JOIN (select * from sys_dict_item where dict_id = '1900374791386140674') dict
|
||||
on csd.cycle_type = dict.item_value) a
|
||||
${ew.customSqlSegment}
|
||||
|
||||
</select>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
@ -62,7 +62,9 @@ public class NuConfigServiceCategoryServiceImpl extends ServiceImpl<NuConfigServ
|
|||
directiceMap.put("levle","3");
|
||||
directiceMap.put("title",directicePar.getDirectiveName());
|
||||
directiceMap.put("serviceDuration",directicePar.getServiceDuration());
|
||||
directiceMap.put("tagName",directicePar.getTagName());
|
||||
directiceMap.put("tagName",directicePar.getBodyTagName());
|
||||
directiceMap.put("bodyTagName",directicePar.getBodyTagName());
|
||||
directiceMap.put("emotionTagName",directicePar.getEmotionTagName());
|
||||
directiceMap.put("cycleType",directicePar.getCycleType());
|
||||
directiceMapList.add(directiceMap);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: jeecg-boot
|
||||
* @Author: yangjun
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -26,7 +26,7 @@ public class RabbitMQConfig {
|
|||
return converter;
|
||||
}
|
||||
|
||||
// 交换器(以Topic为例)
|
||||
// 服务指令交换机
|
||||
@Bean
|
||||
public DirectExchange fwzlExchange() {
|
||||
return new DirectExchange("hldy.fwzl");
|
||||
|
@ -37,17 +37,14 @@ public class RabbitMQConfig {
|
|||
public Queue nu001FwzlAsyncQueue() {
|
||||
return new Queue("nu001.fwzl.async", true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue nu001FwzlStatusQueue() {
|
||||
return new Queue("nu001.fwzl.status", true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue nu002FwzlAsyncQueue() {
|
||||
return new Queue("nu002.fwzl.async", true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue nu002FwzlStatusQueue() {
|
||||
return new Queue("nu002.fwzl.status", true);
|
||||
|
@ -57,22 +54,21 @@ public class RabbitMQConfig {
|
|||
public Binding binding1(Queue nu001FwzlAsyncQueue, DirectExchange fwzlExchange) {
|
||||
return BindingBuilder.bind(nu001FwzlAsyncQueue).to(fwzlExchange).with("nu001.fwzl.async");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding binding2(Queue nu001FwzlStatusQueue, DirectExchange fwzlExchange) {
|
||||
return BindingBuilder.bind(nu001FwzlStatusQueue).to(fwzlExchange).with("nu001.fwzl.status");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding binding3(Queue nu002FwzlAsyncQueue, DirectExchange fwzlExchange) {
|
||||
return BindingBuilder.bind(nu002FwzlAsyncQueue).to(fwzlExchange).with("nu002.fwzl.async");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding binding4(Queue nu002FwzlStatusQueue, DirectExchange fwzlExchange) {
|
||||
return BindingBuilder.bind(nu002FwzlStatusQueue).to(fwzlExchange).with("nu002.fwzl.status");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//注册
|
||||
@Bean
|
||||
public DirectExchange registerExchange() {
|
||||
|
@ -83,7 +79,16 @@ public class RabbitMQConfig {
|
|||
return new Queue("register.addData", true);
|
||||
}
|
||||
@Bean
|
||||
public Binding binding5(Queue registerAddQueue, DirectExchange registerExchange) {
|
||||
public Binding bindingRegAdd(Queue registerAddQueue, DirectExchange registerExchange) {
|
||||
return BindingBuilder.bind(registerAddQueue).to(registerExchange).with("register.addData");
|
||||
}
|
||||
@Bean
|
||||
public Queue registerEditQueue() {
|
||||
return new Queue("register.editData", true);
|
||||
}
|
||||
@Bean
|
||||
public Binding bindingRegEdit(Queue registerEditQueue, DirectExchange registerExchange) {
|
||||
return BindingBuilder.bind(registerEditQueue).to(registerExchange).with("register.editData");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import java.util.List;
|
|||
public class DirectiveMQDto {
|
||||
private boolean izInc;//是否为增量 否则为全量
|
||||
private String orgCode;//机构编码
|
||||
private String idStr;
|
||||
private List<String> idList;
|
||||
private String idStr;//前台传来的所有需要新增的服务指令
|
||||
private List<String> idList;//!!实际需要新增的服务指令id
|
||||
|
||||
//同步主表id
|
||||
private String asyncId;
|
||||
|
|
|
@ -13,4 +13,7 @@ public class StatusMQDto {
|
|||
private String asyncId;
|
||||
//同步表子表code
|
||||
private String code;
|
||||
|
||||
private String dictId;
|
||||
private String orgCode;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package com.nu.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @Author zmy
|
||||
* @since 2025-5-6
|
||||
*/
|
||||
@Data
|
||||
public class SysDictItemMQDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 字典id
|
||||
*/
|
||||
private String dictId;
|
||||
|
||||
/**
|
||||
* 字典项文本
|
||||
*/
|
||||
private String itemText;
|
||||
|
||||
/**
|
||||
* 字典项值
|
||||
*/
|
||||
private String itemValue;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sortOrder;
|
||||
|
||||
|
||||
/**
|
||||
* 状态(1启用 0不启用)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 字典项颜色
|
||||
*/
|
||||
private String itemColor;
|
||||
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package com.nu.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典表
|
||||
* </p>
|
||||
*
|
||||
* @Author zmy
|
||||
* @since 2025-5-6
|
||||
*/
|
||||
@Data
|
||||
public class SysDictMQDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* [预留字段,暂时无用]
|
||||
* 字典类型,0 string,1 number类型,2 boolean
|
||||
* 前端js对stirng类型和number类型 boolean 类型敏感,需要区分。在select 标签匹配的时候会用到
|
||||
* 默认为string类型
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
private String dictName;
|
||||
|
||||
/**
|
||||
* 字典编码
|
||||
*/
|
||||
private String dictCode;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 标识
|
||||
* sys:系统字典,非客户使用字典
|
||||
* nu:业务字典,客户使用字典
|
||||
*/
|
||||
private String tag;
|
||||
|
||||
/**
|
||||
* 删除状态
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**租户ID*/
|
||||
private Integer tenantId;
|
||||
|
||||
/** 关联的低代码应用ID */
|
||||
private String lowAppId;
|
||||
|
||||
private List<SysDictItemMQDto> sysDictItemList;
|
||||
|
||||
}
|
|
@ -37,6 +37,9 @@ public class DirectivePackage implements Serializable {
|
|||
@Excel(name = "服务指令包名称", width = 15)
|
||||
@ApiModelProperty(value = "服务指令包名称")
|
||||
private java.lang.String packageName;
|
||||
@Excel(name = "服务总时长", width = 15)
|
||||
@ApiModelProperty(value = "服务总时长")
|
||||
private Long totalDuration;
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
|
@ -75,4 +78,5 @@ public class DirectivePackage implements Serializable {
|
|||
|
||||
@TableField(exist = false)
|
||||
private List<ConfigServiceDirective> directives;
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ public interface DirectivePackageMapper extends BaseMapper<DirectivePackage> {
|
|||
|
||||
int saveDirectives(@Param("package") DirectivePackage directivePackage);
|
||||
|
||||
int updateTotalDurationInt(@Param("id") String id,@Param("duration") Long duration);
|
||||
|
||||
List<DirectivePackage> queryList( @Param("directivePackage") DirectivePackage directivePackage,@Param("ids") List<DirectivePackage> ids);
|
||||
|
||||
Long queryTotal(@Param("directivePackage") DirectivePackage directivePackage);
|
||||
|
|
|
@ -70,6 +70,9 @@
|
|||
</collection>
|
||||
</collection>
|
||||
</resultMap>
|
||||
<update id="updateTotalDurationInt">
|
||||
update nu_directive_package set total_duration = #{duration} where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="queryList" resultMap="DirectivePackageResultMap">
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.google.common.collect.Lists;
|
|||
import com.nu.modules.directivepackage.entity.DirectivePackage;
|
||||
import com.nu.modules.directivepackage.mapper.DirectivePackageMapper;
|
||||
import com.nu.modules.directivepackage.service.IDirectivePackageService;
|
||||
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -23,6 +25,14 @@ public class DirectivePackageServiceImpl extends ServiceImpl<DirectivePackageMap
|
|||
public void saveDirectives(DirectivePackage directivePackage) {
|
||||
baseMapper.deleteDirectives(directivePackage);
|
||||
baseMapper.saveDirectives(directivePackage);
|
||||
//计算总时长
|
||||
Long duration = 0l;
|
||||
for (ConfigServiceDirective directive : directivePackage.getDirectives()) {
|
||||
if(StringUtils.isNotBlank(directive.getServiceDuration())){
|
||||
duration += Long.parseLong(directive.getServiceDuration());
|
||||
}
|
||||
}
|
||||
baseMapper.updateTotalDurationInt(directivePackage.getId(),duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,6 +2,10 @@ package com.nu.modules.directivetag.body.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTagRelation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 体型标签
|
||||
|
@ -11,4 +15,6 @@ import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
|||
*/
|
||||
public interface DirectiveBodyTagMapper extends BaseMapper<DirectiveBodyTag> {
|
||||
|
||||
List<DirectiveBodyTag> selectAll(@Param("ids") List<String> ids,@Param("excludeIds") List<String> excludeIds);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.nu.modules.directivetag.body.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTagRelation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -12,7 +13,9 @@ import java.util.List;
|
|||
* @Version: V1.0
|
||||
*/
|
||||
public interface DirectiveBodyTagRelationMapper extends BaseMapper<DirectiveBodyTagRelation> {
|
||||
void removeAll();
|
||||
|
||||
void removeAllRelation();
|
||||
|
||||
List<DirectiveBodyTagRelation> selectAllRelation(List<String> ids);
|
||||
List<DirectiveBodyTagRelation> selectAllRelation(@Param("ids") List<String> ids,@Param("excludeIds") List<String> excludeIds);
|
||||
}
|
||||
|
|
|
@ -2,4 +2,19 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.directivetag.body.mapper.DirectiveBodyTagMapper">
|
||||
|
||||
<select id="selectAll" resultType="com.nu.modules.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>
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
<?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.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.directivetag.body.entity.DirectiveBodyTagRelation">
|
||||
select * from nu_directive_body_tag
|
||||
<where>
|
||||
|
@ -11,6 +16,12 @@
|
|||
<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>
|
||||
|
|
|
@ -23,7 +23,11 @@ public interface IDirectiveBodyTagService extends IService<DirectiveBodyTag> {
|
|||
|
||||
public void removeAllRelation();
|
||||
|
||||
public List<DirectiveBodyTagRelation> selectAllRelation(String dataSourceCode, List<String> ids);
|
||||
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);
|
||||
|
||||
void insertAll(List<DirectiveBodyTag> bodyAll);
|
||||
}
|
||||
|
|
|
@ -45,13 +45,14 @@ public class DirectiveBodyTagServiceImpl extends ServiceImpl<DirectiveBodyTagMap
|
|||
|
||||
@Override
|
||||
public void removeAllRelation() {
|
||||
tagRelationMapper.removeAll();
|
||||
tagRelationMapper.removeAllRelation();
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#dataSourceCode")
|
||||
public List<DirectiveBodyTagRelation> selectAllRelation(String dataSourceCode, List<String> ids) {
|
||||
return tagRelationMapper.selectAllRelation(ids);
|
||||
public List<DirectiveBodyTagRelation> selectAllRelation(String dataSourceCode, List<String> ids,List<String> excludeIds) {
|
||||
return tagRelationMapper.selectAllRelation(ids,excludeIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,4 +61,17 @@ public class DirectiveBodyTagServiceImpl extends ServiceImpl<DirectiveBodyTagMap
|
|||
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 void insertAll(List<DirectiveBodyTag> bodyAll) {
|
||||
bodyAll.forEach(b -> {
|
||||
baseMapper.insert(b);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.nu.modules.directivetag.emotion.mapper;
|
||||
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 情绪标签
|
||||
|
@ -11,4 +14,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
*/
|
||||
public interface DirectiveEmotionTagMapper extends BaseMapper<DirectiveEmotionTag> {
|
||||
|
||||
List<DirectiveEmotionTag> selectAll(@Param("ids") List<String> ids, @Param("excludeIds") List<String> excludeIds);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.nu.modules.directivetag.emotion.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTagRelation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -12,7 +13,10 @@ import java.util.List;
|
|||
* @Version: V1.0
|
||||
*/
|
||||
public interface DirectiveEmotionTagRelationMapper extends BaseMapper<DirectiveEmotionTagRelation> {
|
||||
|
||||
void removeAll();
|
||||
|
||||
void removeAllRelation();
|
||||
|
||||
List<DirectiveEmotionTagRelation> selectAllRelation(List<String> ids);
|
||||
List<DirectiveEmotionTagRelation> selectAllRelation(@Param("ids") List<String> ids, @Param("excludeIds") List<String> excludeIds);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
<?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.directivetag.emotion.mapper.DirectiveEmotionTagMapper">
|
||||
|
||||
<select id="selectAll" resultType="com.nu.modules.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>
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
<?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.directivetag.emotion.mapper.DirectiveEmotionTagRelationMapper">
|
||||
<delete id="removeAll">
|
||||
delete
|
||||
from nu_config_emotion_tag
|
||||
</delete>
|
||||
<delete id="removeAllRelation">
|
||||
delete from nu_directive_emotion_tag
|
||||
delete
|
||||
from nu_directive_emotion_tag
|
||||
</delete>
|
||||
<select id="selectAllRelation" resultType="com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTagRelation">
|
||||
select * from nu_directive_emotion_tag
|
||||
|
@ -11,6 +16,12 @@
|
|||
<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>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.nu.modules.directivetag.emotion.service;
|
||||
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTagRelation;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -23,7 +23,11 @@ public interface IDirectiveEmotionTagService extends IService<DirectiveEmotionTa
|
|||
|
||||
public void removeAllRelation();
|
||||
|
||||
public List<DirectiveEmotionTagRelation> selectAllRelation(String dataSourceCode, List<String> ids);
|
||||
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);
|
||||
|
||||
void insertAll(List<DirectiveEmotionTag> emoRelations);
|
||||
}
|
||||
|
|
|
@ -45,13 +45,14 @@ public class DirectiveEmotionTagServiceImpl extends ServiceImpl<DirectiveEmotion
|
|||
|
||||
@Override
|
||||
public void removeAllRelation() {
|
||||
tagRelationMapper.removeAll();
|
||||
tagRelationMapper.removeAllRelation();
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#dataSourceCode")
|
||||
public List<DirectiveEmotionTagRelation> selectAllRelation(String dataSourceCode, List<String> ids) {
|
||||
return tagRelationMapper.selectAllRelation(ids);
|
||||
public List<DirectiveEmotionTagRelation> selectAllRelation(String dataSourceCode, List<String> ids, List<String> excludeIds) {
|
||||
return tagRelationMapper.selectAllRelation(ids, excludeIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,4 +61,17 @@ public class DirectiveEmotionTagServiceImpl extends ServiceImpl<DirectiveEmotion
|
|||
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 void insertAll(List<DirectiveEmotionTag> emoRelations) {
|
||||
emoRelations.forEach(e -> {
|
||||
baseMapper.insert(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@ package com.nu.modules.servicecategory.mapper;
|
|||
|
||||
import com.nu.modules.servicecategory.entity.ConfigServiceCategory;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
|
@ -11,4 +14,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
*/
|
||||
public interface ConfigServiceCategoryMapper extends BaseMapper<ConfigServiceCategory> {
|
||||
|
||||
void removeAll();
|
||||
|
||||
List<ConfigServiceCategory> selectAll(@Param("ids") List<String> ids, @Param("excludeIds") List<String> excludeIds);
|
||||
}
|
||||
|
|
|
@ -2,4 +2,22 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.servicecategory.mapper.ConfigServiceCategoryMapper">
|
||||
|
||||
<delete id="removeAll">
|
||||
delete from nu_config_service_category
|
||||
</delete>
|
||||
<select id="selectAll" resultType="com.nu.modules.servicecategory.entity.ConfigServiceCategory">
|
||||
select distinct c.* from nu_config_service_category c left join nu_config_service_directive d on c.id = d.category_id
|
||||
<where>
|
||||
d.id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
<if test="excludeIds != null and excludeIds.size() > 0">
|
||||
AND c.id not in
|
||||
<foreach collection="excludeIds" item="excludeId" open="(" separator="," close=")">
|
||||
#{excludeId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -3,18 +3,27 @@ package com.nu.modules.servicecategory.service;
|
|||
import com.nu.modules.servicecategory.entity.ConfigServiceCategory;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IConfigServiceCategoryService extends IService<ConfigServiceCategory> {
|
||||
|
||||
/**
|
||||
* 查询数据是否已被使用
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean isUsed(String ids);
|
||||
|
||||
void removeAll();
|
||||
|
||||
List<ConfigServiceCategory> selectAll(String dataSourceCode, List<String> ids, List<String> excludeSubIds);
|
||||
|
||||
void insertAll(List<ConfigServiceCategory> categoryList);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.nu.modules.servicecategory.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
import com.nu.modules.servicetype.service.IConfigServiceTypeService;
|
||||
|
@ -57,4 +58,22 @@ public class ConfigServiceCategoryServiceImpl extends ServiceImpl<ConfigServiceC
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAll() {
|
||||
baseMapper.removeAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#dataSourceCode")
|
||||
public List<ConfigServiceCategory> selectAll(String dataSourceCode, List<String> ids, List<String> excludeSubIds) {
|
||||
return baseMapper.selectAll(ids, excludeSubIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAll(List<ConfigServiceCategory> categoryList) {
|
||||
categoryList.forEach(c -> {
|
||||
baseMapper.insert(c);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.nu.modules.servicetype.mapper;
|
||||
|
||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
|
@ -11,4 +14,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
*/
|
||||
public interface ConfigServiceTypeMapper extends BaseMapper<ConfigServiceType> {
|
||||
|
||||
void removeAll();
|
||||
|
||||
List<ConfigServiceType> selectAll(@Param("ids") List<String> ids, @Param("excludeIds") List<String> excludeIds);
|
||||
}
|
||||
|
|
|
@ -2,4 +2,23 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.servicetype.mapper.ConfigServiceTypeMapper">
|
||||
|
||||
<delete id="removeAll">
|
||||
delete from nu_config_service_type
|
||||
</delete>
|
||||
|
||||
<select id="selectAll" resultType="com.nu.modules.servicetype.entity.ConfigServiceType">
|
||||
select distinct t.* from nu_config_service_type t left join nu_config_service_directive d on t.id = d.category_id
|
||||
<where>
|
||||
d.id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
<if test="excludeIds != null and excludeIds.size() > 0">
|
||||
AND t.id not in
|
||||
<foreach collection="excludeIds" item="excludeId" open="(" separator="," close=")">
|
||||
#{excludeId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -1,20 +1,29 @@
|
|||
package com.nu.modules.servicetype.service;
|
||||
|
||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IConfigServiceTypeService extends IService<ConfigServiceType> {
|
||||
|
||||
/**
|
||||
* 查询数据是否已被使用
|
||||
* @param ids
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
boolean isUsed(String id);
|
||||
|
||||
void removeAll();
|
||||
|
||||
List<ConfigServiceType> selectAll(String dataSourceCode, List<String> ids, List<String> excludeSubIds);
|
||||
|
||||
void insertAll(List<ConfigServiceType> categoryList);
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package com.nu.modules.servicetype.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.servicedirective.service.IConfigServiceDirectiveService;
|
||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
import com.nu.modules.servicetype.mapper.ConfigServiceTypeMapper;
|
||||
import com.nu.modules.servicetype.service.IConfigServiceTypeService;
|
||||
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.servicedirective.service.IConfigServiceDirectiveService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -44,4 +44,22 @@ public class ConfigServiceTypeServiceImpl extends ServiceImpl<ConfigServiceTypeM
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAll() {
|
||||
baseMapper.removeAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#dataSourceCode")
|
||||
public List<ConfigServiceType> selectAll(String dataSourceCode, List<String> ids, List<String> excludeSubIds) {
|
||||
return baseMapper.selectAll(ids, excludeSubIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAll(List<ConfigServiceType> categoryList) {
|
||||
categoryList.forEach(c -> {
|
||||
baseMapper.insert(c);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.nu.dto.DirectiveMQDto;
|
||||
import com.nu.dto.StatusMQDto;
|
||||
import com.nu.enums.MQStatus;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTagRelation;
|
||||
import com.nu.modules.directivetag.body.service.IDirectiveBodyTagService;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTagRelation;
|
||||
import com.nu.modules.directivetag.emotion.service.IDirectiveEmotionTagService;
|
||||
import com.nu.modules.servicecategory.entity.ConfigServiceCategory;
|
||||
import com.nu.modules.servicecategory.service.IConfigServiceCategoryService;
|
||||
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.servicedirective.service.IConfigServiceDirectiveService;
|
||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
import com.nu.modules.servicetype.service.IConfigServiceTypeService;
|
||||
import com.nu.utils.RabbitMQUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -25,25 +35,33 @@ public class DirectiveMQListener {
|
|||
@Autowired
|
||||
private IConfigServiceDirectiveService directiveService;
|
||||
@Autowired
|
||||
private IDirectiveEmotionTagService tagService;
|
||||
private IDirectiveBodyTagService bodyTagService;
|
||||
@Autowired
|
||||
private IDirectiveEmotionTagService emotionTagService;
|
||||
@Autowired
|
||||
private IConfigServiceCategoryService serviceCategoryService;
|
||||
@Autowired
|
||||
private IConfigServiceTypeService serviceTypeService;
|
||||
@Autowired
|
||||
private RabbitMQUtil rabbitMQUtil;
|
||||
|
||||
/**
|
||||
* if 未到运营开始时间时 全量变更
|
||||
* else 增量
|
||||
* 备注:指令相应的字典表有相应的实时更新处理 这里无需处理字典表 但是需要处理中间关系表
|
||||
*
|
||||
* <p>
|
||||
* 具体逻辑说明
|
||||
* 1、未到运营开始时间时:dto.isIzInc()为true时
|
||||
* 1)先将指令主表、指令标签关系表数据全部删除
|
||||
* 2)将指令标签关系表数据增加进去
|
||||
* 3)将指令主表数据增加进去
|
||||
* ->全量同步<-
|
||||
* 1、未到运营开始时间时:dto.isIzInc()为false时
|
||||
* 1)先将所有相关指令字典表主表、关系表数据全部删除后增加
|
||||
* 2)将指令主表数据增加进去
|
||||
* <p>
|
||||
* 2、已到运营开始时间:dto.isIzInc()为false时
|
||||
* 1)只传递过来需要增加的指令
|
||||
* 2)先将指令标签关系表数据增加进去
|
||||
* 3)再将指令主表数据增加
|
||||
* ->增量同步<-
|
||||
* !!增量时:前台操作同步功能 只会在原基础上新增 不存在移除的情况
|
||||
* 2、已到运营开始时间:dto.isIzInc()为true时
|
||||
* 1)传过来的id是所有服务指令的id 需要处理只保留新增部分对应的id
|
||||
* 2)将新增的指令对应的字典表、关系表数据增加进去
|
||||
* 3)将新增的指令数据增加进去
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
|
@ -52,41 +70,11 @@ public class DirectiveMQListener {
|
|||
public void handleMessage(DirectiveMQDto dto) {
|
||||
try {
|
||||
if (!dto.isIzInc()) {
|
||||
//全量移除所有服务指令主表、指令标签中间表数据
|
||||
directiveService.removeAll();
|
||||
tagService.removeAllRelation();
|
||||
dto.setIdList(Arrays.asList(dto.getIdStr().split(",")));
|
||||
//全量
|
||||
handleQuantity(dto);
|
||||
} else {
|
||||
//增量:传过来的是已勾选的全部数据,需将重复部分去除
|
||||
//先查出所有指令id 然后进行去重
|
||||
QueryWrapper<ConfigServiceDirective> dtw = new QueryWrapper<>();
|
||||
dtw.select("id");
|
||||
List<ConfigServiceDirective> tempList = directiveService.list(dtw);
|
||||
Set<String> existingIds = tempList.stream()
|
||||
.map(ConfigServiceDirective::getId)
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
String idStr = dto.getIdStr();
|
||||
List<String> inputIds = Arrays.asList(idStr.split(","));
|
||||
|
||||
List<String> uniqueIds = inputIds.stream()
|
||||
.filter(id -> !existingIds.contains(id))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
dto.setIdList(uniqueIds);
|
||||
}
|
||||
//查询指令标签关系 并将指令标签关系表数据增加进自己的库表中
|
||||
if (dto.getIdList() != null && !dto.getIdList().isEmpty()) {
|
||||
List<DirectiveEmotionTagRelation> relations = tagService.selectAllRelation("nuro", dto.getIdList());
|
||||
if (relations != null && !relations.isEmpty()) {
|
||||
tagService.insertAllRelation(relations);
|
||||
}
|
||||
//查询服务指令,并将服务指令新增进自己的数据库表中
|
||||
List<ConfigServiceDirective> directives = directiveService.selectAllByIds("nuro", dto.getIdList());
|
||||
if (directives != null && !directives.isEmpty()) {
|
||||
directiveService.insertAllDirectives(directives);
|
||||
}
|
||||
//增量
|
||||
handleIncremental(dto);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
StatusMQDto statusMQDto = new StatusMQDto();
|
||||
|
@ -94,6 +82,7 @@ public class DirectiveMQListener {
|
|||
statusMQDto.setMessage(e.getMessage());
|
||||
statusMQDto.setAsyncId(dto.getAsyncId());
|
||||
statusMQDto.setCode("data");
|
||||
//TODO 返回的key应该是动态获取该机构编码 然后使用topic
|
||||
rabbitMQUtil.sendToExchange("hldy.fwzl", "nu002.fwzl.status", statusMQDto);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -104,4 +93,131 @@ public class DirectiveMQListener {
|
|||
statusMQDto.setCode("data");
|
||||
rabbitMQUtil.sendToExchange("hldy.fwzl", "nu002.fwzl.status", statusMQDto);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理全量
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理增量
|
||||
*
|
||||
* @param dto
|
||||
* @throws Exception
|
||||
*/
|
||||
private void handleIncremental(DirectiveMQDto dto) {
|
||||
//增量:传过来的是已勾选的全部数据,需将重复部分去除
|
||||
//先查出所有指令id 然后进行去重
|
||||
QueryWrapper<ConfigServiceDirective> dtw = new QueryWrapper<>();
|
||||
dtw.select("id");
|
||||
List<ConfigServiceDirective> tempList = directiveService.list(dtw);
|
||||
Set<String> existingIds = tempList.stream()
|
||||
.map(ConfigServiceDirective::getId)
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
String idStr = dto.getIdStr();
|
||||
List<String> inputIds = Arrays.asList(idStr.split(","));
|
||||
|
||||
List<String> uniqueIds = inputIds.stream()
|
||||
.filter(id -> !existingIds.contains(id))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
dto.setIdList(uniqueIds);
|
||||
|
||||
handleData(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理数据
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
private void handleData(DirectiveMQDto dto) {
|
||||
if (dto.getIdList() != null && !dto.getIdList().isEmpty()) {
|
||||
//体型标签
|
||||
{
|
||||
//需要排除的体型标签id
|
||||
List<String> excludeSubIds = Lists.newArrayList();
|
||||
if (dto.isIzInc()) {
|
||||
List<DirectiveBodyTag> list = bodyTagService.list();
|
||||
excludeSubIds = list.stream().map(DirectiveBodyTag::getId).collect(Collectors.toList());
|
||||
}
|
||||
List<DirectiveBodyTag> bodyAll = bodyTagService.selectAll("nuro", dto.getIdList(), excludeSubIds);
|
||||
if (bodyAll != null && !bodyAll.isEmpty()) {
|
||||
bodyTagService.insertAll(bodyAll);
|
||||
}
|
||||
List<DirectiveBodyTagRelation> bodyRelations = bodyTagService.selectAllRelation("nuro", dto.getIdList(), null);
|
||||
if (bodyRelations != null && !bodyRelations.isEmpty()) {
|
||||
bodyTagService.insertAllRelation(bodyRelations);
|
||||
}
|
||||
}
|
||||
//情绪标签
|
||||
{
|
||||
//需要排除的情绪标签id
|
||||
List<String> excludeSubIds = Lists.newArrayList();
|
||||
if (dto.isIzInc()) {
|
||||
List<DirectiveEmotionTag> list = emotionTagService.list();
|
||||
excludeSubIds = list.stream().map(DirectiveEmotionTag::getId).collect(Collectors.toList());
|
||||
}
|
||||
List<DirectiveEmotionTag> emoAll = emotionTagService.selectAll("nuro", dto.getIdList(), excludeSubIds);
|
||||
if (emoAll != null && !emoAll.isEmpty()) {
|
||||
emotionTagService.insertAll(emoAll);
|
||||
}
|
||||
List<DirectiveEmotionTagRelation> emoRelations = emotionTagService.selectAllRelation("nuro", dto.getIdList(), null);
|
||||
if (emoRelations != null && !emoRelations.isEmpty()) {
|
||||
emotionTagService.insertAllRelation(emoRelations);
|
||||
}
|
||||
}
|
||||
//服务类别
|
||||
{
|
||||
//需要排除的服务类别id
|
||||
List<String> excludeSubIds = Lists.newArrayList();
|
||||
if (dto.isIzInc()) {
|
||||
List<ConfigServiceCategory> list = serviceCategoryService.list();
|
||||
excludeSubIds = list.stream().map(ConfigServiceCategory::getId).collect(Collectors.toList());
|
||||
}
|
||||
List<ConfigServiceCategory> categoryList = serviceCategoryService.selectAll("nuro", dto.getIdList(), excludeSubIds);
|
||||
if (categoryList != null && !categoryList.isEmpty()) {
|
||||
serviceCategoryService.insertAll(categoryList);
|
||||
}
|
||||
}
|
||||
//服务类型
|
||||
{
|
||||
//需要排除的服务类型id
|
||||
List<String> excludeSubIds = Lists.newArrayList();
|
||||
if (dto.isIzInc()) {
|
||||
List<ConfigServiceType> list = serviceTypeService.list();
|
||||
excludeSubIds = list.stream().map(ConfigServiceType::getId).collect(Collectors.toList());
|
||||
}
|
||||
List<ConfigServiceType> typeList = serviceTypeService.selectAll("nuro", dto.getIdList(), excludeSubIds);
|
||||
if (typeList != null && !typeList.isEmpty()) {
|
||||
serviceTypeService.insertAll(typeList);
|
||||
}
|
||||
}
|
||||
//查询服务指令,并将服务指令新增进自己的数据库表中
|
||||
List<ConfigServiceDirective> directives = directiveService.selectAllByIds("nuro", dto.getIdList());
|
||||
if (directives != null && !directives.isEmpty()) {
|
||||
directiveService.insertAllDirectives(directives);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,11 @@
|
|||
<artifactId>hibernate-re</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.nursingunit.boot</groupId>
|
||||
<artifactId>nursing-unit-common</artifactId>
|
||||
<version>${nursingunit.version}</version>
|
||||
</dependency>
|
||||
<!-- 企业微信/钉钉 api -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
|
|
|
@ -300,4 +300,5 @@ public interface ISysDictService extends IService<SysDict> {
|
|||
* @param ids
|
||||
*/
|
||||
boolean removeLogicDeleted(List<String> ids);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.nu.mq.directive.exceptionhandler;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.AmqpRejectAndDontRequeueException;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.listener.api.RabbitListenerErrorHandler;
|
||||
import org.springframework.amqp.rabbit.support.ListenerExecutionFailedException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component("dictMQErrorHandler")
|
||||
public class DictMQExceptionHandler implements RabbitListenerErrorHandler {
|
||||
|
||||
@Override
|
||||
public Object handleError(Message message, org.springframework.messaging.Message<?> message1, ListenerExecutionFailedException e) {
|
||||
log.error("MQ消息处理失败 | 消息体: {} | 异常原因: {}", new String(message.getBody()), e.getCause().getMessage());
|
||||
|
||||
// 根据异常类型选择处理策略
|
||||
// if (isRetryable(e)) {
|
||||
// // 可重试异常:抛出异常触发重试
|
||||
// throw e;
|
||||
// } else {
|
||||
// 不可恢复异常:拒绝消息且不重新入队
|
||||
throw new AmqpRejectAndDontRequeueException("消息处理失败且禁止重试", e);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
package org.jeecg.mq.dict.listener;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.nu.dto.StatusMQDto;
|
||||
import com.nu.dto.SysDictItemMQDto;
|
||||
import com.nu.dto.SysDictMQDto;
|
||||
import com.nu.enums.MQStatus;
|
||||
import com.nu.utils.RabbitMQUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.entity.SysDict;
|
||||
import org.jeecg.modules.system.entity.SysDictItem;
|
||||
import org.jeecg.modules.system.service.ISysDepartService;
|
||||
import org.jeecg.modules.system.service.ISysDictItemService;
|
||||
import org.jeecg.modules.system.service.ISysDictService;
|
||||
import org.springframework.amqp.core.ExchangeTypes;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
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.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DictMQListener {
|
||||
@Autowired
|
||||
private RabbitMQUtil rabbitMQUtil;
|
||||
@Autowired
|
||||
private ISysDictService dictService;
|
||||
@Autowired
|
||||
private ISysDictItemService dictItemService;
|
||||
@Autowired
|
||||
private ISysDepartService departService;
|
||||
|
||||
/**
|
||||
* 字典同步
|
||||
* 如果 没有字典则创建 然后把每一项字典项新增进去
|
||||
* 有字典项 则检查每一项字典项是否存在,不存在则插入
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
// @RabbitListener(queues = "sysdict.async", errorHandler = "dictMQErrorHandler")
|
||||
@RabbitListener(
|
||||
bindings = @QueueBinding(
|
||||
value = @Queue(
|
||||
name = "#{T(java.util.UUID).randomUUID().toString()}",
|
||||
autoDelete = "true"
|
||||
),
|
||||
exchange = @Exchange(
|
||||
name = "hldy.sysdict.fanout",
|
||||
type = ExchangeTypes.FANOUT
|
||||
)
|
||||
), errorHandler = "dictMQErrorHandler"
|
||||
)
|
||||
public void handleMessage(SysDictMQDto dto) {
|
||||
String orgCode = "业务系统未查询到";
|
||||
String orgName = "业务系统未查询到";
|
||||
QueryWrapper<SysDepart> sysDepartQueryWrapper = new QueryWrapper<>();
|
||||
sysDepartQueryWrapper.eq("org_category", "1");
|
||||
List<SysDepart> list = departService.list(sysDepartQueryWrapper);
|
||||
if (list != null && list.size() > 0) {
|
||||
orgCode = list.get(0).getOrgCode();
|
||||
orgName = list.get(0).getDepartName();
|
||||
}
|
||||
|
||||
try {
|
||||
SysDict dict = dictService.getById(dto.getId());
|
||||
//如果是标识删除 查到的也是null 这里要处理的是只要在回收站就删除 重建
|
||||
if (dict == null || (dict != null && dict.getDelFlag() == 1)) {
|
||||
dictService.deleteOneDictPhysically(dto.getId());
|
||||
dict = null;
|
||||
}
|
||||
if (dict == null) {
|
||||
SysDict sysDict = new SysDict();
|
||||
BeanUtils.copyProperties(dto, sysDict);
|
||||
dictService.save(sysDict);
|
||||
if (dto.getSysDictItemList() != null) {
|
||||
dto.getSysDictItemList().forEach(item -> {
|
||||
SysDictItem sysDictItem = new SysDictItem();
|
||||
BeanUtils.copyProperties(item, sysDictItem);
|
||||
dictItemService.save(sysDictItem);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (dto.getSysDictItemList() != null) {
|
||||
List<SysDictItem> sysDictItems = dictItemService.selectItemsByMainId(dto.getId());
|
||||
Set<String> existingIds = sysDictItems.stream()
|
||||
.map(SysDictItem::getId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 找到需要新增的item
|
||||
List<SysDictItemMQDto> addItems = dto.getSysDictItemList().stream()
|
||||
.filter(item -> !existingIds.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
List<SysDictItem> items = BeanUtil.copyToList(addItems, SysDictItem.class);
|
||||
|
||||
dictItemService.saveBatch(items);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
StatusMQDto statusMQDto = new StatusMQDto();
|
||||
statusMQDto.setStatus(MQStatus.PROCESS_FAILED.getCode());
|
||||
statusMQDto.setMessage(orgName + " 同步失败:" + e.getMessage());
|
||||
statusMQDto.setDictId(dto.getId());
|
||||
statusMQDto.setOrgCode(orgCode);
|
||||
rabbitMQUtil.sendToExchange("hldy.sysdict", "sysdict.async.result", statusMQDto);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
StatusMQDto statusMQDto = new StatusMQDto();
|
||||
statusMQDto.setStatus(MQStatus.SUCCESS.getCode());
|
||||
statusMQDto.setMessage(orgName + " 数据同步成功!");
|
||||
statusMQDto.setDictId(dto.getId());
|
||||
statusMQDto.setOrgCode(orgCode);
|
||||
rabbitMQUtil.sendToExchange("hldy.sysdict", "sysdict.async.result", statusMQDto);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -182,6 +182,12 @@ spring:
|
|||
host: redis
|
||||
port: 6379
|
||||
password: uUgrUus4JAYuwxzo
|
||||
rabbitmq:
|
||||
host: rabbitm
|
||||
prot: 5672
|
||||
username: hldy
|
||||
password: SJ+lhRn6nZ43KeXE
|
||||
virtual-host: /hldy
|
||||
#mybatis plus 设置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:org/jeecg/**/xml/*Mapper.xml,classpath*:com/nu/**/xml/*Mapper.xml
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -491,7 +491,7 @@
|
|||
<id>dev</id>
|
||||
<activation>
|
||||
<!--默认激活配置-->
|
||||
<activeByDefault>true</activeByDefault>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<!--当前环境-->
|
||||
|
@ -543,7 +543,7 @@
|
|||
<id>uat</id>
|
||||
<activation>
|
||||
<!--默认激活配置-->
|
||||
<activeByDefault>false</activeByDefault>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<!--当前环境-->
|
||||
|
|
Loading…
Reference in New Issue