parent
5edee0ab90
commit
0be7905574
|
@ -0,0 +1,7 @@
|
|||
package com.nu.modules.sysconfig;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
public interface ISysConfigApi {
|
||||
JSONObject getAll();
|
||||
}
|
|
@ -35,6 +35,12 @@
|
|||
<artifactId>nursing-unit-common</artifactId>
|
||||
<version>${nursingunit.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nursingunit.boot</groupId>
|
||||
<artifactId>nu-system-local-api</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,180 @@
|
|||
package com.nu.modules.sysconfig.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.sysconfig.entity.SysConfig;
|
||||
import com.nu.modules.sysconfig.service.ISysConfigService;
|
||||
|
||||
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: 张明远
|
||||
* @Date: 2025-05-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="系统参数配置")
|
||||
@RestController
|
||||
@RequestMapping("/sysconfig/sysConfig")
|
||||
@Slf4j
|
||||
public class SysConfigController extends JeecgController<SysConfig, ISysConfigService> {
|
||||
@Autowired
|
||||
private ISysConfigService sysConfigService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysConfig
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "系统参数配置-分页列表查询")
|
||||
@ApiOperation(value="系统参数配置-分页列表查询", notes="系统参数配置-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<SysConfig>> queryPageList(SysConfig sysConfig,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SysConfig> queryWrapper = QueryGenerator.initQueryWrapper(sysConfig, req.getParameterMap());
|
||||
Page<SysConfig> page = new Page<SysConfig>(pageNo, pageSize);
|
||||
IPage<SysConfig> pageList = sysConfigService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysConfig
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "系统参数配置-添加")
|
||||
@ApiOperation(value="系统参数配置-添加", notes="系统参数配置-添加")
|
||||
@RequiresPermissions("sysconfig:nu_sys_config:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody SysConfig sysConfig) {
|
||||
sysConfigService.save(sysConfig);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysConfig
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "系统参数配置-编辑")
|
||||
@ApiOperation(value="系统参数配置-编辑", notes="系统参数配置-编辑")
|
||||
@RequiresPermissions("sysconfig:nu_sys_config:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody SysConfig sysConfig) {
|
||||
sysConfigService.updateById(sysConfig);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "系统参数配置-通过id删除")
|
||||
@ApiOperation(value="系统参数配置-通过id删除", notes="系统参数配置-通过id删除")
|
||||
@RequiresPermissions("sysconfig:nu_sys_config:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sysConfigService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "系统参数配置-批量删除")
|
||||
@ApiOperation(value="系统参数配置-批量删除", notes="系统参数配置-批量删除")
|
||||
@RequiresPermissions("sysconfig:nu_sys_config:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.sysConfigService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "系统参数配置-通过id查询")
|
||||
@ApiOperation(value="系统参数配置-通过id查询", notes="系统参数配置-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysConfig> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysConfig sysConfig = sysConfigService.getById(id);
|
||||
if(sysConfig==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sysConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sysConfig
|
||||
*/
|
||||
@RequiresPermissions("sysconfig:nu_sys_config:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysConfig sysConfig) {
|
||||
return super.exportXls(request, sysConfig, SysConfig.class, "系统参数配置");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sysconfig:nu_sys_config:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysConfig.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package com.nu.modules.sysconfig.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import 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: 张明远
|
||||
* @Date: 2025-05-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_sys_config")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_sys_config对象", description="系统参数配置")
|
||||
public class SysConfig implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.String id;
|
||||
/**参数名称*/
|
||||
@Excel(name = "参数名称", width = 15)
|
||||
@ApiModelProperty(value = "参数名称")
|
||||
private java.lang.String name;
|
||||
/**键名*/
|
||||
@Excel(name = "键名", width = 15)
|
||||
@ApiModelProperty(value = "键名")
|
||||
private java.lang.String configKey;
|
||||
/**键值*/
|
||||
@Excel(name = "键值", width = 15)
|
||||
@ApiModelProperty(value = "键值")
|
||||
private java.lang.String configValue;
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private java.lang.String descr;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
@Excel(name = "是否启用", width = 15)
|
||||
@ApiModelProperty(value = "是否启用 0启用 1未启用")
|
||||
@Dict(dicCode = "iz_enabled")
|
||||
private java.lang.String izEnabled;
|
||||
/**是否删除 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;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.nu.modules.sysconfig.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.nu.modules.sysconfig.entity.SysConfig;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 系统参数配置
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-05-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysConfigMapper extends BaseMapper<SysConfig> {
|
||||
|
||||
int deletePhysicsById(@Param("id") String id);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?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.sysconfig.mapper.SysConfigMapper">
|
||||
|
||||
<delete id="deletePhysicsById">
|
||||
delete from nu_sys_config where id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,15 @@
|
|||
package com.nu.modules.sysconfig.service;
|
||||
|
||||
import com.nu.modules.sysconfig.entity.SysConfig;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 系统参数配置
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-05-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysConfigService extends IService<SysConfig> {
|
||||
|
||||
int deletePhysicsById(String id);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.nu.modules.sysconfig.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.nu.modules.sysconfig.ISysConfigApi;
|
||||
|
||||
public class SysConfigApiServiceImpl implements ISysConfigApi {
|
||||
@Override
|
||||
public JSONObject getAll() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.nu.modules.sysconfig.service.impl;
|
||||
|
||||
import com.nu.modules.sysconfig.entity.SysConfig;
|
||||
import com.nu.modules.sysconfig.mapper.SysConfigMapper;
|
||||
import com.nu.modules.sysconfig.service.ISysConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 系统参数配置
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-05-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements ISysConfigService {
|
||||
|
||||
@Override
|
||||
public int deletePhysicsById(String id) {
|
||||
return baseMapper.deletePhysicsById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.nu.mq.sysconfig.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("sysConfigMQErrorHandler")
|
||||
public class SysConfigMQExceptionHandler 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,28 @@
|
|||
package com.nu.mq.sysconfig.listener;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("sysConfigAsyncDQNP")
|
||||
public class DynamicQueueNameProvider {
|
||||
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
|
||||
public String getQueueName() {
|
||||
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
|
||||
String orgCode = deptInfo.getString("code");
|
||||
if (StringUtils.isNotBlank(orgCode)) {
|
||||
return orgCode + ".sysconfig.async";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public String getKeyName() {
|
||||
return getQueueName();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package com.nu.mq.sysconfig.listener;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.nu.dto.StatusMQDto;
|
||||
import com.nu.dto.SysConfigMQDto;
|
||||
import com.nu.enums.MQStatus;
|
||||
import com.nu.modules.sysconfig.entity.SysConfig;
|
||||
import com.nu.modules.sysconfig.service.ISysConfigService;
|
||||
import com.nu.utils.RabbitMQUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
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;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SysConfigMQListener {
|
||||
@Autowired
|
||||
private RabbitMQUtil rabbitMQUtil;
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
@Autowired
|
||||
private ISysConfigService sysConfigService;
|
||||
|
||||
|
||||
/**
|
||||
* fanout类型 发给所有人统一处理的
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
@RabbitListener(
|
||||
bindings = @QueueBinding(
|
||||
value = @Queue(
|
||||
name = "#{T(java.util.UUID).randomUUID().toString()}",
|
||||
autoDelete = "true"
|
||||
),
|
||||
exchange = @Exchange(
|
||||
name = "hldy.sysconfig.fanout",
|
||||
type = ExchangeTypes.FANOUT
|
||||
)
|
||||
), errorHandler = "sysConfigMQErrorHandler"
|
||||
)
|
||||
public void handleMessage_unify(SysConfigMQDto dto) {
|
||||
saveSysConfig(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* direct直连 只发给我的
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
@RabbitListener(
|
||||
bindings = @QueueBinding(
|
||||
value = @Queue(name = "#{sysConfigAsyncDQNP.getQueueName()}"),
|
||||
exchange = @Exchange(name = "hldy.sysconfig.direct", type = ExchangeTypes.DIRECT),
|
||||
key = "#{sysConfigAsyncDQNP.getKeyName()}"
|
||||
),
|
||||
errorHandler = "sysConfigMQErrorHandler"
|
||||
)
|
||||
public void handleMessage_self(SysConfigMQDto dto) {
|
||||
saveSysConfig(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统参数配置同步
|
||||
* <p>
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
private void saveSysConfig(SysConfigMQDto dto) {
|
||||
//查询此业务系统的机构编码、名称
|
||||
String orgCode = "业务系统中未设置";
|
||||
String orgName = "业务系统中未设置";
|
||||
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
|
||||
orgCode = deptInfo.getString("code");
|
||||
orgName = deptInfo.getString("name");
|
||||
|
||||
try {
|
||||
sysConfigService.deletePhysicsById(dto.getId());
|
||||
SysConfig config = new SysConfig();
|
||||
BeanUtils.copyProperties(dto, config);
|
||||
sysConfigService.save(config);
|
||||
} catch (Exception e) {
|
||||
StatusMQDto statusMQDto = new StatusMQDto();
|
||||
statusMQDto.setStatus(MQStatus.PROCESS_FAILED.getCode());
|
||||
statusMQDto.setMessage(e.getMessage());
|
||||
statusMQDto.setPrimaryKey(dto.getId());
|
||||
statusMQDto.setOrgCode(orgCode);
|
||||
statusMQDto.setOrgName(orgName);
|
||||
rabbitMQUtil.sendToExchange("hldy.sysconfig", "sysconfig.async.result", statusMQDto);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
StatusMQDto statusMQDto = new StatusMQDto();
|
||||
statusMQDto.setStatus(MQStatus.SUCCESS.getCode());
|
||||
statusMQDto.setMessage("数据同步成功!");
|
||||
statusMQDto.setPrimaryKey(dto.getId());
|
||||
statusMQDto.setOrgCode(orgCode);
|
||||
statusMQDto.setOrgName(orgName);
|
||||
rabbitMQUtil.sendToExchange("hldy.sysconfig", "sysconfig.async.result", statusMQDto);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -14,7 +14,7 @@ public class StatusMQDto {
|
|||
//同步表子表code
|
||||
private String code;
|
||||
|
||||
private String dictId;
|
||||
private String primaryKey;
|
||||
private String orgCode;
|
||||
private String orgName;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package com.nu.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 系统参数配置
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-05-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class SysConfigMQDto 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;
|
||||
}
|
|
@ -75,12 +75,18 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
|||
directiveIds = configServiceDirectiveService.queryDirectiveIdByBodyTagIds(configServiceDirective.getBodyTags());
|
||||
if (directiveIds != null && !directiveIds.isEmpty()) {
|
||||
queryWrapper.in("id", directiveIds.stream().map(ConfigServiceDirective::getId).collect(Collectors.toList()));
|
||||
}else{
|
||||
//体重标签下没有数据
|
||||
queryWrapper.eq("id","null");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
|
||||
directiveIds = configServiceDirectiveService.queryDirectiveIdByEmotionTagIds(configServiceDirective.getEmotionTags());
|
||||
if (directiveIds != null && !directiveIds.isEmpty()) {
|
||||
if (directiveIds != null && !directiveIds.isEmpty() && StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
|
||||
queryWrapper.in("id", directiveIds.stream().map(ConfigServiceDirective::getId).collect(Collectors.toList()));
|
||||
}else{
|
||||
//情绪标签下没有数据
|
||||
queryWrapper.eq("id","null");
|
||||
}
|
||||
}
|
||||
Page<ConfigServiceDirective> page = new Page<ConfigServiceDirective>(pageNo, pageSize);
|
||||
|
@ -110,7 +116,7 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
|||
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
|
||||
configServiceDirectiveService.saveEmotionTags(configServiceDirective);
|
||||
}else{
|
||||
} else {
|
||||
configServiceDirectiveService.removeEmotionTags(configServiceDirective);
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</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
|
||||
select distinct t.* from nu_config_service_type t left join nu_config_service_directive d on t.id = d.type_id
|
||||
<where>
|
||||
d.id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.nu.mq.directive.listener;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -12,7 +13,8 @@ public class DynamicQueueNameProvider {
|
|||
private ISysBaseAPI sysBaseAPI;
|
||||
|
||||
public String getQueueName() {
|
||||
String orgCode = sysBaseAPI.getDeptCode();
|
||||
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
|
||||
String orgCode = deptInfo.getString("code");
|
||||
if (StringUtils.isNotBlank(orgCode)) {
|
||||
return orgCode + ".fwzl.async";
|
||||
} else {
|
||||
|
|
|
@ -548,5 +548,5 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||
* 获取本机构编码
|
||||
* @return
|
||||
*/
|
||||
String getDeptCode();
|
||||
JSONObject getDeptInfo();
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.modules.message.entity.SysMessageTemplate;
|
||||
import org.jeecg.modules.message.handle.impl.DdSendMsgHandle;
|
||||
|
@ -1829,16 +1830,19 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getDeptCode() {
|
||||
String result = null;
|
||||
public JSONObject getDeptInfo() {
|
||||
Map<String,Object> map = Maps.newHashMap();
|
||||
|
||||
QueryWrapper<SysDepart> qw = new QueryWrapper<>();
|
||||
qw.eq("org_category","1");
|
||||
qw.eq("del_flag","0");
|
||||
List<SysDepart> list = sysDepartService.list(qw);
|
||||
if(list!=null && !list.isEmpty()){
|
||||
result = list.get(0).getOrgCode();
|
||||
map.put("code",list.get(0).getOrgCode());
|
||||
map.put("name",list.get(0).getDepartName());
|
||||
}
|
||||
return result;
|
||||
return new JSONObject(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ public class DictMQListener {
|
|||
* 如果 没有字典则创建 然后把每一项字典项新增进去
|
||||
* 有字典项 则检查每一项字典项是否存在,不存在则插入
|
||||
* <p>
|
||||
* 动态生成队列名称,避免每次部署新系统都需要改动
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
|
@ -136,7 +135,7 @@ public class DictMQListener {
|
|||
StatusMQDto statusMQDto = new StatusMQDto();
|
||||
statusMQDto.setStatus(MQStatus.PROCESS_FAILED.getCode());
|
||||
statusMQDto.setMessage(e.getMessage());
|
||||
statusMQDto.setDictId(dto.getId());
|
||||
statusMQDto.setPrimaryKey(dto.getId());
|
||||
statusMQDto.setOrgCode(orgCode);
|
||||
statusMQDto.setOrgName(orgName);
|
||||
rabbitMQUtil.sendToExchange("hldy.sysdict", "sysdict.async.result", statusMQDto);
|
||||
|
@ -145,7 +144,7 @@ public class DictMQListener {
|
|||
StatusMQDto statusMQDto = new StatusMQDto();
|
||||
statusMQDto.setStatus(MQStatus.SUCCESS.getCode());
|
||||
statusMQDto.setMessage("数据同步成功!");
|
||||
statusMQDto.setDictId(dto.getId());
|
||||
statusMQDto.setPrimaryKey(dto.getId());
|
||||
statusMQDto.setOrgCode(orgCode);
|
||||
statusMQDto.setOrgName(orgName);
|
||||
rabbitMQUtil.sendToExchange("hldy.sysdict", "sysdict.async.result", statusMQDto);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.mq.dict.listener;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -12,7 +13,8 @@ public class DynamicQueueNameProvider {
|
|||
private ISysBaseAPI sysBaseAPI;
|
||||
|
||||
public String getQueueName() {
|
||||
String orgCode = sysBaseAPI.getDeptCode();
|
||||
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
|
||||
String orgCode = deptInfo.getString("code");
|
||||
if (StringUtils.isNotBlank(orgCode)) {
|
||||
return orgCode + ".dict.async";
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue