服务指令-指令库

This commit is contained in:
1378012178@qq.com 2025-08-04 14:49:58 +08:00
parent fe39e1d0c1
commit f6313df57a
21 changed files with 1069 additions and 549 deletions

View File

@ -10,4 +10,6 @@ public interface ISysConfigApi {
* @return * @return
*/ */
public Object querySysConfigByKey(String key); public Object querySysConfigByKey(String key);
void asyncApi(SysConfigEntity entity);
} }

View File

@ -0,0 +1,72 @@
package com.nu.modules.sysconfig;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description: 系统参数配置
* @Author: 张明远
* @Date: 2025-8-1
* @Version: V1.0
*/
@Data
public class SysConfigEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 参数名称
*/
private String name;
/**
* 键名
*/
private String configKey;
/**
* 键值
*/
private String configValue;
/**
* 备注
*/
private String descr;
/**
* 是否启用 0启用 1未启用
*/
private String izEnabled;
/**
* 是否删除 0未删除 1删除
*/
private String delFlag;
/**
* 创建人
*/
private String createBy;
/**
* 创建日期
*/
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新日期
*/
private Date updateTime;
private String orgCode;
}

View File

@ -35,6 +35,10 @@ public class OrgAllInfo implements Serializable {
* 协议+域名 * 协议+域名
*/ */
private String contextPath; private String contextPath;
/**
* 是否标准指令库 0是1否
*/
private String izDirectiveMain;
/** /**
* 省份 * 省份
*/ */

View File

@ -9,6 +9,7 @@
d.org_code, d.org_code,
d.url, d.url,
d.plat_type, d.plat_type,
d.iz_directive_main,
o.open_id, o.open_id,
o.wechat_name, o.wechat_name,
o.tel, o.tel,

View File

@ -8,6 +8,7 @@ import com.nu.dto.SysConfigMQDto;
import com.nu.modules.async.entity.AsyncMain; import com.nu.modules.async.entity.AsyncMain;
import com.nu.modules.async.service.IAsyncMainService; import com.nu.modules.async.service.IAsyncMainService;
import com.nu.modules.sysconfig.ISysConfigApi; import com.nu.modules.sysconfig.ISysConfigApi;
import com.nu.modules.sysconfig.SysConfigEntity;
import com.nu.modules.sysconfig.entity.SysConfig; import com.nu.modules.sysconfig.entity.SysConfig;
import com.nu.modules.sysconfig.mapper.SysConfigMapper; import com.nu.modules.sysconfig.mapper.SysConfigMapper;
import com.nu.modules.sysconfig.service.ISysConfigService; import com.nu.modules.sysconfig.service.ISysConfigService;
@ -82,6 +83,12 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
} }
} }
public void asyncForAll(SysConfig sysConfig) {
SysConfigMQDto sysConfigMQDto = new SysConfigMQDto();
BeanUtils.copyProperties(sysConfig, sysConfigMQDto);
rabbitMQUtil.sendToExchange("hldy.sysconfig.fanout", "", sysConfigMQDto);
}
@Override @Override
public Object querySysConfigByKey(String key) { public Object querySysConfigByKey(String key) {
QueryWrapper<SysConfig> qw = new QueryWrapper<>(); QueryWrapper<SysConfig> qw = new QueryWrapper<>();
@ -93,4 +100,11 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
return null; return null;
} }
} }
@Override
public void asyncApi(SysConfigEntity entity) {
SysConfig sysConfig = new SysConfig();
BeanUtils.copyProperties(entity, sysConfig);
asyncForAll(sysConfig);
}
} }

View File

@ -2,18 +2,21 @@ package com.nu.modules.common;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.api.ISysBaseAPI; import org.jeecg.common.system.api.ISysBaseAPI;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Map; import java.util.Map;
/** /**
* 获取常用信息不涉及安全信息 * 获取常用信息不涉及安全信息
*
* @author zmy * @author zmy
* @date 2025-5-22 08:43:05 * @date 2025-5-22 08:43:05
*/ */
@ -27,13 +30,37 @@ public class SysBaseInfoApi {
/** /**
* 返回机构信息配置的"协议域名" * 返回机构信息配置的"协议域名"
*
* @return * @return
*/ */
@GetMapping("/sysUrl") @GetMapping("/sysUrl")
public Result<?> sysUrl(){ public Result<?> sysUrl() {
JSONObject deptInfo = sysBaseAPI.getDeptInfo(); JSONObject deptInfo = sysBaseAPI.getDeptInfo();
Map<String,Object> result = Maps.newHashMap(); Map<String, Object> result = Maps.newHashMap();
result.put("url",deptInfo.getString("url")); result.put("url", deptInfo.getString("url"));
return Result.ok(result);
}
/**
* 根据机构编码获取机构api接口前缀
*
* @return
*/
@GetMapping("/getOrgApiAddress")
public Result<?> getOrgInfo(@RequestParam("orgCode") String orgCode) {
JSONObject deptInfo = sysBaseAPI.getOrgInfo(orgCode);
Map<String, Object> result = Maps.newHashMap();
String fullPath = "";
String url = deptInfo.getString("url");
String contextPath = deptInfo.getString("contextPath");
String baseUrl = url.endsWith("/") ? url.substring(0, url.length() - 1) : url;
String normalizedContextPath = contextPath.startsWith("/") ? contextPath : "/" + contextPath;
normalizedContextPath = normalizedContextPath.endsWith("/")
? normalizedContextPath.substring(0, normalizedContextPath.length() - 1)
: normalizedContextPath;
//接口协议域名上下文路径
fullPath = baseUrl + normalizedContextPath;
result.put("url", fullPath);
return Result.ok(result); return Result.ok(result);
} }
} }

View File

@ -0,0 +1,83 @@
package com.nu.modules.canadddirective.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.canadddirective.entity.CanAddDirective;
import com.nu.modules.canadddirective.service.ICanAddDirectiveService;
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.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;
/**
* @Description: 可新增指令
* @Author: jeecg-boot
* @Date: 2025-08-01
* @Version: V1.0
*/
@Api(tags="可新增指令")
@RestController
@RequestMapping("/canadddirective/canAddDirective")
@Slf4j
public class CanAddDirectiveController extends JeecgController<CanAddDirective, ICanAddDirectiveService> {
@Autowired
private ICanAddDirectiveService canAddDirectiveService;
/**
* 分页列表查询
*
* @param canAddDirective
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "可新增指令-分页列表查询")
@ApiOperation(value="可新增指令-分页列表查询", notes="可新增指令-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<CanAddDirective>> queryPageList(CanAddDirective canAddDirective,
@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("orgCode", QueryRuleEnum.LIKE_WITH_OR);
QueryWrapper<CanAddDirective> queryWrapper = QueryGenerator.initQueryWrapper(canAddDirective, req.getParameterMap(),customeRuleMap);
queryWrapper.notIn("directive_id",canAddDirective.getExistDirectiveIds().split(","));
Page<CanAddDirective> page = new Page<CanAddDirective>(pageNo, pageSize);
IPage<CanAddDirective> pageList = canAddDirectiveService.page(page, queryWrapper);
return Result.OK(pageList);
}
}

View File

@ -0,0 +1,103 @@
package com.nu.modules.canadddirective.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
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: jeecg-boot
* @Date: 2025-08-01
* @Version: V1.0
*/
@Data
@TableName("nu_can_add_directive")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="nu_can_add_directive对象", description="可新增指令")
public class CanAddDirective implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**指令ID*/
@Excel(name = "指令ID", width = 15)
@ApiModelProperty(value = "指令ID")
private java.lang.String directiveId;
/**分类标签*/
@Excel(name = "分类标签", width = 15)
@ApiModelProperty(value = "分类标签")
private java.lang.String instructionTag;
/**服务类别*/
@Excel(name = "服务类别", width = 15)
@ApiModelProperty(value = "服务类别")
private java.lang.String category;
/**服务类型*/
@Excel(name = "服务类型", width = 15)
@ApiModelProperty(value = "服务类型")
private java.lang.String type;
/**服务指令*/
@Excel(name = "服务指令", width = 15)
@ApiModelProperty(value = "服务指令")
private java.lang.String directiveName;
/**周期类型 1日常护理 2周期护理 3即时护理*/
@Excel(name = "周期类型", width = 15)
@ApiModelProperty(value = "周期类型")
private java.lang.String cycleType;
/**体型标签*/
@Excel(name = "体型标签", width = 15)
@ApiModelProperty(value = "体型标签")
private java.lang.String bodyTags;
/**情绪标签*/
@Excel(name = "情绪标签", width = 15)
@ApiModelProperty(value = "情绪标签")
private java.lang.String emotionTags;
/**是否删除 0未删除 1删除*/
@Excel(name = "是否删除 0未删除 1删除", width = 15)
@ApiModelProperty(value = "是否删除 0未删除 1删除")
@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;
/**所属部门*/
@Excel(name = "所属部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "org_code")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "org_code")
@ApiModelProperty(value = "所属部门")
private java.lang.String orgCode;
/**
* 已存在服务指令ids 逗号拼接
*/
@TableField(exist = false)
private String existDirectiveIds;
}

View File

@ -0,0 +1,17 @@
package com.nu.modules.canadddirective.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nu.modules.canadddirective.entity.CanAddDirective;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 可新增指令
* @Author: jeecg-boot
* @Date: 2025-08-01
* @Version: V1.0
*/
public interface CanAddDirectiveMapper extends BaseMapper<CanAddDirective> {
}

View File

@ -0,0 +1,5 @@
<?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.canadddirective.mapper.CanAddDirectiveMapper">
</mapper>

View File

@ -0,0 +1,14 @@
package com.nu.modules.canadddirective.service;
import com.nu.modules.canadddirective.entity.CanAddDirective;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 可新增指令
* @Author: jeecg-boot
* @Date: 2025-08-01
* @Version: V1.0
*/
public interface ICanAddDirectiveService extends IService<CanAddDirective> {
}

View File

@ -0,0 +1,19 @@
package com.nu.modules.canadddirective.service.impl;
import com.nu.modules.canadddirective.entity.CanAddDirective;
import com.nu.modules.canadddirective.mapper.CanAddDirectiveMapper;
import com.nu.modules.canadddirective.service.ICanAddDirectiveService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 可新增指令
* @Author: jeecg-boot
* @Date: 2025-08-01
* @Version: V1.0
*/
@Service
public class CanAddDirectiveServiceImpl extends ServiceImpl<CanAddDirectiveMapper, CanAddDirective> implements ICanAddDirectiveService {
}

View File

@ -9,6 +9,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.beust.jcommander.internal.Maps; import com.beust.jcommander.internal.Maps;
import com.nu.dto.DirectiveAsyncMQDto; import com.nu.dto.DirectiveAsyncMQDto;
import com.nu.dto.DirectiveMQDto; import com.nu.dto.DirectiveMQDto;
import com.nu.enums.MQStatus;
import com.nu.modules.async.entity.AsyncMain;
import com.nu.modules.async.entity.AsyncStatus;
import com.nu.modules.async.service.IAsyncMainService;
import com.nu.modules.async.service.IAsyncStatusService;
import com.nu.modules.directivetag.body.entity.DirectiveBodyTag; import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
import com.nu.modules.directivetag.body.service.IDirectiveBodyTagService; import com.nu.modules.directivetag.body.service.IDirectiveBodyTagService;
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag; import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
@ -58,6 +63,10 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
private RabbitMQUtil rabbitMQUtil; private RabbitMQUtil rabbitMQUtil;
@Autowired @Autowired
private ISysBaseAPI sysBaseAPI; private ISysBaseAPI sysBaseAPI;
@Autowired
private IAsyncMainService asyncMainService;
@Autowired
private IAsyncStatusService asyncStatusService;
/** /**
* 分页列表查询 * 分页列表查询
@ -182,6 +191,25 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
return Result.OK(list); return Result.OK(list);
} }
/**
* 查询目标平台已有指令
*
* @param dataSourceCode
* @return
*/
@GetMapping(value = "/idListByDS")
@DS("#dataSourceCode")
public Result<IPage<ConfigServiceDirective>> idListByDS(@RequestParam(name = "dataSourceCode") String dataSourceCode) {
if (StringUtils.isBlank(dataSourceCode)) {
return Result.ok(new Page<>());
}
QueryWrapper<ConfigServiceDirective> queryWrapper = new QueryWrapper<>();
queryWrapper.select("id");
Page<ConfigServiceDirective> page = new Page<>(1, -1);
IPage<ConfigServiceDirective> list = configServiceDirectiveService.page(page, queryWrapper);
return Result.OK(list);
}
/** /**
* 添加 * 添加
* *
@ -408,7 +436,7 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
//处理接口地址 //处理接口地址
String fullPath = ""; String fullPath = "";
if ("all".equals(dto.getSyncOption()) || "media".equals(dto.getSyncOption()) || StringUtils.isNotBlank(dto.getUpIds())) { if ("all".equals(dto.getSyncOption()) || "media".equals(dto.getSyncOption()) || StringUtils.isNotBlank(dto.getUpIds())) {
JSONObject deptInfo = configServiceDirectiveService.getDeptInfo("master",dataSourceCode); JSONObject deptInfo = configServiceDirectiveService.getDeptInfo("master", dataSourceCode);
String url = deptInfo.getString("url"); String url = deptInfo.getString("url");
String contextPath = deptInfo.getString("contextPath"); String contextPath = deptInfo.getString("contextPath");
String baseUrl = url.endsWith("/") ? url.substring(0, url.length() - 1) : url; String baseUrl = url.endsWith("/") ? url.substring(0, url.length() - 1) : url;
@ -421,9 +449,11 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
} }
//同步-新增服务指令 //同步-新增服务指令
configServiceDirectiveService.syncDirective(dto.getSyncIds(), dto.getSyncOrgCodes(), dto.getSyncOption(),fullPath,dataSourceCode); if (StringUtils.isNotBlank(dto.getSyncIds())) {
configServiceDirectiveService.syncDirective(dto.getSyncIds(), dto.getSyncOrgCodes(), dto.getSyncOption(), fullPath, dataSourceCode);
}
//给待更新的指令 //待更新的指令
if (StringUtils.isNotBlank(dto.getUpIds())) { if (StringUtils.isNotBlank(dto.getUpIds())) {
DirectiveMQDto upDirectiveMQDto = new DirectiveMQDto(); DirectiveMQDto upDirectiveMQDto = new DirectiveMQDto();
List<ConfigServiceDirective> directives; List<ConfigServiceDirective> directives;
@ -444,6 +474,22 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
new Thread(() -> { new Thread(() -> {
for (String code : dto.getSyncOrgCodes().split(",")) { for (String code : dto.getSyncOrgCodes().split(",")) {
try { try {
AsyncMain asyncMain = new AsyncMain();
asyncMain.setType("directive");
asyncMain.setOrgCode(dataSourceCode);
asyncMain.setDescr("服务指令同步");
asyncMainService.saveData("master", asyncMain);
upDirectiveMQDto.setAsyncId(asyncMain.getId());
AsyncStatus asyncStatus_file = new AsyncStatus();
asyncStatus_file.setPkid(asyncMain.getId());
asyncStatus_file.setCode("file");
asyncStatus_file.setName("文件");
asyncStatus_file.setStatus(MQStatus.LOADING.getCode() + "");
asyncStatus_file.setMsg("同步中");
asyncStatus_file.setTargetOrgCode(code);
asyncStatusService.saveData("master", asyncStatus_file);
rabbitMQUtil.sendToExchange("hldy.directive", code + ".directive.createmedia", upDirectiveMQDto); rabbitMQUtil.sendToExchange("hldy.directive", code + ".directive.createmedia", upDirectiveMQDto);
// 发送完后休眠 5 分钟 // 发送完后休眠 5 分钟
// Thread.sleep(TimeUnit.MINUTES.toMillis(5)); // Thread.sleep(TimeUnit.MINUTES.toMillis(5));

View File

@ -12,6 +12,8 @@ import com.nu.modules.async.entity.AsyncMain;
import com.nu.modules.async.entity.AsyncStatus; import com.nu.modules.async.entity.AsyncStatus;
import com.nu.modules.async.service.IAsyncMainService; import com.nu.modules.async.service.IAsyncMainService;
import com.nu.modules.async.service.IAsyncStatusService; import com.nu.modules.async.service.IAsyncStatusService;
import com.nu.modules.canadddirective.entity.CanAddDirective;
import com.nu.modules.canadddirective.service.ICanAddDirectiveService;
import com.nu.modules.directivetag.body.entity.DirectiveBodyTag; import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
import com.nu.modules.directivetag.body.entity.DirectiveBodyTagRelation; import com.nu.modules.directivetag.body.entity.DirectiveBodyTagRelation;
import com.nu.modules.directivetag.body.service.IDirectiveBodyTagService; import com.nu.modules.directivetag.body.service.IDirectiveBodyTagService;
@ -40,6 +42,7 @@ import org.springframework.stereotype.Component;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@Component @Component
@ -61,14 +64,45 @@ public class DirectiveMQListener {
private IDirectiveBodyTagService bodyTagService; private IDirectiveBodyTagService bodyTagService;
@Autowired @Autowired
private IDirectiveEmotionTagService emotionTagService; private IDirectiveEmotionTagService emotionTagService;
@Autowired
private ICanAddDirectiveService canAddDirectiveService;
/**
*其他平台新增指令
*/
@RabbitListener(bindings = @QueueBinding(value = @Queue(name = "hldy.directive.newadd"), exchange = @Exchange(name = "hldy.directive", type = ExchangeTypes.DIRECT), key = "hldy.directive.newadd"), errorHandler = "directiveMQErrorHandler")
public void auditBizDirective(DirectiveAsyncMQDto dto) {
CanAddDirective canAddDirective = new CanAddDirective();
canAddDirective.setDirectiveId(dto.getId());
canAddDirective.setDirectiveName(dto.getDirectiveName());
canAddDirective.setInstructionTag(dto.getInstructionName());
canAddDirective.setCategory(dto.getCategoryName());
canAddDirective.setType(dto.getTypeName());
canAddDirective.setCycleType(dto.getCycleTypeName());
List<Map> bodyTagsList = JSON.parseArray(dto.getBodyTagsObj(), Map.class);
String bodyTags = bodyTagsList.stream()
.map(map -> map.get("label").toString())
.collect(Collectors.joining(","));
canAddDirective.setBodyTags(bodyTags);
List<Map> emotionTagsList = JSON.parseArray(dto.getEmotionTagsObj(), Map.class);
String emotionTags = emotionTagsList.stream()
.map(map -> map.get("label").toString())
.collect(Collectors.joining(","));
canAddDirective.setEmotionTags(emotionTags);
canAddDirective.setOrgCode(dto.getSysOrgCode());
canAddDirective.setDelFlag("0");
canAddDirectiveService.save(canAddDirective);
}
/** /**
* 业务平台新增指令/编辑未授权指令 传给 管理平台进行审核 * 业务平台新增指令/编辑未授权指令 传给 管理平台进行审核
* *
* @param dto * @param dto
*/ */
@RabbitListener(bindings = @QueueBinding(value = @Queue(name = "hldy.directive.audit"), exchange = @Exchange(name = "hldy.directive", type = ExchangeTypes.DIRECT), key = "hldy.directive.audit"), errorHandler = "directiveMQErrorHandler") // @RabbitListener(bindings = @QueueBinding(value = @Queue(name = "hldy.directive.audit"), exchange = @Exchange(name = "hldy.directive", type = ExchangeTypes.DIRECT), key = "hldy.directive.audit"), errorHandler = "directiveMQErrorHandler")
public void auditBizDirective(DirectiveAsyncMQDto dto) { public void auditBizDirective2(DirectiveAsyncMQDto dto) {
//先处理各字典项 只新增不修改 //先处理各字典项 只新增不修改
String instructionTagId = dto.getInstructionTagId(); String instructionTagId = dto.getInstructionTagId();
String categoryId = dto.getCategoryId(); String categoryId = dto.getCategoryId();

View File

@ -64,6 +64,10 @@ public class SysDepartEntity implements Serializable {
* 项目访问路径 * 项目访问路径
*/ */
private String contextPath; private String contextPath;
/**
* 是否标准指令库 0是1否
*/
private String izDirectiveMain;
/** /**
* 省份 * 省份
*/ */

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nu.modules.sysconfig.ISysConfigApi;
import com.nu.modules.sysconfig.SysConfigEntity;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -72,6 +74,9 @@ public class SysDepartController {
private ISysUserDepartService sysUserDepartService; private ISysUserDepartService sysUserDepartService;
@Autowired @Autowired
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Autowired
private ISysConfigApi sysConfigApi;
/** /**
* 查询数据 查出我的部门,并以树结构数据格式响应给前端 * 查询数据 查出我的部门,并以树结构数据格式响应给前端
* *
@ -82,22 +87,22 @@ public class SysDepartController {
Result<List<SysDepartTreeModel>> result = new Result<>(); Result<List<SysDepartTreeModel>> result = new Result<>();
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
try { try {
if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals( CommonConstant.USER_IDENTITY_2 )){ if (oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals(CommonConstant.USER_IDENTITY_2)) {
//update-begin--Author:liusq Date:20210624 for:部门查询ids为空后的前端显示问题 issues/I3UD06 //update-begin--Author:liusq Date:20210624 for:部门查询ids为空后的前端显示问题 issues/I3UD06
String departIds = user.getDepartIds(); String departIds = user.getDepartIds();
if(StringUtils.isNotBlank(departIds)){ if (StringUtils.isNotBlank(departIds)) {
List<SysDepartTreeModel> list = sysDepartService.queryMyDeptTreeList(departIds); List<SysDepartTreeModel> list = sysDepartService.queryMyDeptTreeList(departIds);
result.setResult(list); result.setResult(list);
} }
//update-end--Author:liusq Date:20210624 for:部门查询ids为空后的前端显示问题 issues/I3UD06 //update-end--Author:liusq Date:20210624 for:部门查询ids为空后的前端显示问题 issues/I3UD06
result.setMessage(CommonConstant.USER_IDENTITY_2.toString()); result.setMessage(CommonConstant.USER_IDENTITY_2.toString());
result.setSuccess(true); result.setSuccess(true);
}else{ } else {
result.setMessage(CommonConstant.USER_IDENTITY_1.toString()); result.setMessage(CommonConstant.USER_IDENTITY_1.toString());
result.setSuccess(true); result.setSuccess(true);
} }
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
} }
return result; return result;
} }
@ -116,36 +121,37 @@ public class SysDepartController {
// if (CollectionUtils.isEmpty(list)) { // if (CollectionUtils.isEmpty(list)) {
// list = sysDepartService.queryTreeList(); // list = sysDepartService.queryTreeList();
// } // }
if(oConvertUtils.isNotEmpty(ids)){ if (oConvertUtils.isNotEmpty(ids)) {
List<SysDepartTreeModel> departList = sysDepartService.queryTreeList(ids); List<SysDepartTreeModel> departList = sysDepartService.queryTreeList(ids);
result.setResult(departList); result.setResult(departList);
}else{ } else {
List<SysDepartTreeModel> list = sysDepartService.queryTreeList(); List<SysDepartTreeModel> list = sysDepartService.queryTreeList();
result.setResult(list); result.setResult(list);
} }
result.setSuccess(true); result.setSuccess(true);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
} }
return result; return result;
} }
/** /**
* 异步查询部门list * 异步查询部门list
*
* @param parentId 父节点 异步加载时传递 * @param parentId 父节点 异步加载时传递
* @param ids 前端回显是传递 * @param ids 前端回显是传递
* @param primaryKey 主键字段id或者orgCode * @param primaryKey 主键字段id或者orgCode
* @return * @return
*/ */
@RequestMapping(value = "/queryDepartTreeSync", method = RequestMethod.GET) @RequestMapping(value = "/queryDepartTreeSync", method = RequestMethod.GET)
public Result<List<SysDepartTreeModel>> queryDepartTreeSync(@RequestParam(name = "pid", required = false) String parentId,@RequestParam(name = "ids", required = false) String ids, @RequestParam(name = "primaryKey", required = false) String primaryKey, @RequestParam(name = "platType", required = false) String platType) { public Result<List<SysDepartTreeModel>> queryDepartTreeSync(@RequestParam(name = "pid", required = false) String parentId, @RequestParam(name = "ids", required = false) String ids, @RequestParam(name = "primaryKey", required = false) String primaryKey, @RequestParam(name = "platType", required = false) String platType) {
Result<List<SysDepartTreeModel>> result = new Result<>(); Result<List<SysDepartTreeModel>> result = new Result<>();
try { try {
List<SysDepartTreeModel> list = sysDepartService.queryTreeListByPid(parentId,ids, primaryKey,platType); List<SysDepartTreeModel> list = sysDepartService.queryTreeListByPid(parentId, ids, primaryKey, platType);
result.setResult(list); result.setResult(list);
result.setSuccess(true); result.setSuccess(true);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
result.setSuccess(false); result.setSuccess(false);
result.setMessage("查询失败"); result.setMessage("查询失败");
} }
@ -186,7 +192,7 @@ public class SysDepartController {
*/ */
@RequiresPermissions("system:depart:add") @RequiresPermissions("system:depart:add")
@RequestMapping(value = "/add", method = RequestMethod.POST) @RequestMapping(value = "/add", method = RequestMethod.POST)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true)
public Result<SysDepart> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) { public Result<SysDepart> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
Result<SysDepart> result = new Result<SysDepart>(); Result<SysDepart> result = new Result<SysDepart>();
String username = JwtUtil.getUserNameByToken(request); String username = JwtUtil.getUserNameByToken(request);
@ -198,7 +204,7 @@ public class SysDepartController {
// FindsDepartsChildrenUtil.clearDepartIdModel(); // FindsDepartsChildrenUtil.clearDepartIdModel();
result.success("添加成功!"); result.success("添加成功!");
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
result.error500("操作失败"); result.error500("操作失败");
} }
return result; return result;
@ -211,8 +217,8 @@ public class SysDepartController {
* @return * @return
*/ */
@RequiresPermissions("system:depart:edit") @RequiresPermissions("system:depart:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true)
public Result<SysDepart> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) { public Result<SysDepart> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
String username = JwtUtil.getUserNameByToken(request); String username = JwtUtil.getUserNameByToken(request);
sysDepart.setUpdateBy(username); sysDepart.setUpdateBy(username);
@ -235,19 +241,20 @@ public class SysDepartController {
/** /**
* 通过id删除 * 通过id删除
*
* @param id * @param id
* @return * @return
*/ */
@RequiresPermissions("system:depart:delete") @RequiresPermissions("system:depart:delete")
@RequestMapping(value = "/delete", method = RequestMethod.DELETE) @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true)
public Result<SysDepart> delete(@RequestParam(name="id",required=true) String id) { public Result<SysDepart> delete(@RequestParam(name = "id", required = true) String id) {
Result<SysDepart> result = new Result<SysDepart>(); Result<SysDepart> result = new Result<SysDepart>();
SysDepart sysDepart = sysDepartService.getById(id); SysDepart sysDepart = sysDepartService.getById(id);
if(sysDepart==null) { if (sysDepart == null) {
result.error500("未找到对应实体"); result.error500("未找到对应实体");
}else { } else {
sysDepartService.deleteDepart(id); sysDepartService.deleteDepart(id);
//清除部门树内存 //清除部门树内存
//FindsDepartsChildrenUtil.clearSysDepartTreeList(); //FindsDepartsChildrenUtil.clearSysDepartTreeList();
@ -266,7 +273,7 @@ public class SysDepartController {
*/ */
@RequiresPermissions("system:depart:deleteBatch") @RequiresPermissions("system:depart:deleteBatch")
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE) @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true)
public Result<SysDepart> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { public Result<SysDepart> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
Result<SysDepart> result = new Result<SysDepart>(); Result<SysDepart> result = new Result<SysDepart>();
@ -311,7 +318,7 @@ public class SysDepartController {
result.setResult(list); result.setResult(list);
result.setSuccess(true); result.setSuccess(true);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
} }
return result; return result;
} }
@ -325,15 +332,15 @@ public class SysDepartController {
* @return * @return
*/ */
@RequestMapping(value = "/searchBy", method = RequestMethod.GET) @RequestMapping(value = "/searchBy", method = RequestMethod.GET)
public Result<List<SysDepartTreeModel>> searchBy(@RequestParam(name = "keyWord", required = true) String keyWord,@RequestParam(name = "myDeptSearch", required = false) String myDeptSearch) { public Result<List<SysDepartTreeModel>> searchBy(@RequestParam(name = "keyWord", required = true) String keyWord, @RequestParam(name = "myDeptSearch", required = false) String myDeptSearch) {
Result<List<SysDepartTreeModel>> result = new Result<List<SysDepartTreeModel>>(); Result<List<SysDepartTreeModel>> result = new Result<List<SysDepartTreeModel>>();
//部门查询myDeptSearch为1时为我的部门查询登录用户为上级时查只查负责部门下数据 //部门查询myDeptSearch为1时为我的部门查询登录用户为上级时查只查负责部门下数据
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String departIds = null; String departIds = null;
if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals( CommonConstant.USER_IDENTITY_2 )){ if (oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals(CommonConstant.USER_IDENTITY_2)) {
departIds = user.getDepartIds(); departIds = user.getDepartIds();
} }
List<SysDepartTreeModel> treeList = this.sysDepartService.searchByKeyWord(keyWord,myDeptSearch,departIds); List<SysDepartTreeModel> treeList = this.sysDepartService.searchByKeyWord(keyWord, myDeptSearch, departIds);
if (treeList == null || treeList.size() == 0) { if (treeList == null || treeList.size() == 0) {
result.setSuccess(false); result.setSuccess(false);
result.setMessage("未查询匹配数据!"); result.setMessage("未查询匹配数据!");
@ -350,10 +357,10 @@ public class SysDepartController {
* @param request * @param request
*/ */
@RequestMapping(value = "/exportXls") @RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysDepart sysDepart,HttpServletRequest request) { public ModelAndView exportXls(SysDepart sysDepart, HttpServletRequest request) {
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
//是否开启系统管理模块的多租户数据隔离SAAS多租户模式 //是否开启系统管理模块的多租户数据隔离SAAS多租户模式
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){ if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
sysDepart.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0)); sysDepart.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
} }
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
@ -380,7 +387,7 @@ public class SysDepartController {
//step.2 组装导出数据 //step.2 组装导出数据
Integer tenantId = sysDepart == null ? null : sysDepart.getTenantId(); Integer tenantId = sysDepart == null ? null : sysDepart.getTenantId();
//update-begin---author:wangshuai---date:2024-07-05---for:TV360X-1671部门管理不支持选中的记录导出--- //update-begin---author:wangshuai---date:2024-07-05---for:TV360X-1671部门管理不支持选中的记录导出---
List<SysDepartExportVo> sysDepartExportVos = sysDepartService.getExportDepart(tenantId,idList); List<SysDepartExportVo> sysDepartExportVos = sysDepartService.getExportDepart(tenantId, idList);
//update-end---author:wangshuai---date:2024-07-05---for:TV360X-1671部门管理不支持选中的记录导出--- //update-end---author:wangshuai---date:2024-07-05---for:TV360X-1671部门管理不支持选中的记录导出---
//导出文件名称 //导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表"); mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表");
@ -390,7 +397,7 @@ public class SysDepartController {
"1、标题为第三行部门路径和部门名称的标题不允许修改否则会匹配失败第四行为数据填写范围;\n" + "1、标题为第三行部门路径和部门名称的标题不允许修改否则会匹配失败第四行为数据填写范围;\n" +
"2、部门路径用英文字符/分割,部门名称为部门路径的最后一位;\n" + "2、部门路径用英文字符/分割,部门名称为部门路径的最后一位;\n" +
"3、部门从一级名称开始创建如果有同级就需要多添加一行如研发部/研发一部;研发部/研发二部;\n" + "3、部门从一级名称开始创建如果有同级就需要多添加一行如研发部/研发一部;研发部/研发二部;\n" +
"4、自定义的部门编码需要满足规则才能导入。如一级部门编码为A01,那么子部门为A01A01,同级子部门为A01A02,编码固定为三位首字母为A-Z,后两位为数字0-99依次递增;", "导出人:"+user.getRealname(), "导出信息")); "4、自定义的部门编码需要满足规则才能导入。如一级部门编码为A01,那么子部门为A01A01,同级子部门为A01A02,编码固定为三位首字母为A-Z,后两位为数字0-99依次递增;", "导出人:" + user.getRealname(), "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, sysDepartExportVos); mv.addObject(NormalExcelConstants.DATA_LIST, sysDepartExportVos);
//update-end---author:wangshuai---date:2023-10-19---for:QQYUN-5482系统的部门导入导出也可以改成敲敲云模式的部门路径--- //update-end---author:wangshuai---date:2023-10-19---for:QQYUN-5482系统的部门导入导出也可以改成敲敲云模式的部门路径---
@ -408,7 +415,7 @@ public class SysDepartController {
*/ */
@RequiresPermissions("system:depart:importExcel") @RequiresPermissions("system:depart:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
List<String> errorMessageList = new ArrayList<>(); List<String> errorMessageList = new ArrayList<>();
@ -473,7 +480,7 @@ public class SysDepartController {
//update-begin---author:wangshuai---date:2023-10-19---for:QQYUN-5482系统的部门导入导出也可以改成敲敲云模式的部门路径--- //update-begin---author:wangshuai---date:2023-10-19---for:QQYUN-5482系统的部门导入导出也可以改成敲敲云模式的部门路径---
listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepartExportVo.class, params); listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepartExportVo.class, params);
sysDepartService.importSysDepart(listSysDeparts,errorMessageList); sysDepartService.importSysDepart(listSysDeparts, errorMessageList);
//update-end---author:wangshuai---date:2023-10-19---for:QQYUN-5482系统的部门导入导出也可以改成敲敲云模式的部门路径--- //update-end---author:wangshuai---date:2023-10-19---for:QQYUN-5482系统的部门导入导出也可以改成敲敲云模式的部门路径---
//清空部门缓存 //清空部门缓存
@ -483,8 +490,8 @@ public class SysDepartController {
redisTemplate.delete(keys4); redisTemplate.delete(keys4);
return ImportExcelUtil.imporReturnRes(errorMessageList.size(), listSysDeparts.size() - errorMessageList.size(), errorMessageList); return ImportExcelUtil.imporReturnRes(errorMessageList.size(), listSysDeparts.size() - errorMessageList.size(), errorMessageList);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
return Result.error("文件导入失败:"+e.getMessage()); return Result.error("文件导入失败:" + e.getMessage());
} finally { } finally {
try { try {
file.getInputStream().close(); file.getInputStream().close();
@ -499,6 +506,7 @@ public class SysDepartController {
/** /**
* 查询所有部门信息 * 查询所有部门信息
*
* @return * @return
*/ */
@GetMapping("listAll") @GetMapping("listAll")
@ -506,37 +514,38 @@ public class SysDepartController {
Result<List<SysDepart>> result = new Result<>(); Result<List<SysDepart>> result = new Result<>();
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>(); LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
query.orderByAsc(SysDepart::getOrgCode); query.orderByAsc(SysDepart::getOrgCode);
if(oConvertUtils.isNotEmpty(id)){ if (oConvertUtils.isNotEmpty(id)) {
String[] arr = id.split(","); String[] arr = id.split(",");
query.in(SysDepart::getId,arr); query.in(SysDepart::getId, arr);
} }
List<SysDepart> ls = this.sysDepartService.list(query); List<SysDepart> ls = this.sysDepartService.list(query);
result.setSuccess(true); result.setSuccess(true);
result.setResult(ls); result.setResult(ls);
return result; return result;
} }
/** /**
* 查询数据 查出所有部门,并以树结构数据格式响应给前端 * 查询数据 查出所有部门,并以树结构数据格式响应给前端
* *
* @return * @return
*/ */
@RequestMapping(value = "/queryTreeByKeyWord", method = RequestMethod.GET) @RequestMapping(value = "/queryTreeByKeyWord", method = RequestMethod.GET)
public Result<Map<String,Object>> queryTreeByKeyWord(@RequestParam(name = "keyWord", required = false) String keyWord) { public Result<Map<String, Object>> queryTreeByKeyWord(@RequestParam(name = "keyWord", required = false) String keyWord) {
Result<Map<String,Object>> result = new Result<>(); Result<Map<String, Object>> result = new Result<>();
try { try {
Map<String,Object> map=new HashMap(5); Map<String, Object> map = new HashMap(5);
List<SysDepartTreeModel> list = sysDepartService.queryTreeByKeyWord(keyWord); List<SysDepartTreeModel> list = sysDepartService.queryTreeByKeyWord(keyWord);
//根据keyWord获取用户信息 //根据keyWord获取用户信息
LambdaQueryWrapper<SysUser> queryUser = new LambdaQueryWrapper<SysUser>(); LambdaQueryWrapper<SysUser> queryUser = new LambdaQueryWrapper<SysUser>();
queryUser.eq(SysUser::getDelFlag,CommonConstant.DEL_FLAG_0); queryUser.eq(SysUser::getDelFlag, CommonConstant.DEL_FLAG_0);
queryUser.and(i -> i.like(SysUser::getUsername, keyWord).or().like(SysUser::getRealname, keyWord)); queryUser.and(i -> i.like(SysUser::getUsername, keyWord).or().like(SysUser::getRealname, keyWord));
List<SysUser> sysUsers = this.sysUserService.list(queryUser); List<SysUser> sysUsers = this.sysUserService.list(queryUser);
map.put("userList",sysUsers); map.put("userList", sysUsers);
map.put("departList",list); map.put("departList", list);
result.setResult(map); result.setResult(map);
result.setSuccess(true); result.setSuccess(true);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
} }
return result; return result;
} }
@ -574,9 +583,9 @@ public class SysDepartController {
} }
/** /**
* @功能根据id 批量查询
* @param deptIds * @param deptIds
* @return * @return
* @功能根据id 批量查询
*/ */
@RequestMapping(value = "/queryByIds", method = RequestMethod.GET) @RequestMapping(value = "/queryByIds", method = RequestMethod.GET)
public Result<Collection<SysDepart>> queryByIds(@RequestParam(name = "deptIds") String deptIds) { public Result<Collection<SysDepart>> queryByIds(@RequestParam(name = "deptIds") String deptIds) {
@ -590,40 +599,42 @@ public class SysDepartController {
} }
@GetMapping("/getMyDepartList") @GetMapping("/getMyDepartList")
public Result<List<SysDepart>> getMyDepartList(){ public Result<List<SysDepart>> getMyDepartList() {
List<SysDepart> list = sysDepartService.getMyDepartList(); List<SysDepart> list = sysDepartService.getMyDepartList();
return Result.ok(list); return Result.ok(list);
} }
/** /**
* 异步查询部门list * 异步查询部门list
*
* @param parentId 父节点 异步加载时传递 * @param parentId 父节点 异步加载时传递
* @return * @return
*/ */
@RequestMapping(value = "/queryBookDepTreeSync", method = RequestMethod.GET) @RequestMapping(value = "/queryBookDepTreeSync", method = RequestMethod.GET)
public Result<List<SysDepartTreeModel>> queryBookDepTreeSync(@RequestParam(name = "pid", required = false) String parentId, public Result<List<SysDepartTreeModel>> queryBookDepTreeSync(@RequestParam(name = "pid", required = false) String parentId,
@RequestParam(name = "tenantId") Integer tenantId, @RequestParam(name = "tenantId") Integer tenantId,
@RequestParam(name = "departName",required = false) String departName) { @RequestParam(name = "departName", required = false) String departName) {
Result<List<SysDepartTreeModel>> result = new Result<>(); Result<List<SysDepartTreeModel>> result = new Result<>();
try { try {
List<SysDepartTreeModel> list = sysDepartService.queryBookDepTreeSync(parentId, tenantId, departName); List<SysDepartTreeModel> list = sysDepartService.queryBookDepTreeSync(parentId, tenantId, departName);
result.setResult(list); result.setResult(list);
result.setSuccess(true); result.setSuccess(true);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
} }
return result; return result;
} }
/** /**
* 通过部门id和租户id获取用户 低代码应用: 用于选择部门负责人 * 通过部门id和租户id获取用户 低代码应用: 用于选择部门负责人
*
* @param departId * @param departId
* @return * @return
*/ */
@GetMapping("/getUsersByDepartTenantId") @GetMapping("/getUsersByDepartTenantId")
public Result<List<SysUser>> getUsersByDepartTenantId(@RequestParam("departId") String departId){ public Result<List<SysUser>> getUsersByDepartTenantId(@RequestParam("departId") String departId) {
int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0); int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0);
List<SysUser> sysUserList = sysUserDepartService.getUsersByDepartTenantId(departId,tenantId); List<SysUser> sysUserList = sysUserDepartService.getUsersByDepartTenantId(departId, tenantId);
return Result.ok(sysUserList); return Result.ok(sysUserList);
} }
@ -633,7 +644,7 @@ public class SysDepartController {
* @param request * @param request
*/ */
@RequestMapping(value = "/appExportXls") @RequestMapping(value = "/appExportXls")
public ModelAndView appExportXls(SysDepart sysDepart,HttpServletRequest request) { public ModelAndView appExportXls(SysDepart sysDepart, HttpServletRequest request) {
// Step.1 组装查询条件 // Step.1 组装查询条件
int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0); int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0);
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
@ -643,7 +654,7 @@ public class SysDepartController {
mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表"); mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表");
mv.addObject(NormalExcelConstants.CLASS, ExportDepartVo.class); mv.addObject(NormalExcelConstants.CLASS, ExportDepartVo.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息")); mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:" + user.getRealname(), "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
} }
@ -654,7 +665,7 @@ public class SysDepartController {
* @param request * @param request
*/ */
@RequestMapping(value = "/appImportExcel", method = RequestMethod.POST) @RequestMapping(value = "/appImportExcel", method = RequestMethod.POST)
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true)
public Result<?> appImportExcel(HttpServletRequest request, HttpServletResponse response) { public Result<?> appImportExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
List<String> errorMessageList = new ArrayList<>(); List<String> errorMessageList = new ArrayList<>();
@ -669,7 +680,7 @@ public class SysDepartController {
params.setNeedSave(true); params.setNeedSave(true);
try { try {
listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), ExportDepartVo.class, params); listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), ExportDepartVo.class, params);
sysDepartService.importExcel(listSysDeparts,errorMessageList); sysDepartService.importExcel(listSysDeparts, errorMessageList);
//清空部门缓存 //清空部门缓存
List<String> keys3 = redisUtil.scan(CacheConstant.SYS_DEPARTS_CACHE + "*"); List<String> keys3 = redisUtil.scan(CacheConstant.SYS_DEPARTS_CACHE + "*");
List<String> keys4 = redisUtil.scan(CacheConstant.SYS_DEPART_IDS_CACHE + "*"); List<String> keys4 = redisUtil.scan(CacheConstant.SYS_DEPART_IDS_CACHE + "*");
@ -677,8 +688,8 @@ public class SysDepartController {
redisTemplate.delete(keys4); redisTemplate.delete(keys4);
return ImportExcelUtil.imporReturnRes(errorMessageList.size(), listSysDeparts.size() - errorMessageList.size(), errorMessageList); return ImportExcelUtil.imporReturnRes(errorMessageList.size(), listSysDeparts.size() - errorMessageList.size(), errorMessageList);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
return Result.error("文件导入失败:"+e.getMessage()); return Result.error("文件导入失败:" + e.getMessage());
} finally { } finally {
try { try {
file.getInputStream().close(); file.getInputStream().close();
@ -693,23 +704,24 @@ public class SysDepartController {
/** /**
* 人员入住可选择的机构 * 人员入住可选择的机构
*
* @return * @return
*/ */
@RequestMapping(value = "/queryInstitutionsList", method = RequestMethod.GET) @RequestMapping(value = "/queryInstitutionsList", method = RequestMethod.GET)
public List<Map<String,Object>> queryInstitutionsList() { public List<Map<String, Object>> queryInstitutionsList() {
List<Map<String,Object>> result = new ArrayList<>(); List<Map<String, Object>> result = new ArrayList<>();
QueryWrapper<SysDepart> query = new QueryWrapper<>(); QueryWrapper<SysDepart> query = new QueryWrapper<>();
query.eq("del_flag","0"); query.eq("del_flag", "0");
query.eq("org_category","1"); query.eq("org_category", "1");
query.eq("org_type","1"); query.eq("org_type", "1");
query.isNotNull("server_url"); query.isNotNull("server_url");
List<SysDepart> list = sysDepartService.list(query); List<SysDepart> list = sysDepartService.list(query);
for(SysDepart depart : list){ for (SysDepart depart : list) {
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("id",depart.getId()); map.put("id", depart.getId());
map.put("departName",depart.getDepartName()); map.put("departName", depart.getDepartName());
map.put("serverUrl",depart.getServerUrl()); map.put("serverUrl", depart.getServerUrl());
map.put("picUrl",depart.getPicUrl()); map.put("picUrl", depart.getPicUrl());
result.add(map); result.add(map);
} }
return result; return result;
@ -717,6 +729,7 @@ public class SysDepartController {
/** /**
* 查询所有子区域信息 * 查询所有子区域信息
*
* @return * @return
*/ */
@GetMapping("queryChildrenByParentId") @GetMapping("queryChildrenByParentId")
@ -724,7 +737,7 @@ public class SysDepartController {
Result<List<SysDepart>> result = new Result<>(); Result<List<SysDepart>> result = new Result<>();
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>(); LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
query.orderByAsc(SysDepart::getDepartName); query.orderByAsc(SysDepart::getDepartName);
query.eq(SysDepart::getParentId,parentId); query.eq(SysDepart::getParentId, parentId);
List<SysDepart> ls = this.sysDepartService.list(query); List<SysDepart> ls = this.sysDepartService.list(query);
result.setSuccess(true); result.setSuccess(true);
result.setResult(ls); result.setResult(ls);
@ -734,6 +747,7 @@ public class SysDepartController {
/** /**
* 查询所有子区域信息 * 查询所有子区域信息
*
* @return * @return
*/ */
@GetMapping("getDepartServerUrl") @GetMapping("getDepartServerUrl")
@ -748,10 +762,9 @@ public class SysDepartController {
} }
@AutoLog(value = "机构列表-分页列表查询") @AutoLog(value = "机构列表-分页列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<?> list( SysDepart sysDepart, public Result<?> list(SysDepart sysDepart,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "8") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "8") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
@ -761,4 +774,29 @@ public class SysDepartController {
return Result.ok(pageList); return Result.ok(pageList);
} }
@AutoLog(value = "指令库变更")
@PostMapping(value = "/changeDirectiveMain")
public Result<?> changeDirectiveMain(@RequestParam(name = "orgCode") String orgCode) {
sysDepartService.changeDirectiveMain(orgCode);
//发消息通知所有平台修改指令库主库编码
SysConfigEntity config = new SysConfigEntity();
config.setId("1944154379395543440");
config.setName("服务指令主指令库机构编码");
config.setConfigKey("directive_main_org_code");
config.setConfigValue(orgCode);
config.setDescr("服务指令主指令库机构编码");
config.setIzEnabled("0");
config.setDelFlag("0");
sysConfigApi.asyncApi(config);
return Result.ok();
}
@GetMapping(value = "/getDirectiveMain")
public Result<?> getDirectiveMain() {
QueryWrapper<SysDepart> qw = new QueryWrapper<>();
qw.eq("iz_directive_main","0");
return Result.ok(sysDepartService.getOne(qw));
}
} }

View File

@ -84,6 +84,10 @@ public class SysDepart implements Serializable {
* 项目访问路径 * 项目访问路径
*/ */
private String contextPath; private String contextPath;
/**
* 是否标准指令库 0是1否
*/
private String izDirectiveMain;
/** /**
* 省份 * 省份
*/ */
@ -251,6 +255,7 @@ public class SysDepart implements Serializable {
Objects.equals(orgCode, depart.orgCode) && Objects.equals(orgCode, depart.orgCode) &&
Objects.equals(url, depart.url) && Objects.equals(url, depart.url) &&
Objects.equals(contextPath, depart.contextPath) && Objects.equals(contextPath, depart.contextPath) &&
Objects.equals(izDirectiveMain, depart.izDirectiveMain) &&
Objects.equals(province, depart.province) && Objects.equals(province, depart.province) &&
Objects.equals(city, depart.city) && Objects.equals(city, depart.city) &&
Objects.equals(district, depart.district) && Objects.equals(district, depart.district) &&
@ -279,7 +284,7 @@ public class SysDepart implements Serializable {
public int hashCode() { public int hashCode() {
return Objects.hash(super.hashCode(), id, parentId, departName, return Objects.hash(super.hashCode(), id, parentId, departName,
departNameEn, departNameAbbr, departOrder, description, orgCategory, departNameEn, departNameAbbr, departOrder, description, orgCategory,
orgType, orgCode, url,contextPath, province, city, district, operationStartTime, orgType, orgCode, url, contextPath, izDirectiveMain, province, city, district, operationStartTime,
operationEndTime, contractStartTime, contractEndTime, mobile, fax, address, memo, status, operationEndTime, contractStartTime, contractEndTime, mobile, fax, address, memo, status,
delFlag, createBy, createTime, updateBy, updateTime, tenantId, payableAmount); delFlag, createBy, createTime, updateBy, updateTime, tenantId, payableAmount);
} }

View File

@ -69,6 +69,8 @@ public class SysDepartTreeModel implements Serializable {
private String contextPath; private String contextPath;
private String izDirectiveMain;
private String province; private String province;
private String city; private String city;
@ -141,6 +143,7 @@ public class SysDepartTreeModel implements Serializable {
this.orgCode = sysDepart.getOrgCode(); this.orgCode = sysDepart.getOrgCode();
this.url = sysDepart.getUrl(); this.url = sysDepart.getUrl();
this.contextPath = sysDepart.getContextPath(); this.contextPath = sysDepart.getContextPath();
this.izDirectiveMain = sysDepart.getIzDirectiveMain();
this.province = sysDepart.getProvince(); this.province = sysDepart.getProvince();
this.city = sysDepart.getCity(); this.city = sysDepart.getCity();
this.district = sysDepart.getDistrict(); this.district = sysDepart.getDistrict();
@ -493,6 +496,14 @@ public class SysDepartTreeModel implements Serializable {
return contextPath; return contextPath;
} }
public String getIzDirectiveMain() {
return izDirectiveMain;
}
public void setIzDirectiveMain(String izDirectiveMain) {
this.izDirectiveMain = izDirectiveMain;
}
public void setContextPath(String contextPath) { public void setContextPath(String contextPath) {
this.contextPath = contextPath; this.contextPath = contextPath;
} }
@ -522,6 +533,7 @@ public class SysDepartTreeModel implements Serializable {
Objects.equals(orgCode, model.orgCode) && Objects.equals(orgCode, model.orgCode) &&
Objects.equals(url, model.url) && Objects.equals(url, model.url) &&
Objects.equals(contextPath, model.contextPath) && Objects.equals(contextPath, model.contextPath) &&
Objects.equals(izDirectiveMain, model.izDirectiveMain) &&
Objects.equals(province, model.province) && Objects.equals(province, model.province) &&
Objects.equals(city, model.city) && Objects.equals(city, model.city) &&
Objects.equals(district, model.district) && Objects.equals(district, model.district) &&
@ -552,7 +564,7 @@ public class SysDepartTreeModel implements Serializable {
public int hashCode() { public int hashCode() {
return Objects.hash(id, parentId, platType, departName, departNameEn, departNameAbbr, return Objects.hash(id, parentId, platType, departName, departNameEn, departNameAbbr,
departOrder, description, orgCategory, orgType, orgCode, url, contextPath, province, city, district, departOrder, description, orgCategory, orgType, orgCode, url, contextPath, izDirectiveMain, province, city, district,
operationStartTime, operationEndTime, contractStartTime, contractEndTime, operationStartTime, operationEndTime, contractStartTime, contractEndTime,
mobile, fax, address, memo, status, delFlag, qywxIdentifier, mobile, fax, address, memo, status, delFlag, qywxIdentifier,
createBy, createTime, updateBy, updateTime, children, directorUserIds, payableAmount); createBy, createTime, updateBy, updateTime, children, directorUserIds, payableAmount);

View File

@ -239,4 +239,6 @@ public interface ISysDepartService extends IService<SysDepart>{
* @param errorMessageList * @param errorMessageList
*/ */
void importSysDepart(List<SysDepartExportVo> listSysDeparts, List<String> errorMessageList); void importSysDepart(List<SysDepartExportVo> listSysDeparts, List<String> errorMessageList);
void changeDirectiveMain(String orgCode);
} }

View File

@ -1918,6 +1918,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
map.put("name",list.get(0).getDepartName()); map.put("name",list.get(0).getDepartName());
map.put("url",list.get(0).getUrl()); map.put("url",list.get(0).getUrl());
map.put("contextPath",list.get(0).getContextPath()); map.put("contextPath",list.get(0).getContextPath());
map.put("izDirectiveMain",list.get(0).getIzDirectiveMain());
} }
return new JSONObject(map); return new JSONObject(map);
} }

View File

@ -1353,6 +1353,23 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
} }
} }
@Override
public void changeDirectiveMain(String orgCode) {
SysDepart sysDepart = new SysDepart();
//将非当前机构变更为非指令库
QueryWrapper<SysDepart> uqw1 = new QueryWrapper<>();
uqw1.ne("org_code",orgCode);
sysDepart.setIzDirectiveMain("1");
baseMapper.update(sysDepart,uqw1);
//将当前机构变更为指令库
QueryWrapper<SysDepart> uqw2 = new QueryWrapper<>();
uqw2.eq("org_code",orgCode);
sysDepart.setIzDirectiveMain("0");
baseMapper.update(sysDepart,uqw2);
}
/** /**
* 寻找部门路径 * 寻找部门路径
* *